summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorColin Cross <ccross@android.com>2017-10-04 18:01:23 -0700
committerColin Cross <ccross@android.com>2017-10-04 18:02:18 -0700
commitb4ed46425f74345716ac4532e50a543226c1a1fe (patch)
tree9500c62edf93c2835205631a738946571ee030f8
parentd03b48136446e54d06aeebb1538bd8674ec6d154 (diff)
parent42ab0f2bd565293c3accc8f831bb39b77333eecb (diff)
downloadjdk9_corba-main.tar.gz
Merge tag 'jdk-9+181' into masterHEADmastermain
Bug: 62123342 Change-Id: Ic624e0621b096944376ee6b25107bf2811979afe
-rw-r--r--.hgignore5
-rw-r--r--.hgtags425
-rw-r--r--.jcheck/conf1
-rw-r--r--ASSEMBLY_EXCEPTION27
-rw-r--r--make/Makefile49
-rw-r--r--make/copy/Copy-java.corba.gmk34
-rw-r--r--make/gensrc/Gensrc-java.corba.gmk242
-rw-r--r--make/src/classes/build/tools/logutil/IndentingPrintWriter.java123
-rw-r--r--make/src/classes/build/tools/logutil/Input.java211
-rw-r--r--make/src/classes/build/tools/logutil/InputCode.java116
-rw-r--r--make/src/classes/build/tools/logutil/InputException.java93
-rw-r--r--make/src/classes/build/tools/logutil/MC.java559
-rw-r--r--make/src/classes/build/tools/logutil/StringUtil.java62
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/GiopIDL/GIOP.idl224
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/GiopIDL/messages.idl48
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl408
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/activation/CommandHandler.java49
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/activation/NameServiceStartThread.java63
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/activation/ORBD.java352
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/activation/ProcessMonitorThread.java105
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/activation/RepositoryImpl.java474
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerMain.java383
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java645
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerTableEntry.java543
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerTool.java973
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/CopierManagerImpl.java73
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java55
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java78
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java63
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java1351
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImplHelper.java78
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/AsynchInvoke.java92
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/CORBAObjectImpl.java43
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextImpl.java98
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextListImpl.java84
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/EnvironmentImpl.java61
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/ExceptionListImpl.java83
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/NVListImpl.java113
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/NamedValueImpl.java79
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/PrincipalImpl.java48
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/RequestImpl.java374
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/ServerRequestImpl.java257
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/TCUtility.java329
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeFactory.java36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java2413
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeImplHelper.java81
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/corba/orb_config_design.txt330
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyBasicImpl.java636
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyCollectionImpl.java205
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyComplexImpl.java421
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyConstructedImpl.java937
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java87
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java200
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyUtil.java338
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynArrayImpl.java138
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynEnumImpl.java190
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynFixedImpl.java210
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java257
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynStructImpl.java87
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynUnionImpl.java385
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueBoxImpl.java133
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueCommonImpl.java147
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueImpl.java59
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerFactory.java143
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerRead.java95
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadGrow.java99
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadStream.java357
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWrite.java150
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteCollect.java231
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java92
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java134
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferQueue.java60
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/ByteBufferWithInfo.java257
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputObject.java267
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream.java544
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStreamBase.java201
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java2398
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_1.java189
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_2.java144
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputObject.java323
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream.java438
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStreamBase.java176
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java1929
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_1.java149
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_2.java359
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java208
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetCache.java109
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java340
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetConversion.java708
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java184
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java145
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java1083
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java798
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarkAndResetHandler.java39
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalInputStream.java102
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalOutputStream.java89
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/OSFCodeSetRegistry.java230
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/RestorableInputStream.java37
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java195
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java264
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeReader.java77
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/encoding/WrapperInputStream.java211
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java220
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java978
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CodecFactoryImpl.java122
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/IORInfoImpl.java318
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorInvoker.java662
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorList.java260
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ORBInitInfoImpl.java381
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PICurrent.java170
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java992
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java199
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java929
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java907
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTable.java107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTableStack.java188
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java184
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java2810
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java801
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java469
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java1726
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClassCorbaExt.java112
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamField.java271
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/OptionalDataException.java75
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java318
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/TypeMismatchException.java45
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java926
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueUtility.java483
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java208
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java142
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/FreezableList.java142
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericIdentifiable.java97
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedComponent.java58
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java101
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORImpl.java338
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORTemplateImpl.java137
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORTemplateListImpl.java129
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/IdentifiableFactoryFinderBase.java83
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/JIDLObjectKeyTemplate.java83
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/NewObjectKeyTemplateBase.java74
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdArray.java62
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdBase.java98
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java50
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectIdImpl.java69
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java240
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java97
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyTemplateBase.java194
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl.java142
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceProducerBase.java62
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl.java165
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldJIDLObjectKeyTemplate.java119
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldObjectKeyTemplateBase.java56
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldPOAObjectKeyTemplate.java93
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/POAObjectKeyTemplate.java88
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java267
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java73
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedProfileFactoryFinderImpl.java48
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java50
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/TestAssertions136
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/WireObjectKeyTemplate.java155
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java85
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/CodeSetsComponentImpl.java100
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressBase.java84
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressClosureImpl.java56
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressImpl.java75
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java348
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java171
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java83
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java88
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java98
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java83
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java99
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/ior/notes317
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java214
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java778
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/PortableRemoteObject.java362
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/DefaultSocketFactory.java130
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/EndPointInfoImpl.java117
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/LegacyServerSocketManagerImpl.java186
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryAcceptorImpl.java94
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryConnectionImpl.java120
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoImpl.java112
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListImpl.java64
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java117
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/USLPort.java44
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoFactoryImpl.java41
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoImpl.java59
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectFactoryImpl.java38
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectImpl.java146
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java51
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java57
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/BindingIteratorImpl.java185
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InterOperableNamingImpl.java413
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingKey.java101
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingValue.java51
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextDataStore.java115
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java1025
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingUtils.java132
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientBindingIterator.java133
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameServer.java236
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameService.java158
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNamingContext.java357
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbalocURL.java288
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbanameURL.java121
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/IIOPEndpointInfo.java92
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURL.java51
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLBase.java76
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLHandler.java65
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/NamingConstants.java41
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/Utility.java103
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingKey.java135
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingValue.java69
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameServer.java103
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameService.java234
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java1302
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/PersistentBindingIterator.java141
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/ServantManagerImpl.java261
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/NullServantImpl.java45
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java247
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java265
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/BadServerIdHandler.java40
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/DelegateImpl.java147
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/IdAssignmentPolicyImpl.java64
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/IdUniquenessPolicyImpl.java63
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ImplicitActivationPolicyImpl.java65
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/LifespanPolicyImpl.java63
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POACurrent.java182
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAFactory.java248
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java1693
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java547
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediator.java125
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase.java149
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java202
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorFactory.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java135
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java168
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java108
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java118
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java381
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/Policies.java352
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/RequestProcessingPolicyImpl.java75
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ServantRetentionPolicyImpl.java63
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ThreadPolicyImpl.java63
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/minor_code_example.txt61
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/standard_minor_codes.txt160
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOA.java45
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java113
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAImpl.java228
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TransientObjectManager.java205
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/AppletDataCollector.java58
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorBase.java473
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorFactory.java66
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalDataCollector.java59
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserAction.java51
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserData.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBConfiguratorImpl.java628
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java418
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java2128
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java773
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBVersionImpl.java98
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserAction.java48
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionBase.java90
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionFactory.java44
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserDataBase.java54
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserTable.java1110
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserAction.java122
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserData.java66
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/PropertyOnlyDataCollector.java55
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orb/parsing_combinators.txt194
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CacheTable.java163
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java95
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java80
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/GetPropertyAction.java88
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/HexOutputStream.java80
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookGetFields.java157
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookPutFields.java111
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LogKeywords.java97
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBConstants.java471
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java846
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java558
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java1262
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamField.java270
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java87
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectWriter.java216
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java187
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdInterface.java48
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java53
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdUtility.java59
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/StackImpl.java79
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Constant.java42
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Future.java51
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/CondVar.java340
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/DebugMutex.java212
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Mutex.java192
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/ReentrantMutex.java350
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Sync.java362
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/SyncUtil.java49
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/GuardedAction.java70
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/NameBase.java77
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/StateEngineImpl.java328
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Graph.java35
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/GraphImpl.java187
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Node.java37
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/NodeData.java70
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb.properties193
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolImpl.java547
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolManagerImpl.java237
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/TimeoutException.java32
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java199
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicAccessPermission.java62
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicMethodMarshallerImpl.java465
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicStubImpl.java160
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandler.java57
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java295
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java908
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLType.java124
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypeException.java40
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil.java598
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java168
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java170
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/PresentationManagerImpl.java325
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ReflectiveTie.java176
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubConnectImpl.java116
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryBase.java64
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java73
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryBase.java44
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryDynamicBase.java101
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java46
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryStaticImpl.java149
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryProxyImpl.java57
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryStaticImpl.java54
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubInvocationHandlerImpl.java213
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/jndi.properties3
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/AddressingDispositionException.java56
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/BootstrapServerRequestDispatcher.java149
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaClientDelegateImpl.java443
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java1053
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaInvocationInfo.java118
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java2370
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaServerRequestDispatcherImpl.java885
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/FullServantCacheLocalCRDImpl.java81
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/INSServerRequestDispatcher.java99
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/InfoOnlyServantCacheLocalCRDImpl.java68
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/JIDLLocalCRDImpl.java90
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java140
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/MinimalServantCacheLocalCRDImpl.java61
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/NotLocalLocalCRDImpl.java67
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/POALocalCRDImpl.java163
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/RequestCanceledException.java42
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/RequestDispatcherRegistryImpl.java183
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/ServantCacheLocalCRDBase.java96
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java237
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/SpecialMethod.java168
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java81
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage.java37
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_0.java76
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_1.java76
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_2.java76
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage.java37
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_1.java79
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_2.java108
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfo.java51
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/KeyAddr.java39
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage.java45
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_0.java140
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_1.java140
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java194
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java40
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage.java39
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java100
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java102
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java98
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message.java97
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java967
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageHandler.java72
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_0.java143
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_1.java196
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_2.java81
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ProfileAddr.java39
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReferenceAddr.java39
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java201
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java201
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_2.java232
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage.java54
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_0.java161
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_1.java175
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_2.java200
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddress.java124
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddressHelper.java155
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/resolver/BootstrapResolverImpl.java165
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/resolver/CompositeResolverImpl.java58
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/resolver/FileResolverImpl.java110
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java329
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/resolver/LocalResolverImpl.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/resolver/ORBDefaultInitRefResolverImpl.java69
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/resolver/ORBInitRefResolverImpl.java65
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/resolver/SplitLocalResolverImpl.java59
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/ByteBufferPoolImpl.java207
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java268
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java292
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListImpl.java240
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListIteratorImpl.java259
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaInboundConnectionCacheImpl.java222
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaOutboundConnectionCacheImpl.java210
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaResponseWaitingRoomImpl.java337
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java255
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/DefaultIORToSocketInfoImpl.java87
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java123
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/EventHandlerBase.java150
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/ListenerThreadImpl.java147
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/ReadTCPTimeoutsImpl.java58
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/ReaderThreadImpl.java153
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java615
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java187
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java664
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java1687
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelContactInfoImpl.java217
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtable.java373
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtableEntry.java43
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtableEnumerator.java78
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/JDKBridge.java197
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/JDKClassLoader.java192
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/ORBProperties.java72
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/PackagePrefixChecker.java76
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/RepositoryId.java993
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/RepositoryIdCache.java108
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/SUNVMCID.java41
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/Utility.java1002
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/impl/util/Version.java51
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/internal/CosNaming/BootstrapServer.java133
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/internal/Interceptors/PIORB.java40
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/internal/POA/POAORB.java37
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/internal/corba/ORBSingleton.java40
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/internal/iiop/ORB.java38
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/org/omg/CORBA/ORB.java57
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/broker/Broker.java43
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/encoding/InputObject.java63
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/encoding/OutputObject.java65
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/package.html359
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientDelegate.java59
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientInvocationInfo.java60
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientRequestDispatcher.java105
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/protocol/MessageMediator.java130
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ProtocolHandler.java53
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ServerRequestDispatcher.java48
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/Acceptor.java212
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/ByteBufferPool.java40
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/Connection.java227
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/ConnectionCache.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfo.java231
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfoList.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfoListIterator.java83
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/EventHandler.java67
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/InboundConnectionCache.java43
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/ListenerThread.java37
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/OutboundConnectionCache.java41
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/ReaderThread.java36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/ResponseWaitingRoom.java48
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/Selector.java41
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/pept/transport/TransportManager.java62
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/activation/activation.idl305
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/CopierManager.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/CopyobjectDefaults.java100
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ObjectCopier.java38
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ObjectCopierFactory.java36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ReflectiveCopyException.java42
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/encoding/CorbaInputObject.java35
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/encoding/CorbaOutputObject.java53
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/extension/CopyObjectPolicy.java67
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/extension/RequestPartitioningPolicy.java84
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/extension/ServantCachingPolicy.java161
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/extension/ZeroPortPolicy.java74
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/EncapsulationFactoryBase.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/IOR.java86
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORFactories.java203
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORFactory.java45
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTemplate.java41
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTemplateList.java37
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/Identifiable.java42
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableBase.java53
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableContainerBase.java91
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableFactory.java44
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableFactoryFinder.java49
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/MakeImmutable.java30
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectAdapterId.java47
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectId.java34
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKey.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKeyFactory.java46
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKeyTemplate.java74
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponent.java40
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java51
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponentFactoryFinder.java35
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfile.java66
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfileTemplate.java78
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfileTemplateBase.java66
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/WriteContents.java32
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/Writeable.java38
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/AlternateIIOPAddressComponent.java37
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/CodeSetsComponent.java38
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/GIOPVersion.java219
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPAddress.java38
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPFactories.java241
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPProfile.java60
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPProfileTemplate.java53
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/JavaCodebaseComponent.java36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/MaxStreamFormatVersionComponent.java34
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/ORBTypeComponent.java36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/RequestPartitioningComponent.java32
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/iornotes107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/ior/package.html64
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/Connection.java35
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/GetEndPointInfoAgainException.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/LegacyServerSocketEndPointInfo.java65
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/LegacyServerSocketManager.java47
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/ORBSocketFactory.java358
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/README.txt83
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/IORInfoExt.java39
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/ORBInitInfoExt.java41
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/RequestInfoExt.java44
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/UnknownType.java41
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java161
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/LogWrapperBase.java92
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/LogWrapperFactory.java34
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc45
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc68
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc53
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc177
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc407
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/POA.mc107
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Util.mc64
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/LongMonitoredAttributeBase.java60
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttribute.java87
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeBase.java110
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeInfo.java76
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeInfoFactory.java42
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredObject.java131
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredObjectFactory.java38
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringConstants.java115
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringFactories.java95
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManager.java56
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManagerFactory.java41
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StatisticMonitoredAttribute.java113
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StatisticsAccumulator.java203
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StringMonitoredAttributeBase.java60
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html302
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/oa/NullServant.java45
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/oa/OADefault.java50
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/oa/OADestroyed.java31
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/oa/OAInvocationInfo.java110
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapter.java249
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapterBase.java203
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapterFactory.java50
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/DataCollector.java65
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORB.java492
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBConfigurator.java36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBData.java158
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBVersion.java44
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBVersionFactory.java113
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/Operation.java34
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java567
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserData.java43
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserDataFactory.java46
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserImplBase.java136
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserImplTableBase.java173
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/PropertyParser.java85
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orb/StringPair.java65
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/closure/Closure.java30
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/closure/ClosureFactory.java43
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Action.java55
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/ActionBase.java32
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSM.java56
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSMImpl.java114
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSMTest.java227
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Guard.java102
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/GuardBase.java32
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Input.java41
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/InputImpl.java32
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/State.java56
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateEngine.java109
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateEngineFactory.java42
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateImpl.java98
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandler.java42
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java94
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/DelegateInvocationHandlerImpl.java65
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/InvocationHandlerFactory.java40
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/LinkedInvocationHandler.java40
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/NoSuchThreadPoolException.java32
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/NoSuchWorkQueueException.java32
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPool.java118
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolChooser.java53
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolManager.java97
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/Work.java55
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/WorkQueue.java68
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/DynamicMethodMarshaller.java95
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/DynamicStub.java69
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/IDLNameTranslator.java56
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/PresentationDefaults.java62
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/PresentationManager.java170
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/StubAdapter.java209
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/StubWrapper.java162
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/ClientDelegateFactory.java36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaClientDelegate.java34
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaMessageMediator.java146
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaProtocolHandler.java78
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaServerRequestDispatcher.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/ForwardException.java84
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/InitialServerRequestDispatcher.java42
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcher.java73
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcherFactory.java32
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/PIHandler.java306
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherDefault.java115
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherRegistry.java95
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RetryType.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/resolver/LocalResolver.java38
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/resolver/Resolver.java44
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/resolver/ResolverDefault.java104
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/CodeSetServiceContext.java69
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/MaxStreamFormatVersionServiceContext.java82
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ORBVersionServiceContext.java83
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/SendingContextServiceContext.java69
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java120
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContextData.java161
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContextRegistry.java97
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java415
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/UEInfoServiceContext.java73
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/UnknownServiceContext.java71
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaAcceptor.java49
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaConnection.java172
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaConnectionCache.java36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfo.java48
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoList.java52
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoListFactory.java50
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoListIterator.java44
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaResponseWaitingRoom.java44
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaTransportManager.java58
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/IIOPPrimaryToContactInfo.java84
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/IORToSocketInfo.java45
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/IORTransformer.java40
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/ORBSocketFactory.java59
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/ReadTimeouts.java35
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/ReadTimeoutsFactory.java36
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/SocketInfo.java43
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/SocketOrChannelAcceptor.java38
-rw-r--r--src/java.corba/share/classes/com/sun/corba/se/spi/transport/TransportDefault.java95
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java240
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java1178
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtxFactory.java51
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java500
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/cosnaming/CorbanameUrl.java132
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java247
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/cosnaming/IiopUrl.java228
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/cosnaming/OrbReuseTracker.java70
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/cosnaming/RemoteToCorba.java81
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties4
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java244
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/url/corbaname/corbanameURLContextFactory.java38
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/url/iiop/GenericURLContext.java537
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/url/iiop/iiopURLContext.java84
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/url/iiop/iiopURLContextFactory.java101
-rw-r--r--src/java.corba/share/classes/com/sun/jndi/url/iiopname/iiopnameURLContextFactory.java38
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java90
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeDescription.java58
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeDescriptionHelper.java142
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeMode.java64
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeModeHelper.java81
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ContextIdSeqHelper.java92
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ContextIdentifierHelper.java85
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/DefinitionKindHelper.java93
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java90
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ExceptionDescription.java56
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java135
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/IDLTypeHelper.java112
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/IdentifierHelper.java84
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/Initializer.java56
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/InitializerHelper.java113
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/InitializerSeqHelper.java90
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java90
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationDescription.java64
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationDescriptionHelper.java171
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationMode.java64
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationModeHelper.java81
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java90
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterDescription.java60
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterDescriptionHelper.java125
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterMode.java66
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterModeHelper.java81
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/Repository.java29
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryHelper.java76
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryIdHelper.java84
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java91
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/StructMemberHelper.java130
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/StructMemberSeqHelper.java104
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java84
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java220
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueMemberHelper.java162
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueMemberSeqHelper.java104
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/VersionSpecHelper.java84
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/VisibilityHelper.java86
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/_IDLTypeStub.java148
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/CORBA/portable/ValueHelper.java43
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBase.java39
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBaseHelper.java96
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBaseOperations.java53
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java84
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java91
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java90
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java145
-rw-r--r--src/java.corba/share/classes/com/sun/org/omg/SendingContext/_CodeBaseStub.java208
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Arguments.java325
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/AttributeEntry.java105
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/AttributeGen.java46
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Comment.java208
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Compile.java520
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ConstEntry.java112
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ConstGen.java46
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/DefaultSymtabFactory.java257
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/EnumEntry.java108
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/EnumGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ExceptionEntry.java91
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ExceptionGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Factories.java108
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardEntry.java142
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardValueEntry.java90
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardValueGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/GenFactory.java86
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/GenFileStream.java97
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Generator.java42
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/IDLID.java134
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/IncludeEntry.java125
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/IncludeGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceEntry.java355
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceState.java61
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceType.java65
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/InvalidArgument.java62
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/InvalidCharacter.java65
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/MethodEntry.java197
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/MethodGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ModuleEntry.java113
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ModuleGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/NativeEntry.java84
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/NativeGen.java36
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/NoPragma.java50
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Noop.java241
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParameterEntry.java114
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParameterGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParseException.java456
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Parser.java3905
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaEntry.java103
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaHandler.java148
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Preprocessor.java1431
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/PrimitiveEntry.java92
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/PrimitiveGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/RepositoryID.java80
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ResourceBundleUtil.java107
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Scanner.java1615
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/SequenceEntry.java141
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/SequenceGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/StringEntry.java118
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/StringGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/StructEntry.java143
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/StructGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/SymtabEntry.java375
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/SymtabFactory.java117
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Token.java689
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/TokenBuffer.java91
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/TypedefEntry.java123
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/TypedefGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionBranch.java75
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionEntry.java191
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionGen.java48
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/Util.java379
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueBoxEntry.java88
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueBoxGen.java47
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueEntry.java414
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueGen.java46
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueRepositoryId.java131
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/And.java78
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BinaryExpr.java64
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanAnd.java95
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanNot.java79
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanOr.java94
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/DefaultExprFactory.java191
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Divide.java132
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Equal.java79
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/EvaluationException.java46
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ExprFactory.java75
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Expression.java258
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterEqual.java79
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterThan.java79
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/LessEqual.java79
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/LessThan.java79
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Minus.java82
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Modulo.java78
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Negative.java73
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Not.java88
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/NotEqual.java80
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Or.java78
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Plus.java82
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Positive.java73
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftLeft.java88
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftRight.java88
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Terminal.java122
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Times.java82
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/UnaryExpr.java59
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Xor.java81
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/first.set233
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/follow.set233
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/grammar.idl422
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/grammar3.idl539
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl.prp195
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp177
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp177
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl778
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/keywords81
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl47
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/FileLocator.java418
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/Messages.java356
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java259
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java342
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen.java195
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen24.java104
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AuxGen.java46
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Compile.java430
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ConstGen.java197
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/DefaultFactory.java200
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/EnumGen.java279
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ExceptionGen.java65
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Factories.java141
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ForwardValueGen.java206
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/GenFactory.java162
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper.java699
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper24.java160
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Holder.java255
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/InterfaceGen.java864
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/JavaGenerator.java68
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen.java1091
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen24.java258
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGenClone24.java107
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ModuleGen.java78
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifier.java32
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifierImpl.java119
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NativeGen.java65
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/PrimitiveGen.java139
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/SequenceGen.java271
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Skeleton.java568
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StringGen.java139
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StructGen.java455
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java380
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TCOffsets.java145
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TypedefGen.java326
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java1074
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java1429
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen.java349
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen24.java163
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueFactory.java173
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen.java767
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java417
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp111
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp69
-rw-r--r--src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp68
-rw-r--r--src/java.corba/share/classes/javax/activity/ActivityCompletedException.java74
-rw-r--r--src/java.corba/share/classes/javax/activity/ActivityRequiredException.java72
-rw-r--r--src/java.corba/share/classes/javax/activity/InvalidActivityException.java76
-rw-r--r--src/java.corba/share/classes/javax/activity/package.html36
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/ClassDesc.java48
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/GetORBPropertiesFileAction.java107
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/PortableRemoteObjectDelegate.java84
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/Stub.java261
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/StubDelegate.java93
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/Tie.java85
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/Util.java405
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/UtilDelegate.java135
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/ValueHandler.java96
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/ValueHandlerMultiFormat.java70
-rw-r--r--src/java.corba/share/classes/javax/rmi/CORBA/package.html35
-rw-r--r--src/java.corba/share/classes/javax/rmi/PortableRemoteObject.java295
-rw-r--r--src/java.corba/share/classes/javax/rmi/package.html34
-rw-r--r--src/java.corba/share/classes/module-info.java84
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_COMPLETED.java86
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_REQUIRED.java84
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ARG_IN.java53
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ARG_INOUT.java54
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ARG_OUT.java53
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/Any.java721
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/AnyHolder.java107
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/AnySeqHelper.java101
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/AnySeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BAD_CONTEXT.java86
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BAD_INV_ORDER.java85
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BAD_OPERATION.java82
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BAD_PARAM.java90
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY.java39
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_TYPE.java39
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_VALUE.java41
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BAD_QOS.java83
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java83
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BooleanHolder.java109
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/Bounds.java54
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/BoundsHelper.java97
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ByteHolder.java110
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CODESET_INCOMPATIBLE.java82
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/COMM_FAILURE.java90
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CTX_RESTRICT_SCOPE.java52
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CharHolder.java111
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CharSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CharSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CompletionStatus.java142
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CompletionStatusHelper.java79
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/Context.java244
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ContextList.java106
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/Current.java48
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CurrentHelper.java87
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CurrentHolder.java65
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CurrentOperations.java41
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/CustomMarshal.java57
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DATA_CONVERSION.java85
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DataInputStream.java344
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DataOutputStream.java283
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DefinitionKind.java501
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DefinitionKindHelper.java80
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DomainManager.java44
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DomainManagerOperations.java50
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DoubleHolder.java109
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynAny.java732
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/Invalid.java51
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/InvalidSeq.java52
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/InvalidValue.java53
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/TypeMismatch.java52
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/package.html42
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynArray.java58
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynEnum.java65
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynFixed.java57
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynSequence.java74
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynStruct.java70
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynUnion.java94
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynValue.java73
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/DynamicImplementation.java47
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/Environment.java61
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ExceptionList.java110
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/FREE_MEM.java81
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/FieldNameHelper.java82
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/FixedHolder.java98
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/FloatHolder.java105
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/FloatSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/FloatSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/IDLType.java49
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/IDLTypeHelper.java95
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/IDLTypeOperations.java58
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/IMP_LIMIT.java85
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/INITIALIZE.java87
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/INTERNAL.java87
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/INTF_REPOS.java80
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/INVALID_ACTIVITY.java85
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/INVALID_TRANSACTION.java82
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/INV_FLAG.java82
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/INV_IDENT.java83
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java89
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java80
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/IRObject.java42
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/IRObjectOperations.java83
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/IdentifierHelper.java83
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/IntHolder.java112
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/LocalObject.java514
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/LongHolder.java108
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/LongSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/LongSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java87
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java86
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/NO_MEMORY.java79
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/NO_PERMISSION.java79
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/NO_RESOURCES.java80
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/NO_RESPONSE.java80
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/NVList.java177
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/NameValuePair.java63
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/NameValuePairHelper.java109
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/NamedValue.java125
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/OBJECT_NOT_EXIST.java89
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/OBJ_ADAPTER.java84
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/OMGVMCID.java42
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ORB.java1406
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InconsistentTypeCode.java52
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidName.java53
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidNameHelper.java98
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ORBPackage/package.html50
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/Object.java282
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ObjectHelper.java83
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ObjectHolder.java111
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/OctetSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/OctetSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PERSIST_STORE.java79
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PRIVATE_MEMBER.java46
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PUBLIC_MEMBER.java47
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/Policy.java47
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PolicyError.java71
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PolicyHelper.java95
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PolicyHolder.java65
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PolicyListHelper.java89
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PolicyListHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PolicyOperations.java72
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PolicyTypeHelper.java85
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/Principal.java58
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/PrincipalHolder.java93
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/REBIND.java86
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/RepositoryIdHelper.java84
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/Request.java301
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ServerRequest.java314
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ServiceDetail.java68
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ServiceDetailHelper.java85
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ServiceInformation.java62
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHelper.java94
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHolder.java110
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/SetOverrideType.java122
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/SetOverrideTypeHelper.java79
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java110
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ShortSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ShortSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/StringHolder.java109
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/StringValueHelper.java138
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/StructMember.java89
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/StructMemberHelper.java117
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/SystemException.java119
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TCKind.java554
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TIMEOUT.java83
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_MODE.java82
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_REQUIRED.java79
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java83
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java83
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TRANSIENT.java82
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TypeCode.java516
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TypeCodeHolder.java110
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKind.java55
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKindHelper.java98
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/Bounds.java55
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BoundsHelper.java98
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/package.html52
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ULongSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ULongSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UNKNOWN.java88
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY.java40
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java41
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UShortSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UShortSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UnionMember.java95
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UnionMemberHelper.java124
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UnknownUserException.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHelper.java106
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHolder.java65
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/UserException.java57
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/VM_ABSTRACT.java39
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/VM_CUSTOM.java39
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/VM_NONE.java44
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/VM_TRUNCATABLE.java41
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ValueBaseHelper.java86
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ValueBaseHolder.java107
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ValueMember.java121
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ValueMemberHelper.java149
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/VersionSpecHelper.java83
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/VisibilityHelper.java85
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/WCharSeqHelper.java99
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/WCharSeqHolder.java66
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/WStringValueHelper.java142
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/WrongTransaction.java56
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHelper.java98
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHolder.java65
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/_IDLTypeStub.java153
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/_PolicyStub.java164
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html143
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html118
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/ir.idl793
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/orb.idl47
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/package.html982
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/ApplicationException.java64
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/BoxedValueHelper.java39
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/CustomValue.java45
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/Delegate.java408
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/IDLEntity.java37
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/IndirectionException.java68
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/InputStream.java320
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/InvokeHandler.java72
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/ObjectImpl.java534
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/OutputStream.java287
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/RemarshalException.java46
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/ResponseHandler.java54
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/ServantObject.java48
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/Streamable.java60
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/StreamableValue.java41
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/UnknownException.java58
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/ValueBase.java50
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/ValueFactory.java57
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/ValueInputStream.java51
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/ValueOutputStream.java49
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA/portable/package.html96
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA_2_3/ORB.java89
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA_2_3/package.html67
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA_2_3/portable/Delegate.java54
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java153
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA_2_3/portable/ObjectImpl.java59
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java130
-rw-r--r--src/java.corba/share/classes/org/omg/CORBA_2_3/portable/package.html40
-rw-r--r--src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html53
-rw-r--r--src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html56
-rw-r--r--src/java.corba/share/classes/org/omg/CosNaming/_BindingIteratorImplBase.java108
-rw-r--r--src/java.corba/share/classes/org/omg/CosNaming/_NamingContextImplBase.java407
-rw-r--r--src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl509
-rw-r--r--src/java.corba/share/classes/org/omg/CosNaming/package.html351
-rw-r--r--src/java.corba/share/classes/org/omg/Dynamic/package.html53
-rw-r--r--src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html56
-rw-r--r--src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html54
-rw-r--r--src/java.corba/share/classes/org/omg/DynamicAny/DynamicAny.idl1280
-rw-r--r--src/java.corba/share/classes/org/omg/DynamicAny/package.html211
-rw-r--r--src/java.corba/share/classes/org/omg/IOP/CodecFactoryPackage/package.html50
-rw-r--r--src/java.corba/share/classes/org/omg/IOP/CodecPackage/package.html53
-rw-r--r--src/java.corba/share/classes/org/omg/IOP/package.html60
-rw-r--r--src/java.corba/share/classes/org/omg/Messaging/package.html55
-rw-r--r--src/java.corba/share/classes/org/omg/PortableInterceptor/CORBAX.idl69
-rw-r--r--src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl617
-rw-r--r--src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl2214
-rw-r--r--src/java.corba/share/classes/org/omg/PortableInterceptor/Messaging.idl44
-rw-r--r--src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html52
-rw-r--r--src/java.corba/share/classes/org/omg/PortableInterceptor/package.html103
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/CurrentHelper.java113
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/CurrentPackage/package.html61
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/DynamicImplementation.java43
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/POAHelper.java101
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/POAManagerPackage/package.html51
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html82
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/Servant.java266
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java57
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html51
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/corba.idl101
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/package.html230
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/poa.idl1191
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/portable/Delegate.java115
-rw-r--r--src/java.corba/share/classes/org/omg/PortableServer/portable/package.html49
-rw-r--r--src/java.corba/share/classes/org/omg/SendingContext/RunTime.java43
-rw-r--r--src/java.corba/share/classes/org/omg/SendingContext/RunTimeOperations.java43
-rw-r--r--src/java.corba/share/classes/org/omg/SendingContext/package.html76
-rw-r--r--src/java.corba/share/classes/org/omg/stub/java/rmi/_Remote_Stub.java61
-rw-r--r--src/java.corba/share/classes/org/omg/stub/java/rmi/package.html40
-rw-r--r--src/java.corba/share/classes/sun/corba/Bridge.java379
-rw-r--r--src/java.corba/share/classes/sun/corba/BridgePermission.java63
-rw-r--r--src/java.corba/share/classes/sun/corba/EncapsInputStreamFactory.java153
-rw-r--r--src/java.corba/share/classes/sun/corba/JavaCorbaAccess.java33
-rw-r--r--src/java.corba/share/classes/sun/corba/OutputStreamFactory.java149
-rw-r--r--src/java.corba/share/classes/sun/corba/SharedSecrets.java76
-rw-r--r--src/java.corba/share/classes/sun/corba/package.html37
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/AbstractType.java205
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ArrayType.java270
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/BatchEnvironment.java260
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ClassPathLoader.java117
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ClassType.java215
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/CompoundType.java2703
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Constants.java297
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ContextElement.java41
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ContextStack.java447
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/DirectoryLoader.java160
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java436
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/IDLGenerator.java2084
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/IDLNames.java1227
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ImplementationType.java292
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/InterfaceType.java122
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NCClassType.java172
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NCInterfaceType.java162
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NameContext.java232
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/PrimitiveType.java195
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/PrintGenerator.java171
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/RemoteType.java251
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/SpecialClassType.java171
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/SpecialInterfaceType.java233
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/StaticStringsHash.java372
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/StubGenerator.java2380
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Type.java1009
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Util.java174
-rw-r--r--src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ValueType.java488
1200 files changed, 225137 insertions, 0 deletions
diff --git a/.hgignore b/.hgignore
new file mode 100644
index 0000000..d782b28
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,5 @@
+^build/
+^dist/
+^webrev
+/nbproject/private/
+.DS_Store
diff --git a/.hgtags b/.hgtags
new file mode 100644
index 0000000..688de6c
--- /dev/null
+++ b/.hgtags
@@ -0,0 +1,425 @@
+55540e827aef970ecc010b7e06b912d991c8e3ce jdk7-b24
+5e61d5df62586474414d1058e9186441aa908f51 jdk7-b25
+0043eb3d4e628f049ff80a8c223b5657136085e7 jdk7-b26
+e84e9018bebbf3e5bafc5706e7882a15cb1c7d99 jdk7-b27
+27509b7d21ed783b3f6eb7b7612781c675a30c2f jdk7-b28
+8b71960f79ce0a6fb8ddfeec03f03d400a361747 jdk7-b29
+c0252adbb2abbfdd6c35595429ac6fbdd98e20ac jdk7-b30
+ef6af34d75a7b44e77083f1d4ee47631fa09d3b4 jdk7-b31
+80a0f46a6203e727012bd579fe38a609b83decce jdk7-b32
+6a5b9d2f8b20de54e3bfe33cd12bd0793caedc4e jdk7-b33
+0a812b9824e5d17b073765d1505594b49ff88a10 jdk7-b34
+3867c4d14a5bfdbb37c97b4874ccb0ee5343111c jdk7-b35
+0723891eb8d1c27e67c54163af0b4cea05a4e036 jdk7-b36
+59d5848bdedebe91cc2753acce78911bcb4a66db jdk7-b37
+08be802754b0296c91a7713b6d85a015dbcd5349 jdk7-b38
+55078b6661e286e90387d1d9950bd865f5cc436e jdk7-b39
+184e21992f47a8d730df1adc5b21a108f3125489 jdk7-b40
+c90eeda9594ed2983403e2049aed8d503126c62e jdk7-b41
+ccd6a16502e0650d91d85c4b86be05cbcd461a87 jdk7-b42
+9cd740d48a4855321d69f137a7109c00bcda76be jdk7-b43
+9803dac7254041b30ca65e3852d4c566b9757c3b jdk7-b44
+68814aa5b44b1f16931a97e7cd4028c70eb9586b jdk7-b45
+1691dbfc08f8ee3f4e23a1ff30cdff920718696c jdk7-b46
+167ad0164301f318b069a947e1c9c07ed667748a jdk7-b47
+0be222241fd405e48915647facfaa176621b39b9 jdk7-b48
+d70978bc64bc7a04be7797ab0dcd9b7b1b3a6bff jdk7-b49
+0edbd0074b02b42b2b83cc47cb391d4869b7a8ec jdk7-b50
+3eb8f1047a7402a9a79937d1c39560e931e91da2 jdk7-b51
+bec82237d694f9802b820fa11bbb4f7fa9bf8e77 jdk7-b52
+3c4d73194f6f89f040ae3b2d257335dfa8a1b2b5 jdk7-b53
+8130ac858d6789d5853d23044ba4a992afda574a jdk7-b54
+7a869f16ba83060c34b77620406cfa89d1cd7084 jdk7-b55
+553a664b807bb3a3c93f3b5a3c20ff0a90e08371 jdk7-b56
+972c6157fae57850694675da82fd58a17930db0a jdk7-b57
+2e3b8edab3ef55406494d3dd562e06882e6fc15e jdk7-b58
+7e6b2b55c00cc523b468272353ada3979adbbf16 jdk7-b59
+f1e1cccbd13aa96d2d8bd872782ff764010bc22c jdk7-b60
+e906b16a12a9a63b615898afa5d9673cbd1c5ab8 jdk7-b61
+65b66117dbd70a493e9644aeb4033cf95a4e3c99 jdk7-b62
+d20e45cd539f20405ff843652069cfd7550c5ab3 jdk7-b63
+047dd27fddb607f8135296b3754131f6e13cb8c7 jdk7-b64
+97fd9b42f5c2d342b90d18f0a2b57e4117e39415 jdk7-b65
+a821e059a961bcb02830280d51f6dd030425c066 jdk7-b66
+a12ea7c7b497b4ba7830550095ef633bd6f43971 jdk7-b67
+5182bcc9c60cac429d1f7988676cec7320752be3 jdk7-b68
+8120d308ec4e805c5588b8d9372844d781c4112d jdk7-b69
+175bd68779546078dbdb6dacd7f0aced79ed22b1 jdk7-b70
+3f1ef7f899ea2aec189c4fb67e5c8fa374437c50 jdk7-b71
+c793a31209263fbb867c23c752599d85c21abb73 jdk7-b72
+b751c528c55560cf2adeaeef24b39ca1f4d1cbf7 jdk7-b73
+5d0cf59a3203b9f57aceebc33ae656b884987955 jdk7-b74
+0fb137085952c8e47878e240d1cb40f14de463c4 jdk7-b75
+937144222e2219939101b0129d26a872a7956b13 jdk7-b76
+6881f0383f623394b5ec73f27a5f329ff55d0467 jdk7-b77
+a7f7276b48cd74d8eb1baa83fbf3d1ef4a2603c8 jdk7-b78
+ec0421b5703b677e2226cf4bf7ae4eaafd8061c5 jdk7-b79
+0336e70ca0aeabc783cc01658f36cb6e27ea7934 jdk7-b80
+e08a42a2a94d97ea8eedb187a94dbff822c8fbba jdk7-b81
+1e8c1bfad1abb4b81407a0f2645e0fb85764ca48 jdk7-b82
+fde0df7a2384f7fe33204a79678989807d9c2b98 jdk7-b83
+68c8961a82e4a3ad2a67991e5d834192a81eb4cd jdk7-b84
+c67a9df7bc0ca291f08f9a9cc05cb78ea15d25e6 jdk7-b85
+6253e28826d16cf1aecc39ce04c8de1f6bf2df5f jdk7-b86
+09a41111a401d327f65e453384d976a10154d9ea jdk7-b87
+39e14d2da687c7e592142137517aaf689544820f jdk7-b88
+bb4424c5e778b842c064a8b1aa902b35f4397654 jdk7-b89
+56ce07b0eb47b93a98a72adef0f21e602c460623 jdk7-b90
+bcd2fc089227559ac5be927923609fac29f067fa jdk7-b91
+930582f667a13391cd0b3e41e8cb760f55e3a5c0 jdk7-b92
+9718d624864c29dca44373d541e93cdd309a994f jdk7-b93
+533c11186b44e3a02d6c5fe69a73260505fcfe5e jdk7-b94
+06dbf406818c789bb586c1de4c002024cd26ecd2 jdk7-b95
+edc2a2659c77dabc55cb55bb617bad89e3a05bb3 jdk7-b96
+4ec9d59374caa1e5d72fa802291b4d66955a4936 jdk7-b97
+3b99409057e4c255da946f9f540d051a5ef4ab23 jdk7-b98
+95db968660e7d87c345d5cf3dc2e3db037fb7220 jdk7-b99
+a56d734a1e970e1a21a8f4feb13053e9a33674c7 jdk7-b100
+86a239832646a74811695428984b6947c0bd6dc8 jdk7-b101
+78561a95779090b5106c8d0f1a75360a027ef087 jdk7-b102
+11e7678c3eb169b77d9a9892fe5e3dfa1d1a0d51 jdk7-b103
+9607213481d400ac477183191cc080e1bef6f475 jdk7-b104
+6f21b030092fb61244cc8a0aedf8058f7c022b81 jdk7-b105
+519daea48888196af76a975a3b31258efa860bad jdk7-b106
+232adb83eae8375439ccff65b6e205ca0da0510d jdk7-b107
+8d810527b499a67153365db74421a03c12b46f35 jdk7-b108
+c3dd858e09b20206459d9e7b0ead99d27ab00eab jdk7-b109
+0e1f80fda2271f53d4bbb59ec3f301dfbcef6a0a jdk7-b110
+640fa4d4e2ad4c2d7e4815c955026740d8c52b7a jdk7-b111
+cc67fdc4fee9a5b25caee4e71b51a8ff24ae7d1a jdk7-b112
+a89a6c5be9d1a754868d3d359cbf7ad36aa95631 jdk7-b113
+88fddb73c5c4a4b50c319cbae9380caf5172ab45 jdk7-b114
+da7561d479e0ddaa4650d8023ac0fc7294e014e3 jdk7-b115
+98c028de4301106f2285ac0e128a1bb9b4c24f5c jdk7-b116
+fa502e4834dac2176499cc1f44794d5dc32a11b9 jdk7-b117
+42e77836fded7c2a3080d27316b96634ea9e33c6 jdk7-b118
+39829414ae31a0080578a49b751899edd518cd7d jdk7-b119
+cff5a173ec1e89013359e804a3e31736ef6fb462 jdk7-b120
+2cc9f32992101732b23730b737740e64ebc5fa89 jdk7-b121
+1523a060032c8a5b7840198da8911abeff88118f jdk7-b122
+a230c142628cea22475ab9dc5cd544266ddf2466 jdk7-b123
+f90b3e014e831eb4f32ef035a1dad2b8ba87949f jdk7-b124
+1ce58c72b7892cb813eb920276c7e7f17a1b79fe jdk7-b125
+d7532bcd3742f1576dd07ff9fbb535c9c9a276e9 jdk7-b126
+64775e83f4df894355f45555f50c410de6727b4e jdk7-b127
+9baa8f94a11d6c5cab3f9f0e5a20106326d0932e jdk7-b128
+66fa0fcc779296c99746b09efce6109944f82f30 jdk7-b129
+563a8f8b5be3940e9346cffac4eff9ed02b3c69f jdk7-b130
+9d6dd2cdfcb92612dbd836ecded87770d52b49db jdk7-b131
+1b1e75e8f476e5c07f0d2b035993895e2603e1f0 jdk7-b132
+671fe2e623ffefb4b7c312be919fc71eb48c1df1 jdk7-b133
+918003855fa0dba5acf4bf1fe36526d2fc4c1ba8 jdk7-b134
+e0b72ae5dc5e824b342801c8d1d336a55eb54e2c jdk7-b135
+48ef0c712e7cbf272f47f9224db92a3c6a9e2612 jdk7-b136
+a66c01d8bf895261715955df0b95545c000ed6a8 jdk7-b137
+78d8cf04697e9df54f7f11e195b7da29b8e345a2 jdk7-b138
+60b074ec6fcf5cdf9efce22fdfb02326ed8fa2d3 jdk7-b139
+cdf5d19ec142424489549025e9c42e51f32cf688 jdk7-b140
+a58635cdd921bafef353f4864184a0481353197b jdk7-b141
+a2f340a048c88d10cbedc0504f5cf03d39925a40 jdk7-b142
+51ed32f6f4de56f16e910ac54ba6c6f6606f4f17 jdk7-b143
+7033a5756ad552d88114594d8e2d2e4dc2c05963 jdk7-b144
+77ec0541aa2aa4da27e9e385a118a2e51e7fca24 jdk7-b145
+770227a4087e4e401fe87ccd19738440111c3948 jdk7-b146
+73323cb3396260d93e0ab731fd2d431096ceed0f jdk7-b147
+949fb60ca830364571e7c4c9964e6b351ca929ec jdk8-b01
+ed8d94519a87b4adac270c3eec9134ff1f62bff5 jdk8-b02
+cd0da00694fbce642db9be936d3e4909a71d911d jdk8-b03
+60a68d688e24473cf84dedd1e60901a61ab82555 jdk8-b04
+cc1b599b986a37cb57de4584c5e58169766ca535 jdk8-b05
+45c43dde7ba7f176333a51a98f086275478836fa jdk8-b06
+3d61f0856f349e2163bf98146465dab3b7437f63 jdk8-b07
+0d52b1c87aa8fdea7fdc9c4126ea58f95ca6b351 jdk8-b08
+a891732c1a83082177ff7a4cf1506068d9cc0a47 jdk8-b09
+cda87f7fefcee3b89742a57ce5ad9b03a54c210d jdk8-b10
+0199e4fef5cc2bd234c65b93220459ef7a3bb3b1 jdk8-b11
+31d70911b712c6b4e580a3110363d5f044cfed7a jdk8-b12
+5b9d9b839d3d7fe02347827221c97c6d242a6f96 jdk8-b13
+e59c47de1ad8982ff3b0e843773a6902b36c2337 jdk8-b14
+7da69e7175a7c7564ee6d0e52255cbb8a57ef577 jdk8-b15
+82dc033975bb9b553b4ef97b6d483eda8de32e0f jdk8-b17
+82dc033975bb9b553b4ef97b6d483eda8de32e0f jdk8-b16
+312cf15d16577ef198b033d2a4cc0a52369b7343 jdk8-b18
+e1366c5d84ef984095a332bcee70b3938232d07d jdk8-b19
+51d8b6cb18c0978ecfa4f33e1537d35ee01b69fa jdk8-b20
+f157fc2a71a38ce44007a6f18d5b011824dce705 jdk8-b21
+a11d0062c445d5f36651c78650ab88aa594bcbff jdk8-b22
+5218eb256658442b62b05295aafa5b5f35252972 jdk8-b23
+b98f0e6dddf987df565029a1f58417fc1844c3f3 jdk8-b24
+e45d6b406d5f91ff5256a5c82456ab1e7eb8becd jdk8-b25
+79f709a099f40c08f76567fa6d813f9009a69826 jdk8-b26
+4fffe75e4edd39a2517f10b743941bf94edb143d jdk8-b27
+2082eb35d49a9c2aab90b8d4fd31cefb7a23b82e jdk8-b28
+6117395d422682f89d228347e319fcaac7edc729 jdk8-b29
+4605f8418bf562e78be79b25b6b8a5110281acae jdk8-b30
+1954151dfae8f73db24e396380f7c02bdd47c486 jdk8-b31
+5d820cb6b1afd75b619e7fd69e4f2b0eb1d5d6a1 jdk8-b32
+1e2ac1ea3f6c32a62bf88f3fa330120c30db59cb jdk8-b33
+e24c5cc8b0f7cc48374eef0f995838fb4823e0eb jdk8-b34
+e3d735914edd0a621b16bb85417423f8e6af5d51 jdk8-b35
+a5a61f259961a7f46b002e5cc50b4a9bf86927b6 jdk8-b36
+83fac66442cf680bb59ec9e3a71cc4729322b595 jdk8-b37
+b8cbfb31139f820e5e094ba71449e58159fbe22e jdk8-b38
+785af00e2827990f149b32ec37f523dbca3efdd1 jdk8-b39
+56d030e5035fdee5bba6cf318a06287fda5d67ec jdk8-b40
+113f0d5f0a08aa0947b3edf783b603e7f042748a jdk8-b41
+79cc42c9c71bbd6630ede681642e98f5e4a841fa jdk8-b42
+cd879aff5d3cc1f58829aab3116880aa19525b78 jdk8-b43
+439d9bf8e4ff204cc89c9974c1515a508b2cc6ff jdk8-b44
+747dad9e9d37d244a5c765a1afe9194f7ddae118 jdk8-b45
+30141e598d72a6146126cb86b034ed6d0bd191b3 jdk8-b46
+21e46ea21c6a26246fb7a1926ac7fe8d580d0518 jdk8-b47
+7e2b179a5b4dbd3f097e28daa00abfcc72ba3e0b jdk8-b48
+fe44e58a6bdbeae350ce96aafb49770a5dca5d8a jdk8-b49
+d20d9eb9f093adbf392918c703960ad24c93a331 jdk8-b50
+9b0f841ca9f7ee9bacf16a5ab41c4f829276bc6b jdk8-b51
+80689ff9cb499837513f18a1136dac7f0686cd55 jdk8-b52
+63aeb7a2472fb299134ad7388e0a111a5340b02d jdk8-b53
+16c82fc74695bab9b9e0fb05c086a5a08ba0082f jdk8-b54
+e8a0e84383d6fbd303ce44bd355fb25972b13286 jdk8-b55
+bf1bb47414e178beff67dc255fc3b97bf401f679 jdk8-b56
+f3ab4163ae012965fc8acdfc25ce0fece8d6906d jdk8-b57
+18462a19f7bd66d38015f61ea549a5e0c0c889a3 jdk8-b58
+d54dc53e223ed9ce7d5f4d2cd02ad9d5def3c2db jdk8-b59
+207ef43ba69ead6cbbab415d81834545e4d46747 jdk8-b60
+0e08ba7648fb3faa0986cb217887d7c4990977f3 jdk8-b61
+08afb9c6f44f11c3595b01fd0985db64b29834dd jdk8-b62
+6ccbf67b68bfed1ab9c44ab8748a5bdc7df33506 jdk8-b63
+54d599a5b4aad83c235d590652fc81f41c2824fb jdk8-b64
+5132f7900a8f0c30c3ca7f7a32f9433f4fee7745 jdk8-b65
+65771ad1ca557ca26e4979d4dc633cf685435cb8 jdk8-b66
+394515ad2a55d4d54df990b36065505d3e7a3cbb jdk8-b67
+82000531feaa7baef76b6406099e5cd88943d635 jdk8-b68
+22ddcac208a8dea894a16887d04f3ca4d3c5d267 jdk8-b69
+603cceb495c8133d47b26a7502d51c7d8a67d76b jdk8-b70
+8171d23e914d758836527b80b06debcfdb718f2d jdk8-b71
+cb40427f47145b01b7e53c3e02b38ff7625efbda jdk8-b72
+191afde59e7be0e1a1d76d06f2a32ff17444f0ec jdk8-b73
+2132845cf5f717ff5c240a2431c0c0e03e66e3a5 jdk8-b74
+d4e68ce17795601017ac2f952baad7272942c36e jdk8-b75
+58be6ca3c0603882a1ec478724e337aac85e0da0 jdk8-b76
+35684a40c5845782324dbcc9ac8969528020ff61 jdk8-b77
+27d6368ae8ba570c31c2f0e696d39c99fa2f4538 jdk8-b78
+e41fb1aa0329767b2737303c994e38bede1baa07 jdk8-b79
+5f3d4a6bdd027a1631d97e2dfff63fd5e46987a4 jdk8-b80
+2a00aeeb466b9dee22508f6261f63b70f9c696fe jdk8-b81
+48e1bc77004d9af575b733c04637b98fd17603c2 jdk8-b82
+a45bb25a67c7517b45f00c9682e317f46fecbba9 jdk8-b83
+928f8b888deb785cbd7bbd5f951cd6880f11f14e jdk8-b84
+9583a6431596bac1959d2d8828f5ea217843dd12 jdk8-b85
+44a8ce4a759f2668ff434661a93ff462ea472478 jdk8-b86
+f1709874d55a06bc3d5dfa02dbcdfbc59f4cba34 jdk8-b87
+4e3a881ebb1ee96ce0872508b0066d74f310dbfa jdk8-b88
+fe4150590ee597f4e125fea950aa3b352622cc2d jdk8-b89
+c8286839d0df04aba819ec4bef12b86babccf30e jdk8-b90
+8f7ffb296385f85a4a6d53f9f2d4a7b13a8fa1ff jdk8-b91
+717aa26f8e0a1c0e768aebb3a763aca56db0c83e jdk8-b92
+8dc9d7ccbb2d77fd89bc321bb02e67c152aca257 jdk8-b93
+22f5d7f261d9d61a953d2d9a53f2e9ce0ca361d1 jdk8-b94
+2cf36f43df36137980d9828cec27003ec10daeee jdk8-b95
+3357c2776431d51a8de326a85e0f41420e40774f jdk8-b96
+469995a8e97424f450c880606d689bf345277b19 jdk8-b97
+3370fb6146e47a6cc05a213fc213e12fc0a38d07 jdk8-b98
+3f67804ab61303782df57e54989ef5e0e4629beb jdk8-b99
+8d492f1dfd1b131a4c7886ee6b59528609f7e4fe jdk8-b100
+a013024b07475782f1fa8e196e950b34b4077663 jdk8-b101
+528c7e76eaeee022817ee085668459bc97cf5665 jdk8-b102
+49c4a777fdfd648d4c3fffc940fdb97a23108ca8 jdk8-b103
+d411c60a8c2fe8fdc572af907775e90f7eefd513 jdk8-b104
+4e38de7c767e34104fa147b5b346d9fe6b731279 jdk8-b105
+2e3a056c84a71eba78945c18b05397858ffd7ad0 jdk8-b106
+23fc34133152692b725db4bd617b4c8dfd6ccb05 jdk8-b107
+a4bb3b4500164748a9c33b2283cfda76d89f25ab jdk8-b108
+428428cf5e06163322144cfb5367e1faa86acf20 jdk8-b109
+3d2b7ce93c5c2e3db748f29c3d29620a8b3b748a jdk8-b110
+85c1c94e723582f9a1dd0251502c42b73d6deea7 jdk8-b111
+43cec76d1d62587a07af07e2d9bec93aba2a506b jdk8-b112
+a259ff3e42d91da68f4d4f09d7eb9dc22bc024fc jdk8-b113
+0bbccf77c23e566170b88b52c2cf28e5d31ce927 jdk8-b114
+8d07115924b7d703a5048adb24e8aba751442f13 jdk8-b115
+5fdc4465208933ba704825b2b05e1afd062235fb jdk8-b116
+e53d1ee4d2ae898f1cf58688d45a5afe7c482173 jdk8-b117
+d6820a414f182a011a53a29a52370c696cd58dab jdk8-b118
+379fc7609beb7a3d85ebc0cc21a8a51c60d3c7d3 jdk8-b119
+53fd772d28c8a9f0f43adfc06f75f6b3cfa93cb5 jdk8-b120
+a7d3638deb2f4e33217b1ecf889479e90f9e5b50 jdk9-b00
+79a8136b18c1c6848f500088f5a4b39f262f082d jdk9-b01
+8394993063135a42b63a94473280399fb2a13aa7 jdk9-b02
+d338b892a13db19b093f85cf5f949a4504e4d31f jdk9-b03
+1ed19de263e1e0772da0269118cdd9deeb9fff04 jdk9-b04
+167c39eb44731a5d66770d0f00e231164653a2ff jdk9-b05
+a4bf701ac316946c2e5e83138ad8e687da6a4b30 jdk9-b06
+6c8563600a71394c949405189ddd66267a88d8cd jdk9-b07
+2da7fead826bc27f193c7d63048c2cf100a8809c jdk9-b08
+1a3a4f48515dbf1cff37279691b2fb74f228298d jdk9-b09
+3bd4039dfc632fd7fc8418a25a3dcc34d1cd4019 jdk9-b10
+77ea0a2503582a28e4e66be7239a49a0d1dd313f jdk9-b11
+e212cdcc8c11f0ba5acf6f5ddb596c4c545a93f9 jdk9-b12
+088eec4c36f4d7f250fcd19c4969bf698e3d2cdc jdk9-b13
+a2b82f863ba95a596da555a4c1b871c404863e7e jdk9-b14
+e54022d0dd92106fff7f7fe670010cd7e6517ee3 jdk9-b15
+422ef9d29d84f571453f015c4cb8713c3af70ee4 jdk9-b16
+4c75c2ca7cf3e0618315879acf17f42c8fcd0c09 jdk9-b17
+77565aaaa2bb814e94817e92d680168052a25395 jdk9-b18
+eecc1b6adc7e193d00a0641eb0963add5a4c06e8 jdk9-b19
+87f36eecb1665012d01c5cf102494e591c943ea6 jdk9-b20
+3615a4e7f0542ca7552ad6454b742c73ee211d8e jdk9-b21
+ddc07abf4307855c0dc904cc5c96cc764023a930 jdk9-b22
+57735d66face054440a63ce99789eac5a5ee1dfd jdk9-b23
+8a44142bb7fc8118f70f91a1b97c12dfc50563ee jdk9-b24
+da08cca6b97f41b7081a3e176dcb400af6e4bb26 jdk9-b25
+6c777df597bbf5abba3488d44c401edfe73c74af jdk9-b26
+7e06bf1dcb0907b80ddf59315426ce9ce775e56d jdk9-b27
+a00b04ef067e39f50b9a0fea6f1904e35d632a73 jdk9-b28
+163a9cd806fd09970baf1f5f42b92a3cfe7ee945 jdk9-b29
+98967ae6ae53ebf15615e07cd5a6b1ae04dfd84c jdk9-b30
+c432b80aadd0cb2b2361b02add4d671957d4cec9 jdk9-b31
+b5b139354630edb2d06190bf31653acbdcea63a8 jdk9-b32
+cfdac5887952c2dd73c73a1d8d9aa880d0539bbf jdk9-b33
+24a0bad5910f775bb4002d1dacf8b3af87c63cd8 jdk9-b34
+9bc2dbd3dfb8c9fa88e00056b8b93a81ee6d306e jdk9-b35
+ffd90c81d4ef9d94d880fc852e2fc482ecd9b374 jdk9-b36
+7e9add74ad50841fb39dae75db56374aefa1de4c jdk9-b37
+8acf056126e819cf536eef02aee0f61f207a6b52 jdk9-b38
+53bf36cb722db50815712258a77cb6bbe25a2f5f jdk9-b39
+e27c725d6c9d155667b35255f442d4ceb8c3c084 jdk9-b40
+1908b886ba1eda46fa725cf1160fe5d30fd1a7e5 jdk9-b41
+078bb11af876fe528d4b516f33ad4dd9bb60549e jdk9-b42
+9645e35616b60c5c07b4fdf11a132afc8081dfa8 jdk9-b43
+1f57bd728c9e6865ccb9d43ccd80a1c11230a32f jdk9-b44
+9e3f2bed80c0e5a84a256ce41f1d10c5ade48466 jdk9-b45
+326f2068b4a4c05e2fa27d6acf93eba7b54b090d jdk9-b46
+ee8447ca632e1d39180b4767c749db101bff7314 jdk9-b47
+a13c49c5f2899b702652a460ed7aa73123e671e6 jdk9-b48
+9285d14eb7b6b0815679bae98dd936dbc136218d jdk9-b49
+224f593393e5b01b3c8f1e591b7f4b1790a3737a jdk9-b50
+2309c02386d1fa4ced5051873ffb9e04874f7a44 jdk9-b51
+b8538bbb6f224ab1dabba579137099c166ad4724 jdk9-b52
+aadc16ca5ab7d56f92ef9dbfa443595a939241b4 jdk9-b53
+d469c5ad0c763e325a78e0af3016878a57dfc5cc jdk9-b54
+734ca5311a225711b79618f3e92f47f07c82154a jdk9-b55
+ef4afd6832b00b8687832c2a36c90e43750ebe40 jdk9-b56
+d8ebf1a5b18ccbc849f5bf0f80aa3d78583eee68 jdk9-b57
+86dd5de1f5cb09073019bd629e22cfcd012d8b4b jdk9-b58
+cda6ae062f85fac5555f4e1318885b0ecd998bd1 jdk9-b59
+caa330b275f39282793466529f6864766b31d9fd jdk9-b60
+d690f489ca0bb95a6157d996da2fa72bcbcf02ea jdk9-b61
+d27f7e0a7aca129969de23e9934408a31b4abf4c jdk9-b62
+0acac6937de7a0868f8c6f88b7d036d780abeee6 jdk9-b63
+0a5e5a7c3539e8bde73d9fe55750e49a49cb8dac jdk9-b64
+afc1e295c4bf83f9a5dd539c29914edd4a754a3f jdk9-b65
+44ee68f7dbacab24a45115fd6a8ccdc7eb6e8f0b jdk9-b66
+4418697e56f1f43597f55c7cb6573549c6117868 jdk9-b67
+8efad64f40eb8cd4df376c0a5275892eeb396bbd jdk9-b68
+de8acedcb5b5870f1dc54cba575aaa5d33897ea2 jdk9-b69
+e7cf01990ed366bd493080663259281e91ce223b jdk9-b70
+cd39ed501fb0504554a7f58ac6cf3dd2b64afec0 jdk9-b71
+f9f3706bd24c42c07cb260fe05730a749b8e52f4 jdk9-b72
+29096b78d93b01a2f8882509cd40755e3d6b8cd9 jdk9-b73
+622fe934e351e89107edf3c667d6b57f543f58f1 jdk9-b74
+960b56805abd8460598897481820bd6a75f979e7 jdk9-b75
+d8126bc88fa5cd1ae4e44d86a4b1280ca1c9e2aa jdk9-b76
+8bb2441c0fec8b28f7bf11a0ca3ec1642e7ef457 jdk9-b77
+182bb7accc5253bcfefd8edc1d4997ec8f9f8694 jdk9-b78
+4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79
+821a0373ef2d1642a9824facb938b901ad010413 jdk9-b80
+45c35b7f5b40d5af0085e4a7b3a4d6e3e0347c35 jdk9-b81
+c20d8ebddaa6fb09cc81d3edf3d1d05f4232700a jdk9-b82
+ca8a1719588424f6e04e943790c7fcb7cb0b8c8f jdk9-b83
+df70bb200356fec686681f0295c50cc3ed43c3b3 jdk9-b84
+3ec06af1368924469f7ce60a00324bac55eaeecc jdk9-b85
+0a3f0d25c201b40575a7c3920fce4d6f4d3ae310 jdk9-b86
+a5c40ac9b916ff44d512ee764fa919ed2097e149 jdk9-b87
+00f48ecbc09915f793d9e5ad74ab0b25f2549bf5 jdk9-b88
+c847a53b38d2fffb87afc483c74db05eced9b4f4 jdk9-b89
+29cc8228d62319af21cad7c90817671e0813b6bd jdk9-b90
+75843e0a9371d445a3c9b440bab85e50b5dc287c jdk9-b91
+f7d70caad89ad0c43bb057bca0aad6f17ce05a6a jdk9-b92
+27e9c8d8091e2447ea7ef3e3103e9b7dd286e03a jdk9-b93
+61e9f509be0f78f0961477960f372b0533214bb8 jdk9-b94
+fd038e8a16eec80d0d6b337d74a582790ed4b3ee jdk-9+95
+feb1bd85d7990dcf5584ca9e53104269c01db006 jdk-9+96
+10a482b863582376d4ca229090334b23b05159fc jdk-9+97
+ea285530245cf4e0edf0479121a41347d3030eba jdk-9+98
+180212ee1d8710691ba9944593dfc1ff3e4f1532 jdk-9+99
+791d0d3ac0138faeb6110bd840a4545bc1950df2 jdk-9+100
+30dfb3bd3d06b4bb80a087babc0d1841edba187b jdk-9+101
+9c4662334d933d299928d1f599d02ff50777cbf8 jdk-9+102
+0680fb7dae4da1ee6cf783c4b74184e3e08d3179 jdk-9+103
+e385e95e6101711d5c63e7b1a827e99b6ec7a1cc jdk-9+104
+64006ae915b3aa85ac7e6fac679024d2da7fe526 jdk-9+105
+8ec4f97943fe56f93e4621f622b56b7144c0181a jdk-9+106
+49202432b69445164a42be7cbdf74ed5fce98157 jdk-9+107
+84f2862a25eb3232ff36c376b4e2bf2a83dfced3 jdk-9+108
+b75afa17aefe480c23c616a6a2497063312f7189 jdk-9+109
+9666775734fb6028ee86df9972626b3667b6a318 jdk-9+110
+2bb92dd44275679edb29fdbffc3b7cbebc9a6bf0 jdk-9+111
+780d0620add32bf545471cf65038c9ac6d9c036d jdk-9+112
+cc30faa2da498c478e89ab062ff160653ca1b170 jdk-9+113
+10d175b0368c30f54350fc648adc41b94ce357ee jdk-9+114
+7bab1b1b36824924b1c657a8419369ba93d198d3 jdk-9+115
+7dfa7377a5e601b8f740741a9a80e04c72dd04d6 jdk-9+116
+7a1b36bf2fe55a9a7732489ccdd326c910329a7e jdk-9+117
+8c2c2d17f7ce92a31c9ccb44a122ec62f5a85ace jdk-9+118
+daf533920b1266603b5cbdab31908d2a931c5361 jdk-9+119
+5943b791e131e79b969d4cea053aecda34801723 jdk-9+120
+9a5fc5a27560ac272c1341f8f3838338fba49059 jdk-9+121
+a39131aafc51a6fd8836e6ebe1b04458702ce7d6 jdk-9+122
+e33a34cc551907617d8129c4faaf1a5a7e61d21c jdk-9+123
+45121d5afb9d5bfadab75378572ad96832e0809e jdk-9+124
+1d48e67d1b91eb9f72e49e69a4021edb85e357fc jdk-9+125
+c7f5ba08fcd4b8416e62c21229f9a07c95498919 jdk-9+126
+8fab452b6f4710762ba1d8e55fd62db00b1355fe jdk-9+127
+1f093d3f8cd99cd37c3b0af4cf5c3bffaa9c8b98 jdk-9+128
+c3e83ccab3bb1733ae903d681879a33f85ed465c jdk-9+129
+77f9692d5976ae155773dd3e07533616bb95bae1 jdk-9+130
+f7e1d5337c2e550fe553df7a3886bbed80292ecd jdk-9+131
+1ab4b9399c4cba584f66c1c088188f2f565fbf9c jdk-9+132
+2021bfedf1c478a4808a7711a6090682a12f4c0e jdk-9+133
+1a497f5ca0cfd88115cc7daa8af8a62b8741caf2 jdk-9+134
+094d0db606db976045f594dba47d4593b715cc81 jdk-9+135
+aa053a3faf266c12b4fd5272da431a3e08e4a3e3 jdk-9+136
+258cf18fa7fc59359b874f8743b7168dc48baf73 jdk-9+137
+27bb44be32076861a0951bcefb07a1d92509a4b6 jdk-9+138
+8c9da7fc5b07c606afd571c7012441b77dda83b2 jdk-9+139
+9f3fc931bc230f44f2a58d75f7f6360af98bb113 jdk-9+140
+b32f998da32b488ec7c4e9dbb3c750841b48e74d jdk-9+141
+408c9c621938ca028e20bced0459f815de47eba8 jdk-9+142
+6211236ef15ec796806357608b1dd1b70c258ece jdk-9+143
+d4f1dae174098e799c48948e866054c52e11a186 jdk-9+144
+a44b156ae7f06bf41b9bece30df7775e482395dd jdk-9+145
+ecd74b41ab65bf228837b5bdf99690638d55425c jdk-9+146
+dc49e0922a8e4387cbf8670bbe1dc51c9874b74b jdk-9+147
+f95cc86b6ac22ec1ade5d4f825dc7782adeea228 jdk-9+148
+00b19338e505690abe93d5995ed74a473d969c2c jdk-9+149
+9205e980062a5c4530b51021c6e274025f4ccbdf jdk-9+150
+77f827f5bbad3ef795664bc675f72d98d156b9f8 jdk-9+151
+ff8cb43c07c069b1debdee44cb88ca22db1ec757 jdk-9+152
+68a8e8658511093b322a46ed04b2a321e1da2a43 jdk-9+153
+078ebe23b584466dc8346e620d7821d91751e5a9 jdk-9+154
+a545f54babfa31aa7eb611f36031609acd617cbc jdk-9+155
+907c26240cd481579e919bfd23740797ff8ce1c8 jdk-9+156
+9383da04b385cca46b7ca67f3a39ac1b673e09fe jdk-9+157
+de6bdf38935fa753183ca288bed5c06a23c0bb12 jdk-9+158
+6feea77d2083c99e44aa3e272d07b7fb3b801683 jdk-9+159
+c7688f2fa07936b089ca0e9a0a0eff68ff37a542 jdk-9+160
+18f02bc43fe96aef36791d0df7aca748485210cc jdk-9+161
+18ffcf99a3b4a10457853d94190e825bdf07e39b jdk-9+162
+493011dee80e51c2a2b064d049183c047df36d80 jdk-9+163
+965bbae3072702f7c0d95c240523b65e6bb19261 jdk-9+164
+a510b2201154abdd12ede42788086b5283bfb9a6 jdk-9+165
+934c18145915b06d3fcc0de1a30f91f5aab8a192 jdk-9+166
+43de67f51801b9e16507865fcb7e8344f4ca4aa9 jdk-9+167
+03a2cc9c8a1e8f87924c9863e917bc8b91770d5f jdk-9+168
+b2218d41edef02ee8f94bb438f885b2ba79bfa08 jdk-9+169
+8a4ab3b0ab9a86df73d9a1e337134f2dbe006725 jdk-9+170
+c62e5964cfcf144d8f72e9ba69757897785349a9 jdk-9+171
+95ed14547ca9246baed34f90ef3ca13217538a8c jdk-9+172
+534ba4f8cfcf12accc5b9adb943103f2ff79fe16 jdk-9+173
+3615768c12904e29bb2ec1b506cd4633cd8a9ced jdk-9+174
+dc78a3dd6b3a4f11cdae8a3e3d160e6a78bc7838 jdk-9+175
+40fb9f229471ef357d493813d34b15afcce9f32b jdk-9+176
+c72e9d3823f04cb3ef3166646dfea9e4c2769133 jdk-9+177
+9c1e9712648921ae389d623042d22561fad82d75 jdk-9+178
+24390da83c5ee9e23ceafbcaff4460a01e37bb3a jdk-9+179
+6ce6cb8ff41c71c49f23b15e0f0468aca5d52b17 jdk-9+180
diff --git a/.jcheck/conf b/.jcheck/conf
new file mode 100644
index 0000000..5c6f62d
--- /dev/null
+++ b/.jcheck/conf
@@ -0,0 +1 @@
+project=jdk9
diff --git a/ASSEMBLY_EXCEPTION b/ASSEMBLY_EXCEPTION
new file mode 100644
index 0000000..065b8d9
--- /dev/null
+++ b/ASSEMBLY_EXCEPTION
@@ -0,0 +1,27 @@
+
+OPENJDK ASSEMBLY EXCEPTION
+
+The OpenJDK source code made available by Oracle America, Inc. (Oracle) at
+openjdk.java.net ("OpenJDK Code") is distributed under the terms of the GNU
+General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+only ("GPL2"), with the following clarification and special exception.
+
+ Linking this OpenJDK Code statically or dynamically with other code
+ is making a combined work based on this library. Thus, the terms
+ and conditions of GPL2 cover the whole combination.
+
+ As a special exception, Oracle gives you permission to link this
+ OpenJDK Code with certain code licensed by Oracle as indicated at
+ http://openjdk.java.net/legal/exception-modules-2007-05-08.html
+ ("Designated Exception Modules") to produce an executable,
+ regardless of the license terms of the Designated Exception Modules,
+ and to copy and distribute the resulting executable under GPL2,
+ provided that the Designated Exception Modules continue to be
+ governed by the licenses under which they were offered by Oracle.
+
+As such, it allows licensees and sublicensees of Oracle's GPL2 OpenJDK Code
+to build an executable that includes those portions of necessary code that
+Oracle could not provide under GPL2 (or that Oracle has provided under GPL2
+with the Classpath exception). If you modify or add to the OpenJDK code,
+that new GPL2 code may still be combined with Designated Exception Modules
+if the new code is made subject to this exception by its copyright holder.
diff --git a/make/Makefile b/make/Makefile
new file mode 100644
index 0000000..4570070
--- /dev/null
+++ b/make/Makefile
@@ -0,0 +1,49 @@
+#
+# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+# Locate this Makefile
+ifeq ($(filter /%, $(lastword $(MAKEFILE_LIST))), )
+ makefile_path := $(CURDIR)/$(lastword $(MAKEFILE_LIST))
+else
+ makefile_path := $(lastword $(MAKEFILE_LIST))
+endif
+repo_dir := $(patsubst %/make/Makefile, %, $(makefile_path))
+
+# What is the name of this subsystem (langtools, corba, etc)?
+subsystem_name := $(notdir $(repo_dir))
+
+# Try to locate top-level makefile
+top_level_makefile := $(repo_dir)/../Makefile
+ifneq ($(wildcard $(top_level_makefile)), )
+ $(info Will run $(subsystem_name) target on top-level Makefile)
+ $(info WARNING: This is a non-recommended way of building!)
+ $(info ===================================================)
+else
+ $(info Cannot locate top-level Makefile. Is this repo not checked out as part of a complete forest?)
+ $(error Build from top-level Makefile instead)
+endif
+
+all:
+ @$(MAKE) -f $(top_level_makefile) $(subsystem_name)
diff --git a/make/copy/Copy-java.corba.gmk b/make/copy/Copy-java.corba.gmk
new file mode 100644
index 0000000..fbc26a5
--- /dev/null
+++ b/make/copy/Copy-java.corba.gmk
@@ -0,0 +1,34 @@
+#
+# Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+################################################################################
+# Copy idl files to jdk/lib.
+$(eval $(call SetupCopyFiles,COPY_IDL, \
+ SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl, \
+ DEST := $(SUPPORT_OUTPUTDIR)/modules_include/$(MODULE), \
+ FILES := $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl))
+
+TARGETS := $(COPY_IDL)
diff --git a/make/gensrc/Gensrc-java.corba.gmk b/make/gensrc/Gensrc-java.corba.gmk
new file mode 100644
index 0000000..4899790
--- /dev/null
+++ b/make/gensrc/Gensrc-java.corba.gmk
@@ -0,0 +1,242 @@
+#
+# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+default: all
+
+include $(SPEC)
+include MakeBase.gmk
+include JavaCompilation.gmk
+include IdlCompilation.gmk
+include SetupJavaCompilers.gmk
+
+################################################################################
+
+$(eval $(call SetupJavaCompilation,BUILD_TOOLS_CORBA, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(CORBA_TOPDIR)/make/src/classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes))
+
+TOOL_LOGUTIL_CMD := $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/corba_tools_classes \
+ build.tools.logutil.MC
+
+$(eval $(call SetupJavaCompilation,BUILD_IDLJ, \
+ SETUP := GENERATE_OLDBYTECODE, \
+ SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/idlj_classes, \
+ COPY := .prp, \
+ INCLUDES := com/sun/tools/corba/se/idl, \
+ EXCLUDE_FILES := ResourceBundleUtil.java module-info.java))
+
+# Force the language to english for predictable source code generation.
+TOOL_IDLJ_CMD := $(JAVA_SMALL) -cp $(BUILDTOOLS_OUTPUTDIR)/idlj_classes \
+ -Duser.language=en com.sun.tools.corba.se.idl.toJavaPortable.Compile
+
+################################################################################
+
+EXCEPTION_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/logging
+LOGWRAPPER_DIR := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/_logwrappers
+
+# Generate LogWrapper classes
+$(EXCEPTION_DIR)/%SystemException.java: \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
+ $(BUILD_TOOLS_CORBA)
+ $(call LogInfo, Generating class file from $*.mc)
+ $(call MakeDir, $(@D))
+ $(RM) -f $(@D)/_the_wrappers.d
+ $(TOOL_LOGUTIL_CMD) make-class $< $(@D)
+
+# Generate LogWrapper properties file by concatening resource files
+$(EXCEPTION_DIR)/LogStrings.properties: \
+ $(LOGWRAPPER_DIR)/ActivationSystemException.resource \
+ $(LOGWRAPPER_DIR)/IORSystemException.resource \
+ $(LOGWRAPPER_DIR)/InterceptorsSystemException.resource \
+ $(LOGWRAPPER_DIR)/NamingSystemException.resource \
+ $(LOGWRAPPER_DIR)/OMGSystemException.resource \
+ $(LOGWRAPPER_DIR)/ORBUtilSystemException.resource \
+ $(LOGWRAPPER_DIR)/POASystemException.resource \
+ $(LOGWRAPPER_DIR)/UtilSystemException.resource
+ $(call LogInfo, Concatenating 8 resource files into $(@F))
+ $(call MakeDir, $(@D))
+ $(CAT) $^ > $@
+
+# The resources files are generated from lisp-like .mc files.
+$(LOGWRAPPER_DIR)/%SystemException.resource: \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/%.mc \
+ $(BUILD_TOOLS_CORBA)
+ $(call LogInfo, Generating resource file from $*.mc)
+ $(call MakeDir, $(@D))
+ $(RM) -f $(@D)/_the_wrappers.d
+ $(TOOL_LOGUTIL_CMD) make-resource $< $(@D)
+
+
+LOGWRAPPER_TARGETS := \
+ $(EXCEPTION_DIR)/ActivationSystemException.java \
+ $(EXCEPTION_DIR)/IORSystemException.java \
+ $(EXCEPTION_DIR)/InterceptorsSystemException.java \
+ $(EXCEPTION_DIR)/NamingSystemException.java \
+ $(EXCEPTION_DIR)/OMGSystemException.java \
+ $(EXCEPTION_DIR)/ORBUtilSystemException.java \
+ $(EXCEPTION_DIR)/POASystemException.java \
+ $(EXCEPTION_DIR)/UtilSystemException.java \
+ $(EXCEPTION_DIR)/LogStrings.properties
+
+################################################################################
+# Build the IDLs.
+
+IDL_DELETES := \
+ org/omg/DynamicAny/*POA* \
+ org/omg/DynamicAny/*Holder* \
+ org/omg/DynamicAny/DynValueBoxHelper.java \
+ org/omg/DynamicAny/DynValueCommonHelper.java \
+ org/omg/DynamicAny/_DynValueCommonStub.java \
+ org/omg/DynamicAny/_DynValueBoxStub.java \
+ org/omg/DynamicAny/DynAnyPackage/TypeMismatchHolder.java \
+ org/omg/DynamicAny/DynAnyPackage/InvalidValueHolder.java \
+ org/omg/DynamicAny/DynAnyFactoryPackage/InconsistentTypeCodeHolder.java \
+ org/omg/IOP/BI_DIR_IIOP.java \
+ org/omg/IOP/ChainBypassCheck.java \
+ org/omg/IOP/ChainBypassInfo.java \
+ org/omg/IOP/FORWARDED_IDENTITY.java \
+ org/omg/IOP/INVOCATION_POLICIES.java \
+ org/omg/IOP/LogicalThreadId.java \
+ org/omg/IOP/SendingContextRunTime.java \
+ org/omg/IOP/UnknownExceptionInfo.java \
+ org/omg/IOP/TaggedComponentSeqHolder.java \
+ org/omg/PortableServer/CurrentPackage/NoContextHolder.java \
+ org/omg/PortableServer/ForwardRequestHolder.java \
+ org/omg/PortableServer/IdAssignmentPolicyValueHelper.java \
+ org/omg/PortableServer/IdAssignmentPolicyValueHolder.java \
+ org/omg/PortableServer/IdUniquenessPolicyValueHelper.java \
+ org/omg/PortableServer/IdUniquenessPolicyValueHolder.java \
+ org/omg/PortableServer/ImplicitActivationPolicyValueHelper.java \
+ org/omg/PortableServer/ImplicitActivationPolicyValueHolder.java \
+ org/omg/PortableServer/LifespanPolicyValueHelper.java \
+ org/omg/PortableServer/LifespanPolicyValueHolder.java \
+ org/omg/PortableServer/ServantRetentionPolicyValueHelper.java \
+ org/omg/PortableServer/ServantRetentionPolicyValueHolder.java \
+ org/omg/PortableServer/ObjectIdHelper.java \
+ org/omg/PortableServer/ObjectIdHolder.java \
+ org/omg/PortableServer/POAListHelper.java \
+ org/omg/PortableServer/POAListHolder.java \
+ org/omg/PortableServer/POAManagerPackage/AdapterInactiveHolder.java \
+ org/omg/PortableServer/POAManagerPackage/StateHelper.java \
+ org/omg/PortableServer/POAManagerPackage/StateHolder.java \
+ org/omg/PortableServer/POAPackage/AdapterAlreadyExistsHolder.java \
+ org/omg/PortableServer/POAPackage/AdapterNonExistentHolder.java \
+ org/omg/PortableServer/POAPackage/InvalidPolicyHolder.java \
+ org/omg/PortableServer/POAPackage/NoServantHolder.java \
+ org/omg/PortableServer/POAPackage/ObjectAlreadyActiveHolder.java \
+ org/omg/PortableServer/POAPackage/ObjectNotActiveHolder.java \
+ org/omg/PortableServer/POAPackage/ServantAlreadyActiveHolder.java \
+ org/omg/PortableServer/POAPackage/ServantNotActiveHolder.java \
+ org/omg/PortableServer/POAPackage/WrongAdapterHolder.java \
+ org/omg/PortableServer/POAPackage/WrongPolicyHolder.java \
+ org/omg/PortableServer/RequestProcessingPolicyValueHelper.java \
+ org/omg/PortableServer/RequestProcessingPolicyValueHolder.java \
+ org/omg/PortableServer/ServantActivatorHolder.java \
+ org/omg/PortableServer/ServantLocatorHolder.java \
+ org/omg/PortableServer/ThreadPolicyValueHelper.java \
+ org/omg/PortableServer/ThreadPolicyValueHolder.java \
+ org/omg/PortableInterceptor/ClientRequestInfoHelper.java \
+ org/omg/PortableInterceptor/ClientRequestInterceptorHelper.java \
+ org/omg/PortableInterceptor/IORInfoHelper.java \
+ org/omg/PortableInterceptor/IORInterceptorHelper.java \
+ org/omg/PortableInterceptor/InterceptorHelper.java \
+ org/omg/PortableInterceptor/ORBInitInfoHelper.java \
+ org/omg/PortableInterceptor/ORBInitializerHelper.java \
+ org/omg/PortableInterceptor/PolicyFactoryHelper.java \
+ org/omg/PortableInterceptor/ReplyStatusHelper.java \
+ org/omg/PortableInterceptor/RequestInfoHelper.java \
+ org/omg/PortableInterceptor/ServerRequestInfoHelper.java \
+ org/omg/PortableInterceptor/ServerRequestInterceptorHelper.java \
+ org/omg/PortableInterceptor/SlotIdHelper.java \
+ org/omg/PortableInterceptor/ClientRequestInfoHolder.java \
+ org/omg/PortableInterceptor/ClientRequestInterceptorHolder.java \
+ org/omg/PortableInterceptor/CurrentHolder.java \
+ org/omg/PortableInterceptor/ForwardRequestHolder.java \
+ org/omg/PortableInterceptor/IORInfoHolder.java \
+ org/omg/PortableInterceptor/IORInterceptorHolder.java \
+ org/omg/PortableInterceptor/InterceptorHolder.java \
+ org/omg/PortableInterceptor/InvalidSlotHolder.java \
+ org/omg/PortableInterceptor/ORBInitInfoHolder.java \
+ org/omg/PortableInterceptor/ORBInitializerHolder.java \
+ org/omg/PortableInterceptor/PolicyFactoryHolder.java \
+ org/omg/PortableInterceptor/RequestInfoHolder.java \
+ org/omg/PortableInterceptor/ServerRequestInfoHolder.java \
+ org/omg/PortableInterceptor/ServerRequestInterceptorHolder.java \
+ org/omg/PortableInterceptor/TaggedComponentSeqHolder.java \
+ org/omg/PortableInterceptor/ORBInitInfoPackage/DuplicateNameHolder.java \
+ org/omg/PortableInterceptor/ORBInitInfoPackage/InvalidNameHolder.java \
+ org/omg/IOP/CodecPackage/FormatMismatchHolder.java \
+ org/omg/IOP/CodecPackage/InvalidTypeForEncodingHolder.java \
+ org/omg/IOP/CodecPackage/TypeMismatchHolder.java \
+ org/omg/IOP/CodecHelper.java \
+ org/omg/IOP/EncodingFormatHelper.java \
+ org/omg/IOP/EncodingHelper.java \
+ org/omg/IOP/CodecFactoryPackage/UnknownEncodingHolder.java \
+ org/omg/IOP/CodecFactoryHolder.java \
+ org/omg/IOP/CodecHolder.java \
+ org/omg/IOP/EncodingHolder.java \
+ org/omg/IOP/TaggedComponentSeqHelper.java \
+ org/omg/Dynamic/ContextListHelper.java \
+ org/omg/Dynamic/ExceptionListHelper.java \
+ org/omg/Dynamic/ParameterHolder.java \
+ org/omg/Dynamic/ParameterListHolder.java \
+ org/omg/Dynamic/ExceptionListHolder.java \
+ org/omg/Dynamic/ParameterHelper.java \
+ org/omg/Dynamic/ParameterListHelper.java \
+ org/omg/Dynamic/RequestContextHelper.java \
+ org/omg/CORBA/OctetSeqHelper.java \
+ org/omg/CORBA/OctetSeqHolder.java \
+ org/omg/CORBA/PolicyError.java \
+ org/omg/CORBA/RepositoryIdHelper.java \
+ #
+
+$(eval $(call SetupIdlCompilation,BUILD_IDLS, \
+ IDLJ := $(TOOL_IDLJ_CMD), \
+ SRC := $(CORBA_TOPDIR)/src/java.corba/share/classes, \
+ BIN := $(SUPPORT_OUTPUTDIR)/gensrc/java.corba, \
+ EXCLUDES := com/sun/tools/corba/se/idl/% \
+ org/omg/CORBA/% \
+ com/sun/corba/se/GiopIDL/% \
+ org/omg/PortableServer/corba.idl, \
+ INCLUDES := %, \
+ OLDIMPLBASES := com/sun/corba/se/PortableActivationIDL/activation.idl \
+ com/sun/corba/se/spi/activation/activation.idl, \
+ DELETES := $(IDL_DELETES)))
+
+$(BUILD_IDLS): $(BUILD_IDLJ)
+
+################################################################################
+# zh_HK is just a copy of zh_TW
+
+$(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties: \
+ $(CORBA_TOPDIR)/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
+ $(install-file)
+
+################################################################################
+
+all: $(BUILD_IDLS) $(LOGWRAPPER_TARGETS) \
+ $(SUPPORT_OUTPUTDIR)/gensrc/java.corba/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_HK.properties
diff --git a/make/src/classes/build/tools/logutil/IndentingPrintWriter.java b/make/src/classes/build/tools/logutil/IndentingPrintWriter.java
new file mode 100644
index 0000000..d6272db
--- /dev/null
+++ b/make/src/classes/build/tools/logutil/IndentingPrintWriter.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2003, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.logutil;
+
+import java.io.PrintWriter ;
+import java.io.Writer ;
+import java.io.OutputStream ;
+import java.io.BufferedWriter ;
+import java.io.OutputStreamWriter ;
+import java.util.StringTokenizer ;
+
+public class IndentingPrintWriter extends PrintWriter {
+ private int level = 0 ;
+ private int indentWidth = 4 ;
+ private String indentString = "" ;
+
+ public void printMsg( String msg, Object... data )
+ {
+ // System.out.println( "printMsg called with msg=" + msg + " data=" + data ) ;
+ StringTokenizer st = new StringTokenizer( msg, "@", true ) ;
+ StringBuffer result = new StringBuffer() ;
+ String token = null ;
+ int pos = 0;
+
+ while (st.hasMoreTokens()) {
+ token = st.nextToken() ;
+ if (token.equals("@")) {
+ if (pos < data.length) {
+ result.append( data[pos] );
+ ++pos;
+ } else {
+ throw new Error( "List too short for message" ) ;
+ }
+ } else {
+ result.append( token ) ;
+ }
+ }
+
+ // System.out.println( "Printing result " + result + " to file" ) ;
+ print( result ) ;
+ println() ;
+ }
+
+ public IndentingPrintWriter (Writer out) {
+ super( out, true ) ;
+ // System.out.println( "Constructing a new IndentingPrintWriter with Writer " + out ) ;
+ }
+
+ public IndentingPrintWriter(Writer out, boolean autoFlush) {
+ super( out, autoFlush ) ;
+ // System.out.println( "Constructing a new IndentingPrintWriter with Writer " + out ) ;
+ }
+
+ public IndentingPrintWriter(OutputStream out) {
+ super(out, true);
+ // System.out.println( "Constructing a new IndentingPrintWriter with OutputStream " + out ) ;
+ }
+
+ public IndentingPrintWriter(OutputStream out, boolean autoFlush) {
+ super(new BufferedWriter(new OutputStreamWriter(out)), autoFlush);
+ // System.out.println( "Constructing a new IndentingPrintWriter with OutputStream " + out ) ;
+ }
+
+ public void setIndentWidth( int indentWidth )
+ {
+ this.indentWidth = indentWidth ;
+ updateIndentString() ;
+ }
+
+ public void indent()
+ {
+ level++ ;
+ updateIndentString() ;
+ }
+
+ public void undent()
+ {
+ if (level > 0) {
+ level-- ;
+ updateIndentString() ;
+ }
+ }
+
+ private void updateIndentString()
+ {
+ int size = level * indentWidth ;
+ StringBuffer sbuf = new StringBuffer( size ) ;
+ for (int ctr = 0; ctr<size; ctr++ )
+ sbuf.append( " " ) ;
+ indentString = sbuf.toString() ;
+ }
+
+ // overridden from PrintWriter
+ public void println()
+ {
+ super.println() ;
+
+ print( indentString ) ;
+ }
+}
diff --git a/make/src/classes/build/tools/logutil/Input.java b/make/src/classes/build/tools/logutil/Input.java
new file mode 100644
index 0000000..62c80a9
--- /dev/null
+++ b/make/src/classes/build/tools/logutil/Input.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.logutil;
+
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStreamReader;
+import java.io.IOException;
+
+import java.util.LinkedList;
+import java.util.Queue;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+public class Input {
+
+ /**
+ * The name of the package this class will inhabit.
+ */
+ private String packageName;
+
+ /**
+ * The name of the generated class.
+ */
+ private String className;
+
+ /**
+ * The name of the group of exceptions handled by the class.
+ */
+ private String groupName;
+
+ /**
+ * The group of exceptions.
+ */
+ private Queue<InputException> exceptions;
+
+ /**
+ * Represents the current state of parsing the input.
+ */
+ private enum State
+ {
+ OUTER,
+ IN_CLASS,
+ IN_EXCEPTION_LIST
+ };
+
+ /**
+ * Regular expression to match each code line.
+ */
+ private static final Pattern EXCEPTION_INFO_REGEX =
+ Pattern.compile("(\\w+)\\s*(\\d+)\\s*(\\w+)");
+
+ /**
+ * Parses the specified file to create a new {@link Input}
+ * object.
+ *
+ * @param filename the file to parse.
+ * @throws FileNotFoundException if the file can't be found.
+ * @throws IOException if an I/O error occurs.
+ */
+ public Input(final String filename)
+ throws FileNotFoundException, IOException {
+ BufferedReader r =
+ new BufferedReader(new InputStreamReader(new FileInputStream(filename)));
+ State state = State.OUTER;
+ InputException current = null;
+ exceptions = new LinkedList<InputException>();
+ String line;
+ while ((line = r.readLine()) != null) {
+ // Skip ; comments
+ if (line.startsWith(";"))
+ continue;
+
+ int index = line.indexOf("(");
+ if (index == -1)
+ continue;
+
+ switch (state) {
+ case OUTER:
+ state = State.IN_CLASS;
+ String[] classInfo = line.substring(index).split(" ");
+ packageName = classInfo[0].substring(2, classInfo[0].length() - 1);
+ className = classInfo[1].substring(1, classInfo[1].length() - 1);
+ groupName = classInfo[2];
+ break;
+ case IN_CLASS:
+ state = State.IN_EXCEPTION_LIST;
+ break;
+ case IN_EXCEPTION_LIST:
+ boolean inQuote = false;
+ boolean inCode = false;
+ boolean end = false;
+ int start = index + 1;
+ Queue<String> lines = new LinkedList<String>();
+ for (int a = start; a < line.length(); ++a) {
+ if (line.charAt(a) == '(' && !inCode && !inQuote) {
+ if (current == null)
+ current =
+ new InputException(line.substring(start, a).trim());
+ start = a + 1;
+ inCode = true;
+ }
+ if (line.charAt(a) == '"')
+ inQuote = !inQuote;
+ if (line.charAt(a) == ')' && !inQuote) {
+ if (inCode) {
+ lines.offer(line.substring(start, a));
+ inCode = false;
+ } else
+ end = true;
+ }
+ if (!end && a == line.length() - 1)
+ line += r.readLine();
+ }
+ for (String l : lines) {
+ int stringStart = l.indexOf("\"") + 1;
+ int stringEnd = l.indexOf("\"", stringStart);
+ Matcher matcher = EXCEPTION_INFO_REGEX.matcher(l.substring(0, stringStart));
+ if (matcher.find())
+ current.add(new InputCode(matcher.group(1),
+ Integer.parseInt(matcher.group(2)),
+ matcher.group(3),
+ l.substring(stringStart, stringEnd)));
+ }
+ exceptions.offer(current);
+ current = null;
+ break;
+ }
+ }
+ }
+
+ /**
+ * Returns the name of this group of exceptions.
+ *
+ * @return the name of this group of exceptions.
+ */
+ public String getGroupName()
+ {
+ return groupName;
+ }
+
+ /**
+ * Returns the name of the package this class will go in.
+ *
+ * @return the name of the package.
+ */
+ public String getPackageName()
+ {
+ return packageName;
+ }
+
+ /**
+ * Returns the name of the generated class.
+ *
+ * @return the name of the class.
+ */
+ public String getClassName()
+ {
+ return className;
+ }
+
+ /**
+ * Returns the exceptions contained in this class.
+ *
+ * @return the exceptions.
+ */
+ public Queue<InputException> getExceptions() {
+ return exceptions;
+ }
+
+ /**
+ * Returns a textual representation of this input.
+ *
+ * @return a textual representation.
+ */
+ public String toString() {
+ return getClass().getName() +
+ "[packageName=" + packageName +
+ ",className=" + className +
+ ",groupName=" + groupName +
+ ",exceptions=" + exceptions +
+ "]";
+ }
+
+}
diff --git a/make/src/classes/build/tools/logutil/InputCode.java b/make/src/classes/build/tools/logutil/InputCode.java
new file mode 100644
index 0000000..b033382
--- /dev/null
+++ b/make/src/classes/build/tools/logutil/InputCode.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package build.tools.logutil;
+
+public class InputCode {
+
+ /**
+ * The name of this code.
+ */
+ private final String name;
+
+ /**
+ * The code.
+ */
+ private final int code;
+
+ /**
+ * The log level for this code.
+ */
+ private final String logLevel;
+
+ /**
+ * The error message for this code.
+ */
+ private final String message;
+
+ /**
+ * Creates a new error code with the specified name, code,
+ * log level and error message.
+ *
+ * @param name the name of the new code.
+ * @param code the code itself.
+ * @param logLevel the level of severity of this error.
+ * @param message the error message for this code.
+ */
+ public InputCode(final String name, final int code,
+ final String logLevel, final String message) {
+ this.name = name;
+ this.code = code;
+ this.logLevel = logLevel;
+ this.message = message;
+ }
+
+ /**
+ * Returns the name of this code.
+ *
+ * @return the name of the code.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the code.
+ *
+ * @return the code.
+ */
+ public int getCode() {
+ return code;
+ }
+
+ /**
+ * Returns the severity of this code.
+ *
+ * @return the log level severity of the code.
+ */
+ public String getLogLevel() {
+ return logLevel;
+ }
+
+ /**
+ * Returns the error message for this code.
+ *
+ * @return the error message for this code.
+ */
+ public String getMessage() {
+ return message;
+ }
+
+ /**
+ * Returns a textual representation of this code.
+ *
+ * @return a textual representation.
+ */
+ public String toString() {
+ return getClass().getName() +
+ "[name=" + name +
+ ",code=" + code +
+ ",logLevel=" + logLevel +
+ ",message=" + message +
+ "]";
+ }
+
+}
diff --git a/make/src/classes/build/tools/logutil/InputException.java b/make/src/classes/build/tools/logutil/InputException.java
new file mode 100644
index 0000000..5b13de2
--- /dev/null
+++ b/make/src/classes/build/tools/logutil/InputException.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package build.tools.logutil;
+
+import java.util.LinkedList;
+import java.util.Queue;
+
+public class InputException {
+
+ /**
+ * The name of this exception.
+ */
+ private final String name;
+
+ /**
+ * The codes associated with this exception.
+ */
+ private final Queue<InputCode> codes;
+
+ /**
+ * Constructs a new {@link InputException} with the
+ * specified name.
+ *
+ * @param name the name of the new exception;
+ */
+ public InputException(final String name) {
+ this.name = name;
+ codes = new LinkedList<InputCode>();
+ }
+
+ /**
+ * Adds a new code to this exception.
+ *
+ * @param c the code to add.
+ */
+ public void add(InputCode c)
+ {
+ codes.offer(c);
+ }
+
+ /**
+ * Returns the name of this exception.
+ *
+ * @return the exception's name.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Returns the codes associated with this exception.
+ *
+ * @return the exception's codes.
+ */
+ public Queue<InputCode> getCodes() {
+ return codes;
+ }
+
+ /**
+ * Returns a textual representation of this exception.
+ *
+ * @return a textual representation.
+ */
+ public String toString() {
+ return getClass().getName()
+ + "[name=" + name
+ + ",codes=" + codes
+ + "]";
+ }
+
+}
diff --git a/make/src/classes/build/tools/logutil/MC.java b/make/src/classes/build/tools/logutil/MC.java
new file mode 100644
index 0000000..c02602e
--- /dev/null
+++ b/make/src/classes/build/tools/logutil/MC.java
@@ -0,0 +1,559 @@
+/*
+ * Copyright (c) 2008, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package build.tools.logutil;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Formatter;
+import java.util.List;
+import java.util.Queue;
+
+public class MC {
+
+ private static final String VERSION = "1.0";
+
+ private static final List<String> SUN_EXCEPTION_GROUPS = Arrays.asList(new String[]
+ { "SUNBASE", "ORBUTIL", "ACTIVATION", "NAMING", "INTERCEPTORS", "POA", "IOR", "UTIL" });
+
+ private static final List<String> EXCEPTIONS = Arrays.asList(new String[]
+ { "UNKNOWN", "BAD_PARAM", "NO_MEMORY", "IMP_LIMIT", "COMM_FAILURE", "INV_OBJREF", "NO_PERMISSION",
+ "INTERNAL", "MARSHAL", "INITIALIZE", "NO_IMPLEMENT", "BAD_TYPECODE", "BAD_OPERATION", "NO_RESOURCES",
+ "NO_RESPONSE", "PERSIST_STORE", "BAD_INV_ORDER", "TRANSIENT", "FREE_MEM", "INV_IDENT", "INV_FLAG",
+ "INTF_REPOS", "BAD_CONTEXT", "OBJ_ADAPTER", "DATA_CONVERSION", "OBJECT_NOT_EXIST", "TRANSACTION_REQUIRED",
+ "TRANSACTION_ROLLEDBACK", "INVALID_TRANSACTION", "INV_POLICY", "CODESET_INCOMPATIBLE", "REBIND",
+ "TIMEOUT", "TRANSACTION_UNAVAILABLE", "BAD_QOS", "INVALID_ACTIVITY", "ACTIVITY_COMPLETED",
+ "ACTIVITY_REQUIRED" });
+
+ /**
+ * Read the minor codes from the input file and
+ * write out a resource file.
+ *
+ * @param inFile the file to read the codes from.
+ * @param outDir the directory to write the resource file to.
+ * @throws FileNotFoundException if the input file can not be found.
+ * @throws IOException if an I/O error occurs.
+ */
+ private void makeResource(String inFile, String outDir)
+ throws FileNotFoundException, IOException {
+ writeResource(outDir, new Input(inFile));
+ }
+
+ /**
+ * Create a new Java source file using the specified Scheme input file,
+ * and writing the result to the given output directory.
+ *
+ * @param inFile the file to read the data from.
+ * @param outDir the directory to write the Java class to.
+ * @throws FileNotFoundException if the input file can not be found.
+ * @throws IOException if an I/O error occurs.
+ */
+ private void makeClass(String inFile, String outDir)
+ throws FileNotFoundException, IOException {
+ writeClass(inFile, outDir, new Input(inFile));
+ }
+
+ /**
+ * Writes out a Java source file using the data from the given
+ * {@link Input} object. The result is written to {@code outDir}.
+ * The name of the input file is just used in the header of the
+ * resulting source file.
+ *
+ * @param inFile the name of the file the data was read from.
+ * @param outDir the directory to write the Java class to.
+ * @param input the parsed input data.
+ * @throws FileNotFoundException if the output file can't be written.
+ */
+ private void writeClass(String inFile, String outDir, Input input)
+ throws FileNotFoundException {
+ String packageName = input.getPackageName();
+ String className = input.getClassName();
+ String groupName = input.getGroupName();
+ Queue<InputException> exceptions = input.getExceptions();
+ FileOutputStream file = new FileOutputStream(outDir + File.separator + className + ".java");
+ IndentingPrintWriter pw = new IndentingPrintWriter(file);
+
+ writeClassHeader(inFile, groupName, pw);
+ pw.printMsg("package @ ;", packageName);
+ pw.println();
+ pw.println("import java.util.logging.Logger ;");
+ pw.println("import java.util.logging.Level ;");
+ pw.println();
+ pw.println("import org.omg.CORBA.OMGVMCID ;");
+ pw.println( "import com.sun.corba.se.impl.util.SUNVMCID ;");
+ pw.println( "import org.omg.CORBA.CompletionStatus ;");
+ pw.println( "import org.omg.CORBA.SystemException ;");
+ pw.println();
+ pw.println( "import com.sun.corba.se.spi.orb.ORB ;");
+ pw.println();
+ pw.println( "import com.sun.corba.se.spi.logging.LogWrapperFactory;");
+ pw.println();
+ pw.println( "import com.sun.corba.se.spi.logging.LogWrapperBase;");
+ pw.println();
+ writeImports(exceptions, pw);
+ pw.println();
+ pw.indent();
+ pw.printMsg("public class @ extends LogWrapperBase {", className);
+ pw.println();
+ pw.printMsg("public @( Logger logger )", className);
+ pw.indent();
+ pw.println( "{");
+ pw.undent();
+ pw.println( "super( logger ) ;");
+ pw.println( "}");
+ pw.println();
+ pw.flush();
+ writeFactoryMethod(className, groupName, pw);
+ writeExceptions(groupName, exceptions, className, pw);
+ pw.undent();
+ pw.println( );
+ pw.println( "}");
+ pw.flush();
+ pw.close();
+ }
+
+ /**
+ * Writes out the header of a Java source file.
+ *
+ * @param inFile the input file the file was generated from.
+ * @param groupName the group of exceptions the Java source file is for.
+ * @param pw the print writer used to write the output.
+ */
+ private void writeClassHeader(String inFile, String groupName,
+ IndentingPrintWriter pw) {
+ if (groupName.equals("OMG"))
+ pw.println("// Log wrapper class for standard exceptions");
+ else
+ pw.printMsg("// Log wrapper class for Sun private system exceptions in group @",
+ groupName);
+ pw.println("//");
+ pw.printMsg("// Generated by MC.java version @, DO NOT EDIT BY HAND!", VERSION);
+ pw.printMsg("// Generated from input file @ on @", inFile, new Date());
+ pw.println();
+ }
+
+ /**
+ * Write out the import list for the exceptions.
+ *
+ * @param groups the exceptions that were parsed.
+ * @param pw the {@link IndentingPrintWriter} for writing to the file.
+ */
+ private void writeImports(Queue<InputException> exceptions,
+ IndentingPrintWriter pw) {
+ if (exceptions == null)
+ return;
+ for (InputException e : exceptions)
+ pw.println("import org.omg.CORBA." + e.getName() + " ;");
+ }
+
+ /**
+ * Write out the factory method for this group of exceptions.
+ *
+ * @param className the name of the generated class.
+ * @param groupName the name of this group of exceptions.
+ * @param pw the {@link IndentingPrintWriter} for writing to the file.
+ */
+ private void writeFactoryMethod(String className, String groupName,
+ IndentingPrintWriter pw) {
+ pw.indent();
+ pw.println( "private static LogWrapperFactory factory = new LogWrapperFactory() {");
+ pw.println( "public LogWrapperBase create( Logger logger )" );
+ pw.indent();
+ pw.println( "{");
+ pw.undent();
+ pw.printMsg("return new @( logger ) ;", className);
+ pw.undent();
+ pw.println( "}" );
+ pw.println( "} ;" );
+ pw.println();
+ pw.printMsg("public static @ get( ORB orb, String logDomain )", className);
+ pw.indent();
+ pw.println( "{");
+ pw.indent();
+ pw.printMsg( "@ wrapper = ", className);
+ pw.indent();
+ pw.printMsg( "(@) orb.getLogWrapper( logDomain, ", className);
+ pw.undent();
+ pw.undent();
+ pw.printMsg( "\"@\", factory ) ;", groupName);
+ pw.undent();
+ pw.println( "return wrapper ;" );
+ pw.println( "} " );
+ pw.println();
+ pw.printMsg( "public static @ get( String logDomain )", className);
+ pw.indent();
+ pw.println( "{");
+ pw.indent();
+ pw.printMsg( "@ wrapper = ", className);
+ pw.indent();
+ pw.printMsg( "(@) ORB.staticGetLogWrapper( logDomain, ", className);
+ pw.undent();
+ pw.undent();
+ pw.printMsg( "\"@\", factory ) ;", groupName);
+ pw.undent();
+ pw.println( "return wrapper ;" );
+ pw.println( "} " );
+ pw.println();
+ }
+
+ /**
+ * Writes out the exceptions themselves.
+ *
+ * @param groupName the name of this group of exceptions.
+ * @param exceptions the exceptions to write out.
+ * @param className the name of the generated class.
+ * @param pw the {@link IndentingPrintWriter} for writing to the file.
+ */
+ private void writeExceptions(String groupName, Queue<InputException> exceptions,
+ String className, IndentingPrintWriter pw) {
+ for (InputException e : exceptions) {
+ pw.println("///////////////////////////////////////////////////////////");
+ pw.printMsg("// @", e.getName());
+ pw.println("///////////////////////////////////////////////////////////");
+ pw.println();
+ for (InputCode c : e.getCodes())
+ writeMethods(groupName, e.getName(), c.getName(), c.getCode(),
+ c.getLogLevel(), className, StringUtil.countArgs(c.getMessage()), pw);
+ pw.flush();
+ }
+ }
+
+ /**
+ * Writes out the methods for a particular error.
+ *
+ * @param groupName the name of this group of exceptions.
+ * @param exceptionName the name of this particular exception.
+ * @param errorName the name of this particular error.
+ * @param code the minor code for this particular error.
+ * @param ident the name of the error in mixed-case identifier form.
+ * @param level the level at which to place log messages.
+ * @param className the name of the class for this group of exceptions.
+ * @param numParams the number of parameters the detail message takes.
+ * @param pw the print writer for writing to the file.
+ */
+ private void writeMethods(String groupName, String exceptionName, String errorName,
+ int code, String level, String className, int numParams,
+ IndentingPrintWriter pw) {
+ String ident = StringUtil.toMixedCase(errorName);
+ pw.printMsg("public static final int @ = @ ;", errorName, getBase(groupName, code));
+ pw.println();
+ pw.flush();
+ writeMethodStatusCause(groupName, exceptionName, errorName, ident, level,
+ numParams, className, pw);
+ pw.println();
+ pw.flush();
+ writeMethodStatus(exceptionName, ident, numParams, pw);
+ pw.println();
+ pw.flush();
+ writeMethodCause(exceptionName, ident, numParams, pw);
+ pw.println();
+ pw.flush();
+ writeMethodNoArgs(exceptionName, ident, numParams, pw);
+ pw.println();
+ pw.flush();
+ }
+
+ /**
+ * Writes out a method for an error that takes a
+ * {@link org.omg.CORBA.CompletionStatus} and a cause.
+ *
+ * @param groupName the name of this group of exceptions.
+ * @param exceptionName the name of this particular exception.
+ * @param errorName the name of this particular error.
+ * @param ident the name of the error in mixed-case identifier form.
+ * @param logLevel the level at which to place log messages.
+ * @param numParams the number of parameters the detail message takes.
+ * @param className the name of the class for this group of exceptions.
+ * @param pw the print writer for writing to the file.
+ */
+ private void writeMethodStatusCause(String groupName, String exceptionName,
+ String errorName, String ident,
+ String logLevel, int numParams,
+ String className, IndentingPrintWriter pw) {
+ pw.indent();
+ pw.printMsg( "public @ @( CompletionStatus cs, Throwable t@) {", exceptionName,
+ ident, makeDeclArgs(true, numParams));
+ pw.printMsg( "@ exc = new @( @, cs ) ;", exceptionName, exceptionName, errorName);
+ pw.indent();
+ pw.println( "if (t != null)" );
+ pw.undent();
+ pw.println( "exc.initCause( t ) ;" );
+ pw.println();
+ pw.indent();
+ pw.printMsg( "if (logger.isLoggable( Level.@ )) {", logLevel);
+ if (numParams > 0) {
+ pw.printMsg( "Object[] parameters = new Object[@] ;", numParams);
+ for (int a = 0; a < numParams; ++a)
+ pw.printMsg("parameters[@] = arg@ ;", a, a);
+ } else
+ pw.println( "Object[] parameters = null ;");
+ pw.indent();
+ pw.printMsg( "doLog( Level.@, \"@.@\",", logLevel, groupName, ident);
+ pw.undent();
+ pw.undent();
+ pw.printMsg( "parameters, @.class, exc ) ;", className);
+ pw.println( "}");
+ pw.println();
+
+ pw.undent();
+ pw.println( "return exc ;");
+ pw.println( "}");
+ }
+
+ /**
+ * Writes out a method for an error that takes a
+ * {@link org.omg.CORBA.CompletionStatus}.
+ *
+ * @param exceptionName the name of this particular exception.
+ * @param ident the name of the error in mixed-case identifier form.
+ * @param numParams the number of parameters the detail message takes.
+ * @param pw the print writer for writing to the file.
+ */
+ private void writeMethodStatus(String exceptionName, String ident,
+ int numParams, IndentingPrintWriter pw) {
+ pw.indent();
+ pw.printMsg("public @ @( CompletionStatus cs@) {", exceptionName,
+ ident, makeDeclArgs(true, numParams));
+ pw.undent();
+ pw.printMsg("return @( cs, null@ ) ;", ident, makeCallArgs(true, numParams));
+ pw.println("}");
+ }
+
+ /**
+ * Writes out a method for an error that takes a cause.
+ *
+ * @param exceptionName the name of this particular exception.
+ * @param ident the name of the error in mixed-case identifier form.
+ * @param numParams the number of parameters the detail message takes.
+ * @param pw the print writer for writing to the file.
+ */
+ private void writeMethodCause(String exceptionName, String ident,
+ int numParams, IndentingPrintWriter pw) {
+ pw.indent();
+ pw.printMsg("public @ @( Throwable t@) {", exceptionName, ident,
+ makeDeclArgs(true, numParams));
+ pw.undent();
+ pw.printMsg("return @( CompletionStatus.COMPLETED_NO, t@ ) ;", ident,
+ makeCallArgs(true, numParams));
+ pw.println("}");
+ }
+
+ /**
+ * Writes out a method for an error that takes no arguments.
+ *
+ * @param exceptionName the name of this particular exception.
+ * @param ident the name of the error in mixed-case identifier form.
+ * @param numParams the number of parameters the detail message takes.
+ * @param pw the print writer for writing to the file.
+ */
+ private void writeMethodNoArgs(String exceptionName, String ident,
+ int numParams, IndentingPrintWriter pw) {
+
+ pw.indent();
+ pw.printMsg("public @ @( @) {", exceptionName, ident,
+ makeDeclArgs(false, numParams));
+ pw.undent();
+ pw.printMsg("return @( CompletionStatus.COMPLETED_NO, null@ ) ;",
+ ident, makeCallArgs(true, numParams));
+ pw.println("}");
+ }
+
+ /**
+ * Returns a list of comma-separated arguments with type declarations.
+ *
+ * @param leadingComma true if the list should start with a comma.
+ * @param numArgs the number of arguments to generate.
+ * @return the generated string.
+ */
+ private String makeDeclArgs(boolean leadingComma, int numArgs) {
+ return makeArgString("Object arg", leadingComma, numArgs);
+ }
+
+ /**
+ * Returns a list of comma-separated arguments without type declarations.
+ *
+ * @param leadingComma true if the list should start with a comma.
+ * @param numArgs the number of arguments to generate.
+ * @return the generated string.
+ */
+ private String makeCallArgs(boolean leadingComma, int numArgs) {
+ return makeArgString("arg", leadingComma, numArgs);
+ }
+
+ /**
+ * Returns a list of comma-separated arguments.
+ *
+ * @param prefixString the string with which to prefix each argument.
+ * @param leadingComma true if the list should start with a comma.
+ * @param numArgs the number of arguments to generate.
+ * @return the generated string.
+ */
+ private String makeArgString(String prefixString, boolean leadingComma,
+ int numArgs) {
+ if (numArgs == 0)
+ return " ";
+ if (numArgs == 1) {
+ if (leadingComma)
+ return ", " + prefixString + (numArgs - 1);
+ else
+ return " " + prefixString + (numArgs - 1);
+ }
+ return makeArgString(prefixString, leadingComma, numArgs - 1) +
+ ", " + prefixString + (numArgs - 1);
+ }
+
+ /**
+ * Returns the {@link String} containing the calculation of the
+ * error code.
+ *
+ * @param groupName the group of exception to which the code belongs.
+ * @param code the minor code number representing the exception within the group.
+ * @return the unique error code.
+ */
+ private String getBase(String groupName, int code) {
+ if (groupName.equals("OMG"))
+ return "OMGVMCID.value + " + code;
+ else
+ return "SUNVMCID.value + " + (code + getSunBaseNumber(groupName));
+ }
+
+ /**
+ * Returns the base number for Sun-specific exceptions.
+ *
+ * @return the base number.
+ */
+ private int getSunBaseNumber(String groupName) {
+ return 200 * SUN_EXCEPTION_GROUPS.indexOf(groupName);
+ }
+
+ /**
+ * Writes out a resource file using the data from the given
+ * {@link Input} object. The result is written to {@code outDir}.
+ *
+ * @param outDir the directory to write the Java class to.
+ * @param input the parsed input data.
+ * @throws FileNotFoundException if the output file can't be written.
+ */
+ private void writeResource(String outDir, Input input)
+ throws FileNotFoundException {
+ FileOutputStream file = new FileOutputStream(outDir + File.separator +
+ input.getClassName() + ".resource");
+ IndentingPrintWriter pw = new IndentingPrintWriter(file);
+ String groupName = input.getGroupName();
+ for (InputException e : input.getExceptions()) {
+ String exName = e.getName();
+ for (InputCode c : e.getCodes()) {
+ String ident = StringUtil.toMixedCase(c.getName());
+ pw.printMsg("@.@=\"@: (@) @\"", groupName, ident,
+ getMessageID(groupName, exName, c.getCode()), exName, c.getMessage());
+ }
+ pw.flush();
+ }
+ pw.close();
+ }
+
+ /**
+ * Returns the message ID corresponding to the given group name,
+ * exception name and error code.
+ *
+ * @param groupName the name of the group of exceptions.
+ * @param exception the name of the particular exception.
+ * @param code an error code from the given exception.
+ * @return the message ID.
+ */
+ private String getMessageID(String groupName, String exceptionName, int code) {
+ if (groupName.equals("OMG"))
+ return getStandardMessageID(exceptionName, code);
+ else
+ return getSunMessageID(groupName, exceptionName, code);
+ }
+
+ /**
+ * Returns the standard (OMG) message ID corresponding to the given
+ * exception name and error code.
+ *
+ * @param exceptionName the name of the particular exception.
+ * @param code an error code from the given exception.
+ * @return the message ID.
+ */
+ private String getStandardMessageID(String exceptionName, int code) {
+ return new Formatter().format("IOP%s0%04d", getExceptionID(exceptionName),
+ code).toString();
+ }
+
+ /**
+ * Returns the Sun message ID corresponding to the given group name,
+ * exception name and error code.
+ *
+ * @param groupName the name of the group of exceptions.
+ * @param exceptionName the name of the particular exception.
+ * @param code an error code from the given exception.
+ * @return the message ID.
+ */
+ private String getSunMessageID(String groupName, String exceptionName, int code) {
+ return new Formatter().format("IOP%s1%04d", getExceptionID(exceptionName),
+ getSunBaseNumber(groupName) + code).toString();
+ }
+
+ /**
+ * Returns the exception ID corresponding to the given exception name.
+ *
+ * @param exceptionName the name of the particular exception.
+ * @return the message ID.
+ */
+ private String getExceptionID(String exceptionName) {
+ return new Formatter().format("%03d", EXCEPTIONS.indexOf(exceptionName)).toString();
+ }
+
+ /**
+ * Entry point for running the generator from the command
+ * line. Users can specify either "make-class" or "make-resource"
+ * as the first argument to generate the specified type of file.
+ *
+ * @param args the command-line arguments.
+ * @throws FileNotFoundException if the input file can not be found.
+ * @throws IOException if an I/O error occurs.
+ */
+ public static void main(String[] args)
+ throws FileNotFoundException, IOException
+ {
+ if (args.length < 3)
+ {
+ System.err.println("(make-class|make-resource) <input file> <output dir>");
+ System.exit(-1);
+ }
+ if (args[0].equals("make-class"))
+ new MC().makeClass(args[1], args[2]);
+ else if (args[0].equals("make-resource"))
+ new MC().makeResource(args[1], args[2]);
+ else
+ System.err.println("Invalid command: " + args[0]);
+ }
+
+}
diff --git a/make/src/classes/build/tools/logutil/StringUtil.java b/make/src/classes/build/tools/logutil/StringUtil.java
new file mode 100644
index 0000000..c560235
--- /dev/null
+++ b/make/src/classes/build/tools/logutil/StringUtil.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package build.tools.logutil;
+
+public abstract class StringUtil {
+ /** Take a string containing underscores, and return a string
+ * with the underscore removed, and all characters exception in lower
+ * case except the characters after the underscores.
+ */
+ public static String toMixedCase( String str )
+ {
+ StringBuffer sbuf = new StringBuffer( str.length() ) ;
+ boolean uppercaseNext = false ;
+ for (int ctr=0; ctr<str.length(); ctr++) {
+ char ch = str.charAt( ctr ) ;
+
+ if (ch == '_') {
+ uppercaseNext = true ;
+ } else if (uppercaseNext) {
+ sbuf.append( Character.toUpperCase( ch ) ) ;
+ uppercaseNext = false ;
+ } else {
+ sbuf.append( Character.toLowerCase( ch ) ) ;
+ }
+ }
+
+ return sbuf.toString() ;
+ }
+
+ public static int countArgs( String str )
+ {
+ int result = 0 ;
+ for( int ctr = 0; ctr<str.length(); ctr++ )
+ if (str.charAt(ctr) == '{')
+ result++ ;
+
+ return result ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/GiopIDL/GIOP.idl b/src/java.corba/share/classes/com/sun/corba/se/GiopIDL/GIOP.idl
new file mode 100644
index 0000000..7f2d54f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/GiopIDL/GIOP.idl
@@ -0,0 +1,224 @@
+/*
+ * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "IOP.idl"
+
+module GIOP { // IDL extended for version 1.1 and 1.2
+
+ struct Version {
+ octet major;
+ octet minor;
+ };
+
+
+ // GIOP 1.0
+
+ struct MessageHeader_1_0 { // Renamed from MessageHeader
+ char magic [4];
+ Version GIOP_version;
+ boolean byte_order;
+ octet message_type;
+ unsigned long message_size;
+ };
+
+ // GIOP 1.1
+
+ struct MessageHeader_1_1 {
+ char magic [4];
+ Version GIOP_version;
+ octet flags; // GIOP 1.1 change
+ octet message_type;
+ unsigned long message_size;
+ };
+
+ // GIOP 1.2
+ // Same Header contents for 1.1 and 1.2
+ typedef MessageHeader_1_1 MessageHeader_1_2;
+
+
+ // GIOP 1.0
+ struct RequestHeader_1_0 { // Renamed from RequestHeader
+ IOP::ServiceContextList service_context;
+ unsigned long request_id;
+ boolean response_expected;
+ sequence<octet> object_key;
+ string operation;
+ sequence<octet> requesting_principal;
+ };
+
+ // GIOP 1.1
+ struct RequestHeader_1_1 {
+ IOP::ServiceContextList service_context;
+ unsigned long request_id;
+ boolean response_expected;
+ octet reserved[3]; // Added in GIOP 1.1
+ sequence <octet> object_key;
+ string operation;
+ sequence<octet> requesting_principal;
+ };
+
+ // GIOP 1.2
+ typedef short AddressingDisposition;
+ const short KeyAddr = 0;
+ const short ProfileAddr = 1;
+ const short ReferenceAddr = 2;
+ struct IORAddressingInfo {
+ unsigned long selected_profile_index;
+ IOP::IOR ior;
+ };
+ union TargetAddress switch (AddressingDisposition) {
+ case KeyAddr: sequence <octet> object_key;
+ case ProfileAddr: IOP::TaggedProfile profile;
+ case ReferenceAddr: IORAddressingInfo ior;
+ };
+ struct RequestHeader_1_2 {
+ unsigned long request_id;
+ octet response_flags;
+ octet reserved[3];
+ TargetAddress target;
+ string operation;
+ IOP::ServiceContextList service_context;
+ // Principal not in GIOP 1.2
+ };
+
+
+ #ifndef GIOP_1_2 //We're supporting all versions
+
+ // GIOP 1.0 and 1.1
+ enum ReplyStatusType_1_0 { // Renamed from ReplyStatusType
+ NO_EXCEPTION,
+ USER_EXCEPTION,
+ SYSTEM_EXCEPTION,
+ LOCATION_FORWARD
+ };
+
+ // GIOP 1.0
+ struct ReplyHeader_1_0 { // Renamed from ReplyHeader
+ IOP::ServiceContextList service_context;
+ unsigned long request_id;
+ ReplyStatusType_1_0 reply_status;
+ };
+
+ // GIOP 1.1
+ // Same Header contents for 1.0 and 1.1
+ typedef ReplyHeader_1_0 ReplyHeader_1_1;
+
+ #else
+
+ // GIOP 1.2
+ enum ReplyStatusType_1_2 {
+ NO_EXCEPTION,
+ USER_EXCEPTION,
+ SYSTEM_EXCEPTION,
+ LOCATION_FORWARD,
+ LOCATION_FORWARD_PERM,// new value for 1.2
+ NEEDS_ADDRESSING_MODE // new value for 1.2
+ };
+
+ struct ReplyHeader_1_2 {
+ unsigned long request_id;
+ ReplyStatusType_1_2 reply_status;
+ IOP::ServiceContextList service_context;
+ };
+
+ #endif // GIOP_1_2
+
+
+ struct SystemExceptionReplyBody {
+ string exception_id;
+ unsigned long minor_code_value;
+ unsigned long completion_status;
+ };
+
+
+
+ struct CancelRequestHeader {
+ unsigned long request_id;
+ };
+
+
+
+ // GIOP 1.0
+ struct LocateRequestHeader_1_0 { // Renamed LocationRequestHeader
+ unsigned long request_id;
+ sequence <octet> object_key;
+ };
+
+ // GIOP 1.1
+ // Same Header contents for 1.0 and 1.1
+ typedef LocateRequestHeader_1_0 LocateRequestHeader_1_1;
+
+ // GIOP 1.2
+ struct LocateRequestHeader_1_2 {
+ unsigned long request_id;
+ TargetAddress target;
+ };
+
+
+ #ifndef GIOP_1_2 // We're supporting all versions
+
+ // GIOP 1.0 and 1.1
+ enum LocateStatusType_1_0 { // Renamed from LocateStatusType
+ UNKNOWN_OBJECT,
+ OBJECT_HERE,
+ OBJECT_FORWARD
+ };
+
+
+ // GIOP 1.0
+ struct LocateReplyHeader_1_0 { // Renamed from LocateReplyHeader
+ unsigned long request_id;
+ LocateStatusType_1_0 locate_status;
+ };
+
+ // GIOP 1.1
+ // same Header contents for 1.0 and 1.1
+ typedef LocateReplyHeader_1_0 LocateReplyHeader_1_1;
+
+ #else
+
+ // GIOP 1.2
+ enum LocateStatusType_1_2 {
+ UNKNOWN_OBJECT,
+ OBJECT_HERE,
+ OBJECT_FORWARD,
+ OBJECT_FORWARD_PERM, // new value for GIOP 1.2
+ LOC_SYSTEM_EXCEPTION, // new value for GIOP 1.2
+ LOC_NEEDS_ADDRESSING_MODE // new value for GIOP 1.2
+ };
+
+ struct LocateReplyHeader_1_2 {
+ unsigned long request_id;
+ LocateStatusType_1_2 locate_status;
+ };
+
+ #endif // GIOP_1_2
+
+
+ // GIOP 1.2
+ struct FragmentHeader_1_2 {
+ unsigned long request_id;
+ };
+};
diff --git a/src/java.corba/share/classes/com/sun/corba/se/GiopIDL/messages.idl b/src/java.corba/share/classes/com/sun/corba/se/GiopIDL/messages.idl
new file mode 100644
index 0000000..c9b0ddf
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/GiopIDL/messages.idl
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * @(#)GIOP.idl 1.0 00/05/21
+ *
+ */
+
+#include "IOP.idl"
+
+module messages {
+
+ typedef short AddressingDisposition;
+ const short KeyAddr = 0;
+ const short ProfileAddr = 1;
+ const short ReferenceAddr = 2;
+ struct IORAddressingInfo {
+ unsigned long selected_profile_index;
+ IOP::IOR ior;
+ };
+ union TargetAddress switch (AddressingDisposition) {
+ case KeyAddr: sequence <octet> object_key;
+ case ProfileAddr: IOP::TaggedProfile profile;
+ case ReferenceAddr: IORAddressingInfo ior;
+ };
+};
diff --git a/src/java.corba/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl b/src/java.corba/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl
new file mode 100644
index 0000000..9ca22d7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/PortableActivationIDL/activation.idl
@@ -0,0 +1,408 @@
+/*
+ * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "Interceptors.idl"
+
+module PortableActivationIDL {
+ /** Possible values for endpointType argument on Server.getEndpoint()
+ * If you change the value of this constant then update
+ * core.EndPoint accordingly. It has a duplicate definition
+ * to avoid a compilation dependency.
+ */
+ const string IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT";
+
+ /** Raised if getEndpoint is called on a server callback object for
+ * an invalid endpoint type
+ */
+ exception NoSuchEndPoint {} ;
+
+ /** Raised if an attempt is made to retrieve ports corresponding to
+ * non-registered ORB
+ */
+ exception InvalidORBid {} ;
+
+ /** Raised if an operation is attempted against an invalid server ID.
+ */
+ exception ServerNotRegistered {
+ PortableInterceptor::ServerId serverId ;
+ };
+
+ /** Raised if an operation is attempted for a server that is not running,
+ * and the server is required to be running for the operation.
+ */
+ exception ServerNotActive {
+ PortableInterceptor::ServerId serverId ;
+ };
+
+ /** Raised if an operation is attempted against a server that is in a
+ * hold down state. A server becomes held down if it fails to activate
+ * within 10 seconds.
+ */
+ exception ServerHeldDown {
+ PortableInterceptor::ServerId serverId ;
+ };
+
+ /** Raised if an attempt is made to activate a server that is already
+ * running.
+ */
+ exception ServerAlreadyActive{
+ PortableInterceptor::ServerId serverId ;
+ };
+
+ /** Raised if an attempt is made to register a serverdef with the
+ * same applicationName as an existing serverdef.
+ */
+ exception ServerAlreadyRegistered {
+ PortableInterceptor::ServerId serverId;
+ };
+
+ /** Raised if an attempt is made to install a server that is currently
+ * installed. Note that a newly created server starts out in an uninstalled
+ * state.
+ */
+ exception ServerAlreadyInstalled {
+ PortableInterceptor::ServerId serverId;
+ } ;
+
+ /** Raised if an attempt is made to uninstall a server that is currently
+ * uninstalled. Note that a newly created server starts out in an
+ * uninstalled
+ * state.
+ */
+ exception ServerAlreadyUninstalled {
+ PortableInterceptor::ServerId serverId;
+ } ;
+
+ /** Raised if an attempt is made to register an invalid serverdef.
+ */
+ exception BadServerDefinition {
+ string reason;
+ };
+
+ /** Raised if an attempt is made to register endpoints for the
+ * same ORB again
+ */
+ exception ORBAlreadyRegistered {
+ PortableInterceptor::ORBId orbId;
+ };
+
+ /** Type of TCP port number, used in structures that describe
+ * transport endpoints. The valid range is actually 0-65535, but
+ * we use a long here to avoid signed/unsigned conversion headaches
+ * in Java.
+ */
+ typedef long TCPPort ;
+
+ /** Sequence of server Ids, used for queries about servers.
+ */
+ typedef sequence<PortableInterceptor::ServerId> ServerIds;
+
+ /** End point information for one particular kind of port associated with an
+ * an ORB. This is only used in the
+ * Activator interface, which must always run on the same host as the daemon,
+ * therefore we do not need the host name here.
+ */
+ struct EndPointInfo {
+ string endpointType;
+ TCPPort port;
+ };
+
+ /** A list of endpoint information for a particular ORB.
+ */
+ typedef sequence<EndPointInfo> EndpointInfoList;
+
+ /** struct contain ORB and port info for a particular type of endpoint.
+ * This is only used in the
+ * Activator interface, which must always run on the same host as the daemon,
+ * therefore we do not need the host name here.
+ */
+ struct ORBPortInfo {
+ PortableInterceptor::ORBId orbId;
+ TCPPort port;
+ };
+
+ /** A list of ORB and port information for a particular endpoint type.
+ */
+ typedef sequence<ORBPortInfo> ORBPortInfoList;
+
+ /** A list of ORB IDs.
+ */
+ typedef sequence<PortableInterceptor::ORBId> ORBidList;
+
+ /** Server callback interface, passed to Activator in registerServer method.
+ */
+ interface ServerProxy {
+ /** Shutdown this server. Returns after orb.shutdown() completes.
+ */
+ void shutdown();
+
+ /** Install the server. Returns after the install hook completes
+ * execution in the server.
+ */
+ void install();
+
+ /** Uninstall the server. Returns after the uninstall hook
+ * completes execution.
+ */
+ void uninstall();
+ };
+
+ /** ORB callback interface, passed to Activator in registerORB method.
+ */
+ interface ORBProxy {
+ /** Method used to cause ORB to activate the named adapter, if possible.
+ * This will cause the named POA to register itself with the activator as
+ * a side effect. This should always happen before this call can complete.
+ * This method returns true if adapter activation succeeded, otherwise it
+ * returns false.
+ */
+ boolean activate_adapter( in PortableInterceptor::AdapterName name ) ;
+ } ;
+
+ interface Activator {
+ /*******************************************************
+ * Server State Change Methods
+ ********************************************************/
+
+ /** A new ORB started server registers itself with the Activator
+ */
+ void registerServer(in PortableInterceptor::ServerId serverId, in ServerProxy serverObj)
+ raises (ServerNotRegistered);
+
+ /** A server is shutting down that was started by this activator.
+ * Complete termination of the server is detected by the death of the
+ * process implementing the server.
+ */
+ void serverGoingDown( in PortableInterceptor::ServerId serverId ) ;
+
+ /** Called whenever an ORB instance is created. This registers
+ * the transport endpoints and the ORB proxy callback object.
+ * Note that we cannot detect when an ORB shuts down, although
+ * all of the POA shutdowns should still be reported.
+ */
+ void registerORB( in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
+ in ORBProxy orb, in EndpointInfoList endPointInfo)
+ raises (ServerNotRegistered,NoSuchEndPoint, ORBAlreadyRegistered) ;
+
+ /** Construct or find an ORBD object template corresponding to the
+ * server's object template and return it. Called whenever a
+ * persistent POA is created.
+ */
+ PortableInterceptor::ObjectReferenceTemplate registerPOA(
+ in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
+ in PortableInterceptor::ObjectReferenceTemplate poaTemplate ) ;
+
+ /** Called whenever a POA is destroyed.
+ */
+ void poaDestroyed(
+ in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
+ in PortableInterceptor::ObjectReferenceTemplate poaTemplate ) ;
+
+ /*******************************************************
+ * Server Control Methods
+ ********************************************************/
+
+ /** If the server is not running, start it up. This is allowed
+ * whether or not the server has been installed.
+ */
+ void activate(in PortableInterceptor::ServerId serverId)
+ raises (ServerAlreadyActive, ServerNotRegistered, ServerHeldDown);
+
+ /** If the server is running, shut it down
+ */
+ void shutdown(in PortableInterceptor::ServerId serverId)
+ raises (ServerNotActive, ServerNotRegistered);
+
+ /** Invoke the server install hook. If the server is not
+ * currently running, this method will activate it.
+ */
+ void install(in PortableInterceptor::ServerId serverId)
+ raises (ServerNotRegistered, ServerHeldDown,
+ ServerAlreadyInstalled);
+
+ /** Invoke the server uninstall hook. If the server is not
+ * currently running, this method will activate it.
+ * After this hook completes, the server may still be running.
+ */
+ void uninstall(in PortableInterceptor::ServerId serverId)
+ raises (ServerNotRegistered, ServerHeldDown,
+ ServerAlreadyUninstalled);
+
+ /*******************************************************
+ * Accessors
+ ********************************************************/
+
+ /** list active servers
+ */
+ ServerIds getActiveServers();
+
+ /** list all registered ORBs for a server
+ */
+ ORBidList getORBNames(in PortableInterceptor::ServerId serverId)
+ raises (ServerNotRegistered);
+
+ /** Find the server template that corresponds to the ORBD's
+ * adapter id.
+ */
+ PortableInterceptor::ObjectReferenceTemplate lookupPOATemplate(
+ in PortableInterceptor::ServerId serverId, in PortableInterceptor::ORBId orbId,
+ in PortableInterceptor::AdapterName orbAdapterName ) ;
+ };
+
+ interface Locator {
+ /** struct to return the list of endpoints for a server for a specific
+ * endpoint type.
+ */
+ struct ServerLocationPerType {
+ string hostname;
+ ORBPortInfoList ports;
+ };
+
+ /** struct to return the list of endpoints for a server for a specific
+ * ORB
+ */
+ struct ServerLocationPerORB {
+ string hostname;
+ EndpointInfoList ports;
+ };
+
+ /** locate server - returns the port with a specific type for all registered
+ * ORBs of an active server.
+ * Starts the server if it is not already running.
+ */
+ ServerLocationPerType locateServer(
+ in PortableInterceptor::ServerId serverId,
+ in string endPoint)
+ raises(NoSuchEndPoint, ServerNotRegistered, ServerHeldDown);
+
+ /** locate server - returns all ports registered with a specified ORB for
+ * an active server
+ * Starts the server if it is not already running.
+ */
+ ServerLocationPerORB locateServerForORB(
+ in PortableInterceptor::ServerId serverId,
+ in PortableInterceptor::ORBId orbId)
+ raises(InvalidORBid, ServerNotRegistered, ServerHeldDown);
+
+ /** get the port for the endpoint of the locator
+ */
+ TCPPort getEndpoint(in string endPointType)
+ raises(NoSuchEndPoint);
+
+ /** Useful from external BadServerIdHandlers which need
+ * to pick a particular port type.
+ */
+ TCPPort getServerPortForType(
+ in ServerLocationPerORB location,
+ in string endPointType)
+ raises(NoSuchEndPoint);
+ };
+
+ /** Interface used to combine the Activator and Locator when both are
+ * implemented together in the same process, as is currently the case
+ * for our implementation.
+ */
+ interface ServerManager : Activator, Locator { };
+
+ /** Interface used to support binding references in the bootstrap name
+ * service.
+ */
+ interface InitialNameService {
+ exception NameAlreadyBound {};
+
+ /** bind initial name
+ */
+ void bind (
+ in string name,
+ in Object obj,
+ in boolean isPersistant) raises (NameAlreadyBound);
+ };
+
+ interface Repository {
+ /** server program definition.
+ */
+ struct ServerDef {
+ string applicationName; // alias used for servers with identical
+ // serverName values.
+ string serverName; // Class name of server's main class.
+ string serverClassPath; // class path used to run the server.
+ string serverArgs; // arguments passed to the server
+ string serverVmArgs; // arguments passed to the server's Java VM1
+ boolean isInstalled; // Whether or not the server has been installed
+ };
+
+ /** register server definition.
+ * This returns the serverId of the server. A newly created server is
+ * always uninstalled.
+ */
+ PortableInterceptor::ServerId registerServer (in ServerDef serverDef)
+ raises (ServerAlreadyRegistered, BadServerDefinition);
+
+ /** unregister server definition
+ */
+ void unregisterServer (in PortableInterceptor::ServerId serverId)
+ raises (ServerNotRegistered);
+
+ /** get server definition
+ */
+ ServerDef getServer(in PortableInterceptor::ServerId serverId)
+ raises (ServerNotRegistered);
+
+ /** Return whether the server has been installed
+ */
+ boolean isInstalled( in PortableInterceptor::ServerId serverId )
+ raises (ServerNotRegistered);
+
+ /** Mark the server as being installed. Raises ServerAlreadyInstalled
+ * if the server is currently marked as installed.
+ */
+ void install( in PortableInterceptor::ServerId serverId )
+ raises (ServerNotRegistered, ServerAlreadyInstalled) ;
+
+ /** Mark the server as being uninstalled. Raises ServerAlreadyUninstalled
+ * if the server is currently marked as uninstalled.
+ */
+ void uninstall( in PortableInterceptor::ServerId serverId )
+ raises (ServerNotRegistered, ServerAlreadyUninstalled) ;
+
+ /** list registered servers
+ */
+ ServerIds listRegisteredServers ();
+
+ /** Type used for a list of application names
+ */
+ typedef sequence<string> AppNames ;
+
+ /** Returns list of ALL applicationNames defined in ServerDefs of registered
+ * servers.
+ */
+ AppNames getApplicationNames();
+
+ /** Find the ServerID associated with the given application name.
+ */
+ PortableInterceptor::ServerId getServerID( in string applicationName )
+ raises (ServerNotRegistered) ;
+ };
+};
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/activation/CommandHandler.java b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/CommandHandler.java
new file mode 100644
index 0000000..d307a0f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/CommandHandler.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.activation;
+
+import org.omg.CORBA.ORB;
+
+import java.io.PrintStream;
+
+/**
+ * @author Rohit Garg
+ * @since JDK1.2
+ */
+
+public interface CommandHandler
+{
+ String getCommandName();
+
+ public final static boolean shortHelp = true;
+ public final static boolean longHelp = false;
+
+ void printCommandHelp(PrintStream out, boolean helpType);
+
+ public final static boolean parseError = true;
+ public final static boolean commandDone = false;
+
+ boolean processCommand(String[] cmd, ORB orb, PrintStream out);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/activation/NameServiceStartThread.java b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/NameServiceStartThread.java
new file mode 100644
index 0000000..d4d2cf4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/NameServiceStartThread.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.activation;
+
+
+import java.io.File;
+
+import org.omg.CosNaming.NamingContext;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.impl.naming.pcosnaming.NameService;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+// REVISIT: After Merlin to see if we can get rid of this Thread and
+// make the registration of PNameService for INS and BootStrap neat.
+public class NameServiceStartThread extends java.lang.Thread
+{
+ private ORB orb;
+ private File dbDir;
+
+ public NameServiceStartThread( ORB theOrb, File theDir )
+ {
+ orb = theOrb;
+ dbDir = theDir;
+ }
+
+ public void run( )
+ {
+ try {
+ // start Name Service
+ NameService nameService = new NameService(orb, dbDir );
+ NamingContext rootContext = nameService.initialNamingContext();
+ orb.register_initial_reference(
+ ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext );
+ } catch( Exception e ) {
+ System.err.println(
+ "NameService did not start successfully" );
+ e.printStackTrace( );
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ORBD.java b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ORBD.java
new file mode 100644
index 0000000..6a3fd5c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ORBD.java
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.activation;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CosNaming.NamingContext;
+import org.omg.PortableServer.POA;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+
+import com.sun.corba.se.spi.activation.Repository;
+import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
+import com.sun.corba.se.spi.activation.Locator;
+import com.sun.corba.se.spi.activation.LocatorHelper;
+import com.sun.corba.se.spi.activation.Activator;
+import com.sun.corba.se.spi.activation.ActivatorHelper;
+import com.sun.corba.se.spi.activation.ServerAlreadyRegistered;
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
+import com.sun.corba.se.spi.transport.SocketInfo;
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl;
+import com.sun.corba.se.impl.naming.cosnaming.TransientNameService;
+import com.sun.corba.se.impl.naming.pcosnaming.NameService;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
+import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
+
+/**
+ *
+ * @author Rohit Garg
+ * @since JDK1.2
+ */
+public class ORBD
+{
+ private int initSvcPort;
+
+ protected void initializeBootNaming(ORB orb)
+ {
+ // create a bootstrap server
+ initSvcPort = orb.getORBData().getORBInitialPort();
+
+ Acceptor acceptor;
+ // REVISIT: see ORBConfigurator. use factory in TransportDefault.
+ if (orb.getORBData().getLegacySocketFactory() == null) {
+ acceptor =
+ new SocketOrChannelAcceptorImpl(
+ orb,
+ initSvcPort,
+ LegacyServerSocketEndPointInfo.BOOT_NAMING,
+ SocketInfo.IIOP_CLEAR_TEXT);
+ } else {
+ acceptor =
+ new SocketFactoryAcceptorImpl(
+ orb,
+ initSvcPort,
+ LegacyServerSocketEndPointInfo.BOOT_NAMING,
+ SocketInfo.IIOP_CLEAR_TEXT);
+ }
+ orb.getCorbaTransportManager().registerAcceptor(acceptor);
+ }
+
+ protected ORB createORB(String[] args)
+ {
+ Properties props = System.getProperties();
+
+ // For debugging.
+ //props.put( ORBConstants.DEBUG_PROPERTY, "naming" ) ;
+ //props.put( ORBConstants.DEBUG_PROPERTY, "transport,giop,naming" ) ;
+
+ props.put( ORBConstants.SERVER_ID_PROPERTY, "1000" ) ;
+ props.put( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
+ props.getProperty( ORBConstants.ORBD_PORT_PROPERTY,
+ Integer.toString(
+ ORBConstants.DEFAULT_ACTIVATION_PORT ) ) ) ;
+
+ // See Bug 4396928 for more information about why we are initializing
+ // the ORBClass to PIORB (now ORBImpl, but should check the bugid).
+ props.put("org.omg.CORBA.ORBClass",
+ "com.sun.corba.se.impl.orb.ORBImpl");
+
+ return (ORB) ORB.init(args, props);
+ }
+
+ private void run(String[] args)
+ {
+ try {
+ // parse the args and try setting the values for these
+ // properties
+ processArgs(args);
+
+ ORB orb = createORB(args);
+
+ if (orb.orbdDebugFlag)
+ System.out.println( "ORBD begins initialization." ) ;
+
+ boolean firstRun = createSystemDirs( ORBConstants.DEFAULT_DB_DIR );
+
+ startActivationObjects(orb);
+
+ if (firstRun) // orbd is being run the first time
+ installOrbServers(getRepository(), getActivator());
+
+ if (orb.orbdDebugFlag) {
+ System.out.println( "ORBD is ready." ) ;
+ System.out.println("ORBD serverid: " +
+ System.getProperty(ORBConstants.SERVER_ID_PROPERTY));
+ System.out.println("activation dbdir: " +
+ System.getProperty(ORBConstants.DB_DIR_PROPERTY));
+ System.out.println("activation port: " +
+ System.getProperty(ORBConstants.ORBD_PORT_PROPERTY));
+
+ String pollingTime = System.getProperty(
+ ORBConstants.SERVER_POLLING_TIME);
+ if( pollingTime == null ) {
+ pollingTime = Integer.toString(
+ ORBConstants.DEFAULT_SERVER_POLLING_TIME );
+ }
+ System.out.println("activation Server Polling Time: " +
+ pollingTime + " milli-seconds ");
+
+ String startupDelay = System.getProperty(
+ ORBConstants.SERVER_STARTUP_DELAY);
+ if( startupDelay == null ) {
+ startupDelay = Integer.toString(
+ ORBConstants.DEFAULT_SERVER_STARTUP_DELAY );
+ }
+ System.out.println("activation Server Startup Delay: " +
+ startupDelay + " milli-seconds " );
+ }
+
+ // The following two lines start the Persistent NameService
+ NameServiceStartThread theThread =
+ new NameServiceStartThread( orb, dbDir );
+ theThread.start( );
+
+ orb.run();
+ } catch( org.omg.CORBA.COMM_FAILURE cex ) {
+ System.out.println( CorbaResourceUtil.getText("orbd.commfailure"));
+ System.out.println( cex );
+ cex.printStackTrace();
+ } catch( org.omg.CORBA.INTERNAL iex ) {
+ System.out.println( CorbaResourceUtil.getText(
+ "orbd.internalexception"));
+ System.out.println( iex );
+ iex.printStackTrace();
+ } catch (Exception ex) {
+ System.out.println(CorbaResourceUtil.getText(
+ "orbd.usage", "orbd"));
+ System.out.println( ex );
+ ex.printStackTrace();
+ }
+ }
+
+ private void processArgs(String[] args)
+ {
+ Properties props = System.getProperties();
+ for (int i=0; i < args.length; i++) {
+ if (args[i].equals("-port")) {
+ if ((i+1) < args.length) {
+ props.put(ORBConstants.ORBD_PORT_PROPERTY, args[++i]);
+ } else {
+ System.out.println(CorbaResourceUtil.getText(
+ "orbd.usage", "orbd"));
+ }
+ } else if (args[i].equals("-defaultdb")) {
+ if ((i+1) < args.length) {
+ props.put(ORBConstants.DB_DIR_PROPERTY, args[++i]);
+ } else {
+ System.out.println(CorbaResourceUtil.getText(
+ "orbd.usage", "orbd"));
+ }
+ } else if (args[i].equals("-serverid")) {
+ if ((i+1) < args.length) {
+ props.put(ORBConstants.SERVER_ID_PROPERTY, args[++i]);
+ } else {
+ System.out.println(CorbaResourceUtil.getText(
+ "orbd.usage", "orbd"));
+ }
+ } else if (args[i].equals("-serverPollingTime")) {
+ if ((i+1) < args.length) {
+ props.put(ORBConstants.SERVER_POLLING_TIME, args[++i]);
+ } else {
+ System.out.println(CorbaResourceUtil.getText(
+ "orbd.usage", "orbd"));
+ }
+ } else if (args[i].equals("-serverStartupDelay")) {
+ if ((i+1) < args.length) {
+ props.put(ORBConstants.SERVER_STARTUP_DELAY, args[++i]);
+ } else {
+ System.out.println(CorbaResourceUtil.getText(
+ "orbd.usage", "orbd"));
+ }
+ }
+ }
+ }
+
+ /**
+ * Ensure that the Db directory exists. If not, create the Db
+ * and the log directory and return true. Otherwise return false.
+ */
+ protected boolean createSystemDirs(String defaultDbDir)
+ {
+ boolean dirCreated = false;
+ Properties props = System.getProperties();
+ String fileSep = props.getProperty("file.separator");
+
+ // determine the ORB db directory
+ dbDir = new File (props.getProperty( ORBConstants.DB_DIR_PROPERTY,
+ props.getProperty("user.dir") + fileSep + defaultDbDir));
+
+ // create the db and the logs directories
+ dbDirName = dbDir.getAbsolutePath();
+ props.put(ORBConstants.DB_DIR_PROPERTY, dbDirName);
+ if (!dbDir.exists()) {
+ dbDir.mkdir();
+ dirCreated = true;
+ }
+
+ File logDir = new File (dbDir, ORBConstants.SERVER_LOG_DIR ) ;
+ if (!logDir.exists()) logDir.mkdir();
+
+ return dirCreated;
+ }
+
+ protected File dbDir;
+ protected File getDbDir()
+ {
+ return dbDir;
+ }
+
+ private String dbDirName;
+ protected String getDbDirName()
+ {
+ return dbDirName;
+ }
+
+ protected void startActivationObjects(ORB orb) throws Exception
+ {
+ // create Initial Name Service object
+ initializeBootNaming(orb);
+
+ // create Repository object
+ repository = new RepositoryImpl(orb, dbDir, orb.orbdDebugFlag );
+ orb.register_initial_reference( ORBConstants.SERVER_REPOSITORY_NAME, repository );
+
+ // create Locator and Activator objects
+ ServerManagerImpl serverMgr =
+ new ServerManagerImpl( orb,
+ orb.getCorbaTransportManager(),
+ repository,
+ getDbDirName(),
+ orb.orbdDebugFlag );
+
+ locator = LocatorHelper.narrow(serverMgr);
+ orb.register_initial_reference( ORBConstants.SERVER_LOCATOR_NAME, locator );
+
+ activator = ActivatorHelper.narrow(serverMgr);
+ orb.register_initial_reference( ORBConstants.SERVER_ACTIVATOR_NAME, activator );
+
+ // start Name Service
+ TransientNameService nameService = new TransientNameService(orb,
+ ORBConstants.TRANSIENT_NAME_SERVICE_NAME);
+ }
+
+ protected Locator locator;
+ protected Locator getLocator()
+ {
+ return locator;
+ }
+
+ protected Activator activator;
+ protected Activator getActivator()
+ {
+ return activator;
+ }
+
+ protected RepositoryImpl repository;
+ protected RepositoryImpl getRepository()
+ {
+ return repository;
+ }
+
+ /**
+ * Go through the list of ORB Servers and initialize and start
+ * them up.
+ */
+ protected void installOrbServers(RepositoryImpl repository,
+ Activator activator)
+ {
+ int serverId;
+ String[] server;
+ ServerDef serverDef;
+
+ for (int i=0; i < orbServers.length; i++) {
+ try {
+ server = orbServers[i];
+ serverDef = new ServerDef(server[1], server[2],
+ server[3], server[4], server[5] );
+
+ serverId = Integer.valueOf(orbServers[i][0]).intValue();
+
+ repository.registerServer(serverDef, serverId);
+
+ activator.activate(serverId);
+
+ } catch (Exception ex) {}
+ }
+ }
+
+ public static void main(String[] args) {
+ ORBD orbd = new ORBD();
+ orbd.run(args);
+ }
+
+ /**
+ * List of servers to be auto registered and started by the ORBd.
+ *
+ * Each server entry is of the form {id, name, path, args, vmargs}.
+ */
+ private static String[][] orbServers = {
+ {""}
+ };
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ProcessMonitorThread.java b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ProcessMonitorThread.java
new file mode 100644
index 0000000..c7caaba
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ProcessMonitorThread.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.activation;
+
+import java.util.*;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+/** ProcessMonitorThread is started when ServerManager is instantiated. The
+ * thread wakes up every minute (This can be changed by setting sleepTime) and
+ * makes sure that all the processes (Servers) registered with the ServerTool
+ * are healthy. If not the state in ServerTableEntry will be changed to
+ * De-Activated.
+ * Note: This thread can be killed from the main thread by calling
+ * interrupThread()
+ */
+public class ProcessMonitorThread extends java.lang.Thread {
+ private HashMap serverTable;
+ private int sleepTime;
+ private static ProcessMonitorThread instance = null;
+
+ private ProcessMonitorThread( HashMap ServerTable, int SleepTime ) {
+ serverTable = ServerTable;
+ sleepTime = SleepTime;
+ }
+
+ public void run( ) {
+ while( true ) {
+ try {
+ // Sleep's for a specified time, before checking
+ // the Servers health. This will repeat as long as
+ // the ServerManager (ORBD) is up and running.
+ Thread.sleep( sleepTime );
+ } catch( java.lang.InterruptedException e ) {
+ break;
+ }
+ Iterator serverList;
+ synchronized ( serverTable ) {
+ // Check each ServerTableEntry to make sure that they
+ // are in the right state.
+ serverList = serverTable.values().iterator();
+ }
+ try {
+ checkServerHealth( serverList );
+ } catch( ConcurrentModificationException e ) {
+ break;
+ }
+ }
+ }
+
+ private void checkServerHealth( Iterator serverList ) {
+ if( serverList == null ) return;
+ while (serverList.hasNext( ) ) {
+ ServerTableEntry entry = (ServerTableEntry) serverList.next();
+ entry.checkProcessHealth( );
+ }
+ }
+
+ static void start( HashMap serverTable ) {
+ int sleepTime = ORBConstants.DEFAULT_SERVER_POLLING_TIME;
+
+ String pollingTime = System.getProperties().getProperty(
+ ORBConstants.SERVER_POLLING_TIME );
+
+ if ( pollingTime != null ) {
+ try {
+ sleepTime = Integer.parseInt( pollingTime );
+ } catch (Exception e ) {
+ // Too late to complain, Just use the default
+ // sleepTime
+ }
+ }
+
+ instance = new ProcessMonitorThread( serverTable,
+ sleepTime );
+ instance.setDaemon( true );
+ instance.start();
+ }
+
+ static void interruptThread( ) {
+ instance.interrupt();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/activation/RepositoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/RepositoryImpl.java
new file mode 100644
index 0000000..768ae16
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/RepositoryImpl.java
@@ -0,0 +1,474 @@
+/*
+ * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.activation;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Properties;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.SystemException;
+
+import com.sun.corba.se.spi.activation.BadServerDefinition;
+import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
+import com.sun.corba.se.spi.activation._RepositoryImplBase;
+import com.sun.corba.se.spi.activation.ServerAlreadyRegistered;
+import com.sun.corba.se.spi.activation.ServerAlreadyInstalled;
+import com.sun.corba.se.spi.activation.ServerAlreadyUninstalled;
+import com.sun.corba.se.spi.activation.ServerNotRegistered;
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
+import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.impl.logging.ActivationSystemException;
+
+/**
+ *
+ * @author Rohit Garg
+ * @since JDK1.2
+ */
+public class RepositoryImpl extends _RepositoryImplBase
+ implements Serializable
+{
+
+ // added serialver computed by the tool
+ private static final long serialVersionUID = 8458417785209341858L;
+
+ RepositoryImpl(ORB orb, File dbDir, boolean debug)
+ {
+ this.debug = debug ;
+ this.orb = orb;
+ wrapper = ActivationSystemException.get( orb, CORBALogDomains.ORBD_REPOSITORY ) ;
+
+ // if databse does not exist, create it otherwise read it in
+ File dbFile = new File(dbDir, "servers.db");
+ if (!dbFile.exists()) {
+ db = new RepositoryDB(dbFile);
+ db.flush();
+ } else {
+ try {
+ FileInputStream fis = new FileInputStream(dbFile);
+ ObjectInputStream ois = new ObjectInputStream(fis);
+ db = (RepositoryDB) ois.readObject();
+ ois.close();
+ } catch (Exception e) {
+ throw wrapper.cannotReadRepositoryDb( e ) ;
+ }
+ }
+
+ // export the repository
+ orb.connect(this);
+ }
+
+ private String printServerDef( ServerDef sd )
+ {
+ return "ServerDef[applicationName=" + sd.applicationName +
+ " serverName=" + sd.serverName +
+ " serverClassPath=" + sd.serverClassPath +
+ " serverArgs=" + sd. serverArgs +
+ " serverVmArgs=" + sd.serverVmArgs +
+ "]" ;
+ }
+
+ public int registerServer(ServerDef serverDef, int theServerId)
+ throws ServerAlreadyRegistered
+ {
+ int serverId;
+ DBServerDef server = null;
+
+ synchronized (db) {
+
+ // check if server already registered
+ Enumeration enumeration = db.serverTable.elements();
+ while (enumeration.hasMoreElements()) {
+ server = (DBServerDef) enumeration.nextElement();
+ if (serverDef.applicationName.equals(server.applicationName)) {
+ if (debug)
+ System.out.println(
+ "RepositoryImpl: registerServer called " +
+ "to register ServerDef " +
+ printServerDef( serverDef ) +
+ " with " + ((theServerId==illegalServerId) ?
+ "a new server Id" : ("server Id " + theServerId)) +
+ " FAILED because it is already registered." ) ;
+
+ throw (new ServerAlreadyRegistered(server.id));
+ }
+ }
+
+ // generate a new server id
+ if (theServerId == illegalServerId)
+ serverId = db.incrementServerIdCounter();
+ else
+ serverId = theServerId;
+
+ // add server def to the database
+ server = new DBServerDef(serverDef, serverId);
+ db.serverTable.put(new Integer(serverId), server);
+ db.flush();
+
+ if (debug)
+ if (theServerId==illegalServerId)
+ System.out.println( "RepositoryImpl: registerServer called " +
+ "to register ServerDef " + printServerDef( serverDef ) +
+ " with new serverId " + serverId ) ;
+ else
+ System.out.println( "RepositoryImpl: registerServer called " +
+ "to register ServerDef " + printServerDef( serverDef ) +
+ " with assigned serverId " + serverId ) ;
+
+ return serverId;
+ }
+ }
+
+ public int registerServer(ServerDef serverDef)
+ throws ServerAlreadyRegistered, BadServerDefinition
+ {
+ // verify that the entry is valid
+ LegacyServerSocketEndPointInfo endpoint =
+ orb.getLegacyServerSocketManager()
+ .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
+ int initSvcPort = ((SocketOrChannelAcceptor)endpoint)
+ .getServerSocket().getLocalPort();
+ ServerTableEntry entry = new ServerTableEntry( wrapper,
+ illegalServerId, serverDef, (int) initSvcPort, "", true, debug );
+
+ switch (entry.verify()) {
+ case ServerMain.OK:
+ break;
+ case ServerMain.MAIN_CLASS_NOT_FOUND:
+ throw new BadServerDefinition("main class not found.");
+ case ServerMain.NO_MAIN_METHOD:
+ throw new BadServerDefinition("no main method found.");
+ case ServerMain.APPLICATION_ERROR:
+ throw new BadServerDefinition("server application error.");
+ default:
+ throw new BadServerDefinition("unknown Exception.");
+ }
+
+ return registerServer(serverDef, illegalServerId);
+ }
+
+ public void unregisterServer(int serverId) throws ServerNotRegistered {
+
+ DBServerDef server = null;
+ Integer id = new Integer(serverId);
+
+ synchronized (db) {
+
+ // check to see if the server is registered
+ server = (DBServerDef) db.serverTable.get(id);
+ if (server == null) {
+ if (debug)
+ System.out.println(
+ "RepositoryImpl: unregisterServer for serverId " +
+ serverId + " called: server not registered" ) ;
+
+ throw (new ServerNotRegistered());
+ }
+
+ // remove server from the database
+ db.serverTable.remove(id);
+ db.flush();
+ }
+
+ if (debug)
+ System.out.println(
+ "RepositoryImpl: unregisterServer for serverId " + serverId +
+ " called" ) ;
+ }
+
+ private DBServerDef getDBServerDef(int serverId) throws ServerNotRegistered
+ {
+ Integer id = new Integer(serverId);
+ DBServerDef server = (DBServerDef) db.serverTable.get(id);
+
+ if (server == null)
+ throw new ServerNotRegistered( serverId );
+
+ return server ;
+ }
+
+ public ServerDef getServer(int serverId) throws ServerNotRegistered
+ {
+ DBServerDef server = getDBServerDef( serverId ) ;
+
+ ServerDef serverDef = new ServerDef(server.applicationName, server.name,
+ server.classPath, server.args, server.vmArgs);
+
+ if (debug)
+ System.out.println(
+ "RepositoryImpl: getServer for serverId " + serverId +
+ " returns " + printServerDef( serverDef ) ) ;
+
+ return serverDef;
+ }
+
+ public boolean isInstalled(int serverId) throws ServerNotRegistered {
+ DBServerDef server = getDBServerDef( serverId ) ;
+ return server.isInstalled ;
+ }
+
+ public void install( int serverId )
+ throws ServerNotRegistered, ServerAlreadyInstalled
+ {
+ DBServerDef server = getDBServerDef( serverId ) ;
+
+ if (server.isInstalled)
+ throw new ServerAlreadyInstalled( serverId ) ;
+ else {
+ server.isInstalled = true ;
+ db.flush() ;
+ }
+ }
+
+ public void uninstall( int serverId )
+ throws ServerNotRegistered, ServerAlreadyUninstalled
+ {
+ DBServerDef server = getDBServerDef( serverId ) ;
+
+ if (!server.isInstalled)
+ throw new ServerAlreadyUninstalled( serverId ) ;
+ else {
+ server.isInstalled = false ;
+ db.flush() ;
+ }
+ }
+
+ public int[] listRegisteredServers() {
+ synchronized (db) {
+ int i=0;
+
+ int servers[] = new int[db.serverTable.size()];
+
+ Enumeration enumeration = db.serverTable.elements();
+
+ while (enumeration.hasMoreElements()) {
+ DBServerDef server = (DBServerDef) enumeration.nextElement();
+ servers[i++] = server.id;
+ }
+
+ if (debug) {
+ StringBuffer sb = new StringBuffer() ;
+ for (int ctr=0; ctr<servers.length; ctr++) {
+ sb.append( ' ' ) ;
+ sb.append( servers[ctr] ) ;
+ }
+
+ System.out.println(
+ "RepositoryImpl: listRegisteredServers returns" +
+ sb.toString() ) ;
+ }
+
+ return servers;
+ }
+ }
+
+ public int getServerID(String applicationName) throws ServerNotRegistered {
+ synchronized (db) {
+ int result = -1 ;
+
+ for (Enumeration serverIds = db.serverTable.keys();
+ serverIds.hasMoreElements();)
+ {
+ Integer nextServerId = (Integer) serverIds.nextElement();
+ DBServerDef dbServerDef =
+ (DBServerDef) db.serverTable.get(nextServerId);
+
+ if (dbServerDef.applicationName.equals(applicationName)) {
+ result = nextServerId.intValue();
+ break ;
+ }
+ }
+
+ if (debug)
+ System.out.println("RepositoryImpl: getServerID for " +
+ applicationName + " is " + result ) ;
+
+ if (result == -1) {
+ throw (new ServerNotRegistered());
+ } else {
+ return result ;
+ }
+ }
+ }
+
+ public String[] getApplicationNames() {
+ synchronized (db) {
+ Vector v = new Vector();
+ for (Enumeration serverIds = db.serverTable.keys();
+ serverIds.hasMoreElements();)
+ {
+ Integer nextServerId = (Integer) serverIds.nextElement();
+
+ DBServerDef dbServerDef = (DBServerDef)db.serverTable.get(
+ nextServerId);
+
+ if (!dbServerDef.applicationName.equals(""))
+ v.addElement( dbServerDef.applicationName ) ;
+ }
+
+ String[] apps = new String[v.size()];
+ for (int i = 0; i < v.size(); i++) {
+ apps[i] = (String)v.elementAt(i);
+ }
+
+ if (debug) {
+ StringBuffer sb = new StringBuffer() ;
+ for (int ctr=0; ctr<apps.length; ctr++) {
+ sb.append( ' ' ) ;
+ sb.append( apps[ctr] ) ;
+ }
+
+ System.out.println( "RepositoryImpl: getApplicationNames returns " +
+ sb.toString() ) ;
+ }
+
+ return apps;
+ }
+ }
+ /**
+ * Typically the Repositoy is created within the ORBd VM but it can
+ * be independently started as well.
+ */
+ public static void main(String args[]) {
+ boolean debug = false ;
+ for (int ctr=0; ctr<args.length; ctr++)
+ if (args[ctr].equals("-debug"))
+ debug = true ;
+
+ try {
+ // See Bug 4396928 for more information about why we are
+ // initializing the ORBClass to PIORB (now ORBImpl, but see the bug).
+ Properties props = new Properties();
+ props.put("org.omg.CORBA.ORBClass",
+ "com.sun.corba.se.impl.orb.ORBImpl");
+ ORB orb = (ORB) ORB.init(args, props);
+
+ // create the repository object
+ String db = System.getProperty( ORBConstants.DB_PROPERTY,
+ ORBConstants.DEFAULT_DB_NAME );
+ RepositoryImpl repository = new RepositoryImpl(orb, new File(db),
+ debug);
+
+ // wait for shutdown
+ orb.run();
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+
+ transient private boolean debug = false;
+
+ final static int illegalServerId = -1;
+
+ transient private RepositoryDB db = null;
+
+ transient ORB orb = null;
+
+ transient ActivationSystemException wrapper ;
+
+ class RepositoryDB implements Serializable
+ {
+ File db;
+ Hashtable serverTable;
+ Integer serverIdCounter;
+
+ RepositoryDB(File dbFile) {
+
+ db = dbFile;
+
+ // initialize the Server Id counter and hashtable.
+ // the lower id range is reserved for system servers
+ serverTable = new Hashtable(255);
+ serverIdCounter = new Integer(256);
+ }
+
+ int incrementServerIdCounter()
+ {
+ int value = serverIdCounter.intValue();
+ serverIdCounter = new Integer(++value);
+
+ return value;
+ }
+
+ void flush()
+ {
+ try {
+ db.delete();
+ FileOutputStream fos = new FileOutputStream(db);
+ ObjectOutputStream oos = new ObjectOutputStream(fos);
+ oos.writeObject(this);
+ oos.flush();
+ oos.close();
+ } catch (Exception ex) {
+ throw wrapper.cannotWriteRepositoryDb( ex ) ;
+ }
+ }
+ }
+
+ class DBServerDef implements Serializable
+ {
+ public String toString() {
+ return "DBServerDef(applicationName=" + applicationName +
+ ", name=" + name +
+ ", classPath=" + classPath +
+ ", args=" + args +
+ ", vmArgs=" + vmArgs +
+ ", id=" + id +
+ ", isInstalled=" + isInstalled + ")" ;
+ }
+
+ DBServerDef(ServerDef server, int server_id) {
+ applicationName = server.applicationName ;
+ name = server.serverName;
+ classPath = server.serverClassPath;
+ args = server.serverArgs;
+ vmArgs = server.serverVmArgs;
+ id = server_id;
+ isInstalled = false ;
+ }
+
+ String applicationName;
+ String name;
+ String classPath;
+ String args;
+ String vmArgs;
+ boolean isInstalled ;
+ int id;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerMain.java b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerMain.java
new file mode 100644
index 0000000..cd6d534
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerMain.java
@@ -0,0 +1,383 @@
+/*
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.activation;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.io.*;
+import java.util.Date;
+import java.util.Properties ;
+
+import org.omg.CORBA.ORB ;
+import com.sun.corba.se.spi.activation.Activator ;
+import com.sun.corba.se.spi.activation.ActivatorHelper ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+/**
+ * @author Ken Cavanaugh
+ * @since JDK1.2
+ */
+public class ServerMain
+{
+ /* TODO:
+ * 1. Rewrite all uses of ORB properties to use constants from someplace.
+ * The strings are scattered between here, the ORB classes, and
+ * ServerTableEntry.
+ * 2. Consider a more general log facility.
+ * 3. Remove ServerCallback from POAORB.
+ * 4. Needs to be merged with Harold's changes to support SSL.
+ * 5. Logs need to be internationalized.
+ */
+
+ public final static int OK = 0;
+ public final static int MAIN_CLASS_NOT_FOUND = 1;
+ public final static int NO_MAIN_METHOD = 2;
+ public final static int APPLICATION_ERROR = 3;
+ public final static int UNKNOWN_ERROR = 4;
+ public final static int NO_SERVER_ID = 5 ;
+ public final static int REGISTRATION_FAILED = 6;
+
+ public static String printResult( int result )
+ {
+ switch (result) {
+ case OK : return "Server terminated normally" ;
+ case MAIN_CLASS_NOT_FOUND : return "main class not found" ;
+ case NO_MAIN_METHOD : return "no main method" ;
+ case APPLICATION_ERROR : return "application error" ;
+ case NO_SERVER_ID : return "server ID not defined" ;
+ case REGISTRATION_FAILED: return "server registration failed" ;
+ default : return "unknown error" ;
+ }
+ }
+
+ private void redirectIOStreams()
+ {
+ // redirect out and err streams
+ try {
+ String logDirName =
+ System.getProperty( ORBConstants.DB_DIR_PROPERTY ) +
+ System.getProperty("file.separator") +
+ ORBConstants.SERVER_LOG_DIR +
+ System.getProperty("file.separator");
+
+ File logDir = new File(logDirName);
+ String server = System.getProperty(
+ ORBConstants.SERVER_ID_PROPERTY ) ;
+
+ FileOutputStream foutStream =
+ new FileOutputStream(logDirName + server+".out", true);
+ FileOutputStream ferrStream =
+ new FileOutputStream(logDirName + server+".err", true);
+
+ PrintStream pSout = new PrintStream(foutStream, true);
+ PrintStream pSerr = new PrintStream(ferrStream, true);
+
+ System.setOut(pSout);
+ System.setErr(pSerr);
+
+ logInformation( "Server started" ) ;
+
+ } catch (Exception ex) {}
+ }
+
+ /** Write a time-stamped message to the indicated PrintStream.
+ */
+ private static void writeLogMessage( PrintStream pstream, String msg )
+ {
+ Date date = new Date();
+ pstream.print( "[" + date.toString() + "] " + msg + "\n");
+ }
+
+ /** Write information to standard out only.
+ */
+ public static void logInformation( String msg )
+ {
+ writeLogMessage( System.out, " " + msg ) ;
+ }
+
+ /** Write error message to standard out and standard err.
+ */
+ public static void logError( String msg )
+ {
+ writeLogMessage( System.out, "ERROR: " + msg ) ;
+ writeLogMessage( System.err, "ERROR: " + msg ) ;
+ }
+
+ /** Write final message to log(s) and then terminate by calling
+ * System.exit( code ). If code == OK, write a normal termination
+ * message to standard out, otherwise write an abnormal termination
+ * message to standard out and standard error.
+ */
+ public static void logTerminal( String msg, int code )
+ {
+ if (code == 0) {
+ writeLogMessage( System.out, " " + msg ) ;
+ } else {
+ writeLogMessage( System.out, "FATAL: " +
+ printResult( code ) + ": " + msg ) ;
+
+ writeLogMessage( System.err, "FATAL: " +
+ printResult( code ) + ": " + msg ) ;
+ }
+
+ System.exit( code ) ;
+ }
+
+ private Method getMainMethod( Class serverClass )
+ {
+ Class argTypes[] = new Class[] { String[].class } ;
+ Method method = null ;
+
+ try {
+ method = serverClass.getDeclaredMethod( "main", argTypes ) ;
+ } catch (Exception exc) {
+ logTerminal( exc.getMessage(), NO_MAIN_METHOD ) ;
+ }
+
+ if (!isPublicStaticVoid( method ))
+ logTerminal( "", NO_MAIN_METHOD ) ;
+
+ return method ;
+ }
+
+ private boolean isPublicStaticVoid( Method method )
+ {
+ // check modifiers: public static
+ int modifiers = method.getModifiers ();
+ if (!Modifier.isPublic (modifiers) || !Modifier.isStatic (modifiers)) {
+ logError( method.getName() + " is not public static" ) ;
+ return false ;
+ }
+
+ // check return type and exceptions
+ if (method.getExceptionTypes ().length != 0) {
+ logError( method.getName() + " declares exceptions" ) ;
+ return false ;
+ }
+
+ if (!method.getReturnType().equals (Void.TYPE)) {
+ logError( method.getName() + " does not have a void return type" ) ;
+ return false ;
+ }
+
+ return true ;
+ }
+
+ private Method getNamedMethod( Class serverClass, String methodName )
+ {
+ Class argTypes[] = new Class[] { org.omg.CORBA.ORB.class } ;
+ Method method = null ;
+
+ try {
+ method = serverClass.getDeclaredMethod( methodName, argTypes ) ;
+ } catch (Exception exc) {
+ return null ;
+ }
+
+ if (!isPublicStaticVoid( method ))
+ return null ;
+
+ return method ;
+ }
+
+ private void run(String[] args)
+ {
+ try {
+ redirectIOStreams() ;
+
+ String serverClassName = System.getProperty(
+ ORBConstants.SERVER_NAME_PROPERTY ) ;
+
+ // determine the class loader to be used for loading the class
+ // since ServerMain is going to be in JDK and we need to have this
+ // class to load application classes, this is required here.
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+
+ if (cl == null)
+ cl = ClassLoader.getSystemClassLoader();
+
+ // determine the main class
+ Class serverClass = null;
+
+ try {
+ // determine the main class, try loading with current class loader
+ serverClass = Class.forName( serverClassName ) ;
+ } catch (ClassNotFoundException ex) {
+ // eat the exception and try to load using SystemClassLoader
+ serverClass = Class.forName( serverClassName, true, cl);
+ }
+
+ if (debug)
+ System.out.println("class " + serverClassName + " found");
+
+ // get the main method
+ Method mainMethod = getMainMethod( serverClass ) ;
+
+ // This piece of code is required, to verify the server definition
+ // without launching it.
+
+ // verify the server
+
+ boolean serverVerifyFlag = Boolean.getBoolean(
+ ORBConstants.SERVER_DEF_VERIFY_PROPERTY) ;
+ if (serverVerifyFlag) {
+ if (mainMethod == null)
+ logTerminal("", NO_MAIN_METHOD);
+ else {
+ if (debug)
+ System.out.println("Valid Server");
+ logTerminal("", OK);
+ }
+ }
+
+
+ registerCallback( serverClass ) ;
+
+ // build args to the main and call it
+ Object params [] = new Object [1];
+ params[0] = args;
+ mainMethod.invoke(null, params);
+
+ } catch (ClassNotFoundException e) {
+ logTerminal("ClassNotFound exception: " + e.getMessage(),
+ MAIN_CLASS_NOT_FOUND);
+ } catch (Exception e) {
+ logTerminal("Exception: " + e.getMessage(),
+ APPLICATION_ERROR);
+ }
+ }
+
+ public static void main(String[] args) {
+ ServerMain server = new ServerMain();
+ server.run(args);
+ }
+
+ private static final boolean debug = false;
+
+ private int getServerId()
+ {
+ Integer serverId = Integer.getInteger( ORBConstants.SERVER_ID_PROPERTY ) ;
+
+ if (serverId == null)
+ logTerminal( "", NO_SERVER_ID ) ;
+
+ return serverId.intValue() ;
+ }
+
+ private void registerCallback( Class serverClass )
+ {
+ Method installMethod = getNamedMethod( serverClass, "install" ) ;
+ Method uninstallMethod = getNamedMethod( serverClass, "uninstall" ) ;
+ Method shutdownMethod = getNamedMethod( serverClass, "shutdown" ) ;
+
+ Properties props = new Properties() ;
+ props.put( "org.omg.CORBA.ORBClass",
+ "com.sun.corba.se.impl.orb.ORBImpl" ) ;
+ // NOTE: Very important to pass this property, otherwise the
+ // Persistent Server registration will be unsucessfull.
+ props.put( ORBConstants.ACTIVATED_PROPERTY, "false" );
+ String args[] = null ;
+ ORB orb = ORB.init( args, props ) ;
+
+ ServerCallback serverObj = new ServerCallback( orb,
+ installMethod, uninstallMethod, shutdownMethod ) ;
+
+ int serverId = getServerId() ;
+
+ try {
+ Activator activator = ActivatorHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
+ activator.active(serverId, serverObj);
+ } catch (Exception ex) {
+ logTerminal( "exception " + ex.getMessage(),
+ REGISTRATION_FAILED ) ;
+ }
+ }
+}
+
+class ServerCallback extends
+ com.sun.corba.se.spi.activation._ServerImplBase
+{
+ private ORB orb;
+ private transient Method installMethod ;
+ private transient Method uninstallMethod ;
+ private transient Method shutdownMethod ;
+ private Object methodArgs[] ;
+
+ ServerCallback(ORB orb, Method installMethod, Method uninstallMethod,
+ Method shutdownMethod )
+ {
+ this.orb = orb;
+ this.installMethod = installMethod ;
+ this.uninstallMethod = uninstallMethod ;
+ this.shutdownMethod = shutdownMethod ;
+
+ orb.connect( this ) ;
+
+ methodArgs = new Object[] { orb } ;
+ }
+
+ private void invokeMethod( Method method )
+ {
+ if (method != null)
+ try {
+ method.invoke( null, methodArgs ) ;
+ } catch (Exception exc) {
+ ServerMain.logError( "could not invoke " + method.getName() +
+ " method: " + exc.getMessage() ) ;
+ }
+ }
+
+ // shutdown the ORB and wait for completion
+ public void shutdown()
+ {
+ ServerMain.logInformation( "Shutdown starting" ) ;
+
+ invokeMethod( shutdownMethod ) ;
+
+ orb.shutdown(true);
+
+ ServerMain.logTerminal( "Shutdown completed", ServerMain.OK ) ;
+ }
+
+ public void install()
+ {
+ ServerMain.logInformation( "Install starting" ) ;
+
+ invokeMethod( installMethod ) ;
+
+ ServerMain.logInformation( "Install completed" ) ;
+ }
+
+ public void uninstall()
+ {
+ ServerMain.logInformation( "uninstall starting" ) ;
+
+ invokeMethod( uninstallMethod ) ;
+
+ ServerMain.logInformation( "uninstall completed" ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java
new file mode 100644
index 0000000..745f0aa
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerManagerImpl.java
@@ -0,0 +1,645 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.activation;
+
+/**
+ *
+ * @author Rohit Garg
+ * @author Ken Cavanaugh
+ * @author Hemanth Puttaswamy
+ * @since JDK1.2
+ */
+
+import java.lang.reflect.Constructor;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.SystemException;
+
+import com.sun.corba.se.spi.activation.EndPointInfo;
+import com.sun.corba.se.spi.activation.IIOP_CLEAR_TEXT;
+import com.sun.corba.se.spi.activation.ORBPortInfo;
+import com.sun.corba.se.spi.activation.Repository;
+import com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation;
+import com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB;
+import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
+import com.sun.corba.se.spi.activation._ServerManagerImplBase;
+import com.sun.corba.se.spi.activation.ServerAlreadyActive;
+import com.sun.corba.se.spi.activation.ServerAlreadyInstalled;
+import com.sun.corba.se.spi.activation.ServerAlreadyUninstalled;
+import com.sun.corba.se.spi.activation.ServerNotRegistered;
+import com.sun.corba.se.spi.activation.ORBAlreadyRegistered;
+import com.sun.corba.se.spi.activation.ServerHeldDown;
+import com.sun.corba.se.spi.activation.ServerNotActive;
+import com.sun.corba.se.spi.activation.NoSuchEndPoint;
+import com.sun.corba.se.spi.activation.InvalidORBid;
+import com.sun.corba.se.spi.activation.Server;
+import com.sun.corba.se.spi.activation.IIOP_CLEAR_TEXT;
+import com.sun.corba.se.spi.ior.IORTemplate ;
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.ObjectKey ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.IORFactories ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
+import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.protocol.ForwardException;
+import com.sun.corba.se.spi.transport.CorbaTransportManager;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ActivationSystemException ;
+
+import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.util.Utility;
+
+public class ServerManagerImpl extends _ServerManagerImplBase
+ implements BadServerIdHandler
+{
+ // Using HashMap, since synchronization should be done by the calling
+ // routines
+ HashMap serverTable;
+ Repository repository;
+
+ CorbaTransportManager transportManager;
+ int initialPort;
+ ORB orb;
+ ActivationSystemException wrapper;
+ String dbDirName;
+ boolean debug = false ;
+
+ private int serverStartupDelay;
+
+ ServerManagerImpl(ORB orb, CorbaTransportManager transportManager,
+ Repository repository, String dbDirName, boolean debug)
+ {
+ this.orb = orb;
+ wrapper = ActivationSystemException.get( orb, CORBALogDomains.ORBD_ACTIVATOR ) ;
+
+ this.transportManager = transportManager; // REVISIT - NOT USED.
+ this.repository = repository;
+ this.dbDirName = dbDirName;
+ this.debug = debug ;
+
+ LegacyServerSocketEndPointInfo endpoint =
+ orb.getLegacyServerSocketManager()
+ .legacyGetEndpoint(LegacyServerSocketEndPointInfo.BOOT_NAMING);
+
+ initialPort = ((SocketOrChannelAcceptor)endpoint)
+ .getServerSocket().getLocalPort();
+ serverTable = new HashMap(256);
+
+ // The ServerStartupDelay is the delay added after the Server registers
+ // end point information. This is to allow the server to completely
+ // initialize after ORB is instantiated.
+ serverStartupDelay = ORBConstants.DEFAULT_SERVER_STARTUP_DELAY;
+ String delay = System.getProperty( ORBConstants.SERVER_STARTUP_DELAY);
+ if( delay != null ) {
+ try {
+ serverStartupDelay = Integer.parseInt( delay );
+ } catch ( Exception e ) {
+ // Just use the default 1000 milliseconds as the default
+ }
+ }
+
+ Class cls = orb.getORBData( ).getBadServerIdHandler();
+ if( cls == null ) {
+ orb.setBadServerIdHandler( this );
+ } else {
+ orb.initBadServerIdHandler() ;
+ }
+
+ orb.connect(this);
+ ProcessMonitorThread.start( serverTable );
+ }
+
+ public void activate(int serverId)
+ throws ServerAlreadyActive, ServerNotRegistered, ServerHeldDown
+ {
+
+ ServerLocation location;
+ ServerTableEntry entry;
+ Integer key = new Integer(serverId);
+
+ synchronized(serverTable) {
+ entry = (ServerTableEntry) serverTable.get(key);
+ }
+
+ if (entry != null && entry.isActive()) {
+ if (debug)
+ System.out.println( "ServerManagerImpl: activate for server Id " +
+ serverId + " failed because server is already active. " +
+ "entry = " + entry ) ;
+
+ throw new ServerAlreadyActive( serverId );
+ }
+
+ // locate the server
+ try {
+
+ // We call getEntry here so that state of the entry is
+ // checked for validity before we actually go and locate a server
+
+ entry = getEntry(serverId);
+
+ if (debug)
+ System.out.println( "ServerManagerImpl: locateServer called with " +
+ " serverId=" + serverId + " endpointType="
+ + IIOP_CLEAR_TEXT.value + " block=false" ) ;
+
+ location = locateServer(entry, IIOP_CLEAR_TEXT.value, false);
+
+ if (debug)
+ System.out.println( "ServerManagerImpl: activate for server Id " +
+ serverId + " found location " +
+ location.hostname + " and activated it" ) ;
+ } catch (NoSuchEndPoint ex) {
+ if (debug)
+ System.out.println( "ServerManagerImpl: activate for server Id " +
+ " threw NoSuchEndpoint exception, which was ignored" );
+ }
+ }
+
+ public void active(int serverId, Server server) throws ServerNotRegistered
+ {
+ ServerTableEntry entry;
+ Integer key = new Integer(serverId);
+
+ synchronized (serverTable) {
+ entry = (ServerTableEntry) serverTable.get(key);
+
+ if (entry == null) {
+ if (debug)
+ System.out.println( "ServerManagerImpl: active for server Id " +
+ serverId + " called, but no such server is registered." ) ;
+
+ throw wrapper.serverNotExpectedToRegister() ;
+ } else {
+ if (debug)
+ System.out.println( "ServerManagerImpl: active for server Id " +
+ serverId + " called. This server is now active." ) ;
+
+ entry.register(server);
+ }
+ }
+ }
+
+ public void registerEndpoints( int serverId, String orbId,
+ EndPointInfo [] endpointList ) throws NoSuchEndPoint, ServerNotRegistered,
+ ORBAlreadyRegistered
+ {
+ // orbId is ignored for now
+ ServerTableEntry entry;
+ Integer key = new Integer(serverId);
+
+ synchronized (serverTable) {
+ entry = (ServerTableEntry) serverTable.get(key);
+
+ if (entry == null) {
+ if (debug)
+ System.out.println(
+ "ServerManagerImpl: registerEndpoint for server Id " +
+ serverId + " called, but no such server is registered." ) ;
+
+ throw wrapper.serverNotExpectedToRegister() ;
+ } else {
+ if (debug)
+ System.out.println(
+ "ServerManagerImpl: registerEndpoints for server Id " +
+ serverId + " called. This server is now active." ) ;
+
+ entry.registerPorts( orbId, endpointList );
+
+ }
+ }
+ }
+
+ public int[] getActiveServers()
+ {
+ ServerTableEntry entry;
+ int[] list = null;
+
+ synchronized (serverTable) {
+ // unlike vectors, list is not synchronized
+
+ ArrayList servers = new ArrayList(0);
+
+ Iterator serverList = serverTable.keySet().iterator();
+
+ try {
+ while (serverList.hasNext()) {
+ Integer key = (Integer) serverList.next();
+ // get an entry
+ entry = (ServerTableEntry) serverTable.get(key);
+
+ if (entry.isValid() && entry.isActive()) {
+ servers.add(entry);
+ }
+ }
+ } catch (NoSuchElementException e) {
+ // all done
+ }
+
+ // collect the active entries
+ list = new int[servers.size()];
+ for (int i = 0; i < servers.size(); i++) {
+ entry = (ServerTableEntry) servers.get(i);
+ list[i] = entry.getServerId();
+ }
+ }
+
+ if (debug) {
+ StringBuffer sb = new StringBuffer() ;
+ for (int ctr=0; ctr<list.length; ctr++) {
+ sb.append( ' ' ) ;
+ sb.append( list[ctr] ) ;
+ }
+
+ System.out.println( "ServerManagerImpl: getActiveServers returns" +
+ sb.toString() ) ;
+ }
+
+ return list;
+ }
+
+ public void shutdown(int serverId) throws ServerNotActive
+ {
+ ServerTableEntry entry;
+ Integer key = new Integer(serverId);
+
+ synchronized(serverTable) {
+ entry = (ServerTableEntry) serverTable.remove(key);
+
+ if (entry == null) {
+ if (debug)
+ System.out.println( "ServerManagerImpl: shutdown for server Id " +
+ serverId + " throws ServerNotActive." ) ;
+
+ throw new ServerNotActive( serverId );
+ }
+
+ try {
+ entry.destroy();
+
+ if (debug)
+ System.out.println( "ServerManagerImpl: shutdown for server Id " +
+ serverId + " completed." ) ;
+ } catch (Exception e) {
+ if (debug)
+ System.out.println( "ServerManagerImpl: shutdown for server Id " +
+ serverId + " threw exception " + e ) ;
+ }
+ }
+ }
+
+ private ServerTableEntry getEntry( int serverId )
+ throws ServerNotRegistered
+ {
+ Integer key = new Integer(serverId);
+ ServerTableEntry entry = null ;
+
+ synchronized (serverTable) {
+ entry = (ServerTableEntry) serverTable.get(key);
+
+ if (debug)
+ if (entry == null) {
+ System.out.println( "ServerManagerImpl: getEntry: " +
+ "no active server found." ) ;
+ } else {
+ System.out.println( "ServerManagerImpl: getEntry: " +
+ " active server found " + entry + "." ) ;
+ }
+
+ if ((entry != null) && (!entry.isValid())) {
+ serverTable.remove(key);
+ entry = null;
+ }
+
+ if (entry == null) {
+ ServerDef serverDef = repository.getServer(serverId);
+
+ entry = new ServerTableEntry( wrapper,
+ serverId, serverDef, initialPort, dbDirName, false, debug);
+ serverTable.put(key, entry);
+ entry.activate() ;
+ }
+ }
+
+ return entry ;
+ }
+
+ private ServerLocation locateServer (ServerTableEntry entry, String endpointType,
+ boolean block)
+ throws NoSuchEndPoint, ServerNotRegistered, ServerHeldDown
+ {
+ ServerLocation location = new ServerLocation() ;
+
+ // if server location is desired, then wait for the server
+ // to register back, then return location
+
+ ORBPortInfo [] serverORBAndPortList;
+ if (block) {
+ try {
+ serverORBAndPortList = entry.lookup(endpointType);
+ } catch (Exception ex) {
+ if (debug)
+ System.out.println( "ServerManagerImpl: locateServer: " +
+ "server held down" ) ;
+
+ throw new ServerHeldDown( entry.getServerId() );
+ }
+
+ String host =
+ orb.getLegacyServerSocketManager()
+ .legacyGetEndpoint(LegacyServerSocketEndPointInfo.DEFAULT_ENDPOINT).getHostName();
+ location.hostname = host ;
+ int listLength;
+ if (serverORBAndPortList != null) {
+ listLength = serverORBAndPortList.length;
+ } else {
+ listLength = 0;
+ }
+ location.ports = new ORBPortInfo[listLength];
+ for (int i = 0; i < listLength; i++) {
+ location.ports[i] = new ORBPortInfo(serverORBAndPortList[i].orbId,
+ serverORBAndPortList[i].port) ;
+
+ if (debug)
+ System.out.println( "ServerManagerImpl: locateServer: " +
+ "server located at location " +
+ location.hostname + " ORBid " +
+ serverORBAndPortList[i].orbId +
+ " Port " + serverORBAndPortList[i].port) ;
+ }
+ }
+
+ return location;
+ }
+
+ private ServerLocationPerORB locateServerForORB (ServerTableEntry entry, String orbId,
+ boolean block)
+ throws InvalidORBid, ServerNotRegistered, ServerHeldDown
+ {
+ ServerLocationPerORB location = new ServerLocationPerORB() ;
+
+ // if server location is desired, then wait for the server
+ // to register back, then return location
+
+ EndPointInfo [] endpointInfoList;
+ if (block) {
+ try {
+ endpointInfoList = entry.lookupForORB(orbId);
+ } catch (InvalidORBid ex) {
+ throw ex;
+ } catch (Exception ex) {
+ if (debug)
+ System.out.println( "ServerManagerImpl: locateServerForORB: " +
+ "server held down" ) ;
+
+ throw new ServerHeldDown( entry.getServerId() );
+ }
+
+ String host =
+ orb.getLegacyServerSocketManager()
+ .legacyGetEndpoint(LegacyServerSocketEndPointInfo.DEFAULT_ENDPOINT).getHostName();
+ location.hostname = host ;
+ int listLength;
+ if (endpointInfoList != null) {
+ listLength = endpointInfoList.length;
+ } else {
+ listLength = 0;
+ }
+ location.ports = new EndPointInfo[listLength];
+ for (int i = 0; i < listLength; i++) {
+ location.ports[i] = new EndPointInfo(endpointInfoList[i].endpointType,
+ endpointInfoList[i].port) ;
+
+ if (debug)
+ System.out.println( "ServerManagerImpl: locateServer: " +
+ "server located at location " +
+ location.hostname + " endpointType " +
+ endpointInfoList[i].endpointType +
+ " Port " + endpointInfoList[i].port) ;
+ }
+ }
+
+ return location;
+ }
+
+ public String[] getORBNames(int serverId)
+ throws ServerNotRegistered
+ {
+ try {
+ ServerTableEntry entry = getEntry( serverId ) ;
+ return (entry.getORBList());
+ } catch (Exception ex) {
+ throw new ServerNotRegistered(serverId);
+ }
+ }
+
+ private ServerTableEntry getRunningEntry( int serverId )
+ throws ServerNotRegistered
+ {
+ ServerTableEntry entry = getEntry( serverId ) ;
+
+ try {
+ // this is to see if the server has any listeners
+ ORBPortInfo [] serverORBAndPortList = entry.lookup(IIOP_CLEAR_TEXT.value) ;
+ } catch (Exception exc) {
+ return null ;
+ }
+ return entry;
+
+ }
+
+ public void install( int serverId )
+ throws ServerNotRegistered, ServerHeldDown, ServerAlreadyInstalled
+ {
+ ServerTableEntry entry = getRunningEntry( serverId ) ;
+ if (entry != null) {
+ repository.install( serverId ) ;
+ entry.install() ;
+ }
+ }
+
+ public void uninstall( int serverId )
+ throws ServerNotRegistered, ServerHeldDown, ServerAlreadyUninstalled
+ {
+ ServerTableEntry entry =
+ (ServerTableEntry) serverTable.get( new Integer(serverId) );
+
+ if (entry != null) {
+
+ entry =
+ (ServerTableEntry) serverTable.remove(new Integer(serverId));
+
+ if (entry == null) {
+ if (debug)
+ System.out.println( "ServerManagerImpl: shutdown for server Id " +
+ serverId + " throws ServerNotActive." ) ;
+
+ throw new ServerHeldDown( serverId );
+ }
+
+ entry.uninstall();
+ }
+ }
+
+ public ServerLocation locateServer (int serverId, String endpointType)
+ throws NoSuchEndPoint, ServerNotRegistered, ServerHeldDown
+ {
+ ServerTableEntry entry = getEntry( serverId ) ;
+ if (debug)
+ System.out.println( "ServerManagerImpl: locateServer called with " +
+ " serverId=" + serverId + " endpointType=" +
+ endpointType + " block=true" ) ;
+
+ // passing in entry to eliminate multiple lookups for
+ // the same entry in some cases
+
+ return locateServer(entry, endpointType, true);
+ }
+
+ /** This method is used to obtain the registered ports for an ORB.
+ * This is useful for custom Bad server ID handlers in ORBD.
+ */
+ public ServerLocationPerORB locateServerForORB (int serverId, String orbId)
+ throws InvalidORBid, ServerNotRegistered, ServerHeldDown
+ {
+ ServerTableEntry entry = getEntry( serverId ) ;
+
+ // passing in entry to eliminate multiple lookups for
+ // the same entry in some cases
+
+ if (debug)
+ System.out.println( "ServerManagerImpl: locateServerForORB called with " +
+ " serverId=" + serverId + " orbId=" + orbId +
+ " block=true" ) ;
+ return locateServerForORB(entry, orbId, true);
+ }
+
+
+ public void handle(ObjectKey okey)
+ {
+ IOR newIOR = null;
+ ServerLocationPerORB location;
+
+ // we need to get the serverid and the orbid from the object key
+ ObjectKeyTemplate oktemp = okey.getTemplate();
+ int serverId = oktemp.getServerId() ;
+ String orbId = oktemp.getORBId() ;
+
+ try {
+ // get the ORBName corresponding to the orbMapid, that was
+ // first registered by the server
+ ServerTableEntry entry = getEntry( serverId ) ;
+ location = locateServerForORB(entry, orbId, true);
+
+ if (debug)
+ System.out.println( "ServerManagerImpl: handle called for server id" +
+ serverId + " orbid " + orbId) ;
+
+ // we received a list of ports corresponding to an ORB in a
+ // particular server, now retrieve the one corresponding
+ // to IIOP_CLEAR_TEXT, and for other created the tagged
+ // components to be added to the IOR
+
+ int clearPort = 0;
+ EndPointInfo[] listenerPorts = location.ports;
+ for (int i = 0; i < listenerPorts.length; i++) {
+ if ((listenerPorts[i].endpointType).equals(IIOP_CLEAR_TEXT.value)) {
+ clearPort = listenerPorts[i].port;
+ break;
+ }
+ }
+
+ // create a new IOR with the correct port and correct tagged
+ // components
+ IIOPAddress addr = IIOPFactories.makeIIOPAddress( orb,
+ location.hostname, clearPort ) ;
+ IIOPProfileTemplate iptemp =
+ IIOPFactories.makeIIOPProfileTemplate(
+ orb, GIOPVersion.V1_2, addr ) ;
+ if (GIOPVersion.V1_2.supportsIORIIOPProfileComponents()) {
+ iptemp.add(IIOPFactories.makeCodeSetsComponent(orb));
+ iptemp.add(IIOPFactories.makeMaxStreamFormatVersionComponent());
+ }
+ IORTemplate iortemp = IORFactories.makeIORTemplate(oktemp) ;
+ iortemp.add( iptemp ) ;
+
+ newIOR = iortemp.makeIOR(orb, "IDL:org/omg/CORBA/Object:1.0",
+ okey.getId() );
+ } catch (Exception e) {
+ throw wrapper.errorInBadServerIdHandler( e ) ;
+ }
+
+ if (debug)
+ System.out.println( "ServerManagerImpl: handle " +
+ "throws ForwardException" ) ;
+
+
+ try {
+ // This delay is required in case of Server is activated or
+ // re-activated the first time. Server needs some time before
+ // handling all the requests.
+ // (Talk to Ken to see whether there is a better way of doing this).
+ Thread.sleep( serverStartupDelay );
+ } catch ( Exception e ) {
+ System.out.println( "Exception = " + e );
+ e.printStackTrace();
+ }
+
+ throw new ForwardException(orb, newIOR);
+ }
+
+ public int getEndpoint(String endpointType) throws NoSuchEndPoint
+ {
+ return orb.getLegacyServerSocketManager()
+ .legacyGetTransientServerPort(endpointType);
+ }
+
+ public int getServerPortForType(ServerLocationPerORB location,
+ String endPointType)
+ throws NoSuchEndPoint
+ {
+ EndPointInfo[] listenerPorts = location.ports;
+ for (int i = 0; i < listenerPorts.length; i++) {
+ if ((listenerPorts[i].endpointType).equals(endPointType)) {
+ return listenerPorts[i].port;
+ }
+ }
+ throw new NoSuchEndPoint();
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerTableEntry.java b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerTableEntry.java
new file mode 100644
index 0000000..45b6d87
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerTableEntry.java
@@ -0,0 +1,543 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.activation;
+
+/**
+ *
+ * @author Anita Jindal
+ * @since JDK1.2
+ */
+
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.activation.Server;
+import com.sun.corba.se.spi.activation.EndPointInfo;
+import com.sun.corba.se.spi.activation.ORBAlreadyRegistered;
+import com.sun.corba.se.spi.activation.ORBPortInfo;
+import com.sun.corba.se.spi.activation.InvalidORBid;
+import com.sun.corba.se.spi.activation.ServerHeldDown;
+import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
+import com.sun.corba.se.spi.activation.IIOP_CLEAR_TEXT;
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.logging.ActivationSystemException ;
+
+import java.io.File;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+
+public class ServerTableEntry
+{
+
+ private final static int DE_ACTIVATED = 0;
+ private final static int ACTIVATING = 1;
+ private final static int ACTIVATED = 2;
+ private final static int RUNNING = 3;
+ private final static int HELD_DOWN = 4;
+
+
+ private String printState()
+ {
+ String str = "UNKNOWN";
+
+ switch (state) {
+ case (DE_ACTIVATED) : str = "DE_ACTIVATED"; break;
+ case (ACTIVATING ) : str = "ACTIVATING "; break;
+ case (ACTIVATED ) : str = "ACTIVATED "; break;
+ case (RUNNING ) : str = "RUNNING "; break;
+ case (HELD_DOWN ) : str = "HELD_DOWN "; break;
+ default: break;
+ }
+
+ return str;
+ }
+
+ private final static long waitTime = 2000;
+ private static final int ActivationRetryMax = 5;
+
+ // state of each entry
+ private int state;
+ private int serverId;
+ private HashMap orbAndPortInfo;
+ private Server serverObj;
+ private ServerDef serverDef;
+ private Process process;
+ private int activateRetryCount=0;
+ private String activationCmd;
+ private ActivationSystemException wrapper ;
+ public String toString()
+ {
+ return "ServerTableEntry[" + "state=" + printState() +
+ " serverId=" + serverId +
+ " activateRetryCount=" + activateRetryCount + "]" ;
+ }
+
+ // get the string needed to make the activation command
+ private static String javaHome, classPath, fileSep, pathSep;
+
+ static {
+ javaHome = System.getProperty("java.home");
+ classPath = System.getProperty("java.class.path");
+ fileSep = System.getProperty("file.separator");
+ pathSep = System.getProperty("path.separator");
+ }
+
+ ServerTableEntry( ActivationSystemException wrapper,
+ int serverId, ServerDef serverDef, int initialPort,
+ String dbDirName, boolean verify, boolean debug )
+ {
+ this.wrapper = wrapper ;
+ this.serverId = serverId;
+ this.serverDef = serverDef;
+ this.debug = debug ;
+ // create a HashMap with capacity 255
+ // Since all methods are synchronized, we don't need any
+ // additional synchronization mechanisms
+ orbAndPortInfo = new HashMap(255);
+
+ activateRetryCount = 0;
+ state = ACTIVATING;
+
+ // compute the activation command
+ activationCmd =
+
+ // add path to the java vm
+ javaHome + fileSep + "bin" + fileSep + "java " +
+
+ // add any arguments to the server Java VM
+ serverDef.serverVmArgs + " " +
+
+ // add ORB properties
+ "-Dioser=" + System.getProperty( "ioser" ) + " " +
+ "-D" + ORBConstants.INITIAL_PORT_PROPERTY + "=" + initialPort + " " +
+ "-D" + ORBConstants.DB_DIR_PROPERTY + "=" + dbDirName + " " +
+ "-D" + ORBConstants.ACTIVATED_PROPERTY + "=true " +
+ "-D" + ORBConstants.SERVER_ID_PROPERTY + "=" + serverId + " " +
+ "-D" + ORBConstants.SERVER_NAME_PROPERTY + "=" + serverDef.serverName + " " +
+ // we need to pass in the verify flag, so that the server is not
+ // launched, when we try to validate its definition during registration
+ // into the RepositoryImpl
+
+ (verify ? "-D" + ORBConstants.SERVER_DEF_VERIFY_PROPERTY + "=true ": "") +
+
+ // add classpath to the server
+ "-classpath " + classPath +
+ (serverDef.serverClassPath.equals("") == true ? "" : pathSep) +
+ serverDef.serverClassPath +
+
+ // add server class name and arguments
+ " com.sun.corba.se.impl.activation.ServerMain " + serverDef.serverArgs
+
+ // Add the debug flag, if any
+ + (debug ? " -debug" : "") ;
+
+ if (debug) System.out.println(
+ "ServerTableEntry constructed with activation command " +
+ activationCmd);
+ }
+
+ /**
+ * Verify whether the server definition is valid.
+ */
+ public int verify()
+ {
+ try {
+
+ if (debug)
+ System.out.println("Server being verified w/" + activationCmd);
+
+ process = Runtime.getRuntime().exec(activationCmd);
+ int result = process.waitFor();
+ if (debug)
+ printDebug( "verify", "returns " + ServerMain.printResult( result ) ) ;
+ return result ;
+ } catch (Exception e) {
+ if (debug)
+ printDebug( "verify", "returns unknown error because of exception " +
+ e ) ;
+ return ServerMain.UNKNOWN_ERROR;
+ }
+ }
+
+ private void printDebug(String method, String msg)
+ {
+ System.out.println("ServerTableEntry: method =" + method);
+ System.out.println("ServerTableEntry: server =" + serverId);
+ System.out.println("ServerTableEntry: state =" + printState());
+ System.out.println("ServerTableEntry: message =" + msg);
+ System.out.println();
+ }
+
+ synchronized void activate() throws org.omg.CORBA.SystemException
+ {
+ state = ACTIVATED;
+
+ try {
+ if (debug)
+ printDebug("activate", "activating server");
+ process = Runtime.getRuntime().exec(activationCmd);
+ } catch (Exception e) {
+ deActivate();
+ if (debug)
+ printDebug("activate", "throwing premature process exit");
+ throw wrapper.unableToStartProcess() ;
+ }
+ }
+
+ synchronized void register(Server server)
+ {
+ if (state == ACTIVATED) {
+
+ serverObj = server;
+
+ //state = RUNNING;
+ //notifyAll();
+
+ if (debug)
+ printDebug("register", "process registered back");
+
+ } else {
+
+ if (debug)
+ printDebug("register", "throwing premature process exit");
+ throw wrapper.serverNotExpectedToRegister() ;
+ }
+ }
+
+ synchronized void registerPorts( String orbId, EndPointInfo [] endpointList)
+ throws ORBAlreadyRegistered
+ {
+
+ // find if the ORB is already registered, then throw an exception
+ if (orbAndPortInfo.containsKey(orbId)) {
+ throw new ORBAlreadyRegistered(orbId);
+ }
+
+ // store all listener ports and their types
+ int numListenerPorts = endpointList.length;
+ EndPointInfo [] serverListenerPorts = new EndPointInfo[numListenerPorts];
+
+ for (int i = 0; i < numListenerPorts; i++) {
+ serverListenerPorts[i] = new EndPointInfo (endpointList[i].endpointType, endpointList[i].port);
+ if (debug)
+ System.out.println("registering type: " + serverListenerPorts[i].endpointType + " port " + serverListenerPorts[i].port);
+ }
+
+ // put this set of listener ports in the HashMap associated
+ // with the orbId
+ orbAndPortInfo.put(orbId, serverListenerPorts);
+ if (state == ACTIVATED) {
+ state = RUNNING;
+ notifyAll();
+ }
+ // _REVISIT_, If the state is not equal to ACTIVATED then it is a bug
+ // need to log that error, once the Logging framework is in place
+ // for rip-int.
+ if (debug)
+ printDebug("registerPorts", "process registered Ports");
+ }
+
+ void install()
+ {
+ Server localServerObj = null;
+ synchronized ( this ) {
+ if (state == RUNNING)
+ localServerObj = serverObj;
+ else
+ throw wrapper.serverNotRunning() ;
+ }
+ if (localServerObj != null) {
+ localServerObj.install() ;
+ }
+
+ }
+
+ void uninstall()
+ {
+ Server localServerObj = null;
+ Process localProcess = null;
+
+ synchronized (this) {
+ localServerObj = serverObj;
+ localProcess = process;
+
+ if (state == RUNNING) {
+
+ deActivate();
+
+ } else {
+ throw wrapper.serverNotRunning() ;
+ }
+ }
+ try {
+ if (localServerObj != null) {
+ localServerObj.shutdown(); // shutdown the server
+ localServerObj.uninstall() ; // call the uninstall
+ }
+
+ if (localProcess != null) {
+ localProcess.destroy();
+ }
+ } catch (Exception ex) {
+ // what kind of exception should be thrown
+ }
+ }
+
+ synchronized void holdDown()
+ {
+ state = HELD_DOWN;
+
+ if (debug)
+ printDebug( "holdDown", "server held down" ) ;
+
+ notifyAll();
+ }
+
+ synchronized void deActivate()
+ {
+ state = DE_ACTIVATED;
+
+ if (debug)
+ printDebug( "deActivate", "server deactivated" ) ;
+
+ notifyAll();
+ }
+
+ synchronized void checkProcessHealth( ) {
+ // If the State in the ServerTableEntry is RUNNING and the
+ // Process was shut down abnormally, The method will change the
+ // server state as De-Activated.
+ if( state == RUNNING ) {
+ try {
+ int exitVal = process.exitValue();
+ } catch (IllegalThreadStateException e1) {
+ return;
+ }
+ synchronized ( this ) {
+ // Clear the PortInformation as it is old
+ orbAndPortInfo.clear();
+ // Move the state to De-Activated, So that the next
+ // call to this server will re-activate.
+ deActivate();
+ }
+ }
+ }
+
+ synchronized boolean isValid()
+ {
+ if ((state == ACTIVATING) || (state == HELD_DOWN)) {
+ if (debug)
+ printDebug( "isValid", "returns true" ) ;
+
+ return true;
+ }
+
+ try {
+ int exitVal = process.exitValue();
+ } catch (IllegalThreadStateException e1) {
+ return true;
+ }
+
+ if (state == ACTIVATED) {
+ if (activateRetryCount < ActivationRetryMax) {
+ if (debug)
+ printDebug("isValid", "reactivating server");
+ activateRetryCount++;
+ activate();
+ return true;
+ }
+
+ if (debug)
+ printDebug("isValid", "holding server down");
+
+ holdDown();
+ return true;
+ }
+
+ deActivate();
+ return false;
+ }
+
+ synchronized ORBPortInfo[] lookup(String endpointType) throws ServerHeldDown
+ {
+ while ((state == ACTIVATING) || (state == ACTIVATED)) {
+ try {
+ wait(waitTime);
+ if (!isValid()) break;
+ } catch(Exception e) {}
+ }
+ ORBPortInfo[] orbAndPortList = null;
+
+ if (state == RUNNING) {
+ orbAndPortList = new ORBPortInfo[orbAndPortInfo.size()];
+ Iterator setORBids = orbAndPortInfo.keySet().iterator();
+
+ try {
+ int numElements = 0;
+ int i;
+ int port;
+ while (setORBids.hasNext()) {
+ String orbId = (String) setORBids.next();
+ // get an entry corresponding to orbId
+ EndPointInfo [] serverListenerPorts = (EndPointInfo []) orbAndPortInfo.get(orbId);
+ port = -1;
+ // return the port corresponding to the endpointType
+ for (i = 0; i < serverListenerPorts.length; i++) {
+ if (debug)
+ System.out.println("lookup num-ports " + serverListenerPorts.length + " " +
+ serverListenerPorts[i].endpointType + " " +
+ serverListenerPorts[i].port );
+ if ((serverListenerPorts[i].endpointType).equals(endpointType)) {
+ port = serverListenerPorts[i].port;
+ break;
+ }
+ }
+ orbAndPortList[numElements] = new ORBPortInfo(orbId, port);
+ numElements++;
+ }
+ } catch (NoSuchElementException e) {
+ // have everything in the table
+ }
+ return orbAndPortList;
+ }
+
+ if (debug)
+ printDebug("lookup", "throwing server held down error");
+
+ throw new ServerHeldDown( serverId ) ;
+ }
+
+ synchronized EndPointInfo[] lookupForORB(String orbId)
+ throws ServerHeldDown, InvalidORBid
+ {
+ while ((state == ACTIVATING) || (state == ACTIVATED)) {
+ try {
+ wait(waitTime);
+ if (!isValid()) break;
+ } catch(Exception e) {}
+ }
+ EndPointInfo[] portList = null;
+
+ if (state == RUNNING) {
+
+ try {
+
+ // get an entry corresponding to orbId
+ EndPointInfo [] serverListenerPorts = (EndPointInfo []) orbAndPortInfo.get(orbId);
+
+ portList = new EndPointInfo[serverListenerPorts.length];
+ // return the port corresponding to the endpointType
+ for (int i = 0; i < serverListenerPorts.length; i++) {
+ if (debug)
+ System.out.println("lookup num-ports " + serverListenerPorts.length + " "
+ + serverListenerPorts[i].endpointType + " " +
+ serverListenerPorts[i].port );
+ portList[i] = new EndPointInfo(serverListenerPorts[i].endpointType, serverListenerPorts[i].port);
+ }
+ } catch (NoSuchElementException e) {
+ // no element in HashMap corresponding to ORBid found
+ throw new InvalidORBid();
+ }
+ return portList;
+ }
+
+ if (debug)
+ printDebug("lookup", "throwing server held down error");
+
+ throw new ServerHeldDown( serverId ) ;
+ }
+
+ synchronized String[] getORBList()
+ {
+ String [] orbList = new String[orbAndPortInfo.size()];
+ Iterator setORBids = orbAndPortInfo.keySet().iterator();
+
+ try {
+ int numElements = 0;
+ while (setORBids.hasNext()) {
+ String orbId = (String) setORBids.next();
+ orbList[numElements++] = orbId ;
+ }
+ } catch (NoSuchElementException e) {
+ // have everything in the table
+ }
+ return orbList;
+ }
+
+ int getServerId()
+ {
+ return serverId;
+ }
+
+ boolean isActive()
+ {
+ return (state == RUNNING) || (state == ACTIVATED);
+ }
+
+ synchronized void destroy()
+ {
+
+ Server localServerObj = null;
+ Process localProcess = null;
+
+ synchronized (this) {
+ localServerObj = serverObj;
+ localProcess = process;
+
+ deActivate();
+ }
+
+ try {
+ if (localServerObj != null)
+ localServerObj.shutdown();
+
+ if (debug)
+ printDebug( "destroy", "server shutdown successfully" ) ;
+ } catch (Exception ex) {
+ if (debug)
+ printDebug( "destroy",
+ "server shutdown threw exception" + ex ) ;
+ // ex.printStackTrace();
+ }
+
+ try {
+ if (localProcess != null)
+ localProcess.destroy();
+
+ if (debug)
+ printDebug( "destroy", "process destroyed successfully" ) ;
+ } catch (Exception ex) {
+ if (debug)
+ printDebug( "destroy",
+ "process destroy threw exception" + ex ) ;
+
+ // ex.printStackTrace();
+ }
+ }
+
+ private boolean debug = false;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerTool.java b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerTool.java
new file mode 100644
index 0000000..6d48107
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/activation/ServerTool.java
@@ -0,0 +1,973 @@
+/*
+ * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.activation;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.io.PrintStream;
+import java.util.Vector;
+import java.util.Properties;
+import java.util.StringTokenizer;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA.CompletionStatus;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
+import com.sun.corba.se.spi.activation.*;
+import com.sun.corba.se.spi.activation.ServerHeldDown;
+import com.sun.corba.se.spi.activation.RepositoryPackage.ServerDef;
+import com.sun.corba.se.spi.activation.LocatorPackage.ServerLocation;
+import com.sun.corba.se.spi.activation.LocatorPackage.ServerLocationPerORB;
+
+/**
+ *
+ * @author Anita Jindal
+ * @since JDK1.3
+ */
+public class ServerTool
+{
+ final static String helpCommand = "help";
+ final static String toolName = "servertool";
+ final static String commandArg = "-cmd";
+
+ static int getServerIdForAlias( ORB orb, String applicationName ) throws ServerNotRegistered
+ {
+ try {
+ Repository rep = RepositoryHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ) ) ;
+ int serverid = rep.getServerID(applicationName);
+
+ return rep.getServerID( applicationName ) ;
+ } catch (Exception ex) {
+ throw (new ServerNotRegistered());
+ }
+ }
+
+ void run(String[] args)
+ {
+ String[] cmd = null;
+
+ // if command specified in the args, get it
+ for (int i=0; i < args.length; i++) {
+
+ if (args[i].equals(commandArg)) {
+ // get the command
+ int cmdLen = args.length - i - 1;
+ cmd = new String[cmdLen];
+ for (int j=0; j < cmdLen; j++) cmd[j] = args[++i];
+
+ break;
+ }
+ }
+
+ try {
+ // create the POA ORB
+ Properties props = System.getProperties() ;
+ props.put("org.omg.CORBA.ORBClass",
+ "com.sun.corba.se.impl.orb.ORBImpl" );
+ orb = (ORB) ORB.init(args, props);
+
+ // if command specified in the args, process it
+ if (cmd != null) executeCommand(cmd);
+ else { // process commands interactively
+
+ // create a buffered reader to read commands from standard in
+ BufferedReader in = new
+ BufferedReader(new InputStreamReader(System.in));
+
+ // print tool banner
+ System.out.println(CorbaResourceUtil.getText("servertool.banner"));
+
+ // process commands until user quits
+ while (true) {
+ cmd = readCommand(in);
+ if (cmd != null) executeCommand(cmd);
+ else printAvailableCommands();
+ }
+ }
+ } catch (Exception ex) {
+ System.out.println(CorbaResourceUtil.getText("servertool.usage", "servertool"));
+ System.out.println();
+ ex.printStackTrace();
+ }
+ }
+
+ public static void main(String[] args)
+ {
+ ServerTool tool = new ServerTool();
+ tool.run(args);
+ }
+
+ String[] readCommand(BufferedReader in)
+ {
+ System.out.print(toolName + " > ");
+
+ try {
+ int i = 0;
+ String cmd[] = null;
+
+ String cmdLine = in.readLine();
+
+ if (cmdLine != null) {
+ StringTokenizer st = new StringTokenizer(cmdLine);
+ if (st.countTokens() != 0) {
+ cmd = new String[st.countTokens()];
+ while (st.hasMoreTokens()) cmd[i++] = st.nextToken();
+ }
+ }
+
+ return cmd;
+ } catch (Exception ex) {
+ System.out.println(CorbaResourceUtil.getText("servertool.usage", "servertool"));
+ System.out.println();
+ ex.printStackTrace();
+ }
+
+ return null;
+ }
+
+ void printAvailableCommands()
+ {
+ CommandHandler handler;
+
+ // print short help
+ System.out.println(CorbaResourceUtil.getText("servertool.shorthelp"));
+
+ for (int i=0; i < handlers.size(); i++) {
+ handler = (CommandHandler) handlers.elementAt(i);
+ System.out.print("\t" + handler.getCommandName());
+ for (int j=handler.getCommandName().length();
+ j < maxNameLen; j++) System.out.print(" ");
+ System.out.print(" - ");
+ handler.printCommandHelp(System.out,
+ CommandHandler.shortHelp);
+ }
+
+ System.out.println();
+ }
+
+ void executeCommand(String[] cmd)
+ {
+ boolean result;
+ CommandHandler handler;
+
+ // handle the help command
+ if (cmd[0].equals(helpCommand)) {
+ if (cmd.length == 1) printAvailableCommands();
+ else {
+ // print long help for a specific command
+ for (int i=0; i < handlers.size(); i++) {
+ handler = (CommandHandler) handlers.elementAt(i);
+ if (handler.getCommandName().equals(cmd[1])) {
+ handler.printCommandHelp(System.out,
+ CommandHandler.longHelp);
+ }
+ }
+ }
+
+ return;
+ }
+
+ // determine the subcommand and execute it
+ for (int i=0; i < handlers.size(); i++) {
+ handler = (CommandHandler) handlers.elementAt(i);
+ if (handler.getCommandName().equals(cmd[0])) {
+ String[] cmdArgs = new String[cmd.length - 1];
+
+ // construct args to the command
+ for (int j=0; j < cmdArgs.length; j++)
+ cmdArgs[j] = cmd[j+1];
+
+ // execute the command
+ try {
+ System.out.println();
+
+ result = handler.processCommand(cmdArgs, orb, System.out);
+
+ if (result == CommandHandler.parseError) {
+ handler.printCommandHelp(System.out,
+ CommandHandler.longHelp);
+ }
+
+ System.out.println();
+
+ } catch (Exception ex) {}
+
+ return;
+ }
+ }
+
+ // unknown command - print available commands
+ printAvailableCommands();
+ }
+
+ final private static boolean debug = false;
+
+ ORB orb = null;
+
+ static Vector handlers;
+ static int maxNameLen;
+
+ static {
+ handlers = new Vector();
+ handlers.addElement(new RegisterServer());
+ handlers.addElement(new UnRegisterServer());
+ handlers.addElement(new GetServerID());
+ handlers.addElement(new ListServers());
+ handlers.addElement(new ListAliases());
+ handlers.addElement(new ListActiveServers());
+ handlers.addElement(new LocateServer());
+ handlers.addElement(new LocateServerForORB());
+ handlers.addElement(new ListORBs());
+ handlers.addElement(new ShutdownServer());
+ handlers.addElement(new StartServer());
+ handlers.addElement(new Help());
+ handlers.addElement(new Quit());
+
+ // determine longest command name
+ maxNameLen = 0;
+ int cmdNameLen;
+ for (int i=0; i < handlers.size(); i++) {
+ CommandHandler handler = (CommandHandler) handlers.elementAt(i);
+ cmdNameLen = handler.getCommandName().length();
+ if (cmdNameLen > maxNameLen) maxNameLen = cmdNameLen;
+ }
+ }
+}
+
+class RegisterServer implements CommandHandler
+{
+ public String getCommandName() {return "register";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.register"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.register1"));
+ }
+ }
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ int i=0;
+ String applicationName = "";
+ String name = "";
+ String classpath = "";
+ String args = "";
+ String vmargs = "";
+ int serverId = 0;
+
+ // parse register server command
+ String arg;
+ while (i < cmdArgs.length) {
+
+ arg = cmdArgs[i++];
+
+ if (arg.equals("-server")) {
+ if (i < cmdArgs.length) name = cmdArgs[i++];
+ else return parseError;
+ } else if (arg.equals("-applicationName")) {
+ if (i < cmdArgs.length) applicationName = cmdArgs[i++];
+ else return parseError;
+ } else if (arg.equals("-classpath")) {
+ if (i < cmdArgs.length) classpath = cmdArgs[i++];
+ else return parseError;
+ } else if (arg.equals("-args")) {
+ while ((i < cmdArgs.length) && !cmdArgs[i].equals("-vmargs")){
+ args = args.equals("") ? cmdArgs[i] :
+ args + " " + cmdArgs[i];
+ i++;
+ }
+ if (args.equals("")) return parseError;
+ } else if (arg.equals("-vmargs")) {
+ while ((i < cmdArgs.length) && !cmdArgs[i].equals("-args")){
+ vmargs = vmargs.equals("") ? cmdArgs[i] :
+ vmargs + " " + cmdArgs[i];
+ i++;
+ }
+ if (vmargs.equals("")) return parseError;
+ } else return parseError;
+ }
+
+ // minimally the server class name has to be specified
+ if (name.equals("")) return parseError;
+
+ // register server and activate it
+ try {
+ // register the server with the repository
+ Repository repository = RepositoryHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
+
+ ServerDef server = new ServerDef(applicationName, name, classpath, args, vmargs);
+ serverId = repository.registerServer(server);
+
+ // activate the server
+ Activator activator = ActivatorHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
+ activator.activate(serverId);
+ activator.install(serverId);
+
+ // print success message
+ out.println(CorbaResourceUtil.getText("servertool.register2", serverId));
+ } catch (ServerNotRegistered ex) {
+ } catch (ServerAlreadyActive ex) {
+ } catch (ServerHeldDown ex) {
+ out.println(CorbaResourceUtil.getText("servertool.register3", serverId));
+ } catch (ServerAlreadyRegistered ex) {
+ out.println(CorbaResourceUtil.getText("servertool.register4", serverId));
+ } catch (BadServerDefinition ex) {
+ out.println(CorbaResourceUtil.getText("servertool.baddef", ex.reason));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return commandDone;
+ }
+}
+
+class UnRegisterServer implements CommandHandler
+{
+ public String getCommandName() {return "unregister";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.unregister"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.unregister1"));
+ }
+}
+
+ final static int illegalServerId = -1;
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ int serverId = illegalServerId;
+
+ try {
+ if (cmdArgs.length == 2) {
+ if (cmdArgs[0].equals("-serverid"))
+ serverId = (Integer.valueOf(cmdArgs[1])).intValue();
+ else if (cmdArgs[0].equals("-applicationName"))
+ serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
+ }
+
+ // the server id has to be specified
+ if (serverId == illegalServerId)
+ return parseError;
+
+ // deactivate server, hold it down and and unregister it
+ // deactivate the server
+ try {
+ Activator activator = ActivatorHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
+ activator.uninstall(serverId);
+ } catch (ServerHeldDown ex) {}
+
+ // unregister the server from the repository
+ Repository repository = RepositoryHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
+ repository.unregisterServer(serverId);
+
+ // print success message
+ out.println(CorbaResourceUtil.getText("servertool.unregister2"));
+ } catch (ServerNotRegistered ex) {
+ out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return commandDone;
+ }
+}
+
+class LocateServer implements CommandHandler
+{
+ public String getCommandName() {return "locate";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.locate"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.locate1"));
+ }
+ }
+
+ final static int illegalServerId = -1;
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ int serverId = illegalServerId;
+
+ String endPointType = IIOP_CLEAR_TEXT.value;
+ try {
+
+ // parse command
+ String arg;
+ int i = 0;
+ while (i < cmdArgs.length) {
+
+ arg = cmdArgs[i++];
+
+ if (arg.equals("-serverid")) {
+ if (i < cmdArgs.length)
+ serverId = (Integer.valueOf(cmdArgs[i++])).intValue();
+ else
+ return parseError;
+ } else if (arg.equals("-applicationName")) {
+ if (i < cmdArgs.length)
+ serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[i++] ) ;
+ else
+ return parseError;
+ } else if (arg.equals("-endpointType")) {
+ if (i < cmdArgs.length)
+ endPointType = cmdArgs[i++];
+ }
+ }
+
+ // the server id has to be specified
+ if (serverId == illegalServerId)
+ return parseError;
+
+ // locate the server
+ // deactivate the server
+ Locator locator = LocatorHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_LOCATOR_NAME ));
+
+ ServerLocation location = locator.locateServer(serverId, endPointType);
+
+ // print success message
+ out.println(CorbaResourceUtil.getText("servertool.locate2", location.hostname));
+ int numEntries = location.ports.length;
+ for (i = 0; i < numEntries; i++) {
+ ORBPortInfo orbPort = location.ports[i];
+ out.println("\t\t"+ orbPort.port + "\t\t" + endPointType + "\t\t" + orbPort.orbId );
+ }
+ } catch (NoSuchEndPoint ex) {
+ } catch (ServerHeldDown ex) {
+ out.println(CorbaResourceUtil.getText("servertool.helddown"));
+ } catch (ServerNotRegistered ex) {
+ out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return commandDone;
+ }
+}
+
+class LocateServerForORB implements CommandHandler
+{
+ public String getCommandName() {return "locateperorb";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.locateorb"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.locateorb1"));
+ }
+ }
+
+ final static int illegalServerId = -1;
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ int serverId = illegalServerId;
+
+ String orbId = "";
+ try {
+
+ // parse command
+ String arg;
+ int i = 0;
+ while (i < cmdArgs.length) {
+
+ arg = cmdArgs[i++];
+
+ if (arg.equals("-serverid")) {
+ if (i < cmdArgs.length)
+ serverId = (Integer.valueOf(cmdArgs[i++])).intValue();
+ else
+ return parseError;
+ } else if (arg.equals("-applicationName")) {
+ if (i < cmdArgs.length)
+ serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[i++] ) ;
+ else
+ return parseError;
+ } else if (arg.equals("-orbid")) {
+ if (i < cmdArgs.length)
+ orbId = cmdArgs[i++];
+ }
+ }
+
+ // the server id has to be specified
+ if (serverId == illegalServerId)
+ return parseError;
+
+ // locate the server
+ // deactivate the server
+ Locator locator = LocatorHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_LOCATOR_NAME ));
+
+ ServerLocationPerORB location = locator.locateServerForORB(serverId,
+ orbId);
+
+ // print success message
+ out.println(CorbaResourceUtil.getText("servertool.locateorb2", location.hostname));
+ int numEntries = location.ports.length;
+ for (i = 0; i < numEntries; i++) {
+ EndPointInfo Port = location.ports[i];
+ out.println("\t\t"+ Port.port + "\t\t" + Port.endpointType + "\t\t" + orbId );
+ }
+ } catch (InvalidORBid ex) {
+ out.println(CorbaResourceUtil.getText("servertool.nosuchorb"));
+ } catch (ServerHeldDown ex) {
+ out.println(CorbaResourceUtil.getText("servertool.helddown"));
+ } catch (ServerNotRegistered ex) {
+ out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return commandDone;
+ }
+}
+
+class GetServerID implements CommandHandler
+{
+ public String getCommandName() {return "getserverid" ; }
+
+ public void printCommandHelp( PrintStream out, boolean helpType )
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.getserverid"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.getserverid1"));
+ }
+ }
+
+ public boolean processCommand( String[] cmdArgs, ORB orb, PrintStream out )
+ {
+ if ((cmdArgs.length == 2) && cmdArgs[0].equals( "-applicationName" )) {
+ String str = (String)cmdArgs[1] ;
+
+ try {
+ Repository repository = RepositoryHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
+
+ try {
+ int result = repository.getServerID( str ) ;
+ out.println() ;
+ out.println(CorbaResourceUtil.getText("servertool.getserverid2", str, Integer.toString(result)));
+ out.println() ;
+ } catch (ServerNotRegistered e) {
+ out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace() ;
+ }
+
+ return commandDone ;
+ } else
+ return parseError ;
+ }
+}
+
+class ListServers implements CommandHandler
+{
+ public String getCommandName() {return "list";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.list"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.list1"));
+ }
+ }
+
+ final static int illegalServerId = -1;
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ int serverId = illegalServerId;
+ boolean listOneServer = false;
+ ServerDef serverDef;
+
+ // determine if list single server or all servers
+ listOneServer = (cmdArgs.length!=0) ;
+ if ((cmdArgs.length == 2) && cmdArgs[0].equals("-serverid"))
+ serverId = (Integer.valueOf(cmdArgs[1])).intValue();
+
+ if ((serverId == illegalServerId) && listOneServer)
+ return parseError;
+
+ // process the list server command
+ try {
+ Repository repository = RepositoryHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
+
+ if (listOneServer) {
+
+ try {
+ serverDef = repository.getServer(serverId);
+ out.println();
+ printServerDef(serverDef, serverId, out);
+ out.println();
+ } catch (ServerNotRegistered e) {
+ out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
+ }
+
+ } else {
+ int[] servers = repository.listRegisteredServers();
+ out.println(CorbaResourceUtil.getText("servertool.list2"));
+
+ sortServers(servers);
+ for (int i=0; i < servers.length; i++) {
+ try {
+ serverDef = repository.getServer(servers[i]);
+ out.println("\t " + servers[i] + "\t\t" +
+ serverDef.serverName + "\t\t"
+ + serverDef.applicationName);
+ } catch (ServerNotRegistered e) {}
+ }
+
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return commandDone;
+ }
+
+static void printServerDef(ServerDef serverDef, int serverId,
+ PrintStream out)
+{
+ out.println(CorbaResourceUtil.getText("servertool.appname", serverDef.applicationName));
+ out.println(CorbaResourceUtil.getText("servertool.name", serverDef.serverName));
+ out.println(CorbaResourceUtil.getText("servertool.classpath", serverDef.serverClassPath));
+ out.println(CorbaResourceUtil.getText("servertool.args", serverDef.serverArgs));
+ out.println(CorbaResourceUtil.getText("servertool.vmargs", serverDef.serverVmArgs));
+ out.println(CorbaResourceUtil.getText("servertool.serverid", serverId));
+}
+
+/**
+ * Do a simple bubble sort to sort the server ids in ascending
+ * order.
+ */
+static void sortServers(int[] serverIds)
+{
+ int size = serverIds.length;
+ int lowest;
+
+ for (int i=0; i < size; i++) {
+
+ lowest = i;
+
+ for (int j=i+1; j < size; j++) {
+ if (serverIds[j] < serverIds[lowest]) lowest = j;
+ }
+
+ if (lowest != i) {
+ int temp = serverIds[i];
+ serverIds[i] = serverIds[lowest];
+ serverIds[lowest] = temp;
+ }
+ }
+}
+}
+
+class ListActiveServers implements CommandHandler
+{
+ public String getCommandName() {return "listactive";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.listactive"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.listactive1"));
+ }
+ }
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ ServerDef serverDef;
+
+ // process the list active servers command
+ try {
+ Repository repository = RepositoryHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
+
+ Activator activator = ActivatorHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
+
+ int[] servers = activator.getActiveServers();
+
+ out.println(CorbaResourceUtil.getText("servertool.list2"));
+
+ ListServers.sortServers(servers);
+ for (int i=0; i < servers.length; i++) {
+ try {
+ serverDef = repository.getServer(servers[i]);
+ out.println("\t " + servers[i] + "\t\t" +
+ serverDef.serverName + "\t\t" +
+ serverDef.applicationName);
+ } catch (ServerNotRegistered e) {}
+ }
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return commandDone;
+ }
+}
+
+class ListAliases implements CommandHandler
+{
+ public String getCommandName() {return "listappnames";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.listappnames"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.listappnames1"));
+ }
+ }
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ try {
+ Repository repository = RepositoryHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_REPOSITORY_NAME ));
+
+ String[] applicationNames = repository.getApplicationNames();
+
+ out.println(CorbaResourceUtil.getText("servertool.listappnames2"));
+ out.println();
+ for (int i=0; i < applicationNames.length; i++)
+ out.println( "\t" + applicationNames[i] ) ;
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return commandDone;
+ }
+}
+
+class ShutdownServer implements CommandHandler
+{
+ public String getCommandName() {return "shutdown";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.shutdown"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.shutdown1"));
+ }
+ }
+
+ final static int illegalServerId = -1;
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ int serverId = illegalServerId;
+
+ try {
+ // determine the server id
+ if (cmdArgs.length == 2)
+ if (cmdArgs[0].equals("-serverid"))
+ serverId = (Integer.valueOf(cmdArgs[1])).intValue();
+ else if (cmdArgs[0].equals("-applicationName"))
+ serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
+
+ if (serverId == illegalServerId)
+ return parseError;
+
+ // shutdown the server
+ Activator activator = ActivatorHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
+ activator.shutdown(serverId);
+
+ out.println(CorbaResourceUtil.getText("servertool.shutdown2"));
+ } catch (ServerNotActive ex) {
+ out.println(CorbaResourceUtil.getText("servertool.servernotrunning"));
+ } catch (ServerNotRegistered ex) {
+ out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return commandDone;
+ }
+}
+
+class StartServer implements CommandHandler
+{
+ public String getCommandName() {return "startup";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.startserver"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.startserver1"));
+ }
+ }
+
+ final static int illegalServerId = -1;
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ int serverId = illegalServerId;
+
+ try {
+ // determine the server id
+ if (cmdArgs.length == 2)
+ if (cmdArgs[0].equals("-serverid"))
+ serverId = (Integer.valueOf(cmdArgs[1])).intValue();
+ else if (cmdArgs[0].equals("-applicationName"))
+ serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
+
+ if (serverId == illegalServerId)
+ return parseError;
+
+ // startup the server
+ Activator activator = ActivatorHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
+ activator.activate(serverId);
+
+ out.println(CorbaResourceUtil.getText("servertool.startserver2"));
+ } catch (ServerNotRegistered ex) {
+ out.println(CorbaResourceUtil.getText("servertool.nosuchserver"));
+ } catch (ServerAlreadyActive ex) {
+ out.println(CorbaResourceUtil.getText("servertool.serverup"));
+ } catch (ServerHeldDown ex) {
+ out.println(CorbaResourceUtil.getText("servertool.helddown"));
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ return commandDone;
+ }
+}
+
+class Quit implements CommandHandler
+{
+ public String getCommandName() {return "quit";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.quit"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.quit1"));
+ }
+ }
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ System.exit(0);
+
+ return commandDone;
+ }
+}
+
+class Help implements CommandHandler
+{
+ public String getCommandName() {return "help";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.help"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.help1"));
+ }
+ }
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+ return commandDone;
+ }
+}
+
+class ListORBs implements CommandHandler
+{
+ public String getCommandName() {return "orblist";}
+
+ public void printCommandHelp(PrintStream out, boolean helpType)
+ {
+ if (helpType == longHelp) {
+ out.println(CorbaResourceUtil.getText("servertool.orbidmap"));
+ } else {
+ out.println(CorbaResourceUtil.getText("servertool.orbidmap1"));
+ }
+ }
+
+ final static int illegalServerId = -1;
+
+ public boolean processCommand(String[] cmdArgs, ORB orb, PrintStream out)
+ {
+
+ int serverId = illegalServerId;
+
+ try {
+ if (cmdArgs.length == 2) {
+ if (cmdArgs[0].equals("-serverid"))
+ serverId = (Integer.valueOf(cmdArgs[1])).intValue();
+ else if (cmdArgs[0].equals("-applicationName"))
+ serverId = ServerTool.getServerIdForAlias( orb, cmdArgs[1] ) ;
+ }
+
+ // the server id has to be specified
+ if (serverId == illegalServerId)
+ return parseError;
+ // activate the server
+ Activator activator = ActivatorHelper.narrow(
+ orb.resolve_initial_references( ORBConstants.SERVER_ACTIVATOR_NAME ));
+
+ String[] orbList = activator.getORBNames(serverId);
+
+ out.println(CorbaResourceUtil.getText("servertool.orbidmap2"));
+
+ for (int i = 0; i < orbList.length ; i++) {
+ out.println("\t "+ orbList[i]);
+ }
+ } catch (ServerNotRegistered ex) {
+ out.println("\tno such server found.");
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+
+ return commandDone;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/CopierManagerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/CopierManagerImpl.java
new file mode 100644
index 0000000..d55e13d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/CopierManagerImpl.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.copyobject ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.orbutil.DenseIntMapImpl ;
+
+import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
+import com.sun.corba.se.spi.copyobject.CopierManager ;
+import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
+
+public class CopierManagerImpl implements CopierManager
+{
+ private int defaultId ;
+ private DenseIntMapImpl map ;
+ private ORB orb ;
+
+ public CopierManagerImpl( ORB orb )
+ {
+ defaultId = 0 ;
+ map = new DenseIntMapImpl() ;
+ this.orb = orb ;
+ }
+
+ public void setDefaultId( int id )
+ {
+ defaultId = id ;
+ }
+
+ public int getDefaultId()
+ {
+ return defaultId ;
+ }
+
+ public ObjectCopierFactory getObjectCopierFactory( int id )
+ {
+ return (ObjectCopierFactory)(map.get( id )) ;
+ }
+
+ public ObjectCopierFactory getDefaultObjectCopierFactory()
+ {
+ return (ObjectCopierFactory)(map.get( defaultId )) ;
+ }
+
+ public void registerObjectCopierFactory( ObjectCopierFactory factory, int id )
+ {
+ map.set( id, factory ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java
new file mode 100644
index 0000000..0a5c30f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/FallbackObjectCopierImpl.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.copyobject ;
+
+import com.sun.corba.se.spi.copyobject.ObjectCopier ;
+import com.sun.corba.se.spi.copyobject.ReflectiveCopyException ;
+
+/** Trys a first ObjectCopier. If the first throws a ReflectiveCopyException,
+ * falls back and tries a second ObjectCopier.
+ */
+public class FallbackObjectCopierImpl implements ObjectCopier
+{
+ private ObjectCopier first ;
+ private ObjectCopier second ;
+
+ public FallbackObjectCopierImpl( ObjectCopier first,
+ ObjectCopier second )
+ {
+ this.first = first ;
+ this.second = second ;
+ }
+
+ public Object copy( Object src ) throws ReflectiveCopyException
+ {
+ try {
+ return first.copy( src ) ;
+ } catch (ReflectiveCopyException rce ) {
+ // XXX log this fallback at a low level
+ return second.copy( src ) ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java
new file mode 100644
index 0000000..6b4118f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/JavaStreamObjectCopierImpl.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.copyobject ;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.rmi.MarshalException;
+
+import java.io.InputStream ;
+import java.io.OutputStream ;
+import java.io.ByteArrayInputStream ;
+import java.io.ByteArrayOutputStream ;
+import java.io.ObjectInputStream ;
+import java.io.ObjectOutputStream ;
+
+import org.omg.CORBA.ORB ;
+
+import com.sun.corba.se.spi.copyobject.ObjectCopier ;
+import com.sun.corba.se.impl.util.Utility;
+
+public class JavaStreamObjectCopierImpl implements ObjectCopier {
+
+ public JavaStreamObjectCopierImpl( ORB orb )
+ {
+ this.orb = orb ;
+ }
+
+ 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);
+ }
+
+ try {
+ ByteArrayOutputStream os = new ByteArrayOutputStream( 10000 ) ;
+ ObjectOutputStream oos = new ObjectOutputStream( os ) ;
+ oos.writeObject( obj ) ;
+
+ byte[] arr = os.toByteArray() ;
+ InputStream is = new ByteArrayInputStream( arr ) ;
+ ObjectInputStream ois = new ObjectInputStream( is ) ;
+
+ return ois.readObject();
+ } catch (Exception exc) {
+ System.out.println( "Failed with exception:" + exc ) ;
+ return null ;
+ }
+ }
+
+ private ORB orb;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java
new file mode 100644
index 0000000..d1526ba
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ORBStreamObjectCopierImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.copyobject ;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.rmi.MarshalException;
+
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import org.omg.CORBA.ORB ;
+
+import com.sun.corba.se.spi.copyobject.ObjectCopier ;
+import com.sun.corba.se.impl.util.Utility;
+
+public class ORBStreamObjectCopierImpl implements ObjectCopier {
+
+ public ORBStreamObjectCopierImpl( ORB orb )
+ {
+ this.orb = orb ;
+ }
+
+ 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);
+ }
+
+ OutputStream out = (OutputStream)orb.create_output_stream();
+ out.write_value((Serializable)obj);
+ InputStream in = (InputStream)out.create_input_stream();
+ return in.read_value();
+ }
+
+ private ORB orb;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java
new file mode 100644
index 0000000..a1e5c83
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/copyobject/ReferenceObjectCopierImpl.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.copyobject ;
+
+import com.sun.corba.se.spi.copyobject.ObjectCopier ;
+
+public class ReferenceObjectCopierImpl implements ObjectCopier
+{
+ public Object copy( Object obj )
+ {
+ return obj ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java
new file mode 100644
index 0000000..f4af634
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImpl.java
@@ -0,0 +1,1351 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.List ;
+import java.util.ArrayList ;
+
+import org.omg.CORBA.Principal ;
+import org.omg.CORBA.TypeCode ;
+import org.omg.CORBA.Any ;
+import org.omg.CORBA.CompletionStatus ;
+import org.omg.CORBA.TCKind ;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.EncapsInputStream;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+import com.sun.corba.se.impl.io.ValueUtility;
+import com.sun.corba.se.impl.orbutil.RepositoryIdFactory;
+import com.sun.corba.se.impl.orbutil.RepositoryIdStrings;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+// subclasses must provide a matching helper class
+public class AnyImpl extends Any
+{
+ private static final class AnyInputStream extends EncapsInputStream
+ {
+ public AnyInputStream(EncapsInputStream theStream )
+ {
+ super( theStream );
+ }
+ }
+
+ private static final class AnyOutputStream extends EncapsOutputStream
+ {
+ public AnyOutputStream(ORB orb)
+ {
+ super((ORB)orb);
+ }
+
+ 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<AnyInputStream>() {
+ @Override
+ public AnyInputStream run() {
+ return new AnyInputStream(
+ (com.sun.corba.se.impl.encoding.EncapsInputStream) is);
+ }
+ });
+ return aIS;
+ }
+ }
+
+ //
+ // Always valid.
+ //
+ private TypeCodeImpl typeCode;
+ protected ORB orb;
+ private ORBUtilSystemException wrapper ;
+
+ //
+ // Validity depends upon typecode. The 'value' and 'object' instance
+ // members are used to hold immutable types as defined by the
+ // isStreamed[] table below. Otherwise, 'stream' is non-null and
+ // holds the value in CDR marshaled format. As an optimization, the
+ // stream type is an Any extension of CDR stream that is used to
+ // detect an optimization in read_value().
+ //
+ private CDRInputStream stream;
+ private long value;
+ private java.lang.Object object;
+
+ // Setting the typecode via the type() accessor wipes out the value.
+ // An attempt to extract before the value is set will result
+ // in a BAD_OPERATION exception being raised.
+ private boolean isInitialized = false;
+
+ private static final int DEFAULT_BUFFER_SIZE = 32;
+
+ /*
+ * 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 AnyImpl convertToNative(ORB orb, Any any) {
+ if (any instanceof AnyImpl) {
+ return (AnyImpl)any;
+ } else {
+ AnyImpl anyImpl = new AnyImpl(orb, any);
+ anyImpl.typeCode = TypeCodeImpl.convertToNative(orb, anyImpl.typeCode);
+ return anyImpl;
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // 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.
+ */
+ public AnyImpl(ORB orb)
+ {
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get( (com.sun.corba.se.spi.orb.ORB)orb,
+ CORBALogDomains.RPC_PRESENTATION ) ;
+
+ typeCode = orb.get_primitive_tc(TCKind._tk_null);
+ stream = null;
+ object = null;
+ value = 0;
+ // null is a valid value
+ isInitialized = true;
+ }
+
+ //
+ // Create a new AnyImpl which is a copy of obj.
+ //
+ public AnyImpl(ORB orb, Any obj) {
+ this(orb);
+
+ if ((obj instanceof AnyImpl)) {
+ AnyImpl objImpl = (AnyImpl)obj;
+ typeCode = objImpl.typeCode;
+ value = objImpl.value;
+ object = objImpl.object;
+ isInitialized = objImpl.isInitialized;
+
+ if (objImpl.stream != null)
+ stream = objImpl.stream.dup();
+
+ } else {
+ read_value(obj.create_input_stream(), obj.type());
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // basic accessors
+
+ /**
+ * returns the type of the element contained in the Any.
+ *
+ * @return the TypeCode for the element in the Any
+ */
+ public TypeCode type() {
+ return typeCode;
+ }
+
+ private TypeCode realType() {
+ return realType(typeCode);
+ }
+
+ private TypeCode realType(TypeCode aType) {
+ TypeCode realType = aType;
+ try {
+ // Note: Indirect types are handled in kind() method
+ while (realType.kind().value() == TCKind._tk_alias) {
+ realType = realType.content_type();
+ }
+ } catch (BadKind bad) { // impossible
+ throw wrapper.badkindCannotOccur( bad ) ;
+ }
+ return realType;
+ }
+
+ /**
+ * sets the type of the element to be contained in the Any.
+ *
+ * @param tc the TypeCode for the element in the Any
+ */
+ public void type(TypeCode tc)
+ {
+ //debug.log ("type2");
+ // set the typecode
+ typeCode = TypeCodeImpl.convertToNative(orb, tc);
+
+ stream = null;
+ value = 0;
+ object = null;
+ // null is the only legal value this Any can have after resetting the type code
+ isInitialized = (tc.kind().value() == TCKind._tk_null);
+ }
+
+ /**
+ * checks for equality between Anys.
+ *
+ * @param otherAny the Any to be compared with.
+ * @return true if the Anys are equal, false otherwise.
+ */
+ public boolean equal(Any otherAny)
+ {
+ //debug.log ("equal");
+
+ if (otherAny == this)
+ return true;
+
+ // first check for typecode equality.
+ // note that this will take aliases into account
+ if (!typeCode.equal(otherAny.type()))
+ return false;
+
+ // Resolve aliases here
+ TypeCode realType = realType();
+
+ // _REVISIT_ Possible optimization for the case where
+ // otherAny is a AnyImpl and the endianesses match.
+ // Need implementation of CDRInputStream.equals()
+ // For now we disable this to encourage testing the generic,
+ // unoptimized code below.
+ // Unfortunately this generic code needs to copy the whole stream
+ // at least once.
+ // if (AnyImpl.isStreamed[realType.kind().value()]) {
+ // if (otherAny instanceof AnyImpl) {
+ // return ((AnyImpl)otherAny).stream.equals(stream);
+ // }
+ // }
+ 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().
+ 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<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() ;
+
+ if ( ! equalMember(realType.member_type(memberIndex), myStream, otherStream)) {
+ return false;
+ }
+ return true;
+ }
+ 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:
+ 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:
+ // error resolving alias above
+ throw wrapper.errorResolvingAlias() ;
+
+ case TCKind._tk_longdouble:
+ throw wrapper.tkLongDoubleNotSupported() ;
+
+ default:
+ throw wrapper.typecodeNotSupported() ;
+ }
+ } catch (BadKind badKind) { // impossible
+ throw wrapper.badkindCannotOccur() ;
+ } catch (Bounds bounds) { // impossible
+ throw wrapper.boundsCannotOccur() ;
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // accessors for marshaling/unmarshaling
+
+ /**
+ * returns an output stream that an Any value can be marshaled into.
+ *
+ * @return the OutputStream to marshal value of Any into
+ */
+ public org.omg.CORBA.portable.OutputStream create_output_stream()
+ {
+ //debug.log ("create_output_stream");
+ final ORB finalorb = this.orb;
+ return AccessController.doPrivileged(new PrivilegedAction<AnyOutputStream>() {
+ @Override
+ public AnyOutputStream 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.
+ */
+ 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");
+ if (AnyImpl.isStreamed[realType().kind().value()]) {
+ return stream.dup();
+ } else {
+ OutputStream os = (OutputStream)orb.create_output_stream();
+ TCUtility.marshalIn(os, realType(), value, object);
+
+ return os.create_input_stream();
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // marshaling/unmarshaling routines
+
+ //
+ // If the InputStream is a CDRInputStream then we can copy the bytes
+ // since it is in our format and does not have alignment issues.
+ //
+ public void read_value(org.omg.CORBA.portable.InputStream in, TypeCode tc)
+ {
+ //debug.log ("read_value");
+ //
+ // 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
+ // presumably obtained it via our create_output_stream() so they could
+ // write the contents of an IDL data type to it and then call
+ // create_input_stream() for us to read it. This is how Helper classes
+ // typically implement the insert() method.
+ // We should probably document this behavior in the 1.1 revision
+ // task force.
+ //
+
+ typeCode = TypeCodeImpl.convertToNative(orb, tc);
+ int kind = realType().kind().value();
+ if (kind >= isStreamed.length) {
+ throw wrapper.invalidIsstreamedTckind( CompletionStatus.COMPLETED_MAYBE,
+ new Integer(kind)) ;
+ }
+
+ if (AnyImpl.isStreamed[kind]) {
+ if ( in instanceof AnyInputStream ) {
+ // could only have been created here
+ stream = (CDRInputStream)in;
+ } else {
+ org.omg.CORBA_2_3.portable.OutputStream out =
+ (org.omg.CORBA_2_3.portable.OutputStream)orb.create_output_stream();
+ typeCode.copy((org.omg.CORBA_2_3.portable.InputStream)in, out);
+ stream = (CDRInputStream)out.create_input_stream();
+ }
+ } else {
+ java.lang.Object[] objholder = new java.lang.Object[1];
+ objholder[0] = object;
+ long[] longholder = new long[1];
+ TCUtility.unmarshalIn(in, realType(), longholder, objholder);
+ value = longholder[0];
+ object = objholder[0];
+ stream = null;
+ }
+ isInitialized = true;
+ }
+
+
+ //
+ // We could optimize this by noticing whether the target stream
+ // has ever had anything marshaled on it that required an
+ // alignment of greater than 4 (was write_double() ever called on it).
+ // If not, then we can just do a byte array copy without having to
+ // drive the remarshaling through typecode interpretation.
+ //
+ public void write_value(OutputStream out)
+ {
+ //debug.log ("write_value");
+ if (AnyImpl.isStreamed[realType().kind().value()]) {
+ typeCode.copy(stream.dup(), out);
+ } else {
+ // _REVISIT_ check isInitialized whether all we write is TypeCode!
+ TCUtility.marshalIn(out, realType(), value, object);
+ }
+ }
+
+ /**
+ * takes a streamable and inserts its reference into the any
+ *
+ * @param s the streamable to insert
+ */
+ public void insert_Streamable(Streamable s)
+ {
+ //debug.log ("insert_Streamable");
+ typeCode = TypeCodeImpl.convertToNative(orb, s._type());
+ object = s;
+ isInitialized = true;
+ }
+
+ public Streamable extract_Streamable()
+ {
+ //debug.log( "extract_Streamable" ) ;
+ return (Streamable)object;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // insertion/extraction/replacement for all basic types
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ 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 )
+ {
+ if ((tc >= 0) && (tc < TypeCodeImpl.kindNames.length))
+ return TypeCodeImpl.kindNames[tc] ;
+ else
+ return "UNKNOWN(" + tc + ")" ;
+ }
+
+ private void checkExtractBadOperation( int expected )
+ {
+ if (!isInitialized)
+ throw wrapper.extractNotInitialized() ;
+
+ int tc = realType().kind().value() ;
+ if (tc != expected) {
+ String tcName = getTCKindName( tc ) ;
+ String expectedName = getTCKindName( expected ) ;
+ throw wrapper.extractWrongType( expectedName, tcName ) ;
+ }
+ }
+
+ private void checkExtractBadOperationList( int[] expected )
+ {
+ if (!isInitialized)
+ throw wrapper.extractNotInitialized() ;
+
+ int tc = realType().kind().value() ;
+ for (int ctr=0; ctr<expected.length; ctr++)
+ if (tc == expected[ctr])
+ return ;
+
+ List list = new ArrayList() ;
+ for (int ctr=0; ctr<expected.length; ctr++)
+ list.add( getTCKindName( expected[ctr] ) ) ;
+
+ String tcName = getTCKindName( tc ) ;
+ throw wrapper.extractWrongTypeList( list, tcName ) ;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public short extract_short()
+ {
+ //debug.log ("extract_short");
+ checkExtractBadOperation( TCKind._tk_short ) ;
+ return (short)value;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ 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();
+ if (kind != TCKind._tk_long && kind != TCKind._tk_enum) {
+ typeCode = orb.get_primitive_tc(TCKind._tk_long);
+ }
+ value = l;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ 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 <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_ushort(short s)
+ {
+ //debug.log ("insert_ushort");
+ typeCode = orb.get_primitive_tc(TCKind._tk_ushort);
+ value = s;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public short extract_ushort()
+ {
+ //debug.log ("extract_ushort");
+ checkExtractBadOperation( TCKind._tk_ushort ) ;
+ return (short)value;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_ulong(int l)
+ {
+ //debug.log ("insert_ulong");
+ typeCode = orb.get_primitive_tc(TCKind._tk_ulong);
+ value = l;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public int extract_ulong()
+ {
+ //debug.log ("extract_ulong");
+ checkExtractBadOperation( TCKind._tk_ulong ) ;
+ return (int)value;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_float(float f)
+ {
+ //debug.log ("insert_float");
+ typeCode = orb.get_primitive_tc(TCKind._tk_float);
+ value = Float.floatToIntBits(f);
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public float extract_float()
+ {
+ //debug.log ("extract_float");
+ checkExtractBadOperation( TCKind._tk_float ) ;
+ return Float.intBitsToFloat((int)value);
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_double(double d)
+ {
+ //debug.log ("insert_double");
+ typeCode = orb.get_primitive_tc(TCKind._tk_double);
+ value = Double.doubleToLongBits(d);
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public double extract_double()
+ {
+ //debug.log ("extract_double");
+ checkExtractBadOperation( TCKind._tk_double ) ;
+ return Double.longBitsToDouble(value);
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_longlong(long l)
+ {
+ //debug.log ("insert_longlong");
+ typeCode = orb.get_primitive_tc(TCKind._tk_longlong);
+ value = l;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public long extract_longlong()
+ {
+ //debug.log ("extract_longlong");
+ checkExtractBadOperation( TCKind._tk_longlong ) ;
+ return value;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_ulonglong(long l)
+ {
+ //debug.log ("insert_ulonglong");
+ typeCode = orb.get_primitive_tc(TCKind._tk_ulonglong);
+ value = l;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public long extract_ulonglong()
+ {
+ //debug.log ("extract_ulonglong");
+ checkExtractBadOperation( TCKind._tk_ulonglong ) ;
+ return value;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_boolean(boolean b)
+ {
+ //debug.log ("insert_boolean");
+ typeCode = orb.get_primitive_tc(TCKind._tk_boolean);
+ value = (b)? 1:0;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public boolean extract_boolean()
+ {
+ //debug.log ("extract_boolean");
+ checkExtractBadOperation( TCKind._tk_boolean ) ;
+ return (value == 0)? false: true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_char(char c)
+ {
+ //debug.log ("insert_char");
+ typeCode = orb.get_primitive_tc(TCKind._tk_char);
+ value = c;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public char extract_char()
+ {
+ //debug.log ("extract_char");
+ checkExtractBadOperation( TCKind._tk_char ) ;
+ return (char)value;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_wchar(char c)
+ {
+ //debug.log ("insert_wchar");
+ typeCode = orb.get_primitive_tc(TCKind._tk_wchar);
+ value = c;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public char extract_wchar()
+ {
+ //debug.log ("extract_wchar");
+ checkExtractBadOperation( TCKind._tk_wchar ) ;
+ return (char)value;
+ }
+
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_octet(byte b)
+ {
+ //debug.log ("insert_octet");
+ typeCode = orb.get_primitive_tc(TCKind._tk_octet);
+ value = b;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public byte extract_octet()
+ {
+ //debug.log ("extract_octet");
+ checkExtractBadOperation( TCKind._tk_octet ) ;
+ return (byte)value;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ 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 = 0;
+ try {
+ length = typeCode.length();
+ } catch (BadKind bad) {
+ throw wrapper.badkindCannotOccur() ;
+ }
+
+ // Check if bounded strings length is not exceeded
+ if (length != 0 && s != null && s.length() > length) {
+ throw wrapper.badStringBounds( new Integer(s.length()),
+ new Integer(length) ) ;
+ }
+ } else {
+ typeCode = orb.get_primitive_tc(TCKind._tk_string);
+ }
+ object = s;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public String extract_string()
+ {
+ //debug.log ("extract_string");
+ checkExtractBadOperation( TCKind._tk_string ) ;
+ return (String)object;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ 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 = 0;
+ try {
+ length = typeCode.length();
+ } catch (BadKind bad) {
+ throw wrapper.badkindCannotOccur() ;
+ }
+
+ // Check if bounded strings length is not exceeded
+ if (length != 0 && s != null && s.length() > length) {
+ throw wrapper.badStringBounds( new Integer(s.length()),
+ new Integer(length) ) ;
+ }
+ } else {
+ typeCode = orb.get_primitive_tc(TCKind._tk_wstring);
+ }
+ object = s;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public String extract_wstring()
+ {
+ //debug.log ("extract_wstring");
+ checkExtractBadOperation( TCKind._tk_wstring ) ;
+ return (String)object;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_any(Any a)
+ {
+ //debug.log ("insert_any");
+ typeCode = orb.get_primitive_tc(TCKind._tk_any);
+ object = a;
+ stream = null;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public Any extract_any()
+ {
+ //debug.log ("extract_any");
+ checkExtractBadOperation( TCKind._tk_any ) ;
+ return (Any)object;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ 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 ) ;
+ typeCode = new TypeCodeImpl(orb, TCKind._tk_objref, ids[0], "");
+ } else {
+ throw wrapper.badInsertobjParam(
+ CompletionStatus.COMPLETED_MAYBE, o.getClass().getName() ) ;
+ }
+ }
+
+ object = o;
+ isInitialized = true;
+ }
+
+ /**
+ * A variant of the insertion operation that takes a typecode
+ * argument as well.
+ */
+ 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()) )
+ {
+ typeCode = TypeCodeImpl.convertToNative(orb, tc);
+ object = o;
+ }
+ else {
+ throw wrapper.insertObjectIncompatible() ;
+ }
+ } catch ( Exception ex ) {
+ throw wrapper.insertObjectFailed(ex) ;
+ }
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public org.omg.CORBA.Object extract_Object()
+ {
+ //debug.log ("extract_Object");
+ if (!isInitialized)
+ throw wrapper.extractNotInitialized() ;
+
+ // Check if the object contained here is of the type in typeCode
+ org.omg.CORBA.Object obj = null;
+ try {
+ obj = (org.omg.CORBA.Object) object;
+ if (typeCode.id().equals("IDL:omg.org/CORBA/Object:1.0") || obj._is_a(typeCode.id())) {
+ return obj;
+ } else {
+ throw wrapper.extractObjectIncompatible() ;
+ }
+ } catch ( Exception ex ) {
+ throw wrapper.extractObjectFailed(ex);
+ }
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public void insert_TypeCode(TypeCode tc)
+ {
+ //debug.log ("insert_TypeCode");
+ typeCode = orb.get_primitive_tc(TCKind._tk_TypeCode);
+ object = tc;
+ isInitialized = true;
+ }
+
+ /**
+ * See the description of the <a href="#anyOps">general Any operations.</a>
+ */
+ public TypeCode extract_TypeCode()
+ {
+ //debug.log ("extract_TypeCode");
+ checkExtractBadOperation( TCKind._tk_TypeCode ) ;
+ return (TypeCode)object;
+ }
+
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public void insert_Principal(Principal p)
+ {
+ typeCode = orb.get_primitive_tc(TCKind._tk_Principal);
+ object = p;
+ isInitialized = true;
+ }
+
+ /**
+ * @deprecated
+ */
+ @Deprecated
+ public Principal extract_Principal()
+ {
+ checkExtractBadOperation( TCKind._tk_Principal ) ;
+ return (Principal)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.
+ */
+ 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");
+ object = v;
+
+ TypeCode tc;
+
+ if ( v == null ) {
+ tc = orb.get_primitive_tc (TCKind.tk_value);
+ } else {
+ // 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
+ // Util.writeAny, we can do the versioning correctly,
+ // and use the insert_Value(Serializable, TypeCode)
+ // method.
+ //
+ // The ORB singleton uses the latest version.
+ tc = createTypeCodeForClass (v.getClass(), (ORB)ORB.init());
+ }
+
+ typeCode = TypeCodeImpl.convertToNative(orb, tc);
+ isInitialized = true;
+ }
+
+ public void insert_Value(Serializable v, org.omg.CORBA.TypeCode t)
+ {
+ //debug.log ("insert_Value2");
+ object = v;
+ typeCode = TypeCodeImpl.convertToNative(orb, t);
+ isInitialized = true;
+ }
+
+ public void insert_fixed(java.math.BigDecimal value) {
+ typeCode = TypeCodeImpl.convertToNative(orb,
+ orb.create_fixed_tc(TypeCodeImpl.digits(value), TypeCodeImpl.scale(value)));
+ object = value;
+ isInitialized = true;
+ }
+
+ 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() ;
+ }
+ } catch (org.omg.CORBA.TypeCodePackage.BadKind bk) {
+ // type isn't even of kind fixed
+ throw wrapper.fixedBadTypecode( bk ) ;
+ }
+ typeCode = TypeCodeImpl.convertToNative(orb, type);
+ object = value;
+ isInitialized = true;
+ }
+
+ public java.math.BigDecimal extract_fixed() {
+ 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.
+ */
+ public TypeCode createTypeCodeForClass (java.lang.Class c, ORB tcORB)
+ {
+ // Look in the cache first
+ TypeCodeImpl classTC = tcORB.getTypeCodeForClass(c);
+ if (classTC != null)
+ return classTC;
+
+ // All cases need to be able to create repository IDs.
+ //
+ // See bug 4391648 for more info about the tcORB in this
+ // case.
+ RepositoryIdStrings repStrs
+ = RepositoryIdFactory.getRepIdStringsFactory();
+
+
+ // Assertion: c instanceof Serializable?
+
+ if ( c.isArray() ) {
+ // Arrays - may recurse for multi-dimensional arrays
+ Class componentClass = c.getComponentType();
+ TypeCode embeddedType;
+ if ( componentClass.isPrimitive() ) {
+ embeddedType = getPrimitiveTypeCodeForClass(componentClass,
+ tcORB);
+ } else {
+ embeddedType = createTypeCodeForClass (componentClass,
+ tcORB);
+ }
+ 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 ) {
+ // Strings
+ TypeCode t = tcORB.create_string_tc (0);
+
+ String id = repStrs.createForJavaType(c);
+
+ 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());
+ // Intruct classTC to store its buffer
+ classTC.setCaching(true);
+ // Update the cache
+ tcORB.setTypeCodeForClass(c, classTC);
+ return classTC;
+ }
+
+ /**
+ * 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.
+ */
+ private TypeCode getPrimitiveTypeCodeForClass (Class c, ORB tcORB)
+ {
+ //debug.log ("getPrimitiveTypeCodeForClass");
+
+ if (c == Integer.TYPE) {
+ return tcORB.get_primitive_tc (TCKind.tk_long);
+ } else if (c == Byte.TYPE) {
+ return tcORB.get_primitive_tc (TCKind.tk_octet);
+ } else if (c == Long.TYPE) {
+ return tcORB.get_primitive_tc (TCKind.tk_longlong);
+ } else if (c == Float.TYPE) {
+ return tcORB.get_primitive_tc (TCKind.tk_float);
+ } else if (c == Double.TYPE) {
+ return tcORB.get_primitive_tc (TCKind.tk_double);
+ } else if (c == Short.TYPE) {
+ 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
+ // with our older ORBs, we say it maps to a
+ // 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
+ // 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)
+ 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);
+ } else {
+ // _REVISIT_ Not sure if this is right.
+ return tcORB.get_primitive_tc (TCKind.tk_any);
+ }
+ }
+
+ // Extracts a member value according to the given TypeCode from the given complex Any
+ // (at the Anys current internal stream position, consuming the anys stream on the way)
+ // and returns it wrapped into a new Any
+ public Any extractAny(TypeCode memberType, ORB orb) {
+ Any returnValue = orb.create_any();
+ OutputStream out = returnValue.create_output_stream();
+ TypeCodeImpl.convertToNative(orb, memberType).copy((InputStream)stream, out);
+ returnValue.read_value(out.create_input_stream(), memberType);
+ return returnValue;
+ }
+
+ // This method could very well be moved into TypeCodeImpl or a common utility class,
+ // but is has to be in this package.
+ static public Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
+ Any returnValue = orb.create_any();
+ OutputStream out = returnValue.create_output_stream();
+ TypeCodeImpl.convertToNative(orb, memberType).copy(input, out);
+ returnValue.read_value(out.create_input_stream(), memberType);
+ return returnValue;
+ }
+
+ // There is no other way for DynAnys to find out whether the Any is initialized.
+ public boolean isInitialized() {
+ return isInitialized;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImplHelper.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImplHelper.java
new file mode 100644
index 0000000..06668c3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AnyImplHelper.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.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 ());
+ }
+
+ 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);
+ }
+ return __typeCode;
+ }
+
+ 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 void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Any value)
+ {
+ ostream.write_any (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AsynchInvoke.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AsynchInvoke.java
new file mode 100644
index 0000000..59adaef
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/AsynchInvoke.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+///////////////////////////////////////////////////////////////////////////
+// helper class for deferred invocations
+
+/*
+ * The AsynchInvoke class allows for the support of asynchronous
+ * invocations. Instances of these are created with a request object,
+ * and when run, perform an invocation. The instance is also
+ * responsible for waking up a client that might be waiting on the
+ * 'get_response' method.
+ */
+
+public class AsynchInvoke implements Runnable {
+
+ private RequestImpl _req;
+ private ORB _orb;
+ private boolean _notifyORB;
+
+ 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.
+ *
+ */
+
+ public void run()
+ {
+ // do the actual invocation
+ _req.doInvocation();
+
+ // for the asynchronous case, note that the response has been
+ // received.
+ synchronized (_req)
+ {
+ // update local boolean indicator
+ _req.gotResponse = true;
+
+ // notify any client waiting on a 'get_response'
+ _req.notify();
+ }
+
+ if (_notifyORB == true) {
+ _orb.notifyORB() ;
+ }
+ }
+
+};
+
+///////////////////////////////////////////////////////////////////////////
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/CORBAObjectImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/CORBAObjectImpl.java
new file mode 100644
index 0000000..fc02f8c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/CORBAObjectImpl.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+//
+// Bare implementation of CORBA Object.
+//
+public class CORBAObjectImpl extends org.omg.CORBA_2_3.portable.ObjectImpl {
+ public String[] _ids() {
+ String[] typeids = new String[1];
+ typeids[0] = "IDL:omg.org/CORBA/Object:1.0";
+ return typeids;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextImpl.java
new file mode 100644
index 0000000..4856a13
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextImpl.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.NVList;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public final class ContextImpl extends Context {
+
+ private org.omg.CORBA.ORB _orb;
+ private ORBUtilSystemException wrapper ;
+
+ public ContextImpl(org.omg.CORBA.ORB orb)
+ {
+ _orb = orb;
+ wrapper = ORBUtilSystemException.get(
+ (com.sun.corba.se.spi.orb.ORB)orb,
+ CORBALogDomains.RPC_PRESENTATION ) ;
+ }
+
+ public ContextImpl(Context parent)
+ {
+ throw wrapper.contextNotImplemented() ;
+ }
+
+ public String context_name()
+ {
+ throw wrapper.contextNotImplemented() ;
+ }
+
+ public Context parent()
+ {
+ throw wrapper.contextNotImplemented() ;
+ }
+
+ public Context create_child(String name)
+ {
+ 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 NVList get_values(String startScope,
+ int opFlags,
+ String propName)
+ {
+ throw wrapper.contextNotImplemented() ;
+ }
+};
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextListImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextListImpl.java
new file mode 100644
index 0000000..23a5b6f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ContextListImpl.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import java.util.Vector;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.ORB;
+
+public class ContextListImpl extends ContextList
+{
+ private final int INITIAL_CAPACITY = 2;
+ private final int CAPACITY_INCREMENT = 2;
+
+ private org.omg.CORBA.ORB _orb;
+ private Vector _contexts;
+
+ public ContextListImpl(org.omg.CORBA.ORB orb)
+ {
+ // Note: This orb could be an instanceof ORBSingleton or ORB
+ _orb = orb;
+ _contexts = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT);
+ }
+
+ public int count()
+ {
+ return _contexts.size();
+ }
+
+ public void add(String ctxt)
+ {
+ _contexts.addElement(ctxt);
+ }
+
+ public String item(int index)
+ throws Bounds
+ {
+ try {
+ return (String) _contexts.elementAt(index);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new Bounds();
+ }
+ }
+
+ public void remove(int index)
+ throws Bounds
+ {
+ try {
+ _contexts.removeElementAt(index);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new Bounds();
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/EnvironmentImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/EnvironmentImpl.java
new file mode 100644
index 0000000..368aa62
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/EnvironmentImpl.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import org.omg.CORBA.Environment;
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.ORB;
+
+public class EnvironmentImpl extends Environment {
+
+ private Exception _exc;
+
+ public EnvironmentImpl()
+ {
+ }
+
+ public Exception exception()
+ {
+ return _exc;
+ }
+
+ public void exception(Exception exc)
+ {
+ _exc = exc;
+ }
+
+ public void clear()
+ {
+ _exc = null;
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ExceptionListImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ExceptionListImpl.java
new file mode 100644
index 0000000..1694254
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ExceptionListImpl.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import java.util.Vector;
+
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.ORB;
+
+
+public class ExceptionListImpl extends ExceptionList {
+
+ private final int INITIAL_CAPACITY = 2;
+ private final int CAPACITY_INCREMENT = 2;
+
+ private Vector _exceptions;
+
+ public ExceptionListImpl() {
+ _exceptions = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT);
+ }
+
+ public int count()
+ {
+ return _exceptions.size();
+ }
+
+ public void add(TypeCode tc)
+ {
+ _exceptions.addElement(tc);
+ }
+
+ public TypeCode item(int index)
+ throws Bounds
+ {
+ try {
+ return (TypeCode) _exceptions.elementAt(index);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new Bounds();
+ }
+ }
+
+ public void remove(int index)
+ throws Bounds
+ {
+ try {
+ _exceptions.removeElementAt(index);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new Bounds();
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/NVListImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/NVListImpl.java
new file mode 100644
index 0000000..d5cbb20
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/NVListImpl.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import java.util.Vector;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.NamedValue;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+public class NVListImpl extends NVList
+{
+ private final int INITIAL_CAPACITY = 4;
+ private final int CAPACITY_INCREMENT = 2;
+
+ private Vector _namedValues;
+ private ORB orb;
+
+ public NVListImpl(ORB orb)
+ {
+ // Note: This orb could be an instanceof ORBSingleton or ORB
+ this.orb = orb;
+ _namedValues = new Vector(INITIAL_CAPACITY, CAPACITY_INCREMENT);
+ }
+
+ 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 Vector(size);
+ }
+
+
+ public int count()
+ {
+ return _namedValues.size();
+ }
+
+ public NamedValue add(int flags)
+ {
+ NamedValue tmpVal = new NamedValueImpl(orb, "", new AnyImpl(orb), flags);
+ _namedValues.addElement(tmpVal);
+ return tmpVal;
+ }
+
+ public NamedValue add_item(String itemName, int flags)
+ {
+ NamedValue tmpVal = new NamedValueImpl(orb, itemName, new AnyImpl(orb),
+ flags);
+ _namedValues.addElement(tmpVal);
+ return tmpVal;
+ }
+
+ public NamedValue add_value(String itemName, Any val, int flags)
+ {
+ NamedValue tmpVal = new NamedValueImpl(orb, itemName, val, flags);
+ _namedValues.addElement(tmpVal);
+ return tmpVal;
+ }
+
+ public NamedValue item(int index)
+ throws Bounds
+ {
+ try {
+ return (NamedValue) _namedValues.elementAt(index);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new Bounds();
+ }
+ }
+
+ public void remove(int index)
+ throws Bounds
+ {
+ try {
+ _namedValues.removeElementAt(index);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new Bounds();
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/NamedValueImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/NamedValueImpl.java
new file mode 100644
index 0000000..43f6c68
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/NamedValueImpl.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.Any;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+public class NamedValueImpl extends NamedValue
+{
+ private String _name;
+ 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)
+ {
+ // Note: This orb could be an instanceof ORBSingleton or ORB
+ _orb = orb;
+ _name = name;
+ _value = value;
+ _flags = flags;
+ }
+
+ public String name()
+ {
+ return _name;
+ }
+
+ public Any value()
+ {
+ return _value;
+ }
+
+ public int flags()
+ {
+ return _flags;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/PrincipalImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/PrincipalImpl.java
new file mode 100644
index 0000000..e969a41
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/PrincipalImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+
+public class PrincipalImpl extends org.omg.CORBA.Principal
+{
+ private byte[] value;
+
+ public void name(byte[] value)
+ {
+ this.value = value;
+ }
+
+ public byte[] name()
+ {
+ return value;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/RequestImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/RequestImpl.java
new file mode 100644
index 0000000..69b5839
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/RequestImpl.java
@@ -0,0 +1,374 @@
+/*
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ARG_IN;
+import org.omg.CORBA.ARG_OUT;
+import org.omg.CORBA.ARG_INOUT;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.Environment;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.UnknownUserException;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.WrongTransaction;
+
+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.se.spi.orb.ORB;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.corba.AsynchInvoke;
+
+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 ORBUtilSystemException _wrapper;
+
+ // invocation-specific stuff
+ protected boolean _isOneWay = false;
+ private int[] _paramCodes;
+ private long[] _paramLongs;
+ private java.lang.Object[] _paramObjects;
+
+ // 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;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // constructor
+
+ // 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)
+ {
+
+ // initialize the orb
+ _orb = orb;
+ _wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.OA_INVOCATION ) ;
+
+ // initialize target, context and operation name
+ _target = targetObject;
+ _ctx = ctx;
+ _opName = operationName;
+
+ // initialize argument list if not passed in
+ if (argumentList == null)
+ _arguments = new NVListImpl(_orb);
+ else
+ _arguments = argumentList;
+
+ // set result container.
+ _result = resultContainer;
+
+ // initialize exception list if not passed in
+ if (exceptionList == null)
+ _exceptions = new ExceptionListImpl();
+ else
+ _exceptions = exceptionList;
+
+ // initialize context list if not passed in
+ if (ctxList == null)
+ _ctxList = new ContextListImpl(_orb);
+ else
+ _ctxList = ctxList;
+
+ // initialize environment
+ _env = new EnvironmentImpl();
+
+ }
+
+ public org.omg.CORBA.Object target()
+ {
+ return _target;
+ }
+
+ public String operation()
+ {
+ return _opName;
+ }
+
+ public NVList arguments()
+ {
+ return _arguments;
+ }
+
+ public NamedValue result()
+ {
+ return _result;
+ }
+
+ public Environment env()
+ {
+ return _env;
+ }
+
+ public ExceptionList exceptions()
+ {
+ return _exceptions;
+ }
+
+ public ContextList contexts()
+ {
+ return _ctxList;
+ }
+
+ public synchronized Context ctx()
+ {
+ if (_ctx == null)
+ _ctx = new ContextImpl(_orb);
+ return _ctx;
+ }
+
+ public synchronized void ctx(Context newCtx)
+ {
+ _ctx = newCtx;
+ }
+
+ 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)
+ {
+ return _arguments.add_item(name, org.omg.CORBA.ARG_IN.value).value();
+ }
+
+ 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)
+ {
+ return _arguments.add_item(name, org.omg.CORBA.ARG_INOUT.value).value();
+ }
+
+ 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)
+ {
+ return _arguments.add_item(name, org.omg.CORBA.ARG_OUT.value).value();
+ }
+
+ public synchronized void set_return_type(TypeCode tc)
+ {
+ if (_result == null)
+ _result = new NamedValueImpl(_orb);
+ _result.value().type(tc);
+ }
+
+ public synchronized Any return_value()
+ {
+ if (_result == null)
+ _result = new NamedValueImpl(_orb);
+ return _result.value();
+ }
+
+ public synchronized void add_exception(TypeCode exceptionType)
+ {
+ _exceptions.add(exceptionType);
+ }
+
+ public synchronized void invoke()
+ {
+ doInvocation();
+ }
+
+ public synchronized void send_oneway()
+ {
+ _isOneWay = true;
+ doInvocation();
+ }
+
+ public synchronized void send_deferred()
+ {
+ AsynchInvoke invokeObject = new AsynchInvoke(_orb, this, false);
+ new Thread(null, invokeObject, "Async-Request-Invoker-Thread", 0, false).start();
+ }
+
+ 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.
+ return gotResponse;
+ }
+
+ 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) {}
+ }
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // private helper methods
+
+ /*
+ * 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 );
+
+ InputStream $in = null;
+ try {
+ OutputStream $out = delegate.request(null, _opName, !_isOneWay);
+ // Marshal args
+ try {
+ for (int i=0; i<_arguments.count() ; i++) {
+ NamedValue nv = _arguments.item(i);
+ switch (nv.flags()) {
+ case ARG_IN.value:
+ nv.value().write_value($out);
+ break;
+ case ARG_OUT.value:
+ break;
+ case ARG_INOUT.value:
+ nv.value().write_value($out);
+ break;
+ }
+ }
+ } catch ( org.omg.CORBA.Bounds ex ) {
+ throw _wrapper.boundsErrorInDiiRequest( ex ) ;
+ }
+
+ $in = delegate.invoke(null, $out);
+ } catch (ApplicationException e) {
+ // REVISIT - minor code.
+ // This is already handled in subcontract.
+ // REVISIT - uncomment.
+ //throw new INTERNAL();
+ } catch (RemarshalException e) {
+ doInvocation();
+ } catch( SystemException ex ) {
+ _env.exception(ex);
+ // NOTE: The exception should not be thrown.
+ // However, JDK 1.4 and earlier threw the exception,
+ // so we keep the behavior to be compatible.
+ throw ex;
+ } finally {
+ delegate.releaseReply(null, $in);
+ }
+ }
+
+ // REVISIT - make protected after development - so xgiop can get it.
+ public void unmarshalReply(InputStream is)
+ {
+ // First unmarshal the return value if it is not void
+ if ( _result != null ) {
+ Any returnAny = _result.value();
+ TypeCode returnType = returnAny.type();
+ 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++) {
+ NamedValue nv = _arguments.item(i);
+ switch( nv.flags() ) {
+ case ARG_IN.value:
+ break;
+ case ARG_OUT.value:
+ case ARG_INOUT.value:
+ Any any = nv.value();
+ any.read_value(is, any.type());
+ break;
+ }
+ }
+ }
+ catch ( org.omg.CORBA.Bounds ex ) {
+ // Cannot happen since we only iterate till _arguments.count()
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ServerRequestImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ServerRequestImpl.java
new file mode 100644
index 0000000..c77802f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/ServerRequestImpl.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.ServerRequest;
+import org.omg.CORBA.Bounds;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class ServerRequestImpl extends ServerRequest {
+
+ ///////////////////////////////////////////////////////////////////////////
+ // data members
+
+ private ORB _orb = null;
+ private ORBUtilSystemException _wrapper = 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 (CorbaMessageMediator 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;
+ _wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.OA_INVOCATION ) ;
+ }
+
+ public String operation() {
+ return _opName;
+ }
+
+ public void arguments(NVList args)
+ {
+ if (_paramsCalled)
+ throw _wrapper.argumentsCalledMultiple() ;
+
+ if (_exceptionSet)
+ throw _wrapper.argumentsCalledAfterException() ;
+
+ if (args == null )
+ throw _wrapper.argumentsCalledNullArgs() ;
+
+ _paramsCalled = true;
+
+ NamedValue arg = null;
+ for (int i=0; i < args.count() ; i++) {
+ try {
+ arg = args.item(i);
+ } 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)) {
+ // unmarshal the value into the Any
+ arg.value().read_value(_ins, arg.value().type());
+ }
+ } catch ( Exception ex ) {
+ throw _wrapper.badArgumentsNvlist( ex ) ;
+ }
+ }
+
+ // hang on to the NVList for marshaling the result
+ _arguments = args;
+
+ _orb.getPIHandler().setServerPIInfo( _arguments );
+ _orb.getPIHandler().invokeServerPIIntermediatePoint();
+ }
+
+ public void set_result(Any res) {
+ // check for invocation restrictions
+ if (!_paramsCalled)
+ throw _wrapper.argumentsNotCalled() ;
+ if (_resultSet)
+ throw _wrapper.setResultCalledMultiple() ;
+ if (_exceptionSet)
+ throw _wrapper.setResultAfterException() ;
+ if ( res == null )
+ throw _wrapper.setResultCalledNullArgs() ;
+
+ _resultAny = res;
+ _resultSet = true;
+
+ // Notify portable interceptors of the result so that
+ // ServerRequestInfo.result() functions as desired.
+ _orb.getPIHandler().setServerPIInfo( _resultAny );
+
+ // actual marshaling of the reply msg header and params takes place
+ // after the DSI returns control to the ORB.
+ }
+
+ 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() ;
+
+ // 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() ;
+
+ _exception = exc;
+
+ // Inform Portable interceptors of the exception that was set
+ // so sending_exception can return the right value.
+ _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
+ // invoke receive_request the first time set_exception is
+ // called (if they haven't already called arguments).
+ if( !_exceptionSet && !_paramsCalled ) {
+ // We need to invoke intermediate points here.
+ _orb.getPIHandler().invokeServerPIIntermediatePoint();
+ }
+
+ _exceptionSet = true;
+
+ // 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.
+ */
+ 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.
+
+ if ( _paramsCalled && _resultSet ) // normal invocation return
+ return null;
+ 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);
+ _resultAny = _orb.create_any();
+ _resultAny.type(result_tc);
+ _resultSet = true;
+
+ return null;
+ } catch ( Exception ex ) {
+ throw _wrapper.dsiResultException(
+ CompletionStatus.COMPLETED_MAYBE, ex ) ;
+ }
+ } else if ( _exceptionSet )
+ return _exception;
+ else {
+ throw _wrapper.dsimethodNotcalled(
+ CompletionStatus.COMPLETED_MAYBE ) ;
+ }
+ }
+
+ /** This is called from the ORB after the DynamicImplementation.invoke
+ * returns. Here we marshal the return value and inout/out params.
+ */
+ 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++) {
+ try {
+ arg = _arguments.item(i);
+ } catch (Bounds e) {}
+
+ 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() ;
+
+ throw _wrapper.contextNotImplemented() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TCUtility.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TCUtility.java
new file mode 100644
index 0000000..b167081
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TCUtility.java
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/**
+ * Static functions for TypeCode interpretation.
+ */
+public final class TCUtility {
+
+ static void marshalIn(org.omg.CORBA.portable.OutputStream s, TypeCode typeCode, long l, Object o) {
+ switch (typeCode.kind().value()) {
+ case TCKind._tk_null:
+ case TCKind._tk_void:
+ case TCKind._tk_native:
+ // nothing to write
+ break;
+
+ case TCKind._tk_short:
+ s.write_short((short)(l & 0xFFFFL));
+ break;
+
+ case TCKind._tk_ushort:
+ s.write_ushort((short)(l & 0xFFFFL));
+ break;
+
+ case TCKind._tk_enum:
+ case TCKind._tk_long:
+ s.write_long((int)(l & 0xFFFFFFFFL));
+ break;
+
+ case TCKind._tk_ulong:
+ s.write_ulong((int)(l & 0xFFFFFFFFL));
+ break;
+
+ case TCKind._tk_float:
+ s.write_float(Float.intBitsToFloat((int)(l & 0xFFFFFFFFL)));
+ break;
+
+ case TCKind._tk_double:
+ s.write_double(Double.longBitsToDouble(l));
+ break;
+
+ case TCKind._tk_boolean:
+ if ( l == 0 )
+ s.write_boolean(false);
+ else
+ s.write_boolean(true);
+ break;
+
+ case TCKind._tk_char:
+ s.write_char((char)(l & 0xFFFFL));
+ break;
+
+ case TCKind._tk_octet:
+ s.write_octet((byte)(l & 0xFFL));
+ break;
+
+ case TCKind._tk_any:
+ s.write_any((Any)o);
+ break;
+
+ case TCKind._tk_TypeCode:
+ s.write_TypeCode((TypeCode)o);
+ break;
+
+ case TCKind._tk_Principal:
+ s.write_Principal((Principal)o);
+ break;
+
+ case TCKind._tk_objref:
+ s.write_Object((org.omg.CORBA.Object)o);
+ break;
+
+ case TCKind._tk_longlong:
+ s.write_longlong(l);
+ break;
+
+ case TCKind._tk_ulonglong:
+ s.write_ulonglong(l);
+ break;
+
+ case TCKind._tk_wchar:
+ s.write_wchar((char)(l & 0xFFFFL));
+ break;
+
+ case TCKind._tk_string:
+ s.write_string((String)o);
+ break;
+
+ case TCKind._tk_wstring:
+ 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);
+ break;
+
+ case TCKind._tk_fixed:
+ // _REVISIT_ As soon as the java-rtf adds digits and scale parameters to
+ // OutputStream, this check will be unnecessary
+ if (s instanceof CDROutputStream) {
+ try {
+ ((CDROutputStream)s).write_fixed((BigDecimal)o,
+ typeCode.fixed_digits(),
+ typeCode.fixed_scale());
+ } catch (BadKind badKind) { // impossible
+ }
+ } else {
+ s.write_fixed((BigDecimal)o);
+ }
+ break;
+
+ case TCKind._tk_struct:
+ case TCKind._tk_union:
+ case TCKind._tk_sequence:
+ case TCKind._tk_array:
+ case TCKind._tk_alias:
+ case TCKind._tk_except:
+ ((Streamable)o)._write(s);
+ break;
+
+ case TCKind._tk_abstract_interface:
+ ((org.omg.CORBA_2_3.portable.OutputStream)s).write_abstract_interface(o);
+ break;
+
+ case TCKind._tk_longdouble:
+ // Unspecified for Java
+ default:
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ (com.sun.corba.se.spi.orb.ORB)s.orb(),
+ CORBALogDomains.RPC_PRESENTATION ) ;
+ throw wrapper.typecodeNotSupported() ;
+ }
+ }
+
+ 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];
+
+ switch (type) {
+ case TCKind._tk_null:
+ case TCKind._tk_void:
+ case TCKind._tk_native:
+ // Nothing to read
+ break;
+
+ case TCKind._tk_short:
+ l = s.read_short() & 0xFFFFL;
+ break;
+
+ case TCKind._tk_ushort:
+ l = s.read_ushort() & 0xFFFFL;
+ break;
+
+ case TCKind._tk_enum:
+ case TCKind._tk_long:
+ l = s.read_long() & 0xFFFFFFFFL;
+ break;
+
+ case TCKind._tk_ulong:
+ l = s.read_ulong() & 0xFFFFFFFFL;
+ 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;
+
+ case TCKind._tk_octet:
+ l = s.read_octet() & 0xFFL;
+ break;
+
+ case TCKind._tk_boolean:
+ if ( s.read_boolean() )
+ l = 1;
+ else
+ l = 0;
+ break;
+
+ case TCKind._tk_any:
+ o = s.read_any();
+ break;
+
+ case TCKind._tk_TypeCode:
+ o = s.read_TypeCode();
+ break;
+
+ case TCKind._tk_Principal:
+ o = s.read_Principal();
+ break;
+
+ case TCKind._tk_objref:
+ if (o instanceof Streamable)
+ ((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;
+
+ case TCKind._tk_wchar:
+ l = s.read_wchar() & 0xFFFFL;
+ break;
+
+ case TCKind._tk_string:
+ o = s.read_string();
+ break;
+
+ case TCKind._tk_wstring:
+ o = s.read_wstring();
+ break;
+
+ case TCKind._tk_value:
+ case TCKind._tk_value_box:
+ o = ((org.omg.CORBA_2_3.portable.InputStream)s).read_value ();
+ break;
+
+ case TCKind._tk_fixed:
+ try {
+ // _REVISIT_ As soon as the java-rtf adds digits and scale parameters to
+ // InputStream, this check will be unnecessary
+ if (s instanceof CDRInputStream) {
+ o = ((CDRInputStream)s).read_fixed(typeCode.fixed_digits(),
+ typeCode.fixed_scale());
+ } else {
+ BigDecimal bigDecimal = s.read_fixed();
+ o = bigDecimal.movePointLeft((int)typeCode.fixed_scale());
+ }
+ } catch (BadKind badKind) { // impossible
+ }
+ break;
+
+ case TCKind._tk_struct:
+ case TCKind._tk_union:
+ case TCKind._tk_sequence:
+ case TCKind._tk_array:
+ case TCKind._tk_alias:
+ case TCKind._tk_except:
+ ((Streamable)o)._read(s);
+ break;
+
+ case TCKind._tk_abstract_interface:
+ o = ((org.omg.CORBA_2_3.portable.InputStream)s).read_abstract_interface();
+ break;
+
+ case TCKind._tk_longdouble:
+ // Unspecified for Java
+ default:
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ (com.sun.corba.se.spi.orb.ORB)s.orb(),
+ CORBALogDomains.RPC_PRESENTATION ) ;
+ throw wrapper.typecodeNotSupported() ;
+ }
+
+ oa[0] = o;
+ la[0] = l;
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeFactory.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeFactory.java
new file mode 100644
index 0000000..62646eb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.corba;
+
+public interface TypeCodeFactory {
+ void setTypeCode(String id, TypeCodeImpl code);
+
+ TypeCodeImpl getTypeCode(String id);
+
+ void setTypeCodeForClass( Class c, TypeCodeImpl tcimpl ) ;
+
+ TypeCodeImpl getTypeCodeForClass( Class c ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java
new file mode 100644
index 0000000..4e90f7f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeImpl.java
@@ -0,0 +1,2413 @@
+/*
+ * Copyright (c) 1996, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.corba;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.ByteArrayOutputStream;
+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.Principal ;
+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_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.encoding.MarshalInputStream;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+import com.sun.corba.se.impl.encoding.TypeCodeInputStream;
+import com.sun.corba.se.impl.encoding.TypeCodeOutputStream;
+import com.sun.corba.se.impl.encoding.TypeCodeReader;
+import com.sun.corba.se.impl.encoding.WrapperInputStream;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+// no chance of subclasses, so no problems with runtime helper lookup
+public final class TypeCodeImpl extends TypeCode
+{
+ //static final boolean debug = false;
+
+ // the indirection TCKind, needed for recursive typecodes.
+ protected 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
+
+ // 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
+ };
+
+ // 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
+ // fixed
+ private short _digits = 0;
+ private short _scale = 0;
+ // value type
+ // _REVISIT_ We might want to keep references to the ValueMember classes
+ // passed in at initialization instead of copying the relevant data.
+ // Is the data immutable? What about StructMember, UnionMember etc.?
+ 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
+ // recursive sequence support
+ private TypeCodeImpl _parent = null; // the enclosing type code
+ private int _parentOffset = 0; // the level of enclosure
+ // recursive type code support
+ private TypeCodeImpl _indirectType = null;
+
+ // caches the byte buffer written in write_value for quick remarshaling...
+ private byte[] outBuffer = null;
+ // ... but only if caching is enabled
+ private boolean cachingEnabled = false;
+
+ // the ORB instance: may be instanceof ORBSingleton or ORB
+ private ORB _orb;
+ private ORBUtilSystemException wrapper ;
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Constructors...
+
+ public TypeCodeImpl(ORB orb)
+ {
+ // initialized to tk_null
+ _orb = orb;
+ wrapper = ORBUtilSystemException.get(
+ (com.sun.corba.se.spi.orb.ORB)orb, CORBALogDomains.RPC_PRESENTATION ) ;
+ }
+
+ 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 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;
+ if (tci._kind == tk_indirect)
+ throw wrapper.badRemoteTypecode() ;
+ if (tci._kind == TCKind._tk_sequence && tci._contentType == null)
+ throw wrapper.badRemoteTypecode() ;
+ }
+
+ // set up kind
+ _kind = tc.kind().value();
+
+ try {
+ // set up parameters
+ switch (_kind) {
+ case TCKind._tk_value:
+ _type_modifier = tc.type_modifier();
+ // concrete base may be null
+ TypeCode tccb = tc.concrete_base_type();
+ if (tccb != null) {
+ _concrete_base = convertToNative(_orb, tccb);
+ } else {
+ _concrete_base = null;
+ }
+ //_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++) {
+ _memberAccess[i] = tc.member_visibility(i);
+ }
+ case TCKind._tk_except:
+ case TCKind._tk_struct:
+ case TCKind._tk_union:
+ // set up member types
+ _memberTypes = new TypeCodeImpl[tc.member_count()];
+ 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++) {
+ _memberNames[i] = tc.member_name(i);
+ }
+ // set up member count
+ _memberCount = tc.member_count();
+ case TCKind._tk_objref:
+ case TCKind._tk_alias:
+ case TCKind._tk_value_box:
+ case TCKind._tk_native:
+ case TCKind._tk_abstract_interface:
+ setId(tc.id());
+ _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();
+ _unionLabels = new AnyImpl[_memberCount];
+ 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:
+ case TCKind._tk_wstring:
+ case TCKind._tk_sequence:
+ case TCKind._tk_array:
+ _length = tc.length();
+ }
+
+ // set up content type
+ switch (_kind) {
+ case TCKind._tk_sequence:
+ case TCKind._tk_array:
+ case TCKind._tk_alias:
+ case TCKind._tk_value_box:
+ _contentType = convertToNative(_orb, tc.content_type());
+ }
+ } catch (org.omg.CORBA.TypeCodePackage.Bounds e) {} catch (BadKind e) {}
+ // dont have to worry about these since code ensures we dont step
+ // out of bounds.
+ }
+
+ public TypeCodeImpl(ORB orb, int creationKind)
+ // for primitive types
+ {
+ this(orb);
+
+ // private API. dont bother checking that
+ // (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_string:
+ case TCKind._tk_wstring:
+ {
+ _length =0;
+ break;
+ }
+
+ case TCKind._tk_value:
+ {
+ _concrete_base = null;
+ break;
+ }
+ }
+ }
+
+ public TypeCodeImpl(ORB orb,
+ int creationKind,
+ String id,
+ String name,
+ StructMember[] members)
+ // for structs and exceptions
+ {
+ this(orb);
+
+ if ((creationKind == TCKind._tk_struct) || (creationKind == TCKind._tk_except)) {
+ _kind = creationKind;
+ setId(id);
+ _name = name;
+ _memberCount = members.length;
+
+ _memberNames = new String[_memberCount];
+ _memberTypes = new TypeCodeImpl[_memberCount];
+
+ for (int i = 0 ; i < _memberCount ; i++) {
+ _memberNames[i] = members[i].name;
+ _memberTypes[i] = convertToNative(_orb, members[i].type);
+ _memberTypes[i].setParent(this);
+ }
+ } // else initializes to null
+ }
+
+ public TypeCodeImpl(ORB orb,
+ int creationKind,
+ String id,
+ String name,
+ TypeCode discriminator_type,
+ UnionMember[] members)
+ // for unions
+ {
+ this(orb) ;
+
+ if (creationKind == TCKind._tk_union) {
+ _kind = creationKind;
+ setId(id);
+ _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++) {
+ _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) {
+ _defaultIndex = i;
+ }
+ }
+ }
+ } // else initializes to null
+ }
+
+ public TypeCodeImpl(ORB orb,
+ int creationKind,
+ String id,
+ String name,
+ short type_modifier,
+ TypeCode concrete_base,
+ ValueMember[] members)
+ // for value types
+ {
+ this(orb) ;
+
+ if (creationKind == TCKind._tk_value) {
+ _kind = creationKind;
+ setId(id);
+ _name = name;
+ _type_modifier = type_modifier;
+ if (concrete_base != null) {
+ _concrete_base = convertToNative(_orb, concrete_base);
+ }
+ _memberCount = members.length;
+
+ _memberNames = new String[_memberCount];
+ _memberTypes = new TypeCodeImpl[_memberCount];
+ _memberAccess = new short[_memberCount];
+
+ for (int i = 0 ; i < _memberCount ; i++) {
+ _memberNames[i] = members[i].name;
+ _memberTypes[i] = convertToNative(_orb, members[i].type);
+ _memberTypes[i].setParent(this);
+ _memberAccess[i] = members[i].access;
+ }
+ } // else initializes to null
+ }
+
+
+ public TypeCodeImpl(ORB orb,
+ int creationKind,
+ String id,
+ String name,
+ String[] members)
+ // for enums
+ {
+ this(orb) ;
+
+ if (creationKind == TCKind._tk_enum)
+ {
+ _kind = creationKind;
+ setId(id);
+ _name = name;
+ _memberCount = members.length;
+
+ _memberNames = new String[_memberCount];
+
+ 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,
+ TypeCode original_type)
+ // for aliases and value boxes
+ {
+ this(orb) ;
+
+ if ( creationKind == TCKind._tk_alias || creationKind == TCKind._tk_value_box )
+ {
+ _kind = creationKind;
+ setId(id);
+ _name = name;
+ _contentType = convertToNative(_orb, original_type);
+ }
+ // else initializes to null
+
+ }
+
+ public TypeCodeImpl(ORB orb,
+ int creationKind,
+ String id,
+ String name)
+ {
+ this(orb) ;
+
+ if (creationKind == TCKind._tk_objref ||
+ creationKind == TCKind._tk_native ||
+ creationKind == TCKind._tk_abstract_interface)
+ {
+ _kind = creationKind;
+ setId(id);
+ _name = name;
+ } // else initializes to null
+ }
+
+
+ public TypeCodeImpl(ORB orb,
+ int creationKind,
+ int bound)
+ // for strings
+ {
+ this(orb) ;
+
+ if (bound < 0)
+ throw wrapper.negativeBounds() ;
+
+ if ((creationKind == TCKind._tk_string) || (creationKind == TCKind._tk_wstring)) {
+ _kind = creationKind;
+ _length = bound;
+ } // else initializes to null
+ }
+
+ public TypeCodeImpl(ORB orb,
+ int creationKind,
+ int bound,
+ TypeCode element_type)
+ // for sequences and arrays
+ {
+ this(orb) ;
+
+ 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,
+ int offset)
+ // for recursive sequences
+ {
+ this(orb) ;
+
+ if (creationKind == TCKind._tk_sequence) {
+ _kind = creationKind;
+ _length = bound;
+ _parentOffset = offset;
+ } // else initializes to null
+ }
+
+ public TypeCodeImpl(ORB orb,
+ String id)
+ // for recursive type codes
+ {
+ this(orb) ;
+
+ _kind = tk_indirect;
+ // This is the type code of the type we stand in for, not our own.
+ _id = id;
+ // Try to resolve it now. May return null in which case
+ // we try again later (see indirectType()).
+ tryIndirectType();
+ }
+
+ public TypeCodeImpl(ORB orb,
+ int creationKind,
+ short digits,
+ short scale)
+ // for fixed
+ {
+ this(orb) ;
+
+ //if (digits < 1 || digits > 31)
+ //throw new BAD_TYPECODE();
+
+ if (creationKind == TCKind._tk_fixed) {
+ _kind = creationKind;
+ _digits = digits;
+ _scale = scale;
+ } // else initializes to null
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // Other creation functions...
+
+ // Optimization:
+ // If we checked for and returned constant primitive typecodes
+ // here we could reduce object creation and also enable more
+ // efficient typecode comparisons for primitive typecodes.
+ //
+ protected static TypeCodeImpl convertToNative(ORB orb,
+ TypeCode tc)
+ {
+ if (tc instanceof TypeCodeImpl)
+ return (TypeCodeImpl) tc;
+ else
+ return new TypeCodeImpl(orb, tc);
+ }
+
+ public static CDROutputStream newOutputStream(ORB orb) {
+ TypeCodeOutputStream tcos =
+ sun.corba.OutputStreamFactory.newTypeCodeOutputStream(orb);
+ //if (debug) System.out.println("Created TypeCodeOutputStream " + tcos +
+ // " with no parent");
+ return tcos;
+ }
+
+ // Support for indirect/recursive type codes
+
+ private TypeCodeImpl indirectType() {
+ _indirectType = tryIndirectType();
+ if (_indirectType == null) {
+ // Nothing we can do about that.
+ throw wrapper.unresolvedRecursiveTypecode() ;
+ }
+ return _indirectType;
+ }
+
+ private TypeCodeImpl tryIndirectType() {
+ // Assert that _kind == tk_indirect
+ if (_indirectType != null)
+ return _indirectType;
+
+ setIndirectType(_orb.getTypeCode(_id));
+
+ return _indirectType;
+ }
+
+ private void setIndirectType(TypeCodeImpl newType) {
+ _indirectType = newType;
+ if (_indirectType != null) {
+ try {
+ _id = _indirectType.id();
+ } catch (BadKind e) {
+ // can't happen
+ throw wrapper.badkindCannotOccur() ;
+ }
+ }
+ }
+
+ private void setId(String newID) {
+ _id = newID;
+ if (_orb instanceof TypeCodeFactory) {
+ ((TypeCodeFactory)_orb).setTypeCode(_id, this);
+ }
+ // check whether return value != this which would indicate that the
+ // repository id isn't unique.
+ }
+
+ private void setParent(TypeCodeImpl parent) {
+ _parent = parent;
+ }
+
+ private TypeCodeImpl getParentAtLevel(int level) {
+ if (level == 0)
+ return this;
+
+ if (_parent == null)
+ throw wrapper.unresolvedRecursiveTypecode() ;
+
+ return _parent.getParentAtLevel(level - 1);
+ }
+
+ private TypeCodeImpl lazy_content_type() {
+ if (_contentType == null) {
+ if (_kind == TCKind._tk_sequence && _parentOffset > 0 && _parent != null) {
+ // This is an unresolved recursive sequence tc.
+ // Try to resolve it now if the hierarchy is complete.
+ TypeCodeImpl realParent = getParentAtLevel(_parentOffset);
+ if (realParent != null && realParent._id != null) {
+ // Create a recursive type code object as the content type.
+ // This is when the recursive sequence typecode morphes
+ // into a sequence typecode containing a recursive typecode.
+ _contentType = new TypeCodeImpl((ORB)_orb, realParent._id);
+ }
+ }
+ }
+ return _contentType;
+ }
+
+ // Other private functions
+
+ private TypeCode realType(TypeCode aType) {
+ TypeCode realType = aType;
+ try {
+ // Note: Indirect types are handled in kind() method
+ while (realType.kind().value() == TCKind._tk_alias) {
+ realType = realType.content_type();
+ }
+ } catch (BadKind bad) {
+ // impossible
+ throw wrapper.badkindCannotOccur() ;
+ }
+ return realType;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // TypeCode operations
+
+ public final boolean equal(TypeCode tc)
+ // _REVISIT_ for all optional names/ids, we might want to check that
+ // they are equal in case both are non-nil.
+ {
+ if (tc == this)
+ return true;
+
+ try {
+
+ if (_kind == tk_indirect) {
+ //return indirectType().equal(tc);
+ if (_id != null && tc.id() != null)
+ return _id.equals(tc.id());
+ return (_id == null && tc.id() == null);
+ }
+
+ // make sure kinds are identical.
+ if (_kind != tc.kind().value()) {
+ return false;
+ }
+
+ switch (typeTable[_kind]) {
+ case EMPTY:
+ // no parameters to check.
+ return true;
+
+ case SIMPLE:
+ switch (_kind) {
+ case TCKind._tk_string:
+ case TCKind._tk_wstring:
+ // check for bound.
+ return (_length == tc.length());
+
+ case TCKind._tk_fixed:
+ return (_digits == tc.fixed_digits() && _scale == tc.fixed_scale());
+ default:
+ return false;
+ }
+
+ case COMPLEX:
+
+ switch(_kind) {
+
+ case TCKind._tk_objref:
+ {
+ // check for logical id.
+ if (_id.compareTo(tc.id()) == 0) {
+ return true;
+ }
+
+ if (_id.compareTo(
+ (_orb.get_primitive_tc(_kind)).id()) == 0)
+ {
+ return true;
+ }
+
+ 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;
+
+ }
+ // 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)
+ 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;
+ }
+
+ 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 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;
+ }
+
+ 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_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())
+ return false;
+ // concrete_base may be null
+ TypeCode tccb = tc.concrete_base_type();
+ if ((_concrete_base == null && tccb != null) ||
+ (_concrete_base != null && tccb == null) ||
+ ! _concrete_base.equal(tccb))
+ {
+ return false;
+ }
+ // ignore id and names since those are optional.
+ return true;
+ }
+
+ 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());
+ }
+ }
+ }
+ } catch (org.omg.CORBA.TypeCodePackage.Bounds e) {} catch (BadKind e) {}
+ // dont have to worry about these since the code ensures these dont
+ // arise.
+ return false;
+ }
+
+ /**
+ * The equivalent operation is used by the ORB when determining type equivalence
+ * for values stored in an IDL any.
+ */
+ public boolean equivalent(TypeCode tc) {
+ if (tc == this) {
+ return true;
+ }
+
+ // 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
+ // 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,
+ // equivalent returns false.
+ if (myRealType.kind().value() != otherRealType.kind().value()) {
+ return false;
+ }
+
+ String myID = null;
+ String otherID = null;
+ try {
+ myID = this.id();
+ otherID = tc.id();
+ // At this point the id operation is valid for both TypeCodes.
+
+ // Return true if the results of id for both TypeCodes are non-empty strings
+ // and both strings are equal.
+ // If both ids are non-empty but are not equal, then equivalent returns FALSE.
+ if (myID != null && otherID != null) {
+ return (myID.equals(otherID));
+ }
+ } catch (BadKind e) {
+ // id operation is not valid for either or both TypeCodes
+ }
+
+ // If either or both id is an empty string, or the TypeCode kind does not support
+ // the id operation, perform a structural comparison of the TypeCodes.
+
+ 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 (myRealType.member_count() != otherRealType.member_count())
+ return false;
+ }
+ 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 (myRealType.length() != otherRealType.length())
+ return false;
+ }
+ 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<myRealType.member_count(); i++) {
+ if (myRealType.member_label(i) != otherRealType.member_label(i))
+ return false;
+ }
+ if ( ! myRealType.discriminator_type().equivalent(
+ otherRealType.discriminator_type()))
+ return false;
+ }
+ if (myKind == TCKind._tk_alias ||
+ myKind == TCKind._tk_value_box ||
+ myKind == TCKind._tk_sequence ||
+ myKind == TCKind._tk_array)
+ {
+ if ( ! myRealType.content_type().equivalent(otherRealType.content_type()))
+ return false;
+ }
+ if (myKind == TCKind._tk_struct ||
+ myKind == TCKind._tk_union ||
+ myKind == TCKind._tk_except ||
+ myKind == TCKind._tk_value)
+ {
+ for (int i=0; i<myRealType.member_count(); i++) {
+ if ( ! myRealType.member_type(i).equivalent(
+ otherRealType.member_type(i)))
+ return false;
+ }
+ }
+ } catch (BadKind e) {
+ // impossible if we checked correctly above
+ throw wrapper.badkindCannotOccur() ;
+ } catch (org.omg.CORBA.TypeCodePackage.Bounds e) {
+ // impossible if we checked correctly above
+ throw wrapper.boundsCannotOccur() ;
+ }
+
+ // Structural comparison succeeded!
+ return true;
+ }
+
+ public TypeCode get_compact_typecode() {
+ // _REVISIT_ It isn't clear whether this method should operate on this or a copy.
+ // For now just return this unmodified because the name and member_name fields
+ // aren't used for comparison anyways.
+ return this;
+ }
+
+ public TCKind kind()
+ {
+ if (_kind == tk_indirect)
+ return indirectType().kind();
+ return TCKind.from_int(_kind);
+ }
+
+ public boolean is_recursive()
+ {
+ // Recursive is the only form of indirect type codes right now.
+ // Indirection can also be used for repeated type codes.
+ return (_kind == tk_indirect);
+ }
+
+ public String id()
+ throws BadKind
+ {
+ switch (_kind) {
+ case tk_indirect:
+ //return indirectType().id(); // same as _id
+ case TCKind._tk_except:
+ case TCKind._tk_objref:
+ case TCKind._tk_struct:
+ case TCKind._tk_union:
+ case TCKind._tk_enum:
+ case TCKind._tk_alias:
+ case TCKind._tk_value:
+ case TCKind._tk_value_box:
+ case TCKind._tk_native:
+ case TCKind._tk_abstract_interface:
+ // exception and objref typecodes must have a repository id.
+ // structs, unions, enums, and aliases may or may not.
+ return _id;
+ default:
+ // all other typecodes throw the BadKind exception.
+ throw new BadKind();
+ }
+ }
+
+ public String name()
+ throws BadKind
+ {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().name();
+ case TCKind._tk_except:
+ case TCKind._tk_objref:
+ case TCKind._tk_struct:
+ case TCKind._tk_union:
+ case TCKind._tk_enum:
+ case TCKind._tk_alias:
+ case TCKind._tk_value:
+ case TCKind._tk_value_box:
+ case TCKind._tk_native:
+ case TCKind._tk_abstract_interface:
+ return _name;
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public int member_count()
+ throws BadKind
+ {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().member_count();
+ case TCKind._tk_except:
+ case TCKind._tk_struct:
+ case TCKind._tk_union:
+ case TCKind._tk_enum:
+ case TCKind._tk_value:
+ return _memberCount;
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public String member_name(int index)
+ throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
+ {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().member_name(index);
+ case TCKind._tk_except:
+ case TCKind._tk_struct:
+ case TCKind._tk_union:
+ case TCKind._tk_enum:
+ case TCKind._tk_value:
+ try {
+ return _memberNames[index];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new org.omg.CORBA.TypeCodePackage.Bounds();
+ }
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public TypeCode member_type(int index)
+ throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
+ {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().member_type(index);
+ case TCKind._tk_except:
+ case TCKind._tk_struct:
+ case TCKind._tk_union:
+ case TCKind._tk_value:
+ try {
+ return _memberTypes[index];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new org.omg.CORBA.TypeCodePackage.Bounds();
+ }
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public Any member_label(int index)
+ throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds
+ {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().member_label(index);
+ case TCKind._tk_union:
+ try {
+ // _REVISIT_ Why create a new Any for this?
+ return new AnyImpl(_orb, _unionLabels[index]);
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new org.omg.CORBA.TypeCodePackage.Bounds();
+ }
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public TypeCode discriminator_type()
+ throws BadKind
+ {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().discriminator_type();
+ case TCKind._tk_union:
+ return _discriminator;
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public int default_index()
+ throws BadKind
+ {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().default_index();
+ case TCKind._tk_union:
+ return _defaultIndex;
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public int length()
+ throws BadKind
+ {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().length();
+ case TCKind._tk_string:
+ case TCKind._tk_wstring:
+ case TCKind._tk_sequence:
+ case TCKind._tk_array:
+ return _length;
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public TypeCode content_type()
+ throws BadKind
+ {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().content_type();
+ case TCKind._tk_sequence:
+ return lazy_content_type();
+ case TCKind._tk_array:
+ case TCKind._tk_alias:
+ case TCKind._tk_value_box:
+ return _contentType;
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public short fixed_digits() throws BadKind {
+ switch (_kind) {
+ case TCKind._tk_fixed:
+ return _digits;
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public short fixed_scale() throws BadKind {
+ switch (_kind) {
+ case TCKind._tk_fixed:
+ return _scale;
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public short member_visibility(int index) throws BadKind,
+ org.omg.CORBA.TypeCodePackage.Bounds {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().member_visibility(index);
+ case TCKind._tk_value:
+ try {
+ return _memberAccess[index];
+ } catch (ArrayIndexOutOfBoundsException e) {
+ throw new org.omg.CORBA.TypeCodePackage.Bounds();
+ }
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public short type_modifier() throws BadKind {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().type_modifier();
+ case TCKind._tk_value:
+ return _type_modifier;
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public TypeCode concrete_base_type() throws BadKind {
+ switch (_kind) {
+ case tk_indirect:
+ return indirectType().concrete_base_type();
+ case TCKind._tk_value:
+ return _concrete_base;
+ default:
+ throw new BadKind();
+ }
+ }
+
+ public void read_value(InputStream is) {
+ if (is instanceof TypeCodeReader) {
+ // hardly possible unless caller knows our "private" stream classes.
+ if (read_value_kind((TypeCodeReader)is))
+ read_value_body(is);
+ } else if (is instanceof CDRInputStream) {
+ WrapperInputStream wrapper = new WrapperInputStream((CDRInputStream)is);
+ //if (debug) System.out.println("Created WrapperInputStream " + wrapper +
+ // " with no parent");
+ if (read_value_kind((TypeCodeReader)wrapper))
+ read_value_body(wrapper);
+ } else {
+ read_value_kind(is);
+ read_value_body(is);
+ }
+ }
+
+ private void read_value_recursive(TypeCodeInputStream is) {
+ // don't wrap a CDRInputStream reading "inner" TypeCodes.
+ if (is instanceof TypeCodeReader) {
+ if (read_value_kind((TypeCodeReader)is))
+ read_value_body(is);
+ } else {
+ read_value_kind((InputStream)is);
+ read_value_body(is);
+ }
+ }
+
+ boolean read_value_kind(TypeCodeReader tcis)
+ {
+ _kind = tcis.read_long();
+
+ // Bug fix 5034649: allow for padding that precedes the typecode kind.
+ int myPosition = tcis.getTopLevelPosition()-4;
+
+ // check validity of kind
+ if ((_kind < 0 || _kind > typeTable.length) && _kind != tk_indirect) {
+ throw wrapper.cannotMarshalBadTckind() ;
+ }
+
+ // Don't do any work if this is native
+ if (_kind == TCKind._tk_native)
+ throw wrapper.cannotMarshalNative() ;
+
+ // We have to remember the stream and position for EVERY type code
+ // in case some recursive or indirect type code references it.
+ TypeCodeReader topStream = tcis.getTopLevelStream();
+
+ if (_kind == tk_indirect) {
+ int streamOffset = tcis.read_long();
+ if (streamOffset > -4)
+ throw wrapper.invalidIndirection( new Integer(streamOffset) ) ;
+
+ // The encoding used for indirection is the same as that used for recursive ,
+ // TypeCodes i.e., a 0xffffffff indirection marker followed by a long offset
+ // (in units of octets) from the beginning of the long offset.
+ int topPos = tcis.getTopLevelPosition();
+ // substract 4 to get back to the beginning of the long offset.
+ int indirectTypePosition = topPos - 4 + streamOffset;
+
+ // Now we have to find the referenced type
+ // by its indirectTypePosition within topStream.
+ //if (debug) System.out.println(
+ // "TypeCodeImpl looking up indirection at position topPos " +
+ //topPos + " - 4 + offset " + streamOffset + " = " + indirectTypePosition);
+ TypeCodeImpl type = topStream.getTypeCodeAtPosition(indirectTypePosition);
+ if (type == null)
+ throw wrapper.indirectionNotFound( new Integer(indirectTypePosition) ) ;
+ setIndirectType(type);
+ return false;
+ }
+
+ topStream.addTypeCodeAtPosition(this, myPosition);
+ return true;
+ }
+
+ void read_value_kind(InputStream is) {
+ // unmarshal the kind
+ _kind = is.read_long();
+
+ // check validity of kind
+ if ((_kind < 0 || _kind > typeTable.length) && _kind != tk_indirect) {
+ throw wrapper.cannotMarshalBadTckind() ;
+ }
+ // Don't do any work if this is native
+ if (_kind == TCKind._tk_native)
+ throw wrapper.cannotMarshalNative() ;
+
+ if (_kind == tk_indirect) {
+ throw wrapper.recursiveTypecodeError() ;
+ }
+ }
+
+ void read_value_body(InputStream is) {
+ // start unmarshaling the rest of the typecode, based on the
+ // encoding (empty, simple or complex).
+
+ switch (typeTable[_kind]) {
+ case EMPTY:
+ // nothing to unmarshal
+ break;
+
+ case SIMPLE:
+ 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() ;
+ }
+ break;
+
+ case COMPLEX:
+ {
+ TypeCodeInputStream _encap = TypeCodeInputStream.readEncapsulation(is,
+ is.orb());
+
+ switch(_kind) {
+
+ case TCKind._tk_objref:
+ case TCKind._tk_abstract_interface:
+ {
+ // get the repository id
+ setId(_encap.read_string());
+ // get the name
+ _name = _encap.read_string();
+ }
+ break;
+
+ case TCKind._tk_union:
+ {
+ // get the repository id
+ setId(_encap.read_string());
+
+ // get the name
+ _name = _encap.read_string();
+
+ // discriminant typecode
+ _discriminator = new TypeCodeImpl((ORB)is.orb());
+ _discriminator.read_value_recursive(_encap);
+
+ // default index
+ _defaultIndex = _encap.read_long();
+
+ // get the number of members
+ _memberCount = _encap.read_long();
+
+ // create arrays for the label values, names and types of members
+ _unionLabels = new AnyImpl[_memberCount];
+ _memberNames = new String[_memberCount];
+ _memberTypes = new TypeCodeImpl[_memberCount];
+
+ // read off label values, names and types
+ for (int i=0; i < _memberCount; i++) {
+ _unionLabels[i] = new AnyImpl((ORB)is.orb());
+ if (i == _defaultIndex)
+ // for the default case, read off the zero octet
+ _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() ;
+ }
+ }
+ _memberNames[i] = _encap.read_string();
+ _memberTypes[i] = new TypeCodeImpl((ORB)is.orb());
+ _memberTypes[i].read_value_recursive(_encap);
+ _memberTypes[i].setParent(this);
+ }
+ }
+ break;
+
+ case TCKind._tk_enum:
+ {
+ // get the repository id
+ setId(_encap.read_string());
+
+ // get the name
+ _name = _encap.read_string();
+
+ // get the number of members
+ _memberCount = _encap.read_long();
+
+ // create arrays for the identifier names
+ _memberNames = new String[_memberCount];
+
+ // read off identifier names
+ for (int i=0; i < _memberCount; i++)
+ _memberNames[i] = _encap.read_string();
+ }
+ break;
+
+ case TCKind._tk_sequence:
+ {
+ // get the type of the sequence
+ _contentType = new TypeCodeImpl((ORB)is.orb());
+ _contentType.read_value_recursive(_encap);
+
+ // get the bound on the length of the sequence
+ _length = _encap.read_long();
+ }
+ break;
+
+ case TCKind._tk_array:
+ {
+ // get the type of the array
+ _contentType = new TypeCodeImpl((ORB)is.orb());
+ _contentType.read_value_recursive(_encap);
+
+ // get the length of the array
+ _length = _encap.read_long();
+ }
+ break;
+
+ case TCKind._tk_alias:
+ case TCKind._tk_value_box:
+ {
+ // get the repository id
+ setId(_encap.read_string());
+
+ // get the name
+ _name = _encap.read_string();
+
+ // get the type aliased
+ _contentType = new TypeCodeImpl((ORB)is.orb());
+ _contentType.read_value_recursive(_encap);
+ }
+ break;
+
+ case TCKind._tk_except:
+ case TCKind._tk_struct:
+ {
+ // get the repository id
+ setId(_encap.read_string());
+
+ // get the name
+ _name = _encap.read_string();
+
+ // get the number of members
+ _memberCount = _encap.read_long();
+
+ // create arrays for the names and types of members
+ _memberNames = new String[_memberCount];
+ _memberTypes = new TypeCodeImpl[_memberCount];
+
+ // read off member names and types
+ for (int i=0; i < _memberCount; i++) {
+ _memberNames[i] = _encap.read_string();
+ _memberTypes[i] = new TypeCodeImpl((ORB)is.orb());
+ //if (debug) System.out.println("TypeCode " + _name +
+ // " reading member " + _memberNames[i]);
+ _memberTypes[i].read_value_recursive(_encap);
+ _memberTypes[i].setParent(this);
+ }
+ }
+ break;
+
+ case TCKind._tk_value:
+ {
+ // get the repository id
+ setId(_encap.read_string());
+
+ // get the name
+ _name = _encap.read_string();
+
+ // get the type modifier
+ _type_modifier = _encap.read_short();
+
+ // get the type aliased
+ _concrete_base = new TypeCodeImpl((ORB)is.orb());
+ _concrete_base.read_value_recursive(_encap);
+ if (_concrete_base.kind().value() == TCKind._tk_null) {
+ _concrete_base = null;
+ }
+
+ // get the number of members
+ _memberCount = _encap.read_long();
+
+ // create arrays for the names, types and visibility of members
+ _memberNames = new String[_memberCount];
+ _memberTypes = new TypeCodeImpl[_memberCount];
+ _memberAccess = new short[_memberCount];
+
+ // read off value member visibilities
+ for (int i=0; i < _memberCount; i++) {
+ _memberNames[i] = _encap.read_string();
+ _memberTypes[i] = new TypeCodeImpl((ORB)is.orb());
+ //if (debug) System.out.println("TypeCode " + _name +
+ // " reading member " + _memberNames[i]);
+ _memberTypes[i].read_value_recursive(_encap);
+ _memberTypes[i].setParent(this);
+ _memberAccess[i] = _encap.read_short();
+ }
+ }
+ break;
+
+ default:
+ throw wrapper.invalidTypecodeKindMarshal() ;
+ }
+ break;
+ }
+ }
+ }
+
+ public void write_value(OutputStream os) {
+ // Wrap OutputStream into TypeCodeOutputStream.
+ // This test shouldn't be necessary according to the Java language spec.
+ if (os instanceof TypeCodeOutputStream) {
+ this.write_value((TypeCodeOutputStream)os);
+ } else {
+ TypeCodeOutputStream wrapperOutStream = null;
+
+ if (outBuffer == null) {
+ wrapperOutStream = TypeCodeOutputStream.wrapOutputStream(os);
+ this.write_value(wrapperOutStream);
+ if (cachingEnabled) {
+ // Cache the buffer for repeated writes
+ outBuffer = wrapperOutStream.getTypeCodeBuffer();
+ //if (outBuffer != null)
+ //System.out.println("Caching outBuffer with length = " +
+ //outBuffer.length + " for id = " + _id);
+ }
+ } else {
+ //System.out.println("Using cached outBuffer: length = " + outBuffer.length +
+ //", id = " + _id);
+ }
+ // Write the first 4 bytes first to trigger alignment.
+ // We know that it is the kind.
+ if (cachingEnabled && outBuffer != null) {
+ os.write_long(_kind);
+ os.write_octet_array(outBuffer, 0, outBuffer.length);
+ } else {
+ //System.out.println("Buffer is empty for " + _id);
+ wrapperOutStream.writeRawBuffer(os, _kind);
+ }
+ }
+ }
+
+ public void write_value(TypeCodeOutputStream tcos) {
+
+ // Don't do any work if this is native
+ if (_kind == TCKind._tk_native)
+ throw wrapper.cannotMarshalNative() ;
+
+ TypeCodeOutputStream topStream = tcos.getTopLevelStream();
+ //if (debug) tcos.printBuffer();
+
+ if (_kind == tk_indirect) {
+ //if (debug) System.out.println("Writing indirection " + _name + "to " + _id);
+ // The encoding used for indirection is the same as that used for recursive ,
+ // TypeCodes i.e., a 0xffffffff indirection marker followed by a long offset
+ // (in units of octets) from the beginning of the long offset.
+ int pos = topStream.getPositionForID(_id);
+ int topPos = tcos.getTopLevelPosition();
+ //if (debug) System.out.println("TypeCodeImpl " + tcos +
+ // " writing indirection " + _id +
+ //" to position " + pos + " at position " + topPos);
+ tcos.writeIndirection(tk_indirect, pos);
+ // All that gets written is _kind and offset.
+ return;
+ }
+
+ // The original approach changed for 5034649
+ // topStream.addIDAtPosition(_id, tcos.getTopLevelPosition());
+
+ // marshal the kind
+ tcos.write_long(_kind);
+
+ //if (debug) System.out.println("Writing " + _name + " with id " + _id);
+ // We have to remember the stream and position for EVERY type code
+ // in case some recursive or indirect type code references it.
+ //
+ // 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);
+
+ switch (typeTable[_kind]) {
+ 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 TCKind._tk_fixed:
+ tcos.write_ushort(_digits);
+ tcos.write_short(_scale);
+ break;
+ default:
+ // unknown typecode kind
+ throw wrapper.invalidSimpleTypecode() ;
+ }
+ break;
+
+ case COMPLEX:
+ {
+ // create an encapsulation
+ TypeCodeOutputStream _encap = tcos.createEncapsulation(tcos.orb());
+
+ switch(_kind) {
+
+ case TCKind._tk_objref:
+ case TCKind._tk_abstract_interface:
+ {
+ // put the repository id
+ _encap.write_string(_id);
+
+ // put the name
+ _encap.write_string(_name);
+ }
+ break;
+
+ case TCKind._tk_union:
+ {
+ // put the repository id
+ _encap.write_string(_id);
+
+ // put the name
+ _encap.write_string(_name);
+
+ // discriminant typecode
+ _discriminator.write_value(_encap);
+
+ // default index
+ _encap.write_long(_defaultIndex);
+
+ // put the number of members
+ _encap.write_long(_memberCount);
+
+ // marshal label values, names and types
+ for (int i=0; i < _memberCount; i++) {
+
+ // for the default case, marshal the zero octet
+ 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;
+ // _REVISIT_ figure out long double mapping
+ // case TCKind.tk_longdouble:
+ // _encap.putDouble(_unionLabels[i].extract_longdouble());
+ // 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:
+ {
+ // put the repository id
+ _encap.write_string(_id);
+
+ // put the name
+ _encap.write_string(_name);
+
+ // put the number of members
+ _encap.write_long(_memberCount);
+
+ // marshal identifier names
+ for (int i=0; i < _memberCount; i++)
+ _encap.write_string(_memberNames[i]);
+ }
+ break;
+
+ case TCKind._tk_sequence:
+ {
+ // put the type of the sequence
+ lazy_content_type().write_value(_encap);
+
+ // put the bound on the length of the sequence
+ _encap.write_long(_length);
+ }
+ break;
+
+ case TCKind._tk_array:
+ {
+ // put the type of the array
+ _contentType.write_value(_encap);
+
+ // put the length of the array
+ _encap.write_long(_length);
+ }
+ break;
+
+ case TCKind._tk_alias:
+ case TCKind._tk_value_box:
+ {
+ // put the repository id
+ _encap.write_string(_id);
+
+ // put the name
+ _encap.write_string(_name);
+
+ // put the type aliased
+ _contentType.write_value(_encap);
+ }
+ break;
+
+ case TCKind._tk_struct:
+ case TCKind._tk_except:
+ {
+ // put the repository id
+ _encap.write_string(_id);
+
+ // put the name
+ _encap.write_string(_name);
+
+ // put the number of members
+ _encap.write_long(_memberCount);
+
+ // marshal member names and types
+ for (int i=0; i < _memberCount; i++) {
+ _encap.write_string(_memberNames[i]);
+ //if (debug) System.out.println("TypeCode " + _name +
+ // " writing member " + _memberNames[i]);
+ _memberTypes[i].write_value(_encap);
+ }
+ }
+ break;
+
+ case TCKind._tk_value:
+ {
+ // put the repository id
+ _encap.write_string(_id);
+
+ // put the name
+ _encap.write_string(_name);
+
+ // put the type modifier
+ _encap.write_short(_type_modifier);
+
+ // put the type aliased
+ if (_concrete_base == null) {
+ _orb.get_primitive_tc(TCKind._tk_null).write_value(_encap);
+ } else {
+ _concrete_base.write_value(_encap);
+ }
+
+ // put the number of members
+ _encap.write_long(_memberCount);
+
+ // marshal member names and types
+ for (int i=0; i < _memberCount; i++) {
+ _encap.write_string(_memberNames[i]);
+ //if (debug) System.out.println("TypeCode " + _name +
+ // " writing member " + _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.
+ */
+ protected void copy(org.omg.CORBA.portable.InputStream src,
+ org.omg.CORBA.portable.OutputStream dst)
+ {
+ switch (_kind) {
+
+ case TCKind._tk_null:
+ case TCKind._tk_void:
+ case TCKind._tk_native:
+ case TCKind._tk_abstract_interface:
+ break;
+
+ case TCKind._tk_short:
+ case TCKind._tk_ushort:
+ dst.write_short(src.read_short());
+ break;
+
+ case TCKind._tk_long:
+ case TCKind._tk_ulong:
+ dst.write_long(src.read_long());
+ break;
+
+ case TCKind._tk_float:
+ dst.write_float(src.read_float());
+ break;
+
+ case TCKind._tk_double:
+ dst.write_double(src.read_double());
+ break;
+
+ case TCKind._tk_longlong:
+ case TCKind._tk_ulonglong:
+ dst.write_longlong(src.read_longlong());
+ break;
+
+ case TCKind._tk_longdouble:
+ 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;
+
+ case TCKind._tk_wchar:
+ dst.write_wchar(src.read_wchar());
+ break;
+
+ case TCKind._tk_octet:
+ dst.write_octet(src.read_octet());
+ break;
+
+ case TCKind._tk_string:
+ {
+ String s;
+ s = src.read_string();
+ // make sure length bound in typecode is not violated
+ if ((_length != 0) && (s.length() > _length))
+ throw wrapper.badStringBounds( new Integer(s.length()),
+ new Integer(_length) ) ;
+ dst.write_string(s);
+ }
+ break;
+
+ case TCKind._tk_wstring:
+ {
+ String s;
+ s = src.read_wstring();
+ // make sure length bound in typecode is not violated
+ if ((_length != 0) && (s.length() > _length))
+ throw wrapper.badStringBounds( new Integer(s.length()),
+ new Integer(_length) ) ;
+ dst.write_wstring(s);
+ }
+ break;
+
+ case TCKind._tk_fixed:
+ {
+ dst.write_ushort(src.read_ushort());
+ dst.write_short(src.read_short());
+ }
+ break;
+
+ case TCKind._tk_any:
+ {
+ //Any tmp = new AnyImpl(_orb);
+ Any tmp = ((CDRInputStream)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:
+ {
+ dst.write_TypeCode(src.read_TypeCode());
+ break;
+ }
+
+ case TCKind._tk_Principal:
+ {
+ dst.write_Principal(src.read_Principal());
+ break;
+ }
+
+ case TCKind._tk_objref:
+ {
+ dst.write_Object(src.read_Object());
+ break;
+ }
+
+ case TCKind._tk_except:
+ // Copy repositoryId
+ dst.write_string(src.read_string());
+
+ // 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++) {
+ _memberTypes[i].copy(src, dst);
+ }
+ break;
+ }
+ case TCKind._tk_union:
+ /* _REVISIT_ More generic code?
+ {
+ Any discriminator = new AnyImpl(_orb);
+ discriminator.read_value(src, _discriminator);
+ discriminator.write_value(dst);
+ int labelIndex = currentUnionMemberIndex(discriminator);
+ if (labelIndex == -1) {
+ // check if label has not been found
+ if (_defaultIndex == -1)
+ // throw exception if default was not expected
+ throw new MARSHAL();
+ else
+ // must be of the default branch type
+ _memberTypes[_defaultIndex].copy(src, dst);
+ } else {
+ _memberTypes[labelIndex].copy(src, dst);
+ }
+ }
+ */
+ {
+ 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;
+ }
+ 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_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_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_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_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;
+ }
+ // _REVISIT_ figure out long double mapping
+ // case TCKind.tk_longdouble:
+ // {
+ // double value = src.read_double();
+ // tagValue.insert_longdouble(value);
+ // dst.putDouble(value);
+ // break;
+ //}
+ 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.
+
+ int labelIndex;
+ for (labelIndex = 0; labelIndex < _unionLabels.length; labelIndex++) {
+ // use equality over anys
+ if (tagValue.equal(_unionLabels[labelIndex])) {
+ _memberTypes[labelIndex].copy(src, dst);
+ break;
+ }
+ }
+
+ if (labelIndex == _unionLabels.length) {
+ // check if label has not been found
+ if (_defaultIndex != -1)
+ // must be of the default branch type
+ _memberTypes[_defaultIndex].copy(src, dst);
+ }
+ break;
+ }
+
+ case TCKind._tk_enum:
+ dst.write_long(src.read_long());
+ break;
+
+ case TCKind._tk_sequence:
+ // get the length of the sequence
+ int seqLength = src.read_long();
+
+ // check for sequence bound violated
+ if ((_length != 0) && (seqLength > _length))
+ throw wrapper.badSequenceBounds( new Integer(seqLength),
+ new Integer(_length) ) ;
+
+ // write the length of the sequence
+ dst.write_long(seqLength);
+
+ // copy each element of the seq using content type
+ lazy_content_type(); // make sure it's resolved
+ for (int i=0; i < seqLength; i++)
+ _contentType.copy(src, dst);
+ break;
+
+ case TCKind._tk_array:
+ // copy each element of the array using content type
+ for (int i=0; i < _length; i++)
+ _contentType.copy(src, dst);
+ break;
+
+ case TCKind._tk_alias:
+ case TCKind._tk_value_box:
+ // follow the alias
+ _contentType.copy(src, dst);
+ break;
+
+ case tk_indirect:
+ // need to follow offset, get unmarshal typecode from that
+ // offset, and use that to do the copy
+ // Don't need to read type code before using it to do the copy.
+ // It should be fully usable.
+ indirectType().copy(src, dst);
+ break;
+
+ default:
+ throw wrapper.invalidTypecodeKindMarshal() ;
+ }
+ }
+
+
+ static protected short digits(java.math.BigDecimal value) {
+ if (value == null)
+ return 0;
+ short length = (short)value.unscaledValue().toString().length();
+ if (value.signum() == -1)
+ length--;
+ return length;
+ }
+
+ static protected short scale(java.math.BigDecimal value) {
+ if (value == null)
+ return 0;
+ return (short)value.scale();
+ }
+
+ // Utility methods
+
+ // Only for union type. Returns the index of the union member
+ // corresponding to the discriminator. If not found returns the
+ // default index or -1 if there is no default index.
+ int currentUnionMemberIndex(Any discriminatorValue) throws BadKind {
+ if (_kind != TCKind._tk_union)
+ throw new BadKind();
+
+ try {
+ for (int i=0; i<member_count(); i++) {
+ if (member_label(i).equal(discriminatorValue)) {
+ return i;
+ }
+ }
+ if (_defaultIndex != -1) {
+ return _defaultIndex;
+ }
+ } catch (BadKind bad) {
+ } catch (org.omg.CORBA.TypeCodePackage.Bounds bounds) {
+ }
+ return -1;
+ }
+
+ public String description() {
+ return "TypeCodeImpl with kind " + _kind + " and id " + _id;
+ }
+
+ public String toString() {
+ ByteArrayOutputStream byteOut = new ByteArrayOutputStream(1024);
+ PrintStream printOut = new PrintStream(byteOut, true);
+ printStream(printOut);
+ return super.toString() + " =\n" + byteOut.toString();
+ }
+
+ public void printStream(PrintStream s) {
+ printStream(s, 0);
+ }
+
+ private void printStream(PrintStream s, int level) {
+ if (_kind == tk_indirect) {
+ s.print("indirect " + _id);
+ return;
+ }
+
+ switch (_kind) {
+ 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;
+
+ 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("<unknown type>");
+ s.println(" " + _memberNames[i] + ";");
+ }
+ s.print(indent(level) + "}");
+ break;
+
+ case TCKind._tk_union:
+ s.print("union " + _name + "...");
+ break;
+
+ case TCKind._tk_enum:
+ s.print("enum " + _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_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_alias:
+ s.print("alias " + _name + " = " +
+ (_contentType != null ? _contentType._name : "<unresolved>"));
+ break;
+
+ case TCKind._tk_wstring:
+ s.print("wstring[" + _length + "] " + _name);
+ break;
+
+ case TCKind._tk_fixed:
+ s.print("fixed(" + _digits + ", " + _scale + ") " + _name);
+ break;
+
+ case TCKind._tk_value_box:
+ s.print("valueBox " + _name + "...");
+ break;
+
+ case TCKind._tk_abstract_interface:
+ s.print("abstractInterface " + _name + "...");
+ break;
+
+ default:
+ s.print("<unknown type>");
+ break;
+ }
+ }
+
+ private String indent(int level) {
+ String indent = "";
+ for(int i=0; i<level; i++) {
+ indent += " ";
+ }
+ return indent;
+ }
+
+ protected void setCaching(boolean enableCaching) {
+ cachingEnabled = enableCaching;
+ if (enableCaching == false)
+ outBuffer = null;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeImplHelper.java b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeImplHelper.java
new file mode 100644
index 0000000..ea24c1d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/TypeCodeImplHelper.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.corba;
+
+abstract public class TypeCodeImplHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/TypeCode:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.TypeCode 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.TypeCode 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_TypeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.TypeCode read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return istream.read_TypeCode ();
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.TypeCode value)
+ {
+ ostream.write_TypeCode (value);
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, TypeCodeImpl value)
+ {
+ ostream.write_TypeCode (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/corba/orb_config_design.txt b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/orb_config_design.txt
new file mode 100644
index 0000000..30cf698
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/corba/orb_config_design.txt
@@ -0,0 +1,330 @@
+Configuration of Properties for ORB
+
+attributes of propery:
+
+name String (* in front means OMG std, otherwise Sun internal)
+type int, String, boolean, float, class (or any class with a public XXX( String ) constructor)
+default
+
+DEBUG_PROPERTY String setDebugFlags( arg ) ( , list)
+*INITIAL_HOST_PROPERTY String set var
+*INITIAL_PORT_PROPERTY int set var, setInitialServicesPort
+SERVER_HOST_PROPERTY String set var
+SERVER_PORT_PROPERRT int set var
+*ORB_ID_PROPERTY String set var
+*INITIAL_SERVICES_PROPERTY URL setServicesURL
+*ORB_INIT_REF_PROPERTY String addORBInitRef
+*DEFAULT_INIT_REF_PROPERTY String setORBDefaultInitRef
+NUMBER_TO_RECLAIM_PROPERTY int set var
+ALLOW_LOCAL_OPTIMIZATION boolean set var
+SOCKET_FACTORY_CLASS_PROPERTY Class set var
+LISTEN_SOCKET_PROPERTY String add mapped to list ( , list of (S:I) )
+
+*PI_ORB_INITIALIZER_CLASS_PREFIX.* String map to class, instantiate, add to list
+
+PERSISTENT_SERVER_PORT_PROPERTY int setPersistentServerPort
+SERVER_ID_PROPERTY int setPersistentServerId
+BAD_SERVER_ID_HANDLER_CLASS_PROPERTY Class set var (as string)
+ACTIVATED_PROPERTY boolean set var
+
+GIOP transport specific properties:
+
+HIGH_WATER_MARK_PROPERTY int set var
+LOW_WATER_MARK_PROPERTY int set var
+GIOP_VERSION GIOPVersion set var (from int.int)
+GIOP_FRAGMENT_SIZE int set var (special checks)
+GIOP_BUFFER_SIZE int set var
+GIOP_11_BUFFMGR int set var (really enum or else 0-2)
+GIOP_12_BUFFMGR int set var (really enum or else 0-2)
+GIOP_TARGET_ADDRESSING int set mapped var (really enum or else 0-3)
+ALWAYS_SEND_CODESET_CTX_PROPERTY boolean set var
+USE_BOMS boolean set var
+USE_BOMS_IN_ENCAPS boolean set var
+CHAR_CODESETS CodeSetComponent set var
+WCHAR_CODESETS CodeSetComponent set var
+
+
+Parsers
+
+class IntParserFactory {
+ static IntParser makeRangeIntParser( int min, int max ) ;
+
+}
+
+Parsing process;
+
+
+- construct
+- unify all args, properties into a single properties object props
+- for each key k in props
+ - find matching ParseAction p
+ - p.parse( k, props.getProperty( k ) )
+
+Design principles:
+
+1. Get config data out of ORB
+ Discussion: beans framework does not work this way: instead, it creates the beans,
+ which are themselves both configuration data and configured component.
+
+ Two models:
+ a. parse props -> create config data
+ b. parse props -> create config data -> create components
+
+ However, long-term bean persistence can be used in either model. Separation of
+ concerns (and the large size of the ORB class) argues for separating data from
+ components.
+
+2. get configuration out of ORB (except for finding config class)
+ ORB responsibility:
+ - gather all property, arg data together and make it available
+ - load the ORB configurator and let it process the data, generate a config object
+ - ORB is central registry, so ORB configurator store config data in ORB
+
+3. Extensibility is required
+
+ The ORB will have large subsystems that are pluggable components (examples: aobject adaptors,
+ transport plugins). Individual instances of these frameworks will have their own configuration
+ data. To solve this, the ORB class will provide (read-only perhaps?) access to the collected
+ properties.
+
+ While the component config data is not needed in the ORB, it is needed in the ORB config data
+ so that bean persistence can be used to create an XML version of the data.
+
+ problem: properties vs. config data: same or not?
+
+ properties: easier to use, also necessary to indicate where to get config data if not default
+ config data: more powerful
+
+4. Basic principle: A parser performs an action A based on a value V when it matches a property P.
+ Actions can be:
+
+ configObject.setP( V )
+ configObject.setP( A(V) )
+ A(V)
+
+5. ParserActions are composable
+
+ Basic action: Object parse( String arg, String value )
+ which nicely handles prefix parsing and sharing of actions across multiple keys
+
+ interface Operation {
+ Object operate( String arg, String value )
+ }
+
+ interface OperationFactory {
+ Operation booleanAction() ;
+
+ Operation integerAction() ;
+
+ Operation stringAction() ;
+
+ Operation integerRangeAction( int min, int max ) ;
+
+ Operation listAction( char sep, Operation act ) ;
+ }
+
+ interface ParserAction {
+ void parse( String arg, String value ) ;
+ }
+
+ interface ParserActionFactory {
+ ParserAction setFieldAction( String fieldName ) ;
+
+ ParserAction setFieldAction( String fieldName, Operation op ) ;
+
+ ParserAction operationAction( Operation op ) ;
+ }
+
+6. Parsers are created incrementally:
+
+ Constructor:
+ new Parser( Class configurationDataClass )
+ - has the parser class available for useful defaults
+
+ interface PropertyParser {
+ /** Option must look like a standard property name, which we require here to
+ * be ( JavaIdent "." ) * JavaIdent. The last java ident we will call the tail.
+ * If tail starts with "ORB", this option will be used in augmentWithArguments.
+ * This match operates as follows:
+ * Let name = tail stripped of its ORB prefix.
+ * (e.g. if tail = ORBLowWaterMark, name = LowWaterMark).
+ * Then if option is matched, a conversion to the result type of the method named
+ * get<name> is performed, and set<name> is called on the data object to set the
+ * result.
+ */
+ void addMatch( String option ) ;
+
+ void addMatch( String option, ParserAction pa )
+
+ void addPrefixMatch( String prefix, ParserAction pa )
+
+ /** First constructs a new property object that has props as its default,
+ * then enters args into new property object that correspond to property
+ * names registered in match() calls.
+ */
+ Properties augmentWithArguments( Properties props, String[] args ) ;
+
+ /** Parse all matched properties in props, updating data as required
+ * by the actions.
+ */
+ void parse( Properties props, ORBConfigurationData data ) ;
+ }
+
+7. A useful model:
+
+ Provide
+
+ abstract class ConfigDataBase {
+ ConfigDataBase( Properties props )
+ {
+ ...
+ }
+ }
+
+ and then a specific class
+
+ public class ORBConfigData extends ConfigDataBase {
+ ORBConfigData( Properties props )
+ {
+ super( props ) ;
+ }
+
+ private int foo1 = fooDefault ;
+ private String foo2 = fooDefault2 ;
+ private boolean foo3 = fooDefault3 ;
+ private SomeObject foo4 = fooDefault4 ;
+
+ public int getFoo1() { return foo1 ; }
+ // and similarly
+ }
+
+ The constructor then uses reflection to automatically handle all of these variables with a number of
+ assumptions:
+ a. Standard names:
+ private <type> foo { = <default> }
+ public <type> getFoo() { return foo ; }
+ as argument: -ORBfoo
+ as property: com.sun.CORBA.foo (problems here)
+ b. type specific parsing
+ int: from Integer
+ String: no-op
+ boolean: true/false (from Boolean)
+ Class: must be able to load class
+ class XXX: XXX must have a public XXX( String ) constructor
+
+ Custom parsing?
+
+ What are valid prefixes?
+ 1. provide com.sun.corba.prefix.XXX where XXX defines a prefix to look for
+ (some security implications)
+ 2. Extend security model to ORB implementation (I like this approach best so far)
+
+8. ORB config
+
+ public interface ORBConfigurator {
+ /** This method is called from ORB.init after all ORB properties have been
+ * collected. The corba.ORB constructor will make sure that all required
+ * registries are initialized and empty. This constructor will also initialize
+ * some data used in the corba ORB public API, such as support for deferred
+ * asynchronous invocation. However, all regisitration including things like
+ * the dyanmic any factory should take place in the configurator. This method
+ * is resonsible for making PI ORBInitializer calls, if PI is configured.
+ */
+ void configure( com.sun.corba.se.impl.core.ORB orb ) ;
+ }
+
+ The ORB will have a default configurator named
+
+ com.sun.corba.se.impl.core.ORBConfiguratorImpl
+
+ and also a property
+
+ com.sun.CORBA.ORBConfiguratorClass
+
+ than can be set to the name of the ORB configurator class to use. Note that this
+ implementation can either be a straight Java implementation, or something more
+ interpretive, such as an XML-based config description.
+
+9. We need to construct a list of all properties, and then make sure that security is respected.
+ The basic security check is just:
+
+ SecurityManager sman = System.getSecurityManager() ;
+ if (sman != null)
+ sman.checkPropertyAccess( key )
+
+ and also
+
+ sman.checkPropertiesAccess()
+
+ We can construct a list of all properties as we do now, which allows the ORB
+ to call System.getProperties() inside a doPrivileged() block. Then we create
+ a subclass of java.util.Properties that overrides getProperty to
+ do the checkPropertyAccess( key ) call. We also need to overload the
+ enumerate method, either to make it illegal, call sman.checkPropertiesAccess,
+ or just filter it to include only the accessible properties.
+ And we also need to overload store, because it does not call enumerate internally.
+
+ This allows us to provide all properties to an ORBConfigurator, while still preserving
+ the security model. Then anyone that needs security can set up property permissions
+ like com.foo.corba.* to allow access to only the properties they care about.
+
+10. ORB APIs
+
+ The ORB needs registry support including:
+ getSubcontractRegistry
+ getServiceContextRegistry
+
+ The ORB needs to provide access to a basic (and extensible) ORB configuration object,
+ which supports at a minimum all of the standard CORBA defined properties.
+
+ Also need registries for:
+ ObjectAdapter (actually already in SubcontractRegistry, but needs extensions to
+ ObjectAdapterFactory to work fully)
+ TaggedComponentFactory
+ TaggedProfileFactory
+
+ What does an empty ORB provide?
+ - Registration of all ORB components
+ - Request dispatching to object adapters
+ - Access to ORB properties data (as secure Properties object)
+ - Access to ORB arguments
+ - Access to ORB configuration data (base class, plus collections of base config
+ data for plugins such as OAs and transports)
+ - shutdown support (separate tracking of invocations vs. OA tracking in POA case?
+ How should this be designed?)
+ - INS support? (perhaps this could be pluggable too?)
+ - How does create_output_stream get plugged in?
+ - Can we separate the current IIOP transport into a TransportPluging?
+ - PI support
+ - CORBA::ORB API
+ - NVList, DII
+ - object <-> string (which includes INS?)
+ - (dis)connect API for TOA (move all impl to TOAImpl?)
+ - typecode/any
+ - FVD
+ - initial services registry
+ - value factory registry
+ - logging, other M&M support as needed
+
+ORB classes:
+
+ core.ORB: abstract class providing internal interface
+ corba.ORBImpl: internal implementation of CORBA APIs
+ corba.ORBSingleton: the singleton ORB (not much change needed)
+ corba.ConfigurationDataCollector: collects all source of config data and canonicalizes it
+ Interceptor.PIHandler: the interface for PI
+ Interceptor.PIHandlerImpl: standard implementation of PIHandler
+ corba.ORBConfigurationData: extensible bean containing all ORB config data
+
+11. RequestHandler and ORB
+
+ The RH interface is currently implemented in the ORB class, but might better be a separate
+ class. The API is currently almost the same as a ServerSubcontract. Should we regularize
+ this? Also, the API would need to be extended to handle shutdown properly.
+
+ Extended API:
+ - void run(): does not return until shutdown(boolean) is called.
+ - shutdown(boolean) needs to be here so that requests can be
+ synchhronized with shutdown. This is also a point where OAs
+ need to be included (currently in shutdownServants)
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyBasicImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyBasicImpl.java
new file mode 100644
index 0000000..6a366cc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyBasicImpl.java
@@ -0,0 +1,636 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TCKind;
+
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class DynAnyBasicImpl extends DynAnyImpl
+{
+ //
+ // Constructors
+ //
+
+ private DynAnyBasicImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynAnyBasicImpl(ORB orb, Any any, boolean copyValue) {
+ super(orb, any, copyValue);
+ // set the current position to 0 if any has components, otherwise to -1.
+ index = NO_INDEX;
+ }
+
+ protected DynAnyBasicImpl(ORB orb, TypeCode typeCode) {
+ super(orb, typeCode);
+ // set the current position to 0 if any has components, otherwise to -1.
+ index = NO_INDEX;
+ }
+
+ //
+ // DynAny interface methods
+ //
+
+ public void assign (org.omg.DynamicAny.DynAny dyn_any)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ super.assign(dyn_any);
+ index = NO_INDEX;
+ }
+
+ public void from_any (org.omg.CORBA.Any value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ super.from_any(value);
+ index = NO_INDEX;
+ }
+
+ // Spec: Returns a copy of the internal Any
+ public org.omg.CORBA.Any to_any() {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return DynAnyUtil.copy(any, orb);
+ }
+
+ public boolean equal (org.omg.DynamicAny.DynAny dyn_any) {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (dyn_any == this) {
+ return true;
+ }
+ // If the other DynAny is a constructed one we don't want it to have
+ // to create its Any representation just for this test.
+ if ( ! any.type().equal(dyn_any.type())) {
+ return false;
+ }
+ //System.out.println("Comparing anys");
+ return any.equal(getAny(dyn_any));
+ }
+
+ public void destroy() {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (status == STATUS_DESTROYABLE) {
+ status = STATUS_DESTROYED;
+ }
+ }
+
+ public org.omg.DynamicAny.DynAny copy() {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ // The flag "true" indicates copying the Any value
+ try {
+ return DynAnyUtil.createMostDerivedDynAny(any, orb, true);
+ } catch (InconsistentTypeCode ictc) {
+ return null; // impossible
+ }
+ }
+
+ public org.omg.DynamicAny.DynAny current_component()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ return null;
+ }
+
+ public int component_count() {
+ return 0;
+ }
+
+ public boolean next() {
+ return false;
+ }
+
+ public boolean seek(int index) {
+ return false;
+ }
+
+ public void rewind() {
+ }
+
+ public void insert_boolean(boolean value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_boolean)
+ throw new TypeMismatch();
+ any.insert_boolean(value);
+ }
+
+ public void insert_octet(byte value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_octet)
+ throw new TypeMismatch();
+ any.insert_octet(value);
+ }
+
+ public void insert_char(char value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_char)
+ throw new TypeMismatch();
+ any.insert_char(value);
+ }
+
+ public void insert_short(short value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_short)
+ throw new TypeMismatch();
+ any.insert_short(value);
+ }
+
+ public void insert_ushort(short value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_ushort)
+ throw new TypeMismatch();
+ any.insert_ushort(value);
+ }
+
+ public void insert_long(int value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_long)
+ throw new TypeMismatch();
+ any.insert_long(value);
+ }
+
+ public void insert_ulong(int value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_ulong)
+ throw new TypeMismatch();
+ any.insert_ulong(value);
+ }
+
+ public void insert_float(float value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_float)
+ throw new TypeMismatch();
+ any.insert_float(value);
+ }
+
+ public void insert_double(double value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_double)
+ throw new TypeMismatch();
+ any.insert_double(value);
+ }
+
+ public void insert_string(String value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_string)
+ throw new TypeMismatch();
+ if (value == null)
+ throw new InvalidValue();
+ // Throw InvalidValue if this is a bounded string and the length is exceeded
+ try {
+ if (any.type().length() > 0 && any.type().length() < value.length())
+ throw new InvalidValue();
+ } catch (BadKind bad) { // impossible
+ }
+ any.insert_string(value);
+ }
+
+ public void insert_reference(org.omg.CORBA.Object value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_objref)
+ throw new TypeMismatch();
+ any.insert_Object(value);
+ }
+
+ public void insert_typecode(org.omg.CORBA.TypeCode value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_TypeCode)
+ throw new TypeMismatch();
+ any.insert_TypeCode(value);
+ }
+
+ public void insert_longlong(long value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_longlong)
+ throw new TypeMismatch();
+ any.insert_longlong(value);
+ }
+
+ public void insert_ulonglong(long value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_ulonglong)
+ throw new TypeMismatch();
+ any.insert_ulonglong(value);
+ }
+
+ public void insert_wchar(char value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_wchar)
+ throw new TypeMismatch();
+ any.insert_wchar(value);
+ }
+
+ public void insert_wstring(String value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_wstring)
+ throw new TypeMismatch();
+ if (value == null)
+ throw new InvalidValue();
+ // Throw InvalidValue if this is a bounded string and the length is exceeded
+ try {
+ if (any.type().length() > 0 && any.type().length() < value.length())
+ throw new InvalidValue();
+ } catch (BadKind bad) { // impossible
+ }
+ any.insert_wstring(value);
+ }
+
+ public void insert_any(org.omg.CORBA.Any value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_any)
+ throw new TypeMismatch();
+ any.insert_any(value);
+ }
+
+ public void insert_dyn_any (org.omg.DynamicAny.DynAny value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_any)
+ throw new TypeMismatch();
+ // _REVISIT_ Copy value here?
+ any.insert_any(value.to_any());
+ }
+
+ public void insert_val(java.io.Serializable value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ int kind = any.type().kind().value();
+ if (kind != TCKind._tk_value && kind != TCKind._tk_value_box)
+ throw new TypeMismatch();
+ any.insert_Value(value);
+ }
+
+ public java.io.Serializable get_val()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ int kind = any.type().kind().value();
+ if (kind != TCKind._tk_value && kind != TCKind._tk_value_box)
+ throw new TypeMismatch();
+ return any.extract_Value();
+ }
+
+ public boolean get_boolean()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_boolean)
+ throw new TypeMismatch();
+ return any.extract_boolean();
+ }
+
+ public byte get_octet()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_octet)
+ throw new TypeMismatch();
+ return any.extract_octet();
+ }
+
+ public char get_char()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_char)
+ throw new TypeMismatch();
+ return any.extract_char();
+ }
+
+ public short get_short()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_short)
+ throw new TypeMismatch();
+ return any.extract_short();
+ }
+
+ public short get_ushort()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_ushort)
+ throw new TypeMismatch();
+ return any.extract_ushort();
+ }
+
+ public int get_long()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_long)
+ throw new TypeMismatch();
+ return any.extract_long();
+ }
+
+ public int get_ulong()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_ulong)
+ throw new TypeMismatch();
+ return any.extract_ulong();
+ }
+
+ public float get_float()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_float)
+ throw new TypeMismatch();
+ return any.extract_float();
+ }
+
+ public double get_double()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_double)
+ throw new TypeMismatch();
+ return any.extract_double();
+ }
+
+ public String get_string()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_string)
+ throw new TypeMismatch();
+ return any.extract_string();
+ }
+
+ public org.omg.CORBA.Object get_reference()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_objref)
+ throw new TypeMismatch();
+ return any.extract_Object();
+ }
+
+ public org.omg.CORBA.TypeCode get_typecode()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_TypeCode)
+ throw new TypeMismatch();
+ return any.extract_TypeCode();
+ }
+
+ public long get_longlong()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_longlong)
+ throw new TypeMismatch();
+ return any.extract_longlong();
+ }
+
+ public long get_ulonglong()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_ulonglong)
+ throw new TypeMismatch();
+ return any.extract_ulonglong();
+ }
+
+ public char get_wchar()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_wchar)
+ throw new TypeMismatch();
+ return any.extract_wchar();
+ }
+
+ public String get_wstring()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_wstring)
+ throw new TypeMismatch();
+ return any.extract_wstring();
+ }
+
+ public org.omg.CORBA.Any get_any()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_any)
+ throw new TypeMismatch();
+ return any.extract_any();
+ }
+
+ public org.omg.DynamicAny.DynAny get_dyn_any()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (any.type().kind().value() != TCKind._tk_any)
+ throw new TypeMismatch();
+ // _REVISIT_ Copy value here?
+ try {
+ return DynAnyUtil.createMostDerivedDynAny(any.extract_any(), orb, true);
+ } catch (InconsistentTypeCode ictc) {
+ // The spec doesn't allow us to throw back this exception
+ // incase the anys any if of type Principal, native or abstract interface.
+ return null;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyCollectionImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyCollectionImpl.java
new file mode 100644
index 0000000..7643563
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyCollectionImpl.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+abstract class DynAnyCollectionImpl extends DynAnyConstructedImpl
+{
+ //
+ // Instance variables
+ //
+
+ // Keep in sync with DynAny[] components at all times.
+ Any[] anys = null;
+
+ //
+ // Constructors
+ //
+
+ private DynAnyCollectionImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynAnyCollectionImpl(ORB orb, Any any, boolean copyValue) {
+ super(orb, any, copyValue);
+ }
+
+ protected DynAnyCollectionImpl(ORB orb, TypeCode typeCode) {
+ super(orb, typeCode);
+ }
+
+ //
+ // Utility methods
+ //
+
+ protected void createDefaultComponentAt(int i, TypeCode contentType) {
+ try {
+ components[i] = DynAnyUtil.createMostDerivedDynAny(contentType, orb);
+ } catch (InconsistentTypeCode itc) { // impossible
+ }
+ // get a hold of the default initialized Any without copying
+ anys[i] = getAny(components[i]);
+ }
+
+ protected TypeCode getContentType() {
+ try {
+ return any.type().content_type();
+ } catch (BadKind badKind) { // impossible
+ return null;
+ }
+ }
+
+ // This method has a different meaning for sequence and array:
+ // For sequence value of 0 indicates an unbounded sequence,
+ // values > 0 indicate a bounded sequence.
+ // For array any value indicates the boundary.
+ protected int getBound() {
+ try {
+ return any.type().length();
+ } catch (BadKind badKind) { // impossible
+ return 0;
+ }
+ }
+
+ //
+ // DynAny interface methods
+ //
+
+ // _REVISIT_ More efficient copy operation
+
+ //
+ // Collection methods
+ //
+
+ public org.omg.CORBA.Any[] get_elements () {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return (checkInitComponents() ? anys : null);
+ }
+
+ protected abstract void checkValue(Object[] value)
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+
+ // Initializes the elements of the ordered collection.
+ // If value does not contain the same number of elements as the array dimension,
+ // the operation raises InvalidValue.
+ // If one or more elements have a type that is inconsistent with the collections TypeCode,
+ // the operation raises TypeMismatch.
+ // This operation does not change the current position.
+ public void set_elements (org.omg.CORBA.Any[] value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ checkValue(value);
+
+ components = new DynAny[value.length];
+ anys = value;
+
+ // We know that this is of kind tk_sequence or tk_array
+ TypeCode expectedTypeCode = getContentType();
+ for (int i=0; i<value.length; i++) {
+ if (value[i] != null) {
+ if (! value[i].type().equal(expectedTypeCode)) {
+ clearData();
+ // _REVISIT_ More info
+ throw new TypeMismatch();
+ }
+ try {
+ // Creates the appropriate subtype without copying the Any
+ components[i] = DynAnyUtil.createMostDerivedDynAny(value[i], orb, false);
+ //System.out.println(this + " created component " + components[i]);
+ } catch (InconsistentTypeCode itc) {
+ throw new InvalidValue();
+ }
+ } else {
+ clearData();
+ // _REVISIT_ More info
+ throw new InvalidValue();
+ }
+ }
+ index = (value.length == 0 ? NO_INDEX : 0);
+ // Other representations are invalidated by this operation
+ representations = REPRESENTATION_COMPONENTS;
+ }
+
+ public org.omg.DynamicAny.DynAny[] get_elements_as_dyn_any () {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return (checkInitComponents() ? components : null);
+ }
+
+ // Same semantics as set_elements(Any[])
+ public void set_elements_as_dyn_any (org.omg.DynamicAny.DynAny[] value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ checkValue(value);
+
+ components = (value == null ? emptyComponents : value);
+ anys = new Any[value.length];
+
+ // We know that this is of kind tk_sequence or tk_array
+ TypeCode expectedTypeCode = getContentType();
+ for (int i=0; i<value.length; i++) {
+ if (value[i] != null) {
+ if (! value[i].type().equal(expectedTypeCode)) {
+ clearData();
+ // _REVISIT_ More info
+ throw new TypeMismatch();
+ }
+ anys[i] = getAny(value[i]);
+ } else {
+ clearData();
+ // _REVISIT_ More info
+ throw new InvalidValue();
+ }
+ }
+ index = (value.length == 0 ? NO_INDEX : 0);
+ // Other representations are invalidated by this operation
+ representations = REPRESENTATION_COMPONENTS;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyComplexImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyComplexImpl.java
new file mode 100644
index 0000000..4eb3c9a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyComplexImpl.java
@@ -0,0 +1,421 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+abstract class DynAnyComplexImpl extends DynAnyConstructedImpl
+{
+ //
+ // Instance variables
+ //
+
+ String[] names = null;
+ // Instance variables components and names above are kept in sync
+ // with these two arrays at all times.
+ NameValuePair[] nameValuePairs = null;
+ NameDynAnyPair[] nameDynAnyPairs = null;
+
+ //
+ // Constructors
+ //
+
+ private DynAnyComplexImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynAnyComplexImpl(ORB orb, Any any, boolean copyValue) {
+ // We can be sure that typeCode is of kind tk_struct
+ super(orb, any, copyValue);
+ // Initialize components lazily, on demand.
+ // This is an optimization in case the user is only interested in storing Anys.
+ }
+
+ protected DynAnyComplexImpl(ORB orb, TypeCode typeCode) {
+ // We can be sure that typeCode is of kind tk_struct
+ super(orb, typeCode);
+ // For DynAnyComplex, the operation sets the current position to -1
+ // for empty exceptions and to zero for all other TypeCodes.
+ // The members (if any) are (recursively) initialized to their default values.
+ index = 0;
+ }
+
+ //
+ // DynAny interface methods
+ //
+
+ // _REVISIT_ Overridden to provide more efficient copying.
+ // Copies all the internal representations which is faster than reconstructing them.
+/*
+ public org.omg.DynamicAny.DynAny copy() {
+ if (status == STATUS_DESTROYED) {
+ throw new OBJECT_NOT_EXIST();
+ }
+ DynAnyComplexImpl returnValue = null;
+ if ((representations & REPRESENTATION_ANY) != 0) {
+ // The flag "true" indicates copying the Any value
+ returnValue = (DynAnyComplexImpl)DynAnyUtil.createMostDerivedDynAny(any, orb, true);
+ }
+ if ((representations & REPRESENTATION_COMPONENTS) != 0) {
+ }
+ return returnValue;
+ }
+*/
+
+ //
+ // Complex methods
+ //
+
+ public String current_member_name ()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ 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
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ 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
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (value == null || value.length == 0) {
+ clearData();
+ return;
+ }
+
+ Any memberAny;
+ DynAny memberDynAny = null;
+ String memberName;
+ // We know that this is of kind tk_struct
+ TypeCode expectedTypeCode = any.type();
+
+ int expectedMemberCount = 0;
+ try {
+ expectedMemberCount = expectedTypeCode.member_count();
+ } catch (BadKind badKind) { // impossible
+ }
+ if (expectedMemberCount != value.length) {
+ clearData();
+ throw new InvalidValue();
+ }
+
+ allocComponents(value);
+
+ for (int i=0; i<value.length; i++) {
+ if (value[i] != null) {
+ memberName = value[i].id;
+ String expectedMemberName = null;
+ try {
+ expectedMemberName = expectedTypeCode.member_name(i);
+ } catch (BadKind badKind) { // impossible
+ } catch (Bounds bounds) { // impossible
+ }
+ if ( ! (expectedMemberName.equals(memberName) || memberName.equals(""))) {
+ clearData();
+ // _REVISIT_ More info
+ throw new TypeMismatch();
+ }
+ memberAny = value[i].value;
+ TypeCode expectedMemberType = null;
+ try {
+ expectedMemberType = expectedTypeCode.member_type(i);
+ } catch (BadKind badKind) { // impossible
+ } catch (Bounds bounds) { // impossible
+ }
+ if (! expectedMemberType.equal(memberAny.type())) {
+ clearData();
+ // _REVISIT_ More info
+ throw new TypeMismatch();
+ }
+ try {
+ // Creates the appropriate subtype without copying the Any
+ memberDynAny = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
+ } catch (InconsistentTypeCode itc) {
+ throw new InvalidValue();
+ }
+ addComponent(i, memberName, memberAny, memberDynAny);
+ } else {
+ clearData();
+ // _REVISIT_ More info
+ throw new InvalidValue();
+ }
+ }
+ index = (value.length == 0 ? NO_INDEX : 0);
+ representations = REPRESENTATION_COMPONENTS;
+ }
+
+ // Creates references to the parameter instead of copying it.
+ public void set_members_as_dyn_any (org.omg.DynamicAny.NameDynAnyPair[] value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (value == null || value.length == 0) {
+ clearData();
+ return;
+ }
+
+ Any memberAny;
+ DynAny memberDynAny;
+ String memberName;
+ // We know that this is of kind tk_struct
+ TypeCode expectedTypeCode = any.type();
+
+ int expectedMemberCount = 0;
+ try {
+ expectedMemberCount = expectedTypeCode.member_count();
+ } catch (BadKind badKind) { // impossible
+ }
+ if (expectedMemberCount != value.length) {
+ clearData();
+ throw new InvalidValue();
+ }
+
+ allocComponents(value);
+
+ for (int i=0; i<value.length; i++) {
+ if (value[i] != null) {
+ memberName = value[i].id;
+ String expectedMemberName = null;
+ try {
+ expectedMemberName = expectedTypeCode.member_name(i);
+ } catch (BadKind badKind) { // impossible
+ } catch (Bounds bounds) { // impossible
+ }
+ if ( ! (expectedMemberName.equals(memberName) || memberName.equals(""))) {
+ clearData();
+ // _REVISIT_ More info
+ throw new TypeMismatch();
+ }
+ memberDynAny = value[i].value;
+ memberAny = getAny(memberDynAny);
+ TypeCode expectedMemberType = null;
+ try {
+ expectedMemberType = expectedTypeCode.member_type(i);
+ } catch (BadKind badKind) { // impossible
+ } catch (Bounds bounds) { // impossible
+ }
+ if (! expectedMemberType.equal(memberAny.type())) {
+ clearData();
+ // _REVISIT_ More info
+ throw new TypeMismatch();
+ }
+
+ addComponent(i, memberName, memberAny, memberDynAny);
+ } else {
+ clearData();
+ // _REVISIT_ More info
+ throw new InvalidValue();
+ }
+ }
+ index = (value.length == 0 ? NO_INDEX : 0);
+ representations = REPRESENTATION_COMPONENTS;
+ }
+
+ //
+ // Utility methods
+ //
+
+ private void allocComponents(int length) {
+ components = new DynAny[length];
+ names = new String[length];
+ nameValuePairs = new NameValuePair[length];
+ nameDynAnyPairs = new NameDynAnyPair[length];
+ for (int i=0; i<length; i++) {
+ nameValuePairs[i] = new NameValuePair();
+ nameDynAnyPairs[i] = new NameDynAnyPair();
+ }
+ }
+
+ private void allocComponents(org.omg.DynamicAny.NameValuePair[] value) {
+ components = new DynAny[value.length];
+ names = new String[value.length];
+ nameValuePairs = value;
+ nameDynAnyPairs = new NameDynAnyPair[value.length];
+ for (int i=0; i<value.length; i++) {
+ nameDynAnyPairs[i] = new NameDynAnyPair();
+ }
+ }
+
+ private void allocComponents(org.omg.DynamicAny.NameDynAnyPair[] value) {
+ components = new DynAny[value.length];
+ names = new String[value.length];
+ nameValuePairs = new NameValuePair[value.length];
+ for (int i=0; i<value.length; i++) {
+ nameValuePairs[i] = new NameValuePair();
+ }
+ nameDynAnyPairs = value;
+ }
+
+ private void addComponent(int i, String memberName, Any memberAny, DynAny memberDynAny) {
+ components[i] = memberDynAny;
+ names[i] = (memberName != null ? memberName : "");
+ nameValuePairs[i].id = memberName;
+ nameValuePairs[i].value = memberAny;
+ nameDynAnyPairs[i].id = memberName;
+ nameDynAnyPairs[i].value = memberDynAny;
+ if (memberDynAny instanceof DynAnyImpl)
+ ((DynAnyImpl)memberDynAny).setStatus(STATUS_UNDESTROYABLE);
+ }
+
+ // Initializes components, names, nameValuePairs and nameDynAnyPairs representation
+ // from the Any representation
+ protected boolean initializeComponentsFromAny() {
+ // This typeCode is of kind tk_struct.
+ TypeCode typeCode = any.type();
+ TypeCode memberType = null;
+ Any memberAny;
+ DynAny memberDynAny = null;
+ String memberName = null;
+ int length = 0;
+
+ try {
+ length = typeCode.member_count();
+ } catch (BadKind badKind) { // impossible
+ }
+
+ InputStream input = any.create_input_stream();
+
+ allocComponents(length);
+
+ for (int i=0; i<length; i++) {
+ try {
+ memberName = typeCode.member_name(i);
+ memberType = typeCode.member_type(i);
+ } catch (BadKind badKind) { // impossible
+ } catch (Bounds bounds) { // impossible
+ }
+ memberAny = DynAnyUtil.extractAnyFromStream(memberType, input, orb);
+ try {
+ // Creates the appropriate subtype without copying the Any
+ memberDynAny = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
+ // _DEBUG_
+ //System.out.println("Created DynAny for " + memberName +
+ // ", type " + memberType.kind().value());
+ } catch (InconsistentTypeCode itc) { // impossible
+ }
+ addComponent(i, memberName, memberAny, memberDynAny);
+ }
+ return true;
+ }
+
+ // Initializes components, names, nameValuePairs and nameDynAnyPairs representation
+ // from the internal TypeCode information with default values
+ // This is not done recursively, only one level.
+ // More levels are initialized lazily, on demand.
+ protected boolean initializeComponentsFromTypeCode() {
+ // This typeCode is of kind tk_struct.
+ TypeCode typeCode = any.type();
+ TypeCode memberType = null;
+ Any memberAny;
+ DynAny memberDynAny = null;
+ String memberName;
+ int length = 0;
+
+ try {
+ length = typeCode.member_count();
+ } catch (BadKind badKind) { // impossible
+ }
+
+ allocComponents(length);
+
+ for (int i=0; i<length; i++) {
+ memberName = null;
+ try {
+ memberName = typeCode.member_name(i);
+ memberType = typeCode.member_type(i);
+ } catch (BadKind badKind) { // impossible
+ } catch (Bounds bounds) { // impossible
+ }
+ try {
+ memberDynAny = DynAnyUtil.createMostDerivedDynAny(memberType, orb);
+ // _DEBUG_
+ //System.out.println("Created DynAny for " + memberName +
+ // ", type " + memberType.kind().value());
+/*
+ if (memberDynAny instanceof DynAnyConstructedImpl) {
+ if ( ! ((DynAnyConstructedImpl)memberDynAny).isRecursive()) {
+ // This is the recursive part
+ ((DynAnyConstructedImpl)memberDynAny).initializeComponentsFromTypeCode();
+ }
+ } // Other implementations have their own way of dealing with implementing the spec.
+*/
+ } catch (InconsistentTypeCode itc) { // impossible
+ }
+ // get a hold of the default initialized Any without copying
+ memberAny = getAny(memberDynAny);
+ addComponent(i, memberName, memberAny, memberDynAny);
+ }
+ return true;
+ }
+
+ // It is probably right not to destroy the released component DynAnys.
+ // Some other DynAny or a user variable might still hold onto them
+ // and if not then the garbage collector will take care of it.
+ protected void clearData() {
+ super.clearData();
+ names = null;
+ nameValuePairs = null;
+ nameDynAnyPairs = null;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyConstructedImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyConstructedImpl.java
new file mode 100644
index 0000000..8665b23
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyConstructedImpl.java
@@ -0,0 +1,937 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+import com.sun.corba.se.impl.corba.TypeCodeImpl; // needed for recursive type codes
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+abstract class DynAnyConstructedImpl extends DynAnyImpl
+{
+ protected static final byte REPRESENTATION_NONE = 0;
+ protected static final byte REPRESENTATION_TYPECODE = 1;
+ protected static final byte REPRESENTATION_ANY = 2;
+ protected static final byte REPRESENTATION_COMPONENTS = 4;
+
+ protected static final byte RECURSIVE_UNDEF = -1;
+ protected static final byte RECURSIVE_NO = 0;
+ protected static final byte RECURSIVE_YES = 1;
+
+ protected static final DynAny[] emptyComponents = new DynAny[0];
+ //
+ // Instance variables
+ //
+
+ // Constructed DynAnys maintain an ordered collection of component DynAnys.
+ DynAny[] components = emptyComponents;
+ byte representations = REPRESENTATION_NONE;
+ byte isRecursive = RECURSIVE_UNDEF;
+
+ //
+ // Constructors
+ //
+
+ private DynAnyConstructedImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynAnyConstructedImpl(ORB orb, Any any, boolean copyValue) {
+ super(orb, any, copyValue);
+ //System.out.println(this + " constructed with any " + any);
+ if (this.any != null) {
+ representations = REPRESENTATION_ANY;
+ }
+ // set the current position to 0 if any has components, otherwise to -1.
+ index = 0;
+ }
+
+ protected DynAnyConstructedImpl(ORB orb, TypeCode typeCode) {
+ // assertion: typeCode has been checked to be valid for this particular subclass.
+ // note: We don't copy TypeCodes since they are considered immutable.
+ super(orb, typeCode);
+ if (typeCode != null) {
+ representations = REPRESENTATION_TYPECODE;
+ }
+ // set the current position to 0 if any has components, otherwise to -1.
+ index = NO_INDEX;
+
+ // _REVISIT_ Would need REPRESENTATION_TYPECODE for lazy initialization
+ //if ( ! isRecursive()) {
+ // initializeComponentsFromTypeCode();
+ //}
+ }
+
+ protected boolean isRecursive() {
+ if (isRecursive == RECURSIVE_UNDEF) {
+ TypeCode typeCode = any.type();
+ if (typeCode instanceof TypeCodeImpl) {
+ if (((TypeCodeImpl)typeCode).is_recursive())
+ isRecursive = RECURSIVE_YES;
+ else
+ isRecursive = RECURSIVE_NO;
+ } else {
+ // No way to find out unless the TypeCode spec changes.
+ isRecursive = RECURSIVE_NO;
+ }
+ }
+ return (isRecursive == RECURSIVE_YES);
+ }
+
+ //
+ // DynAny traversal methods
+ //
+
+ public org.omg.DynamicAny.DynAny current_component()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX) {
+ return null;
+ }
+ return (checkInitComponents() ? components[index] : null);
+ }
+
+ public int component_count() {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return (checkInitComponents() ? components.length : 0);
+ }
+
+ public boolean next() {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (checkInitComponents() == false) {
+ return false;
+ }
+ index++;
+ if (index >= 0 && index < components.length) {
+ return true;
+ } else {
+ index = NO_INDEX;
+ return false;
+ }
+ }
+
+ public boolean seek(int newIndex) {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (newIndex < 0) {
+ this.index = NO_INDEX;
+ return false;
+ }
+ if (checkInitComponents() == false) {
+ return false;
+ }
+ if (newIndex < components.length) {
+ index = newIndex;
+ return true;
+ }
+ return false;
+ }
+
+ public void rewind() {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ this.seek(0);
+ }
+
+ //
+ // Utility methods
+ //
+
+ protected void clearData() {
+ super.clearData();
+ // _REVISIT_ What about status?
+ components = emptyComponents;
+ index = NO_INDEX;
+ representations = REPRESENTATION_NONE;
+ }
+
+ protected void writeAny(OutputStream out) {
+ // If all we got is TypeCode representation (no value)
+ // then we don't want to force creating a default value
+ //System.out.println(this + " checkInitAny before writeAny");
+ checkInitAny();
+ super.writeAny(out);
+ }
+
+ // Makes sure that the components representation is initialized
+ protected boolean checkInitComponents() {
+ if ((representations & REPRESENTATION_COMPONENTS) == 0) {
+ if ((representations & REPRESENTATION_ANY) != 0) {
+ if (initializeComponentsFromAny()) {
+ representations |= REPRESENTATION_COMPONENTS;
+ } else {
+ return false;
+ }
+ } else if ((representations & REPRESENTATION_TYPECODE) != 0) {
+ if (initializeComponentsFromTypeCode()) {
+ representations |= REPRESENTATION_COMPONENTS;
+ } else {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ // Makes sure that the Any representation is initialized
+ protected void checkInitAny() {
+ if ((representations & REPRESENTATION_ANY) == 0) {
+ //System.out.println(this + " checkInitAny: reps does not have REPRESENTATION_ANY");
+ if ((representations & REPRESENTATION_COMPONENTS) != 0) {
+ //System.out.println(this + " checkInitAny: reps has REPRESENTATION_COMPONENTS");
+ if (initializeAnyFromComponents()) {
+ representations |= REPRESENTATION_ANY;
+ }
+ } else if ((representations & REPRESENTATION_TYPECODE) != 0) {
+ //System.out.println(this + " checkInitAny: reps has REPRESENTATION_TYPECODE");
+ if (representations == REPRESENTATION_TYPECODE && isRecursive())
+ return;
+ if (initializeComponentsFromTypeCode()) {
+ representations |= REPRESENTATION_COMPONENTS;
+ }
+ if (initializeAnyFromComponents()) {
+ representations |= REPRESENTATION_ANY;
+ }
+ }
+ } else {
+ //System.out.println(this + " checkInitAny: reps != REPRESENTATION_ANY");
+ }
+ return;
+ }
+
+ protected abstract boolean initializeComponentsFromAny();
+ protected abstract boolean initializeComponentsFromTypeCode();
+
+ // Collapses the whole DynAny hierarchys values into one single streamed Any
+ protected boolean initializeAnyFromComponents() {
+ //System.out.println(this + " initializeAnyFromComponents");
+ OutputStream out = any.create_output_stream();
+ for (int i=0; i<components.length; i++) {
+ if (components[i] instanceof DynAnyImpl) {
+ ((DynAnyImpl)components[i]).writeAny(out);
+ } else {
+ // Not our implementation. Nothing we can do to prevent copying.
+ components[i].to_any().write_value(out);
+ }
+ }
+ any.read_value(out.create_input_stream(), any.type());
+ return true;
+ }
+
+ //
+ // DynAny interface methods
+ //
+
+ public void assign (org.omg.DynamicAny.DynAny dyn_any)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ clearData();
+ super.assign(dyn_any);
+ representations = REPRESENTATION_ANY;
+ index = 0;
+ }
+
+ public void from_any (org.omg.CORBA.Any value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ clearData();
+ super.from_any(value);
+ representations = REPRESENTATION_ANY;
+ index = 0;
+ }
+
+ // Spec: Returns a copy of the internal Any
+ public org.omg.CORBA.Any to_any() {
+ //System.out.println(this + " to_any ");
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ checkInitAny();
+ // Anys value may still be uninitialized if DynAny was initialized by TypeCode only
+ return DynAnyUtil.copy(any, orb);
+ }
+
+ public boolean equal (org.omg.DynamicAny.DynAny dyn_any) {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (dyn_any == this) {
+ return true;
+ }
+ if ( ! any.type().equal(dyn_any.type())) {
+ return false;
+ }
+ // This changes the current position of dyn_any.
+ // Make sure that our position isn't changed.
+ if (checkInitComponents() == false) {
+ return false;
+ }
+ DynAny currentComponent = null;
+ try {
+ // Remember the current position to restore it later
+ currentComponent = dyn_any.current_component();
+ for (int i=0; i<components.length; i++) {
+ if (dyn_any.seek(i) == false)
+ return false;
+ //System.out.println(this + " comparing component " + i + "=" + components[i] +
+ // " of type " + components[i].type().kind().value());
+ if ( ! components[i].equal(dyn_any.current_component())) {
+ //System.out.println("Not equal component " + i);
+ return false;
+ }
+ }
+ } catch (TypeMismatch tm) {
+ // impossible, we checked the type codes already
+ } finally {
+ // Restore the current position of the other DynAny
+ DynAnyUtil.set_current_component(dyn_any, currentComponent);
+ }
+ return true;
+ }
+
+ public void destroy() {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (status == STATUS_DESTROYABLE) {
+ status = STATUS_DESTROYED;
+ for (int i=0; i<components.length; i++) {
+ if (components[i] instanceof DynAnyImpl) {
+ ((DynAnyImpl)components[i]).setStatus(STATUS_DESTROYABLE);
+ }
+ components[i].destroy();
+ }
+ }
+ }
+
+ public org.omg.DynamicAny.DynAny copy() {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ checkInitAny();
+ try {
+ return DynAnyUtil.createMostDerivedDynAny(any, orb, true);
+ } catch (InconsistentTypeCode ictc) {
+ return null; // impossible
+ }
+ }
+
+ // getter / setter methods
+
+ public void insert_boolean(boolean value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_boolean(value);
+ }
+
+ public void insert_octet(byte value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_octet(value);
+ }
+
+ public void insert_char(char value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_char(value);
+ }
+
+ public void insert_short(short value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_short(value);
+ }
+
+ public void insert_ushort(short value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_ushort(value);
+ }
+
+ public void insert_long(int value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_long(value);
+ }
+
+ public void insert_ulong(int value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_ulong(value);
+ }
+
+ public void insert_float(float value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_float(value);
+ }
+
+ public void insert_double(double value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_double(value);
+ }
+
+ public void insert_string(String value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_string(value);
+ }
+
+ public void insert_reference(org.omg.CORBA.Object value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_reference(value);
+ }
+
+ public void insert_typecode(org.omg.CORBA.TypeCode value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_typecode(value);
+ }
+
+ public void insert_longlong(long value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_longlong(value);
+ }
+
+ public void insert_ulonglong(long value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_ulonglong(value);
+ }
+
+ public void insert_wchar(char value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_wchar(value);
+ }
+
+ public void insert_wstring(String value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_wstring(value);
+ }
+
+ public void insert_any(org.omg.CORBA.Any value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_any(value);
+ }
+
+ public void insert_dyn_any (org.omg.DynamicAny.DynAny value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_dyn_any(value);
+ }
+
+ public void insert_val(java.io.Serializable value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ currentComponent.insert_val(value);
+ }
+
+ public java.io.Serializable get_val()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_val();
+ }
+
+ public boolean get_boolean()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_boolean();
+ }
+
+ public byte get_octet()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_octet();
+ }
+
+ public char get_char()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_char();
+ }
+
+ public short get_short()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_short();
+ }
+
+ public short get_ushort()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_ushort();
+ }
+
+ public int get_long()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_long();
+ }
+
+ public int get_ulong()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_ulong();
+ }
+
+ public float get_float()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_float();
+ }
+
+ public double get_double()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_double();
+ }
+
+ public String get_string()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_string();
+ }
+
+ public org.omg.CORBA.Object get_reference()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_reference();
+ }
+
+ public org.omg.CORBA.TypeCode get_typecode()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_typecode();
+ }
+
+ public long get_longlong()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_longlong();
+ }
+
+ public long get_ulonglong()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_ulonglong();
+ }
+
+ public char get_wchar()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_wchar();
+ }
+
+ public String get_wstring()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_wstring();
+ }
+
+ public org.omg.CORBA.Any get_any()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_any();
+ }
+
+ public org.omg.DynamicAny.DynAny get_dyn_any()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (index == NO_INDEX)
+ throw new org.omg.DynamicAny.DynAnyPackage.InvalidValue();
+ DynAny currentComponent = current_component();
+ if (DynAnyUtil.isConstructedDynAny(currentComponent))
+ throw new org.omg.DynamicAny.DynAnyPackage.TypeMismatch();
+ return currentComponent.get_dyn_any();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java
new file mode 100644
index 0000000..95025ee
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyFactoryImpl.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyFactoryPackage.*;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class DynAnyFactoryImpl
+ extends org.omg.CORBA.LocalObject
+ implements org.omg.DynamicAny.DynAnyFactory
+{
+ //
+ // Instance variables
+ //
+
+ private ORB orb;
+
+ //
+ // Constructors
+ //
+
+ private DynAnyFactoryImpl() {
+ this.orb = null;
+ }
+
+ public DynAnyFactoryImpl(ORB orb) {
+ this.orb = orb;
+ }
+
+ //
+ // DynAnyFactory interface methods
+ //
+
+ // Returns the most derived DynAny type based on the Anys TypeCode.
+ public org.omg.DynamicAny.DynAny create_dyn_any (org.omg.CORBA.Any any)
+ throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
+ {
+ return DynAnyUtil.createMostDerivedDynAny(any, orb, true);
+ }
+
+ // Returns the most derived DynAny type based on the TypeCode.
+ public org.omg.DynamicAny.DynAny create_dyn_any_from_type_code (org.omg.CORBA.TypeCode type)
+ throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
+ {
+ return DynAnyUtil.createMostDerivedDynAny(type, orb);
+ }
+
+ // Needed for org.omg.CORBA.Object
+
+ private String[] __ids = { "IDL:omg.org/DynamicAny/DynAnyFactory:1.0" };
+
+ public String[] _ids() {
+ return (String[]) __ids.clone();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java
new file mode 100644
index 0000000..96da602
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyImpl.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.portable.OutputStream;
+
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+abstract class DynAnyImpl extends org.omg.CORBA.LocalObject implements DynAny
+{
+ protected static final int NO_INDEX = -1;
+ // A DynAny is destroyable if it is the root of a DynAny hierarchy.
+ protected static final byte STATUS_DESTROYABLE = 0;
+ // A DynAny is undestroyable if it is a node in a DynAny hierarchy other than the root.
+ protected static final byte STATUS_UNDESTROYABLE = 1;
+ // A DynAny is destroyed if its root has been destroyed.
+ protected static final byte STATUS_DESTROYED = 2;
+
+ //
+ // Instance variables
+ //
+
+ protected ORB orb = null;
+ protected ORBUtilSystemException wrapper ;
+
+ // An Any is used internally to implement the basic DynAny.
+ // It stores the DynAnys TypeCode.
+ // For primitive types it is the only representation.
+ // For complex types it is the streamed representation.
+ protected Any any = null;
+ // Destroyable is the default status for free standing DynAnys.
+ protected byte status = STATUS_DESTROYABLE;
+ protected int index = NO_INDEX;
+
+ //
+ // Constructors
+ //
+
+ protected DynAnyImpl() {
+ wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PRESENTATION ) ;
+ }
+
+ protected DynAnyImpl(ORB orb, Any any, boolean copyValue) {
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PRESENTATION ) ;
+ if (copyValue)
+ this.any = DynAnyUtil.copy(any, orb);
+ else
+ this.any = any;
+ // set the current position to 0 if any has components, otherwise to -1.
+ index = NO_INDEX;
+ }
+
+ protected DynAnyImpl(ORB orb, TypeCode typeCode) {
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PRESENTATION ) ;
+ this.any = DynAnyUtil.createDefaultAnyOfType(typeCode, orb);
+ }
+
+ protected DynAnyFactory factory() {
+ try {
+ return (DynAnyFactory)orb.resolve_initial_references(
+ ORBConstants.DYN_ANY_FACTORY_NAME );
+ } catch (InvalidName in) {
+ throw new RuntimeException("Unable to find DynAnyFactory");
+ }
+ }
+
+ protected Any getAny() {
+ return any;
+ }
+
+ // Uses getAny() if this is our implementation, otherwise uses to_any()
+ // which copies the Any.
+ protected Any getAny(DynAny dynAny) {
+ if (dynAny instanceof DynAnyImpl)
+ return ((DynAnyImpl)dynAny).getAny();
+ else
+ // _REVISIT_ Nothing we can do about copying at this point
+ // if this is not our implementation of DynAny.
+ // To prevent this we would need another representation,
+ // one where component DynAnys are initialized but not the component Anys.
+ return dynAny.to_any();
+ }
+
+ protected void writeAny(OutputStream out) {
+ //System.out.println(this + " writeAny of type " + type().kind().value());
+ any.write_value(out);
+ }
+
+ protected void setStatus(byte newStatus) {
+ status = newStatus;
+ }
+
+ protected void clearData() {
+ // This clears the data part of the Any while keeping the TypeCode info.
+ any.type(any.type());
+ }
+
+ //
+ // DynAny interface methods
+ //
+
+ public org.omg.CORBA.TypeCode type() {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return any.type();
+ }
+
+ // Makes a copy of the Any value inside the parameter
+ public void assign (org.omg.DynamicAny.DynAny dyn_any)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if ((any != null) && (! any.type().equal(dyn_any.type()))) {
+ throw new TypeMismatch();
+ }
+ any = dyn_any.to_any();
+ }
+
+ // Makes a copy of the Any parameter
+ public void from_any (org.omg.CORBA.Any value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if ((any != null) && (! any.type().equal(value.type()))) {
+ throw new TypeMismatch();
+ }
+ // If the passed Any does not contain a legal value
+ // (such as a null string), the operation raises InvalidValue.
+ Any tempAny = null;
+ try {
+ tempAny = DynAnyUtil.copy(value, orb);
+ } catch (Exception e) {
+ throw new InvalidValue();
+ }
+ if ( ! DynAnyUtil.isInitialized(tempAny)) {
+ throw new InvalidValue();
+ }
+ any = tempAny;
+ }
+
+ public abstract org.omg.CORBA.Any to_any();
+ public abstract boolean equal (org.omg.DynamicAny.DynAny dyn_any);
+ public abstract void destroy();
+ public abstract org.omg.DynamicAny.DynAny copy();
+
+ // Needed for org.omg.CORBA.Object
+
+ private String[] __ids = { "IDL:omg.org/DynamicAny/DynAny:1.0" };
+
+ public String[] _ids() {
+ return (String[]) __ids.clone();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyUtil.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyUtil.java
new file mode 100644
index 0000000..ee90d1a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynAnyUtil.java
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.portable.OutputStream;
+//import org.omg.CORBA.ORBPackage.*;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+import java.math.BigDecimal;
+import com.sun.corba.se.impl.corba.AnyImpl;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class DynAnyUtil
+{
+ static boolean isConsistentType(TypeCode typeCode) {
+ int kind = typeCode.kind().value();
+ return (kind != TCKind._tk_Principal &&
+ kind != TCKind._tk_native &&
+ kind != TCKind._tk_abstract_interface);
+ }
+
+ static boolean isConstructedDynAny(DynAny dynAny) {
+ // DynFixed is constructed but not a subclass of DynAnyConstructedImpl
+ //return (dynAny instanceof DynAnyConstructedImpl);
+ int kind = dynAny.type().kind().value();
+ return (kind == TCKind._tk_sequence ||
+ kind == TCKind._tk_struct ||
+ kind == TCKind._tk_array ||
+ kind == TCKind._tk_union ||
+ kind == TCKind._tk_enum ||
+ kind == TCKind._tk_fixed ||
+ kind == TCKind._tk_value ||
+ kind == TCKind._tk_value_box);
+ }
+
+ static DynAny createMostDerivedDynAny(Any any, ORB orb, boolean copyValue)
+ throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
+ {
+ if (any == null || ! DynAnyUtil.isConsistentType(any.type()))
+ throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();
+
+ switch (any.type().kind().value()) {
+ case TCKind._tk_sequence:
+ return new DynSequenceImpl(orb, any, copyValue);
+ case TCKind._tk_struct:
+ return new DynStructImpl(orb, any, copyValue);
+ case TCKind._tk_array:
+ return new DynArrayImpl(orb, any, copyValue);
+ case TCKind._tk_union:
+ return new DynUnionImpl(orb, any, copyValue);
+ case TCKind._tk_enum:
+ return new DynEnumImpl(orb, any, copyValue);
+ case TCKind._tk_fixed:
+ return new DynFixedImpl(orb, any, copyValue);
+ case TCKind._tk_value:
+ return new DynValueImpl(orb, any, copyValue);
+ case TCKind._tk_value_box:
+ return new DynValueBoxImpl(orb, any, copyValue);
+ default:
+ return new DynAnyBasicImpl(orb, any, copyValue);
+ }
+ }
+
+ static DynAny createMostDerivedDynAny(TypeCode typeCode, ORB orb)
+ throws org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode
+ {
+ if (typeCode == null || ! DynAnyUtil.isConsistentType(typeCode))
+ throw new org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode();
+
+ switch (typeCode.kind().value()) {
+ case TCKind._tk_sequence:
+ return new DynSequenceImpl(orb, typeCode);
+ case TCKind._tk_struct:
+ return new DynStructImpl(orb, typeCode);
+ case TCKind._tk_array:
+ return new DynArrayImpl(orb, typeCode);
+ case TCKind._tk_union:
+ return new DynUnionImpl(orb, typeCode);
+ case TCKind._tk_enum:
+ return new DynEnumImpl(orb, typeCode);
+ case TCKind._tk_fixed:
+ return new DynFixedImpl(orb, typeCode);
+ case TCKind._tk_value:
+ return new DynValueImpl(orb, typeCode);
+ case TCKind._tk_value_box:
+ return new DynValueBoxImpl(orb, typeCode);
+ default:
+ return new DynAnyBasicImpl(orb, typeCode);
+ }
+ }
+
+ // Extracts a member value according to the given TypeCode from the given complex Any
+ // (at the Anys current internal stream position, consuming the anys stream on the way)
+ // and returns it wrapped into a new Any
+/*
+ static Any extractAnyFromAny(TypeCode memberType, Any any, ORB orb) {
+ // Moved this functionality into AnyImpl because it is needed for Any.equal()
+ return ((AnyImpl)any).extractAny(memberType, orb);
+ }
+*/
+
+ // Extracts a member value according to the given TypeCode from the given complex Any
+ // (at the Anys current internal stream position, consuming the anys stream on the way)
+ // and returns it wrapped into a new Any
+ static Any extractAnyFromStream(TypeCode memberType, InputStream input, ORB orb) {
+ return AnyImpl.extractAnyFromStream(memberType, input, orb);
+ }
+
+ // Creates a default Any of the given type.
+ static Any createDefaultAnyOfType(TypeCode typeCode, ORB orb) {
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PRESENTATION ) ;
+
+ Any returnValue = orb.create_any();
+ // The spec for DynAny differs from Any on initialization via type code:
+ // - false for boolean
+ // - zero for numeric types
+ // - zero for types octet, char, and wchar
+ // - the empty string for string and wstring
+ // - nil for object references
+ // - a type code with a TCKind value of tk_null for type codes
+ // - for Any values, an Any containing a type code with a TCKind value of tk_null
+ // type and no value
+ switch (typeCode.kind().value()) {
+ case TCKind._tk_boolean:
+ // false for boolean
+ returnValue.insert_boolean(false);
+ break;
+ case TCKind._tk_short:
+ // zero for numeric types
+ returnValue.insert_short((short)0);
+ break;
+ case TCKind._tk_ushort:
+ // zero for numeric types
+ returnValue.insert_ushort((short)0);
+ break;
+ case TCKind._tk_long:
+ // zero for numeric types
+ returnValue.insert_long(0);
+ break;
+ case TCKind._tk_ulong:
+ // zero for numeric types
+ returnValue.insert_ulong(0);
+ break;
+ case TCKind._tk_longlong:
+ // zero for numeric types
+ returnValue.insert_longlong((long)0);
+ break;
+ case TCKind._tk_ulonglong:
+ // zero for numeric types
+ returnValue.insert_ulonglong((long)0);
+ break;
+ case TCKind._tk_float:
+ // zero for numeric types
+ returnValue.insert_float((float)0.0);
+ break;
+ case TCKind._tk_double:
+ // zero for numeric types
+ returnValue.insert_double((double)0.0);
+ break;
+ case TCKind._tk_octet:
+ // zero for types octet, char, and wchar
+ returnValue.insert_octet((byte)0);
+ break;
+ case TCKind._tk_char:
+ // zero for types octet, char, and wchar
+ returnValue.insert_char((char)0);
+ break;
+ case TCKind._tk_wchar:
+ // zero for types octet, char, and wchar
+ returnValue.insert_wchar((char)0);
+ break;
+ case TCKind._tk_string:
+ // the empty string for string and wstring
+ // Make sure that type code for bounded strings gets respected
+ returnValue.type(typeCode);
+ // Doesn't erase the type of bounded string
+ returnValue.insert_string("");
+ break;
+ case TCKind._tk_wstring:
+ // the empty string for string and wstring
+ // Make sure that type code for bounded strings gets respected
+ returnValue.type(typeCode);
+ // Doesn't erase the type of bounded string
+ returnValue.insert_wstring("");
+ break;
+ case TCKind._tk_objref:
+ // nil for object references
+ returnValue.insert_Object(null);
+ break;
+ case TCKind._tk_TypeCode:
+ // a type code with a TCKind value of tk_null for type codes
+ // We can reuse the type code that's already in the any.
+ returnValue.insert_TypeCode(returnValue.type());
+ break;
+ case TCKind._tk_any:
+ // for Any values, an Any containing a type code with a TCKind value
+ // of tk_null type and no value.
+ // This is exactly what the default AnyImpl constructor provides.
+ // _REVISIT_ Note that this inner Any is considered uninitialized.
+ returnValue.insert_any(orb.create_any());
+ break;
+ case TCKind._tk_struct:
+ case TCKind._tk_union:
+ case TCKind._tk_enum:
+ case TCKind._tk_sequence:
+ case TCKind._tk_array:
+ case TCKind._tk_except:
+ case TCKind._tk_value:
+ case TCKind._tk_value_box:
+ // There are no default value for complex types since there is no
+ // concept of a hierarchy of Anys. Only DynAnys can be arrange in
+ // a hierarchy to mirror the TypeCode hierarchy.
+ // See DynAnyConstructedImpl.initializeComponentsFromTypeCode()
+ // on how this DynAny hierarchy is created from TypeCodes.
+ returnValue.type(typeCode);
+ break;
+ case TCKind._tk_fixed:
+ returnValue.insert_fixed(new BigDecimal("0.0"), typeCode);
+ break;
+ case TCKind._tk_native:
+ case TCKind._tk_alias:
+ case TCKind._tk_void:
+ case TCKind._tk_Principal:
+ case TCKind._tk_abstract_interface:
+ returnValue.type(typeCode);
+ break;
+ case TCKind._tk_null:
+ // Any is already initialized to null
+ break;
+ case TCKind._tk_longdouble:
+ // Unspecified for Java
+ throw wrapper.tkLongDoubleNotSupported() ;
+ default:
+ throw wrapper.typecodeNotSupported() ;
+ }
+ return returnValue;
+ }
+/*
+ static Any setTypeOfAny(TypeCode typeCode, Any value) {
+ if (value != null) {
+ value.read_value(value.create_input_stream(), typeCode);
+ }
+ return value;
+ }
+*/
+ static Any copy(Any inAny, ORB orb) {
+ return new AnyImpl(orb, inAny);
+ }
+
+/*
+ static Any copy(Any inAny, ORB orb) {
+ Any outAny = null;
+ if (inAny != null && orb != null) {
+ outAny = orb.create_any();
+ outAny.read_value(inAny.create_input_stream(), inAny.type());
+ // isInitialized is set to true
+ }
+ return outAny;
+ }
+*/
+
+ static DynAny convertToNative(DynAny dynAny, ORB orb) {
+ if (dynAny instanceof DynAnyImpl) {
+ return dynAny;
+ } else {
+ // if copy flag wasn't true we would be using our DynAny with
+ // a foreign Any in it.
+ try {
+ return createMostDerivedDynAny(dynAny.to_any(), orb, true);
+ } catch (InconsistentTypeCode ictc) {
+ return null;
+ }
+ }
+ }
+
+ static boolean isInitialized(Any any) {
+ // Returning simply the value of Any.isInitialized() is not enough.
+ // The DynAny spec says that Anys containing null strings do not contain
+ // a "legal value" (see ptc 99-10-07, 9.2.3.3)
+ boolean isInitialized = ((AnyImpl)any).isInitialized();
+ switch (any.type().kind().value()) {
+ case TCKind._tk_string:
+ return (isInitialized && (any.extract_string() != null));
+ case TCKind._tk_wstring:
+ return (isInitialized && (any.extract_wstring() != null));
+ }
+ return isInitialized;
+ }
+
+ // This is a convenient method to reset the current component to where it was
+ // before we changed it. See DynAnyConstructedImpl.equal for use.
+ static boolean set_current_component(DynAny dynAny, DynAny currentComponent) {
+ if (currentComponent != null) {
+ try {
+ dynAny.rewind();
+ do {
+ if (dynAny.current_component() == currentComponent)
+ return true;
+ } while (dynAny.next());
+ } catch (TypeMismatch tm) { /* impossible */ }
+ }
+ return false;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynArrayImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynArrayImpl.java
new file mode 100644
index 0000000..cb46958
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynArrayImpl.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class DynArrayImpl extends DynAnyCollectionImpl implements DynArray
+{
+ //
+ // Constructors
+ //
+
+ private DynArrayImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynArrayImpl(ORB orb, Any any, boolean copyValue) {
+ super(orb, any, copyValue);
+ }
+
+ protected DynArrayImpl(ORB orb, TypeCode typeCode) {
+ super(orb, typeCode);
+ }
+
+ // Initializes components and anys representation
+ // from the Any representation
+ protected boolean initializeComponentsFromAny() {
+ // This typeCode is of kind tk_array.
+ TypeCode typeCode = any.type();
+ int length = getBound();
+ TypeCode contentType = getContentType();
+ InputStream input;
+
+ try {
+ input = any.create_input_stream();
+ } catch (BAD_OPERATION e) {
+ return false;
+ }
+
+ components = new DynAny[length];
+ anys = new Any[length];
+
+ for (int i=0; i<length; i++) {
+ // _REVISIT_ Could use read_xxx_array() methods on InputStream for efficiency
+ // but only for primitive types
+ anys[i] = DynAnyUtil.extractAnyFromStream(contentType, input, orb);
+ try {
+ // Creates the appropriate subtype without copying the Any
+ components[i] = DynAnyUtil.createMostDerivedDynAny(anys[i], orb, false);
+ } catch (InconsistentTypeCode itc) { // impossible
+ }
+ }
+ return true;
+ }
+
+ // Initializes components and anys representation
+ // from the internal TypeCode information with default values.
+ // This is not done recursively, only one level.
+ // More levels are initialized lazily, on demand.
+ protected boolean initializeComponentsFromTypeCode() {
+ // This typeCode is of kind tk_array.
+ TypeCode typeCode = any.type();
+ int length = getBound();
+ TypeCode contentType = getContentType();
+
+ components = new DynAny[length];
+ anys = new Any[length];
+
+ for (int i=0; i<length; i++) {
+ createDefaultComponentAt(i, contentType);
+ }
+ return true;
+ }
+
+ //
+ // DynArray interface methods
+ //
+
+ // Initializes the elements of the array.
+ // If value does not contain the same number of elements as the array dimension,
+ // the operation raises InvalidValue.
+ // If one or more elements have a type that is inconsistent with the DynArrays TypeCode,
+ // the operation raises TypeMismatch.
+ // This operation does not change the current position.
+/*
+ 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
+ {
+ if (value == null || value.length != getBound()) {
+ throw new InvalidValue();
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynEnumImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynEnumImpl.java
new file mode 100644
index 0000000..9777971
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynEnumImpl.java
@@ -0,0 +1,190 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.*;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class DynEnumImpl extends DynAnyBasicImpl implements DynEnum
+{
+ //
+ // Instance variables
+ //
+
+ // This int and the any value are kept in sync at all times
+ int currentEnumeratorIndex = NO_INDEX;
+
+ //
+ // Constructors
+ //
+
+ private DynEnumImpl() {
+ this(null, (Any)null, false);
+ }
+
+ // The current position of a DynEnum is always -1.
+ protected DynEnumImpl(ORB orb, Any anAny, boolean copyValue) {
+ super(orb, anAny, copyValue);
+ index = NO_INDEX;
+ // The any doesn't have to be initialized. We have a default value in this case.
+ try {
+ currentEnumeratorIndex = any.extract_long();
+ } catch (BAD_OPERATION e) {
+ // _REVISIT_: Fix Me
+ currentEnumeratorIndex = 0;
+ any.type(any.type());
+ any.insert_long(0);
+ }
+ }
+
+ // Sets the current position to -1 and sets the value of the enumerator
+ // to the first enumerator value indicated by the TypeCode.
+ protected DynEnumImpl(ORB orb, TypeCode typeCode) {
+ super(orb, typeCode);
+ index = NO_INDEX;
+ currentEnumeratorIndex = 0;
+ any.insert_long(0);
+ }
+
+ //
+ // Utility methods
+ //
+
+ private int memberCount() {
+ int memberCount = 0;
+ try {
+ memberCount = any.type().member_count();
+ } catch (BadKind bad) {
+ }
+ return memberCount;
+ }
+
+ private String memberName(int i) {
+ String memberName = null;
+ try {
+ memberName = any.type().member_name(i);
+ } catch (BadKind bad) {
+ } catch (Bounds bounds) {
+ }
+ return memberName;
+ }
+
+ private int computeCurrentEnumeratorIndex(String value) {
+ int memberCount = memberCount();
+ for (int i=0; i<memberCount; i++) {
+ if (memberName(i).equals(value)) {
+ return i;
+ }
+ }
+ return NO_INDEX;
+ }
+
+ //
+ // DynAny interface methods
+ //
+
+ // Returns always 0 for DynEnum
+ public int component_count() {
+ return 0;
+ }
+
+ // Calling current_component on a DynAny that cannot have components,
+ // such as a DynEnum or an empty exception, raises TypeMismatch.
+ public org.omg.DynamicAny.DynAny current_component()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ throw new TypeMismatch();
+ }
+
+ //
+ // DynEnum interface methods
+ //
+
+ // Returns the value of the DynEnum as an IDL identifier.
+ public String get_as_string () {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return memberName(currentEnumeratorIndex);
+ }
+
+ // Sets the value of the DynEnum to the enumerated value
+ // whose IDL identifier is passed in the value parameter.
+ // If value contains a string that is not a valid IDL identifier
+ // for the corresponding enumerated type, the operation raises InvalidValue.
+ public void set_as_string (String value)
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ int newIndex = computeCurrentEnumeratorIndex(value);
+ if (newIndex == NO_INDEX) {
+ throw new InvalidValue();
+ }
+ currentEnumeratorIndex = newIndex;
+ any.insert_long(newIndex);
+ }
+
+ // Returns the value of the DynEnum as the enumerated values ordinal value.
+ // Enumerators have ordinal values 0 to n-1,
+ // as they appear from left to right in the corresponding IDL definition.
+ public int get_as_ulong () {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return currentEnumeratorIndex;
+ }
+
+ // Sets the value of the DynEnum as the enumerated values ordinal value.
+ // If value contains a value that is outside the range of ordinal values
+ // for the corresponding enumerated type, the operation raises InvalidValue.
+ public void set_as_ulong (int value)
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (value < 0 || value >= memberCount()) {
+ throw new InvalidValue();
+ }
+ currentEnumeratorIndex = value;
+ any.insert_long(value);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynFixedImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynFixedImpl.java
new file mode 100644
index 0000000..5486f9b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynFixedImpl.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.*;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class DynFixedImpl extends DynAnyBasicImpl implements DynFixed
+{
+ //
+ // Constructors
+ //
+
+ private DynFixedImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynFixedImpl(ORB orb, Any any, boolean copyValue) {
+ super(orb, any, copyValue);
+ }
+
+ // Sets the current position to -1 and the value to zero.
+ protected DynFixedImpl(ORB orb, TypeCode typeCode) {
+ super(orb, typeCode);
+ index = NO_INDEX;
+ }
+
+ //
+ // DynAny interface methods
+ //
+/*
+ public int component_count() {
+ return 0;
+ }
+*/
+ //
+ // DynFixed interface methods
+ //
+
+ public String get_value () {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return any.extract_fixed().toString();
+ }
+
+ // Initializes the value of the DynFixed.
+ // The val string must contain a fixed string constant in the same format
+ // as used for IDL fixed-point literals.
+ //
+ // It may consist of an integer part, an optional decimal point,
+ // a fraction part and an optional letter d or D.
+ // The integer and fraction parts both must be sequences of decimal (base 10) digits.
+ // Either the integer part or the fraction part, but not both, may be missing.
+ //
+ // If val contains a value whose scale exceeds that of the DynFixed or is not initialized,
+ // the operation raises InvalidValue.
+ // The return value is true if val can be represented as the DynFixed without loss of precision.
+ // If val has more fractional digits than can be represented in the DynFixed,
+ // fractional digits are truncated and the return value is false.
+ // 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
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ int digits = 0;
+ int scale = 0;
+ boolean preservedPrecision = true;
+ try {
+ digits = any.type().fixed_digits();
+ scale = any.type().fixed_scale();
+ } catch (BadKind ex) { // impossible
+ }
+ // First get rid of leading or trailing whitespace which is allowed
+ String string = val.trim();
+ if (string.length() == 0)
+ throw new TypeMismatch();
+ // Now scan for the sign
+ String sign = "";
+ if (string.charAt(0) == '-') {
+ sign = "-";
+ string = string.substring(1);
+ } else if (string.charAt(0) == '+') {
+ sign = "+";
+ string = string.substring(1);
+ }
+ // Now get rid of the letter d or D.
+ int dIndex = string.indexOf('d');
+ if (dIndex == -1) {
+ dIndex = string.indexOf('D');
+ }
+ if (dIndex != -1) {
+ string = string.substring(0, dIndex);
+ }
+ // Just to be sure
+ if (string.length() == 0)
+ throw new TypeMismatch();
+ // Now look for the dot to determine the integer part
+ String integerPart;
+ String fractionPart;
+ int currentScale;
+ int currentDigits;
+ int dotIndex = string.indexOf('.');
+ if (dotIndex == -1) {
+ integerPart = string;
+ fractionPart = null;
+ currentScale = 0;
+ currentDigits = integerPart.length();
+ } else if (dotIndex == 0 ) {
+ integerPart = null;
+ fractionPart = string;
+ currentScale = fractionPart.length();
+ currentDigits = currentScale;
+ } else {
+ integerPart = string.substring(0, dotIndex);
+ fractionPart = string.substring(dotIndex + 1);
+ currentScale = fractionPart.length();
+ currentDigits = integerPart.length() + currentScale;
+ }
+ // Let's see if we have to drop some precision
+ if (currentDigits > digits) {
+ preservedPrecision = false;
+ // truncate the fraction part
+ if (integerPart.length() < digits) {
+ fractionPart = fractionPart.substring(0, digits - integerPart.length());
+ } else if (integerPart.length() == digits) {
+ // currentScale > 0
+ // drop the fraction completely
+ fractionPart = null;
+ } else {
+ // integerPart.length() > digits
+ // unable to truncate fraction part
+ throw new InvalidValue();
+ }
+ }
+ // If val contains a value whose scale exceeds that of the DynFixed or is not initialized,
+ // 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);
+ }
+*/
+ // Now check whether both parts are valid numbers
+ BigDecimal result;
+ try {
+ new BigInteger(integerPart);
+ if (fractionPart == null) {
+ result = new BigDecimal(sign + integerPart);
+ } else {
+ new BigInteger(fractionPart);
+ result = new BigDecimal(sign + integerPart + "." + fractionPart);
+ }
+ } catch (NumberFormatException nfe) {
+ throw new TypeMismatch();
+ }
+ any.insert_fixed(result, any.type());
+ return preservedPrecision;
+ }
+
+ public String toString() {
+ int digits = 0;
+ int scale = 0;
+ try {
+ digits = any.type().fixed_digits();
+ scale = any.type().fixed_scale();
+ } catch (BadKind ex) { // impossible
+ }
+ return "DynFixed with value=" + this.get_value() + ", digits=" + digits + ", scale=" + scale;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java
new file mode 100644
index 0000000..1cf5303
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynSequenceImpl.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+// _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
+{
+ //
+ // Constructors
+ //
+
+ private DynSequenceImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynSequenceImpl(ORB orb, Any any, boolean copyValue) {
+ super(orb, any, copyValue);
+ }
+
+ // Sets the current position to -1 and creates an empty sequence.
+ protected DynSequenceImpl(ORB orb, TypeCode typeCode) {
+ super(orb, typeCode);
+ }
+
+ // Initializes components and anys representation
+ // from the Any representation
+ protected boolean initializeComponentsFromAny() {
+ // This typeCode is of kind tk_sequence.
+ TypeCode typeCode = any.type();
+ int length;
+ TypeCode contentType = getContentType();
+ InputStream input;
+
+ try {
+ input = any.create_input_stream();
+ } catch (BAD_OPERATION e) {
+ return false;
+ }
+
+ length = input.read_long();
+ components = new DynAny[length];
+ anys = new Any[length];
+
+ for (int i=0; i<length; i++) {
+ // _REVISIT_ Could use read_xxx_array() methods on InputStream for efficiency
+ // but only for primitive types
+ anys[i] = DynAnyUtil.extractAnyFromStream(contentType, input, orb);
+ try {
+ // Creates the appropriate subtype without copying the Any
+ components[i] = DynAnyUtil.createMostDerivedDynAny(anys[i], orb, false);
+ } catch (InconsistentTypeCode itc) { // impossible
+ }
+ }
+ return true;
+ }
+
+ // Sets the current position to -1 and creates an empty sequence.
+ protected boolean initializeComponentsFromTypeCode() {
+ // already done in the type code constructor
+ components = new DynAny[0];
+ anys = new Any[0];
+ return true;
+ }
+
+ // Collapses the whole DynAny hierarchys values into one single streamed Any
+ protected boolean initializeAnyFromComponents() {
+ OutputStream out = any.create_output_stream();
+ // Writing the length first is the only difference to supers implementation
+ out.write_long(components.length);
+ for (int i=0; i<components.length; i++) {
+ if (components[i] instanceof DynAnyImpl) {
+ ((DynAnyImpl)components[i]).writeAny(out);
+ } else {
+ // Not our implementation. Nothing we can do to prevent copying.
+ components[i].to_any().write_value(out);
+ }
+ }
+ any.read_value(out.create_input_stream(), any.type());
+ return true;
+ }
+
+
+ //
+ // DynSequence interface methods
+ //
+
+ // Returns the current length of the sequence
+ public int get_length() {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return (checkInitComponents() ? components.length : 0);
+ }
+
+ // Sets the length of the sequence. Increasing the length of a sequence
+ // adds new elements at the tail without affecting the values of already
+ // existing elements. Newly added elements are default-initialized.
+ //
+ // Increasing the length of a sequence sets the current position to the first
+ // newly-added element if the previous current position was -1.
+ // Otherwise, if the previous current position was not -1,
+ // the current position is not affected.
+ //
+ // Increasing the length of a bounded sequence to a value larger than the bound
+ // raises InvalidValue.
+ //
+ // Decreasing the length of a sequence removes elements from the tail
+ // without affecting the value of those elements that remain.
+ // The new current position after decreasing the length of a sequence is determined
+ // as follows:
+ // ?f the length of the sequence is set to zero, the current position is set to -1.
+ // ?f the current position is -1 before decreasing the length, it remains at -1.
+ // ?f the current position indicates a valid element and that element is not removed
+ // when the length is decreased, the current position remains unaffected.
+ // ?f the current position indicates a valid element and that element is removed, the
+ // current position is set to -1.
+ public void set_length(int len)
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ int bound = getBound();
+ if (bound > 0 && len > bound) {
+ throw new InvalidValue();
+ }
+
+ checkInitComponents();
+
+ int oldLength = components.length;
+ if (len > oldLength) {
+ // Increase length
+ DynAny[] newComponents = new DynAny[len];
+ Any[] newAnys = new Any[len];
+ System.arraycopy(components, 0, newComponents, 0, oldLength);
+ System.arraycopy(anys, 0, newAnys, 0, oldLength);
+ components = newComponents;
+ anys = newAnys;
+
+ // Newly added elements are default-initialized
+ TypeCode contentType = getContentType();
+ for (int i=oldLength; i<len; i++) {
+ createDefaultComponentAt(i, contentType);
+ }
+
+ // Increasing the length of a sequence sets the current position to the first
+ // newly-added element if the previous current position was -1.
+ if (index == NO_INDEX)
+ index = oldLength;
+ } else if (len < oldLength) {
+ // Decrease length
+ DynAny[] newComponents = new DynAny[len];
+ Any[] newAnys = new Any[len];
+ System.arraycopy(components, 0, newComponents, 0, len);
+ System.arraycopy(anys, 0, newAnys, 0, len);
+ // It is probably right not to destroy the released component DynAnys.
+ // Some other DynAny or a user variable might still hold onto them
+ // and if not then the garbage collector will take care of it.
+ //for (int i=len; i<oldLength; i++) {
+ // components[i].destroy();
+ //}
+ components = newComponents;
+ anys = newAnys;
+
+ // ?f the length of the sequence is set to zero, the current position is set to -1.
+ // ?f the current position is -1 before decreasing the length, it remains at -1.
+ // ?f the current position indicates a valid element and that element is not removed
+ // when the length is decreased, the current position remains unaffected.
+ // ?f the current position indicates a valid element and that element is removed,
+ // the current position is set to -1.
+ if (len == 0 || index >= len) {
+ index = NO_INDEX;
+ }
+ } else {
+ // Length unchanged
+ // Maybe components is now default initialized from type code
+ if (index == NO_INDEX && len > 0) {
+ index = 0;
+ }
+ }
+ }
+
+ // Initializes the elements of the sequence.
+ // The length of the DynSequence is set to the length of value.
+ // The current position is set to zero if value has non-zero length
+ // and to -1 if value is a zero-length sequence.
+ // If the length of value exceeds the bound of a bounded sequence,
+ // 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;
+*/
+
+ //
+ // Utility methods
+ //
+
+ protected void checkValue(Object[] value)
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (value == null || value.length == 0) {
+ clearData();
+ index = NO_INDEX;
+ return;
+ } else {
+ index = 0;
+ }
+ int bound = getBound();
+ if (bound > 0 && value.length > bound) {
+ throw new InvalidValue();
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynStructImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynStructImpl.java
new file mode 100644
index 0000000..43145e2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynStructImpl.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class DynStructImpl extends DynAnyComplexImpl implements DynStruct
+{
+ //
+ // Constructors
+ //
+
+ private DynStructImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynStructImpl(ORB orb, Any any, boolean copyValue) {
+ // We can be sure that typeCode is of kind tk_struct
+ super(orb, any, copyValue);
+ // Initialize components lazily, on demand.
+ // This is an optimization in case the user is only interested in storing Anys.
+ }
+
+ protected DynStructImpl(ORB orb, TypeCode typeCode) {
+ // We can be sure that typeCode is of kind tk_struct
+ super(orb, typeCode);
+ // For DynStruct, the operation sets the current position to -1
+ // for empty exceptions and to zero for all other TypeCodes.
+ // The members (if any) are (recursively) initialized to their default values.
+ index = 0;
+ }
+
+ //
+ // Methods differing from DynValues
+ //
+
+ public org.omg.DynamicAny.NameValuePair[] get_members () {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ checkInitComponents();
+ return nameValuePairs;
+ }
+
+ public org.omg.DynamicAny.NameDynAnyPair[] get_members_as_dyn_any () {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ checkInitComponents();
+ return nameDynAnyPairs;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynUnionImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynUnionImpl.java
new file mode 100644
index 0000000..51a44b5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynUnionImpl.java
@@ -0,0 +1,385 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class DynUnionImpl extends DynAnyConstructedImpl implements DynUnion
+{
+ //
+ // Instance variables
+ //
+
+ DynAny discriminator = null;
+ // index either points to the discriminator or the named member is it exists.
+ // The currently active member, which is of the same type as the discriminator.
+ DynAny currentMember = null;
+ int currentMemberIndex = NO_INDEX;
+
+ //
+ // Constructors
+ //
+
+ private DynUnionImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynUnionImpl(ORB orb, Any any, boolean copyValue) {
+ // We can be sure that typeCode is of kind tk_union
+ super(orb, any, copyValue);
+ }
+
+ protected DynUnionImpl(ORB orb, TypeCode typeCode) {
+ // We can be sure that typeCode is of kind tk_union
+ super(orb, typeCode);
+ }
+
+ protected boolean initializeComponentsFromAny() {
+ try {
+ InputStream input = any.create_input_stream();
+ Any discriminatorAny = DynAnyUtil.extractAnyFromStream(discriminatorType(), input, orb);
+ discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
+ currentMemberIndex = currentUnionMemberIndex(discriminatorAny);
+ Any memberAny = DynAnyUtil.extractAnyFromStream(memberType(currentMemberIndex), input, orb);
+ currentMember = DynAnyUtil.createMostDerivedDynAny(memberAny, orb, false);
+ components = new DynAny[] {discriminator, currentMember};
+ } catch (InconsistentTypeCode ictc) { // impossible
+ }
+ return true;
+ }
+
+ // Sets the current position to zero.
+ // 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");
+ 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};
+ } catch (InconsistentTypeCode ictc) { // impossible
+ }
+ return true;
+ }
+
+ //
+ // Convenience methods
+ //
+
+ private TypeCode discriminatorType() {
+ TypeCode discriminatorType = null;
+ try {
+ discriminatorType = any.type().discriminator_type();
+ } catch (BadKind bad) {
+ }
+ return discriminatorType;
+ }
+
+ private int memberCount() {
+ int memberCount = 0;
+ try {
+ memberCount = any.type().member_count();
+ } catch (BadKind bad) {
+ }
+ return memberCount;
+ }
+
+ private Any memberLabel(int i) {
+ Any memberLabel = null;
+ try {
+ memberLabel = any.type().member_label(i);
+ } catch (BadKind bad) {
+ } catch (Bounds bounds) {
+ }
+ return memberLabel;
+ }
+
+ private TypeCode memberType(int i) {
+ TypeCode memberType = null;
+ try {
+ memberType = any.type().member_type(i);
+ } catch (BadKind bad) {
+ } catch (Bounds bounds) {
+ }
+ return memberType;
+ }
+
+ private String memberName(int i) {
+ String memberName = null;
+ try {
+ memberName = any.type().member_name(i);
+ } catch (BadKind bad) {
+ } catch (Bounds bounds) {
+ }
+ return memberName;
+ }
+
+ private int defaultIndex() {
+ int defaultIndex = -1;
+ try {
+ defaultIndex = any.type().default_index();
+ } catch (BadKind bad) {
+ }
+ return defaultIndex;
+ }
+
+ private int currentUnionMemberIndex(Any discriminatorValue) {
+ int memberCount = memberCount();
+ Any memberLabel;
+ for (int i=0; i<memberCount; i++) {
+ memberLabel = memberLabel(i);
+ if (memberLabel.equal(discriminatorValue)) {
+ return i;
+ }
+ }
+ if (defaultIndex() != -1) {
+ return defaultIndex();
+ }
+ return NO_INDEX;
+ }
+
+ protected void clearData() {
+ super.clearData();
+ discriminator = null;
+ // Necessary to guarantee OBJECT_NOT_EXIST in member()
+ currentMember.destroy();
+ currentMember = null;
+ currentMemberIndex = NO_INDEX;
+ }
+
+ //
+ // DynAny interface methods
+ //
+
+ // _REVISIT_ More efficient copy operation
+
+ //
+ // DynUnion interface methods
+ //
+
+ /**
+ * Returns the current discriminator value.
+ */
+ public org.omg.DynamicAny.DynAny get_discriminator () {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return (checkInitComponents() ? discriminator : null);
+ }
+
+ // Sets the discriminator of the DynUnion to the specified value.
+ // If the TypeCode of the parameter is not equivalent
+ // to the TypeCode of the unions discriminator, the operation raises TypeMismatch.
+ //
+ // Setting the discriminator to a value that is consistent with the currently
+ // active union member does not affect the currently active member.
+ // Setting the discriminator to a value that is inconsistent with the currently
+ // active member deactivates the member and activates the member that is consistent
+ // with the new discriminator value (if there is a member for that value)
+ // by initializing the member to its default value.
+ //
+ // If the discriminator value indicates a non-existent union member
+ // this operation sets the current position to 0
+ // (has_no_active_member returns true in this case).
+ // Otherwise the current position is set to 1 (has_no_active_member returns false and
+ // component_count returns 2 in this case).
+ public void set_discriminator (org.omg.DynamicAny.DynAny newDiscriminator)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if ( ! newDiscriminator.type().equal(discriminatorType())) {
+ throw new TypeMismatch();
+ }
+ newDiscriminator = DynAnyUtil.convertToNative(newDiscriminator, orb);
+ Any newDiscriminatorAny = getAny(newDiscriminator);
+ int newCurrentMemberIndex = currentUnionMemberIndex(newDiscriminatorAny);
+ if (newCurrentMemberIndex == NO_INDEX) {
+ clearData();
+ index = 0;
+ } else {
+ // _REVISIT_ Could possibly optimize here if we don't need to initialize components
+ checkInitComponents();
+ if (currentMemberIndex == NO_INDEX || newCurrentMemberIndex != currentMemberIndex) {
+ clearData();
+ index = 1;
+ currentMemberIndex = newCurrentMemberIndex;
+ try {
+ currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(currentMemberIndex), orb);
+ } catch (InconsistentTypeCode ictc) {}
+ discriminator = newDiscriminator;
+ components = new DynAny[] { discriminator, currentMember };
+ representations = REPRESENTATION_COMPONENTS;
+ }
+ }
+ }
+
+ // Sets the discriminator to a value that is consistent with the value
+ // of the default case of a union; it sets the current position to
+ // zero and causes component_count to return 2.
+ // Calling set_to_default_member on a union that does not have an explicit
+ // default case raises TypeMismatch.
+ public void set_to_default_member ()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ int defaultIndex = defaultIndex();
+ if (defaultIndex == -1) {
+ throw new TypeMismatch();
+ }
+ try {
+ clearData();
+ index = 1;
+ currentMemberIndex = defaultIndex;
+ currentMember = DynAnyUtil.createMostDerivedDynAny(memberType(defaultIndex), orb);
+ components = new DynAny[] {discriminator, currentMember};
+ Any discriminatorAny = orb.create_any();
+ discriminatorAny.insert_octet((byte)0);
+ discriminator = DynAnyUtil.createMostDerivedDynAny(discriminatorAny, orb, false);
+ representations = REPRESENTATION_COMPONENTS;
+ } catch (InconsistentTypeCode ictc) {}
+ }
+
+ // Sets the discriminator to a value that does not correspond
+ // to any of the unions case labels.
+ // It sets the current position to zero and causes component_count to return 1.
+ // Calling set_to_no_active_member on a union that has an explicit default case
+ // or on a union that uses the entire range of discriminator values
+ // for explicit case labels raises TypeMismatch.
+ public void set_to_no_active_member ()
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ // _REVISIT_ How does one check for "entire range of discriminator values"?
+ if (defaultIndex() != -1) {
+ throw new TypeMismatch();
+ }
+ checkInitComponents();
+ Any discriminatorAny = getAny(discriminator);
+ // erase the discriminators value so that it does not correspond
+ // to any of the unions case labels
+ discriminatorAny.type(discriminatorAny.type());
+ index = 0;
+ currentMemberIndex = NO_INDEX;
+ // Necessary to guarantee OBJECT_NOT_EXIST in member()
+ currentMember.destroy();
+ currentMember = null;
+ components[0] = discriminator;
+ representations = REPRESENTATION_COMPONENTS;
+ }
+
+ // Returns true if the union has no active member
+ // (that is, the unions value consists solely of its discriminator because the
+ // discriminator has a value that is not listed as an explicit case label).
+ // Calling this operation on a union that has a default case returns false.
+ // Calling this operation on a union that uses the entire range of discriminator
+ // values for explicit case labels returns false.
+ public boolean has_no_active_member () {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ // _REVISIT_ How does one check for "entire range of discriminator values"?
+ if (defaultIndex() != -1) {
+ return false;
+ }
+ checkInitComponents();
+ return (checkInitComponents() ? (currentMemberIndex == NO_INDEX) : false);
+ }
+
+ public org.omg.CORBA.TCKind discriminator_kind () {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ return discriminatorType().kind();
+ }
+
+ // Returns the currently active member.
+ // If the union has no active member, the operation raises InvalidValue.
+ // Note that the returned reference remains valid only for as long
+ // as the currently active member does not change.
+ // Using the returned reference beyond the life time
+ // of the currently active member raises OBJECT_NOT_EXIST.
+ public org.omg.DynamicAny.DynAny member ()
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if ( ! checkInitComponents() || currentMemberIndex == NO_INDEX)
+ throw new InvalidValue();
+ return currentMember;
+ }
+
+ // Returns the name of the currently active member.
+ // If the unions TypeCode does not contain a member name for the currently active member,
+ // the operation returns an empty string.
+ // Calling member_name on a union without an active member raises InvalidValue.
+ public String member_name ()
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if ( ! checkInitComponents() || currentMemberIndex == NO_INDEX)
+ throw new InvalidValue();
+ String memberName = memberName(currentMemberIndex);
+ return (memberName == null ? "" : memberName);
+ }
+
+ // Returns the TCKind value of the TypeCode of the currently active member.
+ // If the union has no active member, the operation raises InvalidValue.
+ public org.omg.CORBA.TCKind member_kind ()
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if ( ! checkInitComponents() || currentMemberIndex == NO_INDEX)
+ throw new InvalidValue();
+ return memberType(currentMemberIndex).kind();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueBoxImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueBoxImpl.java
new file mode 100644
index 0000000..60ad744
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueBoxImpl.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class DynValueBoxImpl extends DynValueCommonImpl implements DynValueBox
+{
+ //
+ // Constructors
+ //
+
+ private DynValueBoxImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynValueBoxImpl(ORB orb, Any any, boolean copyValue) {
+ super(orb, any, copyValue);
+ }
+
+ protected DynValueBoxImpl(ORB orb, TypeCode typeCode) {
+ super(orb, typeCode);
+ }
+
+ //
+ // DynValueBox methods
+ //
+
+ public Any get_boxed_value()
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (isNull) {
+ throw new InvalidValue();
+ }
+ checkInitAny();
+ return any;
+ }
+
+ public void set_boxed_value(org.omg.CORBA.Any boxed)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ if ( ! isNull && ! boxed.type().equal(this.type())) {
+ throw new TypeMismatch();
+ }
+ clearData();
+ any = boxed;
+ representations = REPRESENTATION_ANY;
+ index = 0;
+ isNull = false;
+ }
+
+ public DynAny get_boxed_value_as_dyn_any()
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (isNull) {
+ throw new InvalidValue();
+ }
+ checkInitComponents();
+ return components[0];
+ }
+
+ public void set_boxed_value_as_dyn_any(DynAny boxed)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch
+ {
+ if ( ! isNull && ! boxed.type().equal(this.type())) {
+ throw new TypeMismatch();
+ }
+ clearData();
+ components = new DynAny[] {boxed};
+ representations = REPRESENTATION_COMPONENTS;
+ index = 0;
+ isNull = false;
+ }
+
+ protected boolean initializeComponentsFromAny() {
+ try {
+ components = new DynAny[] {DynAnyUtil.createMostDerivedDynAny(any, orb, false)};
+ } catch (InconsistentTypeCode ictc) {
+ return false; // impossible
+ }
+ return true;
+ }
+
+ protected boolean initializeComponentsFromTypeCode() {
+ try {
+ any = DynAnyUtil.createDefaultAnyOfType(any.type(), orb);
+ components = new DynAny[] {DynAnyUtil.createMostDerivedDynAny(any, orb, false)};
+ } catch (InconsistentTypeCode ictc) {
+ return false; // impossible
+ }
+ return true;
+ }
+
+ protected boolean initializeAnyFromComponents() {
+ any = getAny(components[0]);
+ return true;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueCommonImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueCommonImpl.java
new file mode 100644
index 0000000..215551c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueCommonImpl.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+abstract class DynValueCommonImpl extends DynAnyComplexImpl implements DynValueCommon
+{
+ //
+ // Constructors
+ //
+
+ protected boolean isNull;
+
+ private DynValueCommonImpl() {
+ this(null, (Any)null, false);
+ isNull = true;
+ }
+
+ protected DynValueCommonImpl(ORB orb, Any any, boolean copyValue) {
+ super(orb, any, copyValue);
+ isNull = checkInitComponents();
+ }
+
+ protected DynValueCommonImpl(ORB orb, TypeCode typeCode) {
+ super(orb, typeCode);
+ isNull = true;
+ }
+
+ //
+ // DynValueCommon methods
+ //
+
+ // Returns TRUE if this object represents a null valuetype
+ public boolean is_null() {
+ return isNull;
+ }
+
+ // Changes the representation to a null valuetype.
+ public void set_to_null() {
+ isNull = true;
+ clearData();
+ }
+
+ // If this object represents a null valuetype then this operation
+ // replaces it with a newly constructed value with its components
+ // initialized to default values as in DynAnyFactory::create_dyn_any_from_type_code.
+ // If this object represents a non-null valuetype, then this operation has no effect.
+ public void set_to_value() {
+ if (isNull) {
+ isNull = false;
+ // the rest is done lazily
+ }
+ // else: there is nothing to do
+ }
+
+ //
+ // Methods differing from DynStruct
+ //
+
+ // Required to raise InvalidValue if this is a null value type.
+ public org.omg.DynamicAny.NameValuePair[] get_members ()
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (isNull) {
+ throw new InvalidValue();
+ }
+ checkInitComponents();
+ return nameValuePairs;
+ }
+
+ // Required to raise InvalidValue if this is a null value type.
+ public org.omg.DynamicAny.NameDynAnyPair[] get_members_as_dyn_any ()
+ throws org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.dynAnyDestroyed() ;
+ }
+ if (isNull) {
+ throw new InvalidValue();
+ }
+ checkInitComponents();
+ return nameDynAnyPairs;
+ }
+
+ //
+ // Overridden methods
+ //
+
+ // Overridden to change to non-null status.
+ public void set_members (org.omg.DynamicAny.NameValuePair[] value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ super.set_members(value);
+ // If we didn't get an exception then this must be a valid non-null value
+ isNull = false;
+ }
+
+ // Overridden to change to non-null status.
+ public void set_members_as_dyn_any (org.omg.DynamicAny.NameDynAnyPair[] value)
+ throws org.omg.DynamicAny.DynAnyPackage.TypeMismatch,
+ org.omg.DynamicAny.DynAnyPackage.InvalidValue
+ {
+ super.set_members_as_dyn_any(value);
+ // If we didn't get an exception then this must be a valid non-null value
+ isNull = false;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueImpl.java
new file mode 100644
index 0000000..2556895
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/dynamicany/DynValueImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.dynamicany;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.TypeCodePackage.Bounds;
+import org.omg.DynamicAny.*;
+import org.omg.DynamicAny.DynAnyPackage.TypeMismatch;
+import org.omg.DynamicAny.DynAnyPackage.InvalidValue;
+import org.omg.DynamicAny.DynAnyFactoryPackage.InconsistentTypeCode;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class DynValueImpl extends DynValueCommonImpl implements DynValue
+{
+ //
+ // Constructors
+ //
+
+ private DynValueImpl() {
+ this(null, (Any)null, false);
+ }
+
+ protected DynValueImpl(ORB orb, Any any, boolean copyValue) {
+ super(orb, any, copyValue);
+ }
+
+ protected DynValueImpl(ORB orb, TypeCode typeCode) {
+ super(orb, typeCode);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerFactory.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerFactory.java
new file mode 100644
index 0000000..b61926b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerFactory.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import com.sun.corba.se.impl.encoding.BufferManagerRead;
+import com.sun.corba.se.impl.encoding.BufferManagerReadGrow;
+import com.sun.corba.se.impl.encoding.BufferManagerReadStream;
+import com.sun.corba.se.impl.encoding.BufferManagerWrite;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+
+import org.omg.CORBA.INTERNAL;
+
+/**
+ * Creates read/write buffer managers to handle over/under flow
+ * in CDR*putStream.
+ */
+
+public class BufferManagerFactory
+{
+ public static final int GROW = 0;
+ public static final int COLLECT = 1;
+ public static final int STREAM = 2;
+
+ // The next two methods allow creation of BufferManagers based on GIOP version.
+ // We may want more criteria to be involved in this decision.
+ // These are only used for sending messages (so could be fragmenting)
+ public static BufferManagerRead newBufferManagerRead(
+ GIOPVersion version, byte encodingVersion, ORB orb) {
+
+ // REVISIT - On the reading side, shouldn't we monitor the incoming
+ // fragments on a given connection to determine what fragment size
+ // they're using, then use that ourselves?
+
+ if (encodingVersion != Message.CDR_ENC_VERSION) {
+ return new BufferManagerReadGrow(orb);
+ }
+
+ switch (version.intValue())
+ {
+ case GIOPVersion.VERSION_1_0:
+ return new BufferManagerReadGrow(orb);
+ case GIOPVersion.VERSION_1_1:
+ case GIOPVersion.VERSION_1_2:
+ // The stream reader can handle fragmented and
+ // non fragmented messages
+ return new BufferManagerReadStream(orb);
+ default:
+ // REVISIT - what is appropriate?
+ throw new INTERNAL("Unknown GIOP version: "
+ + version);
+ }
+ }
+
+ public static BufferManagerRead newBufferManagerRead(
+ int strategy, byte encodingVersion, ORB orb) {
+
+ if (encodingVersion != Message.CDR_ENC_VERSION) {
+ if (strategy != BufferManagerFactory.GROW) {
+ ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get((ORB)orb,
+ CORBALogDomains.RPC_ENCODING);
+ throw wrapper.invalidBuffMgrStrategy("newBufferManagerRead");
+ }
+ return new BufferManagerReadGrow(orb);
+ }
+ switch (strategy) {
+ case BufferManagerFactory.GROW:
+ return new BufferManagerReadGrow(orb);
+ case BufferManagerFactory.COLLECT:
+ throw new INTERNAL("Collect strategy invalid for reading");
+ case BufferManagerFactory.STREAM:
+ return new BufferManagerReadStream(orb);
+ default:
+ throw new INTERNAL("Unknown buffer manager read strategy: "
+ + strategy);
+ }
+ }
+
+ public static BufferManagerWrite newBufferManagerWrite(
+ int strategy, byte encodingVersion, ORB orb) {
+ if (encodingVersion != Message.CDR_ENC_VERSION) {
+ if (strategy != BufferManagerFactory.GROW) {
+ ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get((ORB)orb,
+ CORBALogDomains.RPC_ENCODING);
+ throw wrapper.invalidBuffMgrStrategy("newBufferManagerWrite");
+ }
+ return new BufferManagerWriteGrow(orb);
+ }
+ switch (strategy) {
+ case BufferManagerFactory.GROW:
+ return new BufferManagerWriteGrow(orb);
+ case BufferManagerFactory.COLLECT:
+ return new BufferManagerWriteCollect(orb);
+ case BufferManagerFactory.STREAM:
+ return new BufferManagerWriteStream(orb);
+ default:
+ throw new INTERNAL("Unknown buffer manager write strategy: "
+ + strategy);
+ }
+ }
+
+ public static BufferManagerWrite newBufferManagerWrite(
+ GIOPVersion version, byte encodingVersion, ORB orb) {
+ if (encodingVersion != Message.CDR_ENC_VERSION) {
+ return new BufferManagerWriteGrow(orb);
+ }
+ return BufferManagerFactory.newBufferManagerWrite(
+ orb.getORBData().getGIOPBuffMgrStrategy(version),
+ encodingVersion, orb);
+ }
+
+ public static BufferManagerRead defaultBufferManagerRead(ORB orb) {
+ return new BufferManagerReadGrow(orb);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerRead.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerRead.java
new file mode 100644
index 0000000..2fb2c3f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerRead.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.nio.ByteBuffer;
+import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+public interface BufferManagerRead
+{
+ /**
+ * Case: Called from ReaderThread on complete message or fragments.
+ * The given buf may be entire message or a fragment.
+ *
+ * The ReaderThread finds the ReadBufferManager instance either in
+ * in a fragment map (when collecting - GIOP 1.2 phase 1) or
+ * in an active server requests map (when streaming - GIOP 1.2 phase 2).
+ *
+ * As a model for implementation see IIOPInputStream's
+ * constructor of the same name. There are going to be some variations.
+ *
+ */
+
+ public void processFragment ( ByteBuffer byteBuffer,
+ FragmentMessage header);
+
+
+ /**
+ * Case: called from CDRInputStream constructor before unmarshaling.
+ *
+ * Does:
+ *
+ * this.bufQ.get()
+ *
+ * If streaming then sync on bufQ and wait if empty.
+ */
+
+
+ /**
+ * Case: called from CDRInputStream.grow.
+ *
+ * Does:
+ *
+ * this.bufQ.get()
+ *
+ * If streaming then sync on bufQ and wait if empty.
+ */
+
+ public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi);
+
+ /**
+ * Called once after creating this buffer manager and before
+ * it begins processing.
+ */
+ public void init(Message header);
+
+ /**
+ * Returns the mark/reset handler for this stream.
+ */
+ public MarkAndResetHandler getMarkAndResetHandler();
+
+ /*
+ * Signals that the processing be cancelled.
+ */
+ public void cancelProcessing(int requestId);
+
+ /*
+ * Close BufferManagerRead and perform any oustanding cleanup.
+ */
+ public void close(ByteBufferWithInfo bbwi);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadGrow.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadGrow.java
new file mode 100644
index 0000000..1e827fa
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadGrow.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.nio.ByteBuffer;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+public class BufferManagerReadGrow
+ implements BufferManagerRead, MarkAndResetHandler
+{
+ // REVISIT - This should go in an abstract class called
+ // BufferManagerReadBase which should implement
+ // BufferManagerRead. Then, this class should extend
+ // BufferManagerReadBase.
+ private ORB orb ;
+
+ private ORBUtilSystemException wrapper ;
+
+ BufferManagerReadGrow( ORB orb )
+ {
+ this.orb = orb ;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+ }
+
+ public void processFragment (ByteBuffer byteBuffer, FragmentMessage header)
+ {
+ // REVISIT - should we consider throwing an exception similar to what's
+ // done for underflow()???
+ }
+
+ public void init(Message msg) {}
+
+ public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
+ {
+ throw wrapper.unexpectedEof() ;
+ }
+
+ public void cancelProcessing(int requestId) {}
+
+ // Mark and reset handler -------------------------
+
+ private Object streamMemento;
+ private RestorableInputStream inputStream;
+ private boolean markEngaged = false;
+
+ public MarkAndResetHandler getMarkAndResetHandler() {
+ return this;
+ }
+
+ public void mark(RestorableInputStream is) {
+ markEngaged = true;
+ inputStream = is;
+ streamMemento = inputStream.createStreamMemento();
+ }
+
+ // This will never happen
+ public void fragmentationOccured(ByteBufferWithInfo newFragment) {}
+
+ public void reset() {
+
+ if (!markEngaged)
+ return;
+
+ markEngaged = false;
+ inputStream.restoreInternalState(streamMemento);
+ streamMemento = null;
+ }
+
+ // Nothing to close and cleanup.
+ public void close(ByteBufferWithInfo bbwi) {}
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadStream.java
new file mode 100644
index 0000000..bc87a38
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerReadStream.java
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.nio.ByteBuffer;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.protocol.RequestCanceledException;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import java.util.*;
+
+public class BufferManagerReadStream
+ implements BufferManagerRead, MarkAndResetHandler
+{
+ private boolean receivedCancel = false;
+ private int cancelReqId = 0;
+
+ // We should convert endOfStream to a final static dummy end node
+ private boolean endOfStream = true;
+ private BufferQueue fragmentQueue = new BufferQueue();
+ private long FRAGMENT_TIMEOUT = 60000;
+
+ // REVISIT - This should go in BufferManagerRead. But, since
+ // BufferManagerRead is an interface. BufferManagerRead
+ // might ought to be an abstract class instead of an
+ // interface.
+ private ORB orb ;
+ private ORBUtilSystemException wrapper ;
+ private boolean debug = false;
+
+ BufferManagerReadStream( ORB orb )
+ {
+ this.orb = orb ;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+ debug = orb.transportDebugFlag;
+ }
+
+ public void cancelProcessing(int requestId) {
+ synchronized(fragmentQueue) {
+ receivedCancel = true;
+ cancelReqId = requestId;
+ fragmentQueue.notify();
+ }
+ }
+
+ public void processFragment(ByteBuffer byteBuffer, FragmentMessage msg)
+ {
+ ByteBufferWithInfo bbwi =
+ new ByteBufferWithInfo(orb, byteBuffer, msg.getHeaderLength());
+
+ synchronized (fragmentQueue) {
+ if (debug)
+ {
+ // print address of ByteBuffer being queued
+ int bbAddress = System.identityHashCode(byteBuffer);
+ StringBuffer sb = new StringBuffer(80);
+ sb.append("processFragment() - queueing ByteBuffer id (");
+ sb.append(bbAddress).append(") to fragment queue.");
+ String strMsg = sb.toString();
+ dprint(strMsg);
+ }
+ fragmentQueue.enqueue(bbwi);
+ endOfStream = !msg.moreFragmentsToFollow();
+ fragmentQueue.notify();
+ }
+ }
+
+ public ByteBufferWithInfo underflow (ByteBufferWithInfo bbwi)
+ {
+
+ ByteBufferWithInfo result = null;
+
+ try {
+ //System.out.println("ENTER underflow");
+
+ synchronized (fragmentQueue) {
+
+ if (receivedCancel) {
+ throw new RequestCanceledException(cancelReqId);
+ }
+
+ while (fragmentQueue.size() == 0) {
+
+ if (endOfStream) {
+ throw wrapper.endOfStream() ;
+ }
+
+ boolean interrupted = false;
+ try {
+ fragmentQueue.wait(FRAGMENT_TIMEOUT);
+ } catch (InterruptedException e) {
+ interrupted = true;
+ }
+
+ if (!interrupted && fragmentQueue.size() == 0) {
+ throw wrapper.bufferReadManagerTimeout();
+ }
+
+ if (receivedCancel) {
+ throw new RequestCanceledException(cancelReqId);
+ }
+ }
+
+ result = fragmentQueue.dequeue();
+ result.fragmented = true;
+
+ if (debug)
+ {
+ // print address of ByteBuffer being dequeued
+ int bbAddr = System.identityHashCode(result.byteBuffer);
+ StringBuffer sb1 = new StringBuffer(80);
+ sb1.append("underflow() - dequeued ByteBuffer id (");
+ sb1.append(bbAddr).append(") from fragment queue.");
+ String msg1 = sb1.toString();
+ dprint(msg1);
+ }
+
+ // VERY IMPORTANT
+ // Release bbwi.byteBuffer to the ByteBufferPool only if
+ // this BufferManagerStream is not marked for potential restore.
+ if (markEngaged == false && bbwi != null && bbwi.byteBuffer != null)
+ {
+ ByteBufferPool byteBufferPool = getByteBufferPool();
+
+ if (debug)
+ {
+ // print address of ByteBuffer being released
+ int bbAddress = System.identityHashCode(bbwi.byteBuffer);
+ StringBuffer sb = new StringBuffer(80);
+ sb.append("underflow() - releasing ByteBuffer id (");
+ sb.append(bbAddress).append(") to ByteBufferPool.");
+ String msg = sb.toString();
+ dprint(msg);
+ }
+
+ byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
+ bbwi.byteBuffer = null;
+ bbwi = null;
+ }
+ }
+ return result;
+ } finally {
+ //System.out.println("EXIT underflow");
+ }
+ }
+
+ public void init(Message msg) {
+ if (msg != null)
+ endOfStream = !msg.moreFragmentsToFollow();
+ }
+
+ // Release any queued ByteBufferWithInfo's byteBuffers to the
+ // ByteBufferPoool
+ public void close(ByteBufferWithInfo bbwi)
+ {
+ int inputBbAddress = 0;
+
+ // release ByteBuffers on fragmentQueue
+ if (fragmentQueue != null)
+ {
+ synchronized (fragmentQueue)
+ {
+ // IMPORTANT: The fragment queue may have one ByteBuffer
+ // on it that's also on the CDRInputStream if
+ // this method is called when the stream is 'marked'.
+ // Thus, we'll compare the ByteBuffer passed
+ // in (from a CDRInputStream) with all ByteBuffers
+ // on the stack. If one is found to equal, it will
+ // not be released to the ByteBufferPool.
+ if (bbwi != null)
+ {
+ inputBbAddress = System.identityHashCode(bbwi.byteBuffer);
+ }
+
+ ByteBufferWithInfo abbwi = null;
+ ByteBufferPool byteBufferPool = getByteBufferPool();
+ while (fragmentQueue.size() != 0)
+ {
+ abbwi = fragmentQueue.dequeue();
+ if (abbwi != null && abbwi.byteBuffer != null)
+ {
+ int bbAddress = System.identityHashCode(abbwi.byteBuffer);
+ if (inputBbAddress != bbAddress)
+ {
+ if (debug)
+ {
+ // print address of ByteBuffer released
+ StringBuffer sb = new StringBuffer(80);
+ sb.append("close() - fragmentQueue is ")
+ .append("releasing ByteBuffer id (")
+ .append(bbAddress).append(") to ")
+ .append("ByteBufferPool.");
+ String msg = sb.toString();
+ dprint(msg);
+ }
+ }
+ byteBufferPool.releaseByteBuffer(abbwi.byteBuffer);
+ }
+ }
+ }
+ fragmentQueue = null;
+ }
+
+ // release ByteBuffers on fragmentStack
+ if (fragmentStack != null && fragmentStack.size() != 0)
+ {
+ // IMPORTANT: The fragment stack may have one ByteBuffer
+ // on it that's also on the CDRInputStream if
+ // this method is called when the stream is 'marked'.
+ // Thus, we'll compare the ByteBuffer passed
+ // in (from a CDRInputStream) with all ByteBuffers
+ // on the stack. If one is found to equal, it will
+ // not be released to the ByteBufferPool.
+ if (bbwi != null)
+ {
+ inputBbAddress = System.identityHashCode(bbwi.byteBuffer);
+ }
+
+ ByteBufferWithInfo abbwi = null;
+ ByteBufferPool byteBufferPool = getByteBufferPool();
+ ListIterator itr = fragmentStack.listIterator();
+ while (itr.hasNext())
+ {
+ abbwi = (ByteBufferWithInfo)itr.next();
+
+ if (abbwi != null && abbwi.byteBuffer != null)
+ {
+ int bbAddress = System.identityHashCode(abbwi.byteBuffer);
+ if (inputBbAddress != bbAddress)
+ {
+ if (debug)
+ {
+ // print address of ByteBuffer being released
+ StringBuffer sb = new StringBuffer(80);
+ sb.append("close() - fragmentStack - releasing ")
+ .append("ByteBuffer id (" + bbAddress + ") to ")
+ .append("ByteBufferPool.");
+ String msg = sb.toString();
+ dprint(msg);
+ }
+ byteBufferPool.releaseByteBuffer(abbwi.byteBuffer);
+ }
+ }
+ }
+ fragmentStack = null;
+ }
+
+ }
+
+ protected ByteBufferPool getByteBufferPool()
+ {
+ return orb.getByteBufferPool();
+ }
+
+ private void dprint(String msg)
+ {
+ ORBUtility.dprint("BufferManagerReadStream", msg);
+ }
+
+ // Mark and reset handler ----------------------------------------
+
+ private boolean markEngaged = false;
+
+ // List of fragment ByteBufferWithInfos received since
+ // the mark was engaged.
+ private LinkedList fragmentStack = null;
+ private RestorableInputStream inputStream = null;
+
+ // Original state of the stream
+ private Object streamMemento = null;
+
+ public void mark(RestorableInputStream inputStream)
+ {
+ this.inputStream = inputStream;
+ markEngaged = true;
+
+ // Get the magic Object that the stream will use to
+ // reconstruct it's state when reset is called
+ streamMemento = inputStream.createStreamMemento();
+
+ if (fragmentStack != null) {
+ fragmentStack.clear();
+ }
+ }
+
+ // Collects fragments received since the mark was engaged.
+ public void fragmentationOccured(ByteBufferWithInfo newFragment)
+ {
+ if (!markEngaged)
+ return;
+
+ if (fragmentStack == null)
+ fragmentStack = new LinkedList();
+
+ fragmentStack.addFirst(new ByteBufferWithInfo(newFragment));
+ }
+
+ public void reset()
+ {
+ if (!markEngaged) {
+ // REVISIT - call to reset without call to mark
+ return;
+ }
+
+ markEngaged = false;
+
+ // If we actually did peek across fragments, we need
+ // to push those fragments onto the front of the
+ // buffer queue.
+ if (fragmentStack != null && fragmentStack.size() != 0) {
+ ListIterator iter = fragmentStack.listIterator();
+
+ synchronized(fragmentQueue) {
+ while (iter.hasNext()) {
+ fragmentQueue.push((ByteBufferWithInfo)iter.next());
+ }
+ }
+
+ fragmentStack.clear();
+ }
+
+ // Give the stream the magic Object to restore
+ // it's state.
+ inputStream.restoreInternalState(streamMemento);
+ }
+
+ public MarkAndResetHandler getMarkAndResetHandler() {
+ return this;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWrite.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWrite.java
new file mode 100644
index 0000000..a73f2cc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWrite.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+/**
+ * Defines the contract between the BufferManager and
+ * CDR stream on the writing side. The CDR stream
+ * calls back to the BufferManagerWrite when it needs
+ * more room in the output buffer to continue. The
+ * BufferManager can then grow the output buffer or
+ * use some kind of fragmentation technique.
+ */
+public abstract class BufferManagerWrite
+{
+ protected ORB orb ;
+ protected ORBUtilSystemException wrapper ;
+
+ BufferManagerWrite( ORB orb )
+ {
+ this.orb = orb ;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+ }
+
+ /**
+ * Has the stream sent out any fragments so far?
+ */
+ public abstract boolean sentFragment();
+
+ /**
+ * Has the entire message been sent? (Has
+ * sendMessage been called?)
+ */
+ public boolean sentFullMessage() {
+ return sentFullMessage;
+ }
+
+ /**
+ * Returns the correct buffer size for this type of
+ * buffer manager as set in the ORB.
+ */
+ public abstract int getBufferSize();
+
+ /*
+ * Called from CDROutputStream.grow.
+ *
+ * bbwi.buf contains a byte array which needs to grow by bbwi.needed bytes.
+ *
+ * This can be handled in several ways:
+ *
+ * 1. Resize the bbwi.buf like the current implementation of
+ * CDROutputStream.grow.
+ *
+ * 2. Collect the buffer for a later send:
+ * this.bufQ.put(bbwi);
+ * return new ByteBufferWithInfo(bbwi.length);
+ *
+ * 3. Send buffer as fragment:
+ * Backpatch fragment size field in bbwi.buf.
+ * Set more fragments bit in bbwi.buf.
+ * this.connection.send(bbwi);
+ * return reinitialized bbwi.buf with fragment header
+ *
+ * All cases should adjust the returned bbwi.* appropriately.
+ *
+ * Should set the bbwi.fragmented flag to true only in cases 2 and 3.
+ */
+
+ public abstract void overflow (ByteBufferWithInfo bbwi);
+
+ /**
+ * Called after Stub._invoke (i.e., before complete message has been sent).
+ *
+ * IIOPOutputStream.writeTo called from IIOPOutputStream.invoke
+ *
+ * Case: overflow was never called (bbwi.buf contains complete message).
+ * Backpatch size field.
+ * If growing or collecting:
+ * this.bufQ.put(bbwi).
+ * this.bufQ.iterate // However, see comment in getBufferQ
+ * this.connection.send(fragment)
+ * If streaming:
+ * this.connection.send(bbwi).
+ *
+ * Case: overflow was called N times (bbwi.buf contains last buffer).
+ * If growing or collecting:
+ * this.bufQ.put(bbwi).
+ * backpatch size field in first buffer.
+ * this.bufQ.iterate // However, see comment in getBufferQ
+ * this.connection.send(fragment)
+ * If streaming:
+ * backpatch fragment size field in bbwi.buf.
+ * Set no more fragments bit.
+ * this.connection.send(bbwi).
+ */
+
+ public abstract void sendMessage ();
+
+ /**
+ * A reference to the connection level stream will be required when
+ * sending fragments.
+ */
+ public void setOutputObject(Object outputObject) {
+ this.outputObject = outputObject;
+ }
+
+ /**
+ * Close the BufferManagerWrite and do any outstanding cleanup.
+ */
+ abstract public void close();
+
+
+ // XREVISIT - Currently a java.lang.Object during
+ // the rip-int-generic transition. Should eventually
+ // become a GIOPOutputObject.
+ protected Object outputObject;
+
+ protected boolean sentFullMessage = false;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteCollect.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteCollect.java
new file mode 100644
index 0000000..dc1de8d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteCollect.java
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+import java.util.NoSuchElementException;
+import java.util.LinkedList;
+
+import com.sun.corba.se.impl.encoding.BufferQueue;
+import com.sun.corba.se.impl.encoding.BufferManagerWrite;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+import com.sun.corba.se.pept.encoding.OutputObject;
+
+/**
+ * Collect buffer manager.
+ */
+public class BufferManagerWriteCollect extends BufferManagerWrite
+{
+ private BufferQueue queue = new BufferQueue();
+
+ private boolean sentFragment = false;
+ private boolean debug = false;
+
+
+ BufferManagerWriteCollect(ORB orb)
+ {
+ super(orb);
+ if (orb != null)
+ debug = orb.transportDebugFlag;
+ }
+
+ public boolean sentFragment() {
+ return sentFragment;
+ }
+
+ /**
+ * Returns the correct buffer size for this type of
+ * buffer manager as set in the ORB.
+ */
+ public int getBufferSize() {
+ return orb.getORBData().getGIOPFragmentSize();
+ }
+
+ // Set the fragment's "more fragments" bit to true, put it in the
+ // queue, and allocate a new bbwi.
+ public void overflow (ByteBufferWithInfo bbwi)
+ {
+ // Set the fragment's moreFragments field to true
+ MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);
+
+ // Enqueue the previous fragment
+ queue.enqueue(bbwi);
+
+ // Create a new bbwi
+ ByteBufferWithInfo newBbwi = new ByteBufferWithInfo(orb, this);
+ newBbwi.fragmented = true;
+
+ // XREVISIT - Downcast
+ ((CDROutputObject)outputObject).setByteBufferWithInfo(newBbwi);
+
+ // Now we must marshal in the fragment header/GIOP header
+
+ // REVISIT - we can optimize this by not creating the fragment message
+ // each time.
+
+ // XREVISIT - Downcast
+ FragmentMessage header =
+ ((CDROutputObject)outputObject).getMessageHeader()
+ .createFragmentMessage();
+
+ header.write((CDROutputObject)outputObject);
+ }
+
+ // Send all fragments
+ public void sendMessage ()
+ {
+ // Enqueue the last fragment
+ queue.enqueue(((CDROutputObject)outputObject).getByteBufferWithInfo());
+
+ Iterator bufs = iterator();
+
+ Connection conn =
+ ((OutputObject)outputObject).getMessageMediator().
+ getConnection();
+
+ // With the collect strategy, we must lock the connection
+ // while fragments are being sent. This is so that there are
+ // no interleved fragments in GIOP 1.1.
+ //
+ // Note that this thread must not call writeLock again in any
+ // of its send methods!
+ conn.writeLock();
+
+ try {
+
+ // Get a reference to ByteBufferPool so that the ByteBufferWithInfo
+ // ByteBuffer can be released to the ByteBufferPool
+ ByteBufferPool byteBufferPool = orb.getByteBufferPool();
+
+ while (bufs.hasNext()) {
+
+ ByteBufferWithInfo bbwi = (ByteBufferWithInfo)bufs.next();
+ ((CDROutputObject)outputObject).setByteBufferWithInfo(bbwi);
+
+ conn.sendWithoutLock(((CDROutputObject)outputObject));
+
+ sentFragment = true;
+
+ // Release ByteBufferWithInfo's ByteBuffer back to the pool
+ // of ByteBuffers.
+ if (debug)
+ {
+ // print address of ByteBuffer being released
+ int bbAddress = System.identityHashCode(bbwi.byteBuffer);
+ StringBuffer sb = new StringBuffer(80);
+ sb.append("sendMessage() - releasing ByteBuffer id (");
+ sb.append(bbAddress).append(") to ByteBufferPool.");
+ String msg = sb.toString();
+ dprint(msg);
+ }
+ byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
+ bbwi.byteBuffer = null;
+ bbwi = null;
+ }
+
+ sentFullMessage = true;
+
+ } finally {
+
+ conn.writeUnlock();
+ }
+ }
+
+ /**
+ * Close the BufferManagerWrite - do any outstanding cleanup.
+ *
+ * For a BufferManagerWriteGrow any queued ByteBufferWithInfo must
+ * have its ByteBuffer released to the ByteBufferPool.
+ */
+ public void close()
+ {
+ // iterate thru queue and release any ByteBufferWithInfo's
+ // ByteBuffer that may be remaining on the queue to the
+ // ByteBufferPool.
+
+ Iterator bufs = iterator();
+
+ ByteBufferPool byteBufferPool = orb.getByteBufferPool();
+
+ while (bufs.hasNext())
+ {
+ ByteBufferWithInfo bbwi = (ByteBufferWithInfo)bufs.next();
+ if (bbwi != null && bbwi.byteBuffer != null)
+ {
+ if (debug)
+ {
+ // print address of ByteBuffer being released
+ int bbAddress = System.identityHashCode(bbwi.byteBuffer);
+ StringBuffer sb = new StringBuffer(80);
+ sb.append("close() - releasing ByteBuffer id (");
+ sb.append(bbAddress).append(") to ByteBufferPool.");
+ String msg = sb.toString();
+ dprint(msg);
+ }
+ byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
+ bbwi.byteBuffer = null;
+ bbwi = null;
+ }
+ }
+ }
+
+ private void dprint(String msg)
+ {
+ ORBUtility.dprint("BufferManagerWriteCollect", msg);
+ }
+
+ private Iterator iterator ()
+ {
+ return new BufferManagerWriteCollectIterator();
+ }
+
+ private class BufferManagerWriteCollectIterator implements Iterator
+ {
+ public boolean hasNext ()
+ {
+ return queue.size() != 0;
+ }
+
+ public Object next ()
+ {
+ return queue.dequeue();
+ }
+
+ public void remove ()
+ {
+ throw new UnsupportedOperationException();
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java
new file mode 100644
index 0000000..1ede700
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteGrow.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
+import com.sun.corba.se.impl.encoding.BufferManagerWrite;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.spi.orb.ORB;
+
+public class BufferManagerWriteGrow extends BufferManagerWrite
+{
+ BufferManagerWriteGrow( ORB orb )
+ {
+ super(orb) ;
+ }
+
+ public boolean sentFragment() {
+ return false;
+ }
+
+ /**
+ * Returns the correct buffer size for this type of
+ * buffer manager as set in the ORB.
+ */
+ public int getBufferSize() {
+ return orb.getORBData().getGIOPBufferSize();
+ }
+
+ public void overflow (ByteBufferWithInfo bbwi)
+ {
+ // The code that once lived directly in CDROutputStream.grow()
+ // has been moved ByteBufferWithInfo.growBuffer().
+
+ // Grow ByteBufferWithInfo to a larger size.
+ bbwi.growBuffer(orb);
+
+ // Must be false for the grow case
+ bbwi.fragmented = false;
+ }
+
+ public void sendMessage ()
+ {
+ Connection conn =
+ ((OutputObject)outputObject).getMessageMediator().getConnection();
+
+ conn.writeLock();
+
+ try {
+
+ conn.sendWithoutLock((OutputObject)outputObject);
+
+ sentFullMessage = true;
+
+ } finally {
+
+ conn.writeUnlock();
+ }
+ }
+
+ /**
+ * Close the BufferManagerWrite and do any outstanding cleanup.
+ *
+ * No work to do for a BufferManagerWriteGrow.
+ */
+ public void close() {}
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java
new file mode 100644
index 0000000..e03c71c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferManagerWriteStream.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.nio.ByteBuffer;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
+import com.sun.corba.se.impl.encoding.BufferManagerWrite;
+import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import org.omg.CORBA.SystemException;
+
+/**
+ * Streaming buffer manager.
+ */
+public class BufferManagerWriteStream extends BufferManagerWrite
+{
+ private int fragmentCount = 0;
+
+ BufferManagerWriteStream( ORB orb )
+ {
+ super(orb) ;
+ }
+
+ public boolean sentFragment() {
+ return fragmentCount > 0;
+ }
+
+ /**
+ * Returns the correct buffer size for this type of
+ * buffer manager as set in the ORB.
+ */
+ public int getBufferSize() {
+ return orb.getORBData().getGIOPFragmentSize();
+ }
+
+ public void overflow (ByteBufferWithInfo bbwi)
+ {
+ // Set the fragment's moreFragments field to true
+ MessageBase.setFlag(bbwi.byteBuffer, Message.MORE_FRAGMENTS_BIT);
+
+ try {
+ sendFragment(false);
+ } catch(SystemException se){
+ orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.SYSTEM_EXCEPTION, se);
+ throw se;
+ }
+
+ // Reuse the old buffer
+
+ // REVISIT - need to account for case when needed > available
+ // even after fragmenting. This is the large array case, so
+ // the caller should retry when it runs out of space.
+ bbwi.position(0);
+ bbwi.buflen = bbwi.byteBuffer.limit();
+ bbwi.fragmented = true;
+
+ // Now we must marshal in the fragment header/GIOP header
+
+ // REVISIT - we can optimize this by not creating the fragment message
+ // each time.
+
+ FragmentMessage header = ((CDROutputObject)outputObject).getMessageHeader().createFragmentMessage();
+
+ header.write(((CDROutputObject)outputObject));
+ }
+
+ private void sendFragment(boolean isLastFragment)
+ {
+ Connection conn = ((OutputObject)outputObject).getMessageMediator().getConnection();
+
+ // REVISIT: need an ORB
+ //System.out.println("sendFragment: last?: " + isLastFragment);
+ conn.writeLock();
+
+ try {
+ // Send the fragment
+ conn.sendWithoutLock(((OutputObject)outputObject));
+
+ fragmentCount++;
+
+ } finally {
+
+ conn.writeUnlock();
+ }
+
+ }
+
+ // Sends the last fragment
+ public void sendMessage ()
+ {
+ sendFragment(true);
+
+ sentFullMessage = true;
+ }
+
+ /**
+ * Close the BufferManagerWrite and do any outstanding cleanup.
+ *
+ * No work to do for a BufferManagerWriteStream
+ */
+ public void close(){};
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferQueue.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferQueue.java
new file mode 100644
index 0000000..92618bc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/BufferQueue.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.util.LinkedList;
+import java.util.NoSuchElementException;
+import java.util.LinkedList;
+
+/**
+ * Simple unsynchronized queue implementation for ByteBufferWithInfos.
+ */
+// XREVISIT - Should be in orbutil or package private
+public class BufferQueue
+{
+ private LinkedList list = new LinkedList();
+
+ public void enqueue(ByteBufferWithInfo item)
+ {
+ list.addLast(item);
+ }
+
+ public ByteBufferWithInfo dequeue() throws NoSuchElementException
+ {
+ return (ByteBufferWithInfo)list.removeFirst();
+ }
+
+ public int size()
+ {
+ return list.size();
+ }
+
+ // Adds the given ByteBufferWithInfo to the front
+ // of the queue.
+ public void push(ByteBufferWithInfo item)
+ {
+ list.addFirst(item);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/ByteBufferWithInfo.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/ByteBufferWithInfo.java
new file mode 100644
index 0000000..490fd60
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/ByteBufferWithInfo.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.nio.ByteBuffer;
+
+
+import com.sun.corba.se.impl.encoding.BufferManagerWrite;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+import com.sun.corba.se.spi.orb.ORB;
+
+
+// Notes about the class.
+// Assumptions, the ByteBuffer's position is set by the constructor's
+// index variable and the ByteBuffer's limit points to the end of the
+// data. Also, since the index variable tracks the current empty
+// position in the buffer, the ByteBuffer's position is updated
+// any time there's a call to this class's position().
+// Although, a ByteBuffer's length is it's capacity(), the context in
+// which length is used in this object, this.buflen is actually the
+// ByteBuffer limit().
+
+public class ByteBufferWithInfo
+{
+ private ORB orb;
+ private boolean debug;
+ // REVISIT - index should eventually be replaced with byteBuffer.position()
+ private int index; // Current empty position in buffer.
+ // REVISIT - CHANGE THESE TO PRIVATE
+ public ByteBuffer byteBuffer;// Marshal buffer.
+ public int buflen; // Total length of buffer. // Unnecessary...
+ public int needed; // How many more bytes are needed on overflow.
+ public boolean fragmented; // Did the overflow operation fragment?
+
+ public ByteBufferWithInfo(org.omg.CORBA.ORB orb,
+ ByteBuffer byteBuffer,
+ int index)
+ {
+ this.orb = (com.sun.corba.se.spi.orb.ORB)orb;
+ debug = this.orb.transportDebugFlag;
+ this.byteBuffer = byteBuffer;
+ if (byteBuffer != null)
+ {
+ this.buflen = byteBuffer.limit();
+ }
+ position(index);
+ this.needed = 0;
+ this.fragmented = false;
+ }
+
+ public ByteBufferWithInfo(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer)
+ {
+ this(orb, byteBuffer, 0);
+ }
+
+ public ByteBufferWithInfo(org.omg.CORBA.ORB orb,
+ BufferManagerWrite bufferManager)
+ {
+ this(orb, bufferManager, true);
+ }
+
+ // Right now, EncapsOutputStream's do not use pooled byte buffers.
+ // EncapsOutputStream's is the only one that does not use pooled
+ // byte buffers. Hence, the reason for the boolean 'usePooledByteBuffers'.
+ // See EncapsOutputStream for additional information.
+
+ public ByteBufferWithInfo(org.omg.CORBA.ORB orb,
+ BufferManagerWrite bufferManager,
+ boolean usePooledByteBuffers)
+ {
+ this.orb = (com.sun.corba.se.spi.orb.ORB)orb;
+ debug = this.orb.transportDebugFlag;
+
+ int bufferSize = bufferManager.getBufferSize();
+
+ if (usePooledByteBuffers)
+ {
+ ByteBufferPool byteBufferPool = this.orb.getByteBufferPool();
+ this.byteBuffer = byteBufferPool.getByteBuffer(bufferSize);
+
+ if (debug)
+ {
+ // print address of ByteBuffer gotten from pool
+ int bbAddress = System.identityHashCode(byteBuffer);
+ StringBuffer sb = new StringBuffer(80);
+ sb.append("constructor (ORB, BufferManagerWrite) - got ")
+ .append("ByteBuffer id (").append(bbAddress)
+ .append(") from ByteBufferPool.");
+ String msgStr = sb.toString();
+ dprint(msgStr);
+ }
+ }
+ else
+ {
+ // don't allocate from pool, allocate non-direct ByteBuffer
+ this.byteBuffer = ByteBuffer.allocate(bufferSize);
+ }
+
+ position(0);
+ this.buflen = bufferSize;
+ this.byteBuffer.limit(this.buflen);
+ this.needed = 0;
+ this.fragmented = false;
+ }
+
+ // Shallow copy constructor
+ public ByteBufferWithInfo (ByteBufferWithInfo bbwi)
+ {
+ this.orb = bbwi.orb;
+ this.debug = bbwi.debug;
+ this.byteBuffer = bbwi.byteBuffer;
+ this.buflen = bbwi.buflen;
+ this.byteBuffer.limit(this.buflen);
+ position(bbwi.position());
+ this.needed = bbwi.needed;
+ this.fragmented = bbwi.fragmented;
+ }
+
+ // So IIOPOutputStream seems more intuitive
+ public int getSize()
+ {
+ return position();
+ }
+
+ // accessor to buflen
+ public int getLength()
+ {
+ return buflen;
+ }
+
+ // get position in this buffer
+ public int position()
+ {
+ // REVISIT - This should be changed to return the
+ // value of byteBuffer.position() rather
+ // than this.index. But, byteBuffer.position
+ // is manipulated via ByteBuffer writes, reads,
+ // gets and puts. These locations need to be
+ // investigated and updated before
+ // byteBuffer.position() can be returned here.
+ // return byteBuffer.position();
+ return index;
+ }
+
+ // set position in this buffer
+ public void position(int newPosition)
+ {
+ // REVISIT - This should be changed to set only the
+ // value of byteBuffer.position rather
+ // than this.index. This change should be made
+ // in conjunction with the change to this.position().
+ byteBuffer.position(newPosition);
+ index = newPosition;
+ }
+
+ // mutator to buflen
+ public void setLength(int theLength)
+ {
+ buflen = theLength;
+ byteBuffer.limit(buflen);
+ }
+
+ // Grow byteBuffer to a size larger than position() + needed
+ public void growBuffer(com.sun.corba.se.spi.orb.ORB orb)
+ {
+ // This code used to live directly in CDROutputStream.grow.
+
+ // Recall that the byteBuffer size is 'really' the limit or
+ // buflen.
+
+ int newLength = byteBuffer.limit() * 2;
+
+ while (position() + needed >= newLength)
+ newLength = newLength * 2;
+
+ ByteBufferPool byteBufferPool = orb.getByteBufferPool();
+ ByteBuffer newBB = byteBufferPool.getByteBuffer(newLength);
+
+ if (debug)
+ {
+ // print address of ByteBuffer just gotten
+ int newbbAddress = System.identityHashCode(newBB);
+ StringBuffer sb = new StringBuffer(80);
+ sb.append("growBuffer() - got ByteBuffer id (");
+ sb.append(newbbAddress).append(") from ByteBufferPool.");
+ String msgStr = sb.toString();
+ dprint(msgStr);
+ }
+
+ byteBuffer.position(0);
+ newBB.put(byteBuffer);
+
+ // return 'old' byteBuffer reference to the ByteBuffer pool
+ if (debug)
+ {
+ // print address of ByteBuffer being released
+ int bbAddress = System.identityHashCode(byteBuffer);
+ StringBuffer sb = new StringBuffer(80);
+ sb.append("growBuffer() - releasing ByteBuffer id (");
+ sb.append(bbAddress).append(") to ByteBufferPool.");
+ String msgStr2 = sb.toString();
+ dprint(msgStr2);
+ }
+ byteBufferPool.releaseByteBuffer(byteBuffer);
+
+ // update the byteBuffer with a larger ByteBuffer
+ byteBuffer = newBB;
+
+ // limit and buflen must be set to newLength.
+ buflen = newLength;
+ byteBuffer.limit(buflen);
+ }
+
+ public String toString()
+ {
+ StringBuffer str = new StringBuffer("ByteBufferWithInfo:");
+
+ str.append(" buflen = " + buflen);
+ str.append(" byteBuffer.limit = " + byteBuffer.limit());
+ str.append(" index = " + index);
+ str.append(" position = " + position());
+ str.append(" needed = " + needed);
+ str.append(" byteBuffer = " + (byteBuffer == null ? "null" : "not null"));
+ str.append(" fragmented = " + fragmented);
+
+ return str.toString();
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("ByteBufferWithInfo", msg);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputObject.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputObject.java
new file mode 100644
index 0000000..039484b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputObject.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.nio.ByteBuffer;
+
+import com.sun.org.omg.SendingContext.CodeBase;
+
+import com.sun.corba.se.pept.encoding.InputObject;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.transport.CorbaConnection;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.impl.encoding.BufferManagerFactory;
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+/**
+ * @author Harold Carr
+ */
+public class CDRInputObject extends CDRInputStream
+ implements
+ InputObject
+{
+ private CorbaConnection corbaConnection;
+ private Message header;
+ private boolean unmarshaledHeader;
+ private ORB orb ;
+ private ORBUtilSystemException wrapper ;
+ private OMGSystemException omgWrapper ;
+
+ public CDRInputObject(ORB orb,
+ CorbaConnection corbaConnection,
+ ByteBuffer byteBuffer,
+ Message header)
+ {
+ super(orb, byteBuffer, header.getSize(), header.isLittleEndian(),
+ header.getGIOPVersion(), header.getEncodingVersion(),
+ BufferManagerFactory.newBufferManagerRead(
+ header.getGIOPVersion(),
+ header.getEncodingVersion(),
+ orb));
+
+ this.corbaConnection = corbaConnection;
+ this.orb = orb ;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+ this.omgWrapper = OMGSystemException.get( orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ if (orb.transportDebugFlag) {
+ dprint(".CDRInputObject constructor:");
+ }
+
+ getBufferManager().init(header);
+
+ this.header = header;
+
+ unmarshaledHeader = false;
+
+ setIndex(Message.GIOPMessageHeaderLength);
+
+ setBufferLength(header.getSize());
+ }
+
+ // REVISIT - think about this some more.
+ // 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 CorbaConnection getConnection()
+ {
+ return corbaConnection;
+ }
+
+ // XREVISIT - Should the header be kept in the stream or the
+ // message mediator? Or should we not have a header and
+ // have the information stored in the message mediator
+ // directly?
+ public Message getMessageHeader()
+ {
+ return header;
+ }
+
+ /**
+ * 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.
+ */
+ public void unmarshalHeader()
+ {
+ // Unmarshal the extended GIOP message from the buffer.
+
+ if (!unmarshaledHeader) {
+ try {
+ if (((ORB)orb()).transportDebugFlag) {
+ dprint(".unmarshalHeader->: " + getMessageHeader());
+ }
+ getMessageHeader().read(this);
+ unmarshaledHeader= true;
+ } catch (RuntimeException e) {
+ if (((ORB)orb()).transportDebugFlag) {
+ dprint(".unmarshalHeader: !!ERROR!!: "
+ + getMessageHeader()
+ + ": " + e);
+ }
+ throw e;
+ } finally {
+ if (((ORB)orb()).transportDebugFlag) {
+ dprint(".unmarshalHeader<-: " + getMessageHeader());
+ }
+ }
+ }
+ }
+
+ public final boolean unmarshaledHeader()
+ {
+ return unmarshaledHeader;
+ }
+
+ /**
+ * 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.
+ */
+ protected CodeSetConversion.BTCConverter createCharBTCConverter() {
+ CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
+
+ // If the connection doesn't have its negotiated
+ // code sets by now, fall back on the defaults defined
+ // in CDRInputStream.
+ if (codesets == null)
+ return super.createCharBTCConverter();
+
+ OSFCodeSetRegistry.Entry charSet
+ = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());
+
+ if (charSet == null)
+ throw wrapper.unknownCodeset( charSet ) ;
+
+ return CodeSetConversion.impl().getBTCConverter(charSet, isLittleEndian());
+ }
+
+ protected CodeSetConversion.BTCConverter createWCharBTCConverter() {
+
+ CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
+
+ // If the connection doesn't have its negotiated
+ // code sets by now, we have to throw an exception.
+ // See CORBA formal 00-11-03 13.9.2.6.
+ if (codesets == null) {
+ if (getConnection().isServer())
+ throw omgWrapper.noClientWcharCodesetCtx() ;
+ else
+ throw omgWrapper.noServerWcharCodesetCmp() ;
+ }
+
+ OSFCodeSetRegistry.Entry wcharSet
+ = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());
+
+ if (wcharSet == null)
+ throw wrapper.unknownCodeset( wcharSet ) ;
+
+ // For GIOP 1.2 and UTF-16, use big endian if there is no byte
+ // 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,
+ // we do what our old ORBs did.
+ if (wcharSet == OSFCodeSetRegistry.UTF_16) {
+ if (getGIOPVersion().equals(GIOPVersion.V1_2))
+ return CodeSetConversion.impl().getBTCConverter(wcharSet, false);
+ }
+
+ return CodeSetConversion.impl().getBTCConverter(wcharSet, isLittleEndian());
+ }
+
+ // If we're local and don't have a Connection, use the
+ // local code sets, otherwise get them from the connection.
+ // If the connection doesn't have negotiated code sets
+ // yet, then we use ISO8859-1 for char/string and wchar/wstring
+ // are illegal.
+ private CodeSetComponentInfo.CodeSetContext getCodeSets() {
+ if (getConnection() == null)
+ return CodeSetComponentInfo.LOCAL_CODE_SETS;
+ else
+ return getConnection().getCodeSetContext();
+ }
+
+ public final CodeBase getCodeBase() {
+ if (getConnection() == null)
+ return null;
+ else
+ return getConnection().getCodeBase();
+ }
+
+ // -----------------------------------------------------------
+ // Below this point are commented out methods with features
+ // from the old stream. We must find ways to address
+ // these issues in the future.
+ // -----------------------------------------------------------
+
+ // XREVISIT
+// private XIIOPInputStream(XIIOPInputStream stream) {
+// super(stream);
+
+// this.conn = stream.conn;
+// this.msg = stream.msg;
+// this.unmarshaledHeader = stream.unmarshaledHeader;
+// }
+
+ public CDRInputStream dup() {
+ // XREVISIT
+ return null;
+ // return new XIIOPInputStream(this);
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("CDRInputObject", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream.java
new file mode 100644
index 0000000..2202014
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream.java
@@ -0,0 +1,544 @@
+/*
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.Any;
+
+import com.sun.org.omg.SendingContext.CodeBase;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+/**
+ * This is delegates to the real implementation.
+ *
+ * NOTE:
+ *
+ * Before using the stream for valuetype unmarshaling, one must call
+ * performORBVersionSpecificInit().
+ */
+public abstract class CDRInputStream
+ extends org.omg.CORBA_2_3.portable.InputStream
+ implements com.sun.corba.se.impl.encoding.MarshalInputStream,
+ org.omg.CORBA.DataInputStream, org.omg.CORBA.portable.ValueInputStream
+{
+ protected CorbaMessageMediator messageMediator;
+ private CDRInputStreamBase impl;
+
+ // 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 InputStreamFactory {
+
+ public static CDRInputStreamBase newInputStream(
+ ORB orb, GIOPVersion version, byte encodingVersion) {
+ 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:
+ if (encodingVersion != Message.CDR_ENC_VERSION) {
+ return
+ new IDLJavaSerializationInputStream(encodingVersion);
+ }
+ return new CDRInputStream_1_2();
+ // else fall through and report exception.
+ default:
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+ 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
+ // not be initialized in this case.
+ //
+ // Probably also required by ServerRequestImpl.
+ //
+ // REVISIT.
+ public CDRInputStream() {
+ }
+
+ public CDRInputStream(CDRInputStream is) {
+ impl = is.impl.dup();
+ impl.setParent(this);
+ }
+
+ public CDRInputStream(org.omg.CORBA.ORB orb,
+ ByteBuffer byteBuffer,
+ int size,
+ boolean littleEndian,
+ GIOPVersion version,
+ byte encodingVersion,
+ BufferManagerRead bufMgr)
+ {
+ impl = InputStreamFactory.newInputStream((ORB)orb, version,
+ encodingVersion);
+
+ impl.init(orb, byteBuffer, size, littleEndian, bufMgr);
+
+ impl.setParent(this);
+ }
+
+ // org.omg.CORBA.portable.InputStream
+ public final boolean read_boolean() {
+ return impl.read_boolean();
+ }
+
+ public final char read_char() {
+ return impl.read_char();
+ }
+
+ public final char read_wchar() {
+ return impl.read_wchar();
+ }
+
+ public final byte read_octet() {
+ return impl.read_octet();
+ }
+
+ public final short read_short() {
+ return impl.read_short();
+ }
+
+ public final short read_ushort() {
+ return impl.read_ushort();
+ }
+
+ public final int read_long() {
+ return impl.read_long();
+ }
+
+ public final int read_ulong() {
+ return impl.read_ulong();
+ }
+
+ public final long read_longlong() {
+ return impl.read_longlong();
+ }
+
+ public final long read_ulonglong() {
+ return impl.read_ulonglong();
+ }
+
+ public final float read_float() {
+ return impl.read_float();
+ }
+
+ public final double read_double() {
+ return impl.read_double();
+ }
+
+ public final String read_string() {
+ return impl.read_string();
+ }
+
+ public final String read_wstring() {
+ return impl.read_wstring();
+ }
+
+ public final void read_boolean_array(boolean[] value, int offset, int length) {
+ impl.read_boolean_array(value, offset, length);
+ }
+
+ public final void read_char_array(char[] value, int offset, int length) {
+ impl.read_char_array(value, offset, length);
+ }
+
+ public final void read_wchar_array(char[] value, int offset, int length) {
+ impl.read_wchar_array(value, offset, length);
+ }
+
+ public final void read_octet_array(byte[] value, int offset, int length) {
+ impl.read_octet_array(value, offset, length);
+ }
+
+ public final void read_short_array(short[] value, int offset, int length) {
+ impl.read_short_array(value, offset, length);
+ }
+
+ public final void read_ushort_array(short[] value, int offset, int length) {
+ impl.read_ushort_array(value, offset, length);
+ }
+
+ public final void read_long_array(int[] value, int offset, int length) {
+ impl.read_long_array(value, offset, length);
+ }
+
+ public final void read_ulong_array(int[] value, int offset, int length) {
+ impl.read_ulong_array(value, offset, length);
+ }
+
+ public final void read_longlong_array(long[] value, int offset, int length) {
+ impl.read_longlong_array(value, offset, length);
+ }
+
+ public final void read_ulonglong_array(long[] value, int offset, int length) {
+ impl.read_ulonglong_array(value, offset, length);
+ }
+
+ public final void read_float_array(float[] value, int offset, int length) {
+ impl.read_float_array(value, offset, length);
+ }
+
+ public final void read_double_array(double[] value, int offset, int length) {
+ impl.read_double_array(value, offset, length);
+ }
+
+ public final org.omg.CORBA.Object read_Object() {
+ return impl.read_Object();
+ }
+
+ public final TypeCode read_TypeCode() {
+ return impl.read_TypeCode();
+ }
+ public final Any read_any() {
+ return impl.read_any();
+ }
+
+ public final Principal read_Principal() {
+ return impl.read_Principal();
+ }
+
+ public final int read() throws java.io.IOException {
+ return impl.read();
+ }
+
+ public final java.math.BigDecimal read_fixed() {
+ return impl.read_fixed();
+ }
+
+ public final org.omg.CORBA.Context read_Context() {
+ return impl.read_Context();
+ }
+
+ public final org.omg.CORBA.Object read_Object(java.lang.Class clz) {
+ return impl.read_Object(clz);
+ }
+
+ public final org.omg.CORBA.ORB orb() {
+ return impl.orb();
+ }
+
+ // org.omg.CORBA_2_3.portable.InputStream
+ public final java.io.Serializable read_value() {
+ return impl.read_value();
+ }
+
+ public final java.io.Serializable read_value(java.lang.Class clz) {
+ return impl.read_value(clz);
+ }
+
+ public final java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) {
+ return impl.read_value(factory);
+ }
+
+ public final java.io.Serializable read_value(java.lang.String rep_id) {
+ return impl.read_value(rep_id);
+ }
+
+ public final java.io.Serializable read_value(java.io.Serializable value) {
+ return impl.read_value(value);
+ }
+
+ public final java.lang.Object read_abstract_interface() {
+ return impl.read_abstract_interface();
+ }
+
+ public final java.lang.Object read_abstract_interface(java.lang.Class clz) {
+ return impl.read_abstract_interface(clz);
+ }
+ // com.sun.corba.se.impl.encoding.MarshalInputStream
+
+ public final void consumeEndian() {
+ impl.consumeEndian();
+ }
+
+ public final int getPosition() {
+ return impl.getPosition();
+ }
+
+ // org.omg.CORBA.DataInputStream
+
+ public final java.lang.Object read_Abstract () {
+ return impl.read_Abstract();
+ }
+
+ public final java.io.Serializable read_Value () {
+ return impl.read_Value();
+ }
+
+ public final void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length) {
+ impl.read_any_array(seq, offset, length);
+ }
+
+ public final void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length) {
+ impl.read_boolean_array(seq, offset, length);
+ }
+
+ public final void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length) {
+ impl.read_char_array(seq, offset, length);
+ }
+
+ public final void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length) {
+ impl.read_wchar_array(seq, offset, length);
+ }
+
+ public final void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length) {
+ impl.read_octet_array(seq, offset, length);
+ }
+
+ public final void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length) {
+ impl.read_short_array(seq, offset, length);
+ }
+
+ public final void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length) {
+ impl.read_ushort_array(seq, offset, length);
+ }
+
+ public final void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length) {
+ impl.read_long_array(seq, offset, length);
+ }
+
+ public final void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length) {
+ impl.read_ulong_array(seq, offset, length);
+ }
+
+ public final void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length) {
+ impl.read_ulonglong_array(seq, offset, length);
+ }
+
+ public final void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length) {
+ impl.read_longlong_array(seq, offset, length);
+ }
+
+ public final void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length) {
+ impl.read_float_array(seq, offset, length);
+ }
+
+ public final void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) {
+ impl.read_double_array(seq, offset, length);
+ }
+
+ // org.omg.CORBA.portable.ValueBase
+ public final String[] _truncatable_ids() {
+ return impl._truncatable_ids();
+ }
+
+ // java.io.InputStream
+ public final int read(byte b[]) throws IOException {
+ return impl.read(b);
+ }
+
+ public final int read(byte b[], int off, int len) throws IOException {
+ return impl.read(b, off, len);
+ }
+
+ public final long skip(long n) throws IOException {
+ return impl.skip(n);
+ }
+
+ public final int available() throws IOException {
+ return impl.available();
+ }
+
+ public final void close() throws IOException {
+ impl.close();
+ }
+
+ public final void mark(int readlimit) {
+ impl.mark(readlimit);
+ }
+
+ public final void reset() {
+ impl.reset();
+ }
+
+ public final boolean markSupported() {
+ return impl.markSupported();
+ }
+
+ public abstract CDRInputStream dup();
+
+ // Needed by TCUtility
+ public final java.math.BigDecimal read_fixed(short digits, short scale) {
+ return impl.read_fixed(digits, scale);
+ }
+
+ public final boolean isLittleEndian() {
+ return impl.isLittleEndian();
+ }
+
+ protected final ByteBuffer getByteBuffer() {
+ return impl.getByteBuffer();
+ }
+
+ protected final void setByteBuffer(ByteBuffer byteBuffer) {
+ impl.setByteBuffer(byteBuffer);
+ }
+
+ protected final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
+ impl.setByteBufferWithInfo(bbwi);
+ }
+
+ /**
+ * return true if our ByteBuffer is sharing/equal to bb
+ */
+ protected final boolean isSharing(ByteBuffer bb) {
+ return (getByteBuffer() == bb);
+ }
+
+ public final int getBufferLength() {
+ return impl.getBufferLength();
+ }
+
+ protected final void setBufferLength(int value) {
+ impl.setBufferLength(value);
+ }
+
+ protected final int getIndex() {
+ return impl.getIndex();
+ }
+
+ protected final void setIndex(int value) {
+ impl.setIndex(value);
+ }
+
+ public final void orb(org.omg.CORBA.ORB orb) {
+ impl.orb(orb);
+ }
+
+ public final GIOPVersion getGIOPVersion() {
+ return impl.getGIOPVersion();
+ }
+
+ public final BufferManagerRead getBufferManager() {
+ return impl.getBufferManager();
+ }
+
+ // This should be overridden by any stream (ex: IIOPInputStream)
+ // which wants to read values. Thus, TypeCodeInputStream doesn't
+ // have to do this.
+ public CodeBase getCodeBase() {
+ return null;
+ }
+
+ // Use Latin-1 for GIOP 1.0 or when code set negotiation was not
+ // performed.
+ protected CodeSetConversion.BTCConverter createCharBTCConverter() {
+ return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1,
+ impl.isLittleEndian());
+ }
+
+ // Subclasses must decide what to do here. It's inconvenient to
+ // make the class and this method abstract because of dup().
+ protected abstract CodeSetConversion.BTCConverter createWCharBTCConverter();
+
+ // Prints the current buffer in a human readable form
+ void printBuffer() {
+ impl.printBuffer();
+ }
+
+ /**
+ * 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.
+ */
+ public void alignOnBoundary(int octetBoundary) {
+ impl.alignOnBoundary(octetBoundary);
+ }
+
+ // Needed by request and reply messages for GIOP versions >= 1.2 only.
+ 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.
+ *
+ * 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
+ // with its default constructor (and thus no impl is set).
+ if (impl != null)
+ impl.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.
+ */
+ public void resetCodeSetConverters() {
+ impl.resetCodeSetConverters();
+ }
+
+ public void setMessageMediator(MessageMediator messageMediator)
+ {
+ this.messageMediator = (CorbaMessageMediator) messageMediator;
+ }
+
+ public MessageMediator getMessageMediator()
+ {
+ return messageMediator;
+ }
+
+ // ValueInputStream -----------------------------
+
+ public void start_value() {
+ impl.start_value();
+ }
+
+ public void end_value() {
+ impl.end_value();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStreamBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStreamBase.java
new file mode 100644
index 0000000..1f0eedb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStreamBase.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.Any;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+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.
+ */
+abstract class CDRInputStreamBase extends java.io.InputStream
+{
+ protected CDRInputStream parent;
+
+ public void setParent(CDRInputStream parent) {
+ this.parent = parent;
+ }
+
+ public abstract void init(org.omg.CORBA.ORB orb,
+ ByteBuffer byteBuffer,
+ int size,
+ boolean littleEndian,
+ 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();
+ public abstract 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.se.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);
+
+ // org.omg.CORBA.portable.ValueBase
+ public abstract String[] _truncatable_ids();
+
+ // 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[], int off, int len) throws IOException
+// public abstract long skip(long n) throws IOException;
+// public abstract int available() throws IOException;
+// public abstract void close() throws IOException;
+ public abstract void mark(int readlimit);
+ public abstract void reset();
+
+ // 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
+ // like expect obj1a == obj1b in the following code:
+ //
+ // is.mark(10000);
+ // Object obj1a = is.readObject();
+ // is.reset();
+ // Object obj1b = is.readObject();
+ //
+ public boolean markSupported() { return false; }
+
+ // Needed by AnyImpl and ServiceContexts
+ public abstract CDRInputStreamBase dup();
+
+ // Needed by TCUtility
+ public abstract java.math.BigDecimal read_fixed(short digits, short scale);
+
+ // Needed by TypeCodeImpl
+ public abstract boolean isLittleEndian();
+
+ // Needed by request and reply messages for GIOP versions >= 1.2 only.
+ abstract void setHeaderPadding(boolean headerPadding);
+
+ // Needed by IIOPInputStream and other subclasses
+
+ public abstract ByteBuffer getByteBuffer();
+ public abstract void setByteBuffer(ByteBuffer byteBuffer);
+
+ public abstract void setByteBufferWithInfo(ByteBufferWithInfo bbwi);
+
+ public abstract int getBufferLength();
+ public abstract void setBufferLength(int value);
+
+ public abstract int getIndex();
+ public abstract void setIndex(int value);
+
+ public abstract void orb(org.omg.CORBA.ORB orb);
+
+ public abstract BufferManagerRead getBufferManager();
+ public abstract GIOPVersion getGIOPVersion();
+
+ abstract CodeBase getCodeBase();
+
+ abstract void printBuffer();
+
+ abstract void alignOnBoundary(int octetBoundary);
+
+ abstract void performORBVersionSpecificInit();
+
+ public abstract void resetCodeSetConverters();
+
+ // ValueInputStream -------------------------
+ public abstract void start_value();
+ public abstract void end_value();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java
new file mode 100644
index 0000000..a00d66c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_0.java
@@ -0,0 +1,2398 @@
+/*
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.ByteArrayInputStream;
+import java.io.ObjectInputStream;
+import java.io.IOException;
+import java.io.StreamCorruptedException;
+import java.io.OptionalDataException;
+import java.io.IOException;
+
+import java.util.Stack;
+
+import java.net.URL;
+import java.net.MalformedURLException;
+
+import java.nio.ByteBuffer;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+
+import java.math.BigDecimal;
+
+import java.rmi.Remote;
+import java.rmi.StubNotFoundException;
+
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ValueBase;
+import org.omg.CORBA.portable.IndirectionException;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.CustomMarshal;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.ValueFactory;
+import org.omg.CORBA.portable.CustomValue;
+import org.omg.CORBA.portable.StreamableValue;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.portable.IDLEntity;
+
+import javax.rmi.PortableRemoteObject;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
+import com.sun.corba.se.spi.protocol.CorbaClientDelegate;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.orb.ORBVersion;
+
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+
+import com.sun.corba.se.impl.corba.PrincipalImpl;
+import com.sun.corba.se.impl.corba.TypeCodeImpl;
+import com.sun.corba.se.impl.corba.CORBAObjectImpl;
+
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+
+import com.sun.corba.se.impl.util.Utility;
+import com.sun.corba.se.impl.util.RepositoryId;
+
+import com.sun.corba.se.impl.orbutil.RepositoryIdStrings;
+import com.sun.corba.se.impl.orbutil.RepositoryIdInterface;
+import com.sun.corba.se.impl.orbutil.RepositoryIdUtility;
+import com.sun.corba.se.impl.orbutil.RepositoryIdFactory;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.orbutil.CacheTable;
+
+
+import com.sun.org.omg.CORBA.portable.ValueHelper;
+
+import com.sun.org.omg.SendingContext.CodeBase;
+
+public class CDRInputStream_1_0 extends CDRInputStreamBase
+ implements RestorableInputStream
+{
+ private static final String kReadMethod = "read";
+ private static final int maxBlockLength = 0x7fffff00;
+
+ protected BufferManagerRead bufferManagerRead;
+ protected ByteBufferWithInfo bbwi;
+
+ // Set to the ORB's transportDebugFlag value. This value is
+ // used if the ORB is null.
+ private boolean debug = false;
+
+ protected boolean littleEndian;
+ protected ORB orb;
+ protected ORBUtilSystemException wrapper ;
+ protected OMGSystemException omgWrapper ;
+ protected ValueHandler valueHandler = null;
+
+ // Value cache
+ private CacheTable valueCache = null;
+
+ // Repository ID cache
+ private CacheTable repositoryIdCache = null;
+
+ // codebase cache
+ private CacheTable codebaseCache = null;
+
+ // Current Class Stack (repository Ids of current class being read)
+ // private Stack currentStack = null;
+
+ // Length of current chunk, or a large positive number if not in a chunk
+ protected int blockLength = maxBlockLength;
+
+ // Read end flag (value nesting depth)
+ protected int end_flag = 0;
+
+ // 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
+ // the old computation around for interoperability with our
+ // older ORBs.
+ private int chunkedValueNestingLevel = 0;
+
+ // Flag used to determine whether blocksize was zero
+ // private int checkForNullBlock = -1;
+
+ // In block flag
+ // private boolean inBlock = false;
+
+ // Indicates whether we are inside a value
+ // private boolean outerValueDone = true;
+
+ // Int used by read_value(Serializable) that is set by this class
+ // before calling ValueFactory.read_value
+ protected int valueIndirection = 0;
+
+ // Int set by readStringOrIndirection to communicate the actual
+ // offset of the string length field back to the caller
+ protected int stringIndirection = 0;
+
+ // Flag indicating whether we are unmarshalling a chunked value
+ protected boolean isChunked = false;
+
+ // Repository ID handlers
+ private RepositoryIdUtility repIdUtil;
+ private RepositoryIdStrings repIdStrs;
+
+ // Code set converters (created when first needed)
+ private CodeSetConversion.BTCConverter charConverter;
+ 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
+ // 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
+ // calls end_value after the readObject method exits.
+ private boolean specialNoOptionalDataState = false;
+
+ // Template method
+ public CDRInputStreamBase dup()
+ {
+ CDRInputStreamBase result = null ;
+
+ try {
+ result = (CDRInputStreamBase)this.getClass().newInstance();
+ } catch (Exception e) {
+ throw wrapper.couldNotDuplicateCdrInputStream( e ) ;
+ }
+ result.init(this.orb,
+ this.bbwi.byteBuffer,
+ this.bbwi.buflen,
+ this.littleEndian,
+ this.bufferManagerRead);
+
+ ((CDRInputStream_1_0)result).bbwi.position(this.bbwi.position());
+ // To ensure we keep bbwi.byteBuffer.limit in sync with bbwi.buflen.
+ ((CDRInputStream_1_0)result).bbwi.byteBuffer.limit(this.bbwi.buflen);
+
+ return result;
+ }
+
+ /**
+ * NOTE: size passed to init means buffer size
+ */
+ public void init(org.omg.CORBA.ORB orb,
+ ByteBuffer byteBuffer,
+ int size,
+ boolean littleEndian,
+ BufferManagerRead bufferManager)
+ {
+ this.orb = (ORB)orb;
+ this.wrapper = ORBUtilSystemException.get( (ORB)orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+ this.omgWrapper = OMGSystemException.get( (ORB)orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+ this.littleEndian = littleEndian;
+ this.bufferManagerRead = bufferManager;
+ this.bbwi = new ByteBufferWithInfo(orb,byteBuffer,0);
+ this.bbwi.buflen = size;
+ this.bbwi.byteBuffer.limit(bbwi.buflen);
+ this.markAndResetHandler = bufferManagerRead.getMarkAndResetHandler();
+
+ debug = ((ORB)orb).transportDebugFlag;
+ }
+
+ // See description in CDRInputStream
+ void performORBVersionSpecificInit() {
+ createRepositoryIdHandlers();
+ }
+
+ private final void createRepositoryIdHandlers()
+ {
+ repIdUtil = RepositoryIdFactory.getRepIdUtility();
+ repIdStrs = RepositoryIdFactory.getRepIdStringsFactory();
+ }
+
+ 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) {
+ throw wrapper.giopVersionError();
+ }
+
+ protected final int computeAlignment(int index, int align) {
+ if (align > 1) {
+ int incr = index & (align - 1);
+ if (incr != 0)
+ return align - incr;
+ }
+
+ return 0;
+ }
+
+ public int getSize()
+ {
+ return bbwi.position();
+ }
+
+ protected void checkBlockLength(int align, int dataSize) {
+ // Since chunks can end at arbitrary points (though not within
+ // primitive CDR types, arrays of primitives, strings, wstrings,
+ // or indirections),
+ // we must check here for termination of the current chunk.
+ if (!isChunked)
+ return;
+
+ // RMI-IIOP stream format version 2 case in which we know
+ // 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
+ // calls end_value after the readObject method exits.
+ if (specialNoOptionalDataState) {
+ throw omgWrapper.rmiiiopOptionalDataIncompatible1() ;
+ }
+
+ boolean checkForEndTag = false;
+
+ // 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.)
+ //
+ // If it isn't a chunk length, blockLength will
+ // remain set to maxBlockLength.
+ if (blockLength == get_offset()) {
+
+ blockLength = maxBlockLength;
+ start_block();
+
+ // What's next is either a valuetag or
+ // 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,
+ // then there isn't enough data left in
+ // this valuetype to read!
+ if (blockLength == maxBlockLength)
+ checkForEndTag = true;
+
+ } else
+ if (blockLength < get_offset()) {
+ // Are we already past the end of the current chunk?
+ // This is always an error.
+ throw wrapper.chunkOverflow() ;
+ }
+
+ // If what's next on the wire isn't a chunk length or
+ // what we want to read (which can't be split across chunks)
+ // won't fit in the current chunk, throw this exception.
+ // This probably means that we're in an RMI-IIOP
+ // Serializable's readObject method or a custom marshaled
+ // IDL type is reading too much/in an incorrect order
+ int requiredNumBytes =
+ computeAlignment(bbwi.position(), align) + dataSize;
+
+ if (blockLength != maxBlockLength &&
+ blockLength < get_offset() + requiredNumBytes) {
+ throw omgWrapper.rmiiiopOptionalDataIncompatible2() ;
+ }
+
+ // REVISIT - We should look at using the built in advancement
+ // of using ByteBuffer.get() rather than explicitly
+ // advancing the ByteBuffer's position.
+ // This is true for anywhere we are incrementing
+ // the ByteBuffer's position.
+ if (checkForEndTag) {
+ int nextLong = read_long();
+ bbwi.position(bbwi.position() - 4);
+
+ // It was an end tag, so there wasn't enough data
+ // left in the valuetype's encoding on the wire
+ // to read what we wanted
+ if (nextLong < 0)
+ throw omgWrapper.rmiiiopOptionalDataIncompatible3() ;
+ }
+ }
+
+ 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 alignResult = computeAlignment(bbwi.position(), align);
+ bbwi.position(bbwi.position() + alignResult);
+
+ if (bbwi.position() + n > bbwi.buflen)
+ grow(align, n);
+ }
+
+ //
+ // This can be overridden....
+ //
+ protected void grow(int align, int n) {
+
+ bbwi.needed = n;
+
+ bbwi = bufferManagerRead.underflow(bbwi);
+
+ }
+
+ //
+ // Marshal primitives.
+ //
+
+ public final void consumeEndian() {
+ littleEndian = read_boolean();
+ }
+
+ // No such type in java
+ public final double read_longdouble() {
+ throw wrapper.longDoubleNotImplemented( CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ public final boolean read_boolean() {
+ return (read_octet() != 0);
+ }
+
+ public final char read_char() {
+ alignAndCheck(1, 1);
+
+ return getConvertedChars(1, getCharConverter())[0];
+ }
+
+ 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)orb)) {
+ throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ // If we're talking to one of our legacy ORBs, do what
+ // they did:
+ int b1, b2;
+
+ alignAndCheck(2, 2);
+
+ if (littleEndian) {
+ b2 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
+ bbwi.position(bbwi.position() + 1);
+ b1 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
+ bbwi.position(bbwi.position() + 1);
+ } else {
+ b1 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
+ bbwi.position(bbwi.position() + 1);
+ b2 = bbwi.byteBuffer.get(bbwi.position()) & 0x00FF;
+ bbwi.position(bbwi.position() + 1);
+ }
+
+ return (char)((b1 << 8) + (b2 << 0));
+ }
+
+ public final byte read_octet() {
+
+ alignAndCheck(1, 1);
+
+ byte b = bbwi.byteBuffer.get(bbwi.position());
+ bbwi.position(bbwi.position() + 1);
+
+ return b;
+ }
+
+ public final short read_short() {
+ int b1, b2;
+
+ alignAndCheck(2, 2);
+
+ if (littleEndian) {
+ b2 = (bbwi.byteBuffer.get(bbwi.position()) << 0) & 0x000000FF;
+ bbwi.position(bbwi.position() + 1);
+ b1 = (bbwi.byteBuffer.get(bbwi.position()) << 8) & 0x0000FF00;
+ bbwi.position(bbwi.position() + 1);
+ } else {
+ b1 = (bbwi.byteBuffer.get(bbwi.position()) << 8) & 0x0000FF00;
+ bbwi.position(bbwi.position() + 1);
+ b2 = (bbwi.byteBuffer.get(bbwi.position()) << 0) & 0x000000FF;
+ bbwi.position(bbwi.position() + 1);
+ }
+
+ return (short)(b1 | b2);
+ }
+
+ public final short read_ushort() {
+ return read_short();
+ }
+
+ public final int read_long() {
+ int b1, b2, b3, b4;
+
+ alignAndCheck(4, 4);
+
+ int bufPos = bbwi.position();
+ if (littleEndian) {
+ b4 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
+ b3 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
+ b2 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
+ b1 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
+ } else {
+ b1 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
+ b2 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
+ b3 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
+ b4 = bbwi.byteBuffer.get(bufPos++) & 0xFF;
+ }
+ bbwi.position(bufPos);
+
+ return (b1 << 24) | (b2 << 16) | (b3 << 8) | b4;
+ }
+
+ public final int read_ulong() {
+ return read_long();
+ }
+
+ public final long read_longlong() {
+ long i1, i2;
+
+ alignAndCheck(8, 8);
+
+ if (littleEndian) {
+ i2 = read_long() & 0xFFFFFFFFL;
+ i1 = (long)read_long() << 32;
+ } else {
+ i1 = (long)read_long() << 32;
+ i2 = read_long() & 0xFFFFFFFFL;
+ }
+
+ return (i1 | i2);
+ }
+
+ public final long read_ulonglong() {
+ return read_longlong();
+ }
+
+ public final float read_float() {
+ return Float.intBitsToFloat(read_long());
+ }
+
+ public final double read_double() {
+ return Double.longBitsToDouble(read_longlong());
+ }
+
+ protected final void checkForNegativeLength(int length) {
+ if (length < 0)
+ throw wrapper.negativeStringLength( CompletionStatus.COMPLETED_MAYBE,
+ new Integer(length) ) ;
+ }
+
+ protected final String readStringOrIndirection(boolean allowIndirection) {
+
+ int len = read_long();
+
+ //
+ // Check for indirection
+ //
+ if (allowIndirection) {
+ if (len == 0xffffffff)
+ return null;
+ else
+ stringIndirection = get_offset() - 4;
+ }
+
+ checkForNegativeLength(len);
+
+ return internalReadString(len);
+ }
+
+ private final String internalReadString(int len) {
+ // Workaround for ORBs which send string lengths of
+ // zero to mean empty string.
+ //
+ // IMPORTANT: Do not replace 'new String("")' with "", it may result
+ // in a Serialization bug (See serialization.zerolengthstring) and
+ // bug id: 4728756 for details
+ if (len == 0)
+ return new String("");
+
+ char[] result = getConvertedChars(len - 1, getCharConverter());
+
+ // Skip over the 1 byte null
+ read_octet();
+
+ return new String(result, 0, getCharConverter().getNumChars());
+ }
+
+ public final String read_string() {
+ return readStringOrIndirection(false);
+ }
+
+ public String read_wstring() {
+ // Don't allow transmission of wchar/wstring data with
+ // foreign ORBs since it's against the spec.
+ if (ORBUtility.isForeignORB((ORB)orb)) {
+ throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ int len = read_long();
+
+ //
+ // Workaround for ORBs which send string lengths of
+ // zero to mean empty string.
+ //
+ //
+ // IMPORTANT: Do not replace 'new String("")' with "", it may result
+ // in a Serialization bug (See serialization.zerolengthstring) and
+ // bug id: 4728756 for details
+ if (len == 0)
+ return new String("");
+
+ checkForNegativeLength(len);
+
+ len--;
+ char[] c = new char[len];
+
+ for (int i = 0; i < len; i++)
+ c[i] = read_wchar();
+
+ // skip the two null terminator bytes
+ read_wchar();
+ // bbwi.position(bbwi.position() + 2);
+
+ return new String(c);
+ }
+
+ public final void read_octet_array(byte[] b, int offset, int length) {
+ if ( b == null )
+ throw wrapper.nullParam() ;
+
+ // Must call alignAndCheck at least once to ensure
+ // we aren't at the end of a chunk. Of course, we
+ // should only call it if we actually need to read
+ // something, otherwise we might end up with an
+ // exception at the end of the stream.
+ if (length == 0)
+ return;
+
+ alignAndCheck(1, 1);
+
+ int n = offset;
+ while (n < length+offset) {
+ int avail;
+ int bytes;
+ int wanted;
+
+ avail = bbwi.buflen - bbwi.position();
+ if (avail <= 0) {
+ grow(1, 1);
+ avail = bbwi.buflen - bbwi.position();
+ }
+ wanted = (length + offset) - n;
+ bytes = (wanted < avail) ? wanted : avail;
+ // Microbenchmarks are showing a loop of ByteBuffer.get(int) being
+ // faster than ByteBuffer.get(byte[], int, int).
+ for (int i = 0; i < bytes; i++) {
+ b[n+i] = bbwi.byteBuffer.get(bbwi.position() + i);
+ }
+
+ bbwi.position(bbwi.position() + bytes);
+
+ n += bytes;
+ }
+ }
+
+ public Principal read_Principal() {
+ int len = read_long();
+ byte[] pvalue = new byte[len];
+ read_octet_array(pvalue,0,len);
+
+ Principal p = new PrincipalImpl();
+ p.name(pvalue);
+ return p;
+ }
+
+ public TypeCode read_TypeCode() {
+ TypeCodeImpl tc = new TypeCodeImpl(orb);
+ tc.read_value(parent);
+ return tc;
+ }
+
+ public Any read_any() {
+ Any any = orb.create_any();
+ TypeCodeImpl tc = new TypeCodeImpl(orb);
+
+ // 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
+ // 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,
+ // including encapsulations, is read off.
+ try {
+ tc.read_value(parent);
+ } catch (MARSHAL ex) {
+ if (tc.kind().value() != TCKind._tk_value)
+ throw ex;
+ // We can be sure that the whole typecode encapsulation has been
+ // read off.
+ dprintThrowable(ex);
+ }
+ // read off the value of the any
+ any.read_value(parent, tc);
+
+ return any;
+ }
+
+ public org.omg.CORBA.Object read_Object() {
+ return read_Object(null);
+ }
+
+ // ------------ 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
+ // 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 ).
+ // 3. If clz is an interface, use it to create the appropriate
+ // stub factory.
+ public org.omg.CORBA.Object read_Object(Class clz)
+ {
+ // In any case, we must first read the IOR.
+ IOR ior = IORFactories.makeIOR(parent) ;
+ if (ior.isNil())
+ return 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() ;
+ boolean isIDLInterface = rid.isIDLType() ;
+
+ if (className == null || className.equals( "" ))
+ stubFactory = null ;
+ else
+ try {
+ stubFactory = sff.createStubFactory( className,
+ isIDLInterface, codeBase, (Class)null,
+ (ClassLoader)null );
+ } catch (Exception exc) {
+ // Could not create stubFactory, so use null.
+ // XXX stubFactory handling is still too complex:
+ // Can we resolve the stubFactory question once in
+ // a single place?
+ stubFactory = null ;
+ }
+ } else if (StubAdapter.isStubClass( clz )) {
+ stubFactory = PresentationDefaults.makeStaticStubFactory(
+ clz ) ;
+ } else {
+ // clz is an interface class
+ boolean isIDL = IDLEntity.class.isAssignableFrom( clz ) ;
+
+ stubFactory = sff.createStubFactory( clz.getName(),
+ isIDL, codeBase, clz, clz.getClassLoader() ) ;
+ }
+
+ 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.
+ */
+ public static org.omg.CORBA.Object internalIORToObject(
+ IOR ior, PresentationManager.StubFactory stubFactory, ORB orb)
+ {
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ (ORB)orb, CORBALogDomains.RPC_ENCODING ) ;
+
+ 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);
+
+ // If we managed to load a stub, return it, otherwise we
+ // must fail...
+ if (objref != null) {
+ return objref;
+ } else {
+ 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;
+ }
+ } else
+ throw wrapper.badServantReadObject() ;
+ }
+
+ CorbaClientDelegate del = ORBUtility.makeClientDelegate( ior ) ;
+ org.omg.CORBA.Object objref = null ;
+ try {
+ objref = stubFactory.makeStub() ;
+ } catch (Throwable e) {
+ wrapper.stubCreateError( e ) ;
+
+ if (e instanceof ThreadDeath) {
+ throw (ThreadDeath) e;
+ }
+
+ // Return the "default" stub...
+ objref = new CORBAObjectImpl() ;
+ }
+
+ StubAdapter.setDelegate( objref, del ) ;
+ return objref;
+ }
+
+ public java.lang.Object read_abstract_interface()
+ {
+ return read_abstract_interface(null);
+ }
+
+ public java.lang.Object read_abstract_interface(java.lang.Class clz)
+ {
+ boolean object = read_boolean();
+
+ if (object) {
+ return read_Object(clz);
+ } else {
+ return read_value();
+ }
+ }
+
+ public Serializable read_value()
+ {
+ return read_value((Class)null);
+ }
+
+ private Serializable handleIndirection() {
+ 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 {
+ // In RMI-IIOP the ValueHandler will recognize this
+ // exception and use the provided indirection value
+ // to lookup a possible indirection to an object
+ // currently on the deserialization stack.
+ throw new IndirectionException(indirection);
+ }
+ }
+
+ private String readRepositoryIds(int valueTag,
+ Class expectedType,
+ String expectedTypeRepId) {
+ return readRepositoryIds(valueTag, expectedType,
+ 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.
+ */
+ private String readRepositoryIds(int valueTag,
+ Class expectedType,
+ 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(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+ return repIdStrs.createForAnyType(expectedType);
+ case RepositoryIdUtility.SINGLE_REP_TYPE_INFO :
+ return read_repositoryId();
+ case RepositoryIdUtility.PARTIAL_LIST_TYPE_INFO :
+ return read_repositoryIds();
+ default:
+ throw wrapper.badValueTag( CompletionStatus.COMPLETED_MAYBE,
+ Integer.toHexString(valueTag) ) ;
+ }
+ }
+
+ public Serializable read_value(Class expectedType) {
+
+ // Read value tag
+ int vType = readValueTag();
+
+ // Is value null?
+ if (vType == 0)
+ return null;
+
+ // Is this an indirection to a previously
+ // read valuetype?
+ if (vType == 0xffffffff)
+ return handleIndirection();
+
+ // Save where this valuetype started so we
+ // can put it in the indirection valueCache
+ // later
+ int indirection = get_offset() - 4;
+
+ // Need to save this special marker variable
+ // to restore its value during recursion
+ boolean saveIsChunked = isChunked;
+
+ isChunked = repIdUtil.isChunkedEncoding(vType);
+
+ java.lang.Object value = null;
+
+ String codebase_URL = null;
+ if (repIdUtil.isCodeBasePresent(vType)) {
+ codebase_URL = read_codebase_URL();
+ }
+
+ // Read repository id(s)
+ String repositoryIDString
+ = readRepositoryIds(vType, expectedType, null);
+
+ // If isChunked was determined to be true based
+ // on the valuetag, this will read a chunk length
+ start_block();
+
+ // Remember that end_flag keeps track of all nested
+ // valuetypes and is used for older ORBs
+ end_flag--;
+ if (isChunked)
+ chunkedValueNestingLevel--;
+
+ if (repositoryIDString.equals(repIdStrs.getWStringValueRepId())) {
+ value = read_wstring();
+ } else
+ if (repositoryIDString.equals(repIdStrs.getClassDescValueRepId())) {
+ // read in the class whether with the old ClassDesc or the
+ // new one
+ value = readClass();
+ } else {
+
+ Class valueClass = expectedType;
+
+ // By this point, either the expectedType or repositoryIDString
+ // is guaranteed to be non-null.
+ if (expectedType == null ||
+ !repositoryIDString.equals(repIdStrs.createForAnyType(expectedType))) {
+
+ valueClass = getClassFromString(repositoryIDString,
+ codebase_URL,
+ expectedType);
+ }
+
+ if (valueClass == null) {
+ // No point attempting to use value handler below, since the
+ // class information is not available.
+ throw wrapper.couldNotFindClass(
+ CompletionStatus.COMPLETED_MAYBE,
+ new ClassNotFoundException());
+ }
+
+ if (valueClass != null &&
+ org.omg.CORBA.portable.IDLEntity.class.isAssignableFrom(valueClass)) {
+
+ value = readIDLValue(indirection,
+ repositoryIDString,
+ valueClass,
+ codebase_URL);
+
+ } else {
+
+ // Must be some form of RMI-IIOP valuetype
+
+ try {
+ if (valueHandler == null)
+ valueHandler = ORBUtility.createValueHandler();
+
+ value = 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(
+ CompletionStatus.COMPLETED_MAYBE, ex ) ;
+ } catch(Error e) {
+ throw wrapper.valuehandlerReadError(
+ CompletionStatus.COMPLETED_MAYBE, e ) ;
+ }
+ }
+ }
+
+ // Skip any remaining chunks until we get to
+ // 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();
+
+ // Read and process the end tag if we're chunking.
+ // Assumes that we're at the position of the end tag
+ // (handleEndOfValue should assure this)
+ readEndTag();
+
+ // Cache the valuetype that we read
+ if (valueCache == null)
+ valueCache = new CacheTable(orb,false);
+ valueCache.put(value, indirection);
+
+ // Allow for possible continuation chunk.
+ // If we're a nested valuetype inside of a chunked
+ // valuetype, and that enclosing valuetype has
+ // more data to write, it will need to have this
+ // new chunk begin after we wrote our end tag.
+ isChunked = saveIsChunked;
+ start_block();
+
+ return (java.io.Serializable)value;
+ }
+
+ public Serializable read_value(BoxedValueHelper factory) {
+
+ // Read value tag
+ int vType = readValueTag();
+
+ if (vType == 0)
+ return null; // value is 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 {
+ throw new IndirectionException(indirection);
+ }
+ }
+ else {
+ int indirection = get_offset() - 4;
+
+ // end_block();
+
+ boolean saveIsChunked = isChunked;
+ isChunked = repIdUtil.isChunkedEncoding(vType);
+
+ java.lang.Object value = null;
+
+ String codebase_URL = null;
+ if (repIdUtil.isCodeBasePresent(vType)){
+ codebase_URL = read_codebase_URL();
+ }
+
+ // Read repository id
+ String repositoryIDString
+ = readRepositoryIds(vType, null, null, factory);
+
+ // Compare rep. ids to see if we should use passed helper
+ if (!repositoryIDString.equals(factory.get_id()))
+ factory = Utility.getHelper(null, codebase_URL, repositoryIDString);
+
+ start_block();
+ end_flag--;
+ if (isChunked)
+ chunkedValueNestingLevel--;
+
+ if (factory instanceof ValueHelper) {
+ value = readIDLValueWithHelper((ValueHelper)factory, indirection);
+ } else {
+ valueIndirection = indirection; // for callback
+ value = factory.read_value(parent);
+ }
+
+ handleEndOfValue();
+ readEndTag();
+
+ // Put into valueCache
+ if (valueCache == null)
+ valueCache = new CacheTable(orb,false);
+ valueCache.put(value, indirection);
+
+ // allow for possible continuation chunk
+ isChunked = saveIsChunked;
+ start_block();
+
+ return (java.io.Serializable)value;
+ }
+ }
+
+ private boolean isCustomType(ValueHelper helper) {
+ 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) ;
+ }
+
+ return false;
+ }
+
+ // 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.
+ public java.io.Serializable read_value(java.io.Serializable value) {
+
+ // Put into valueCache using valueIndirection
+ if (valueCache == null)
+ valueCache = new CacheTable(orb,false);
+ valueCache.put(value, valueIndirection);
+
+ if (value instanceof StreamableValue)
+ ((StreamableValue)value)._read(parent);
+ else if (value instanceof CustomValue)
+ ((CustomValue)value).unmarshal(parent);
+
+ return value;
+ }
+
+ public java.io.Serializable read_value(java.lang.String repositoryId) {
+
+ // if (inBlock)
+ // end_block();
+
+ // Read value tag
+ int vType = readValueTag();
+
+ if (vType == 0)
+ return null; // value is 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 {
+ throw new IndirectionException(indirection);
+ }
+ }
+ else {
+ int indirection = get_offset() - 4;
+
+ // end_block();
+
+ boolean saveIsChunked = isChunked;
+ isChunked = repIdUtil.isChunkedEncoding(vType);
+
+ java.lang.Object value = null;
+
+ String codebase_URL = null;
+ if (repIdUtil.isCodeBasePresent(vType)){
+ codebase_URL = read_codebase_URL();
+ }
+
+ // Read repository id
+ String repositoryIDString
+ = readRepositoryIds(vType, null, repositoryId);
+
+ ValueFactory factory =
+ Utility.getFactory(null, codebase_URL, orb, repositoryIDString);
+
+ start_block();
+ end_flag--;
+ if (isChunked)
+ chunkedValueNestingLevel--;
+
+ valueIndirection = indirection; // for callback
+ value = factory.read_value(parent);
+
+ handleEndOfValue();
+ readEndTag();
+
+ // Put into valueCache
+ if (valueCache == null)
+ valueCache = new CacheTable(orb,false);
+ valueCache.put(value, indirection);
+
+ // allow for possible continuation chunk
+ isChunked = saveIsChunked;
+ start_block();
+
+ return (java.io.Serializable)value;
+ }
+ }
+
+ private Class readClass() {
+
+ String codebases = null, classRepId = null;
+
+ 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);
+ } 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);
+ }
+
+ if (debug) {
+ dprint("readClass codebases: "
+ + codebases
+ + " rep Id: "
+ + classRepId);
+ }
+
+ Class cl = null;
+
+ RepositoryIdInterface repositoryID
+ = repIdStrs.getFromString(classRepId);
+
+ try {
+ cl = repositoryID.getClassFromType(codebases);
+ } catch(ClassNotFoundException cnfe) {
+ throw wrapper.cnfeReadClass( CompletionStatus.COMPLETED_MAYBE,
+ cnfe, repositoryID.getClassName() ) ;
+ } catch(MalformedURLException me) {
+ throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
+ me, repositoryID.getClassName(), codebases ) ;
+ }
+
+ return cl;
+ }
+
+ private java.lang.Object readIDLValueWithHelper(ValueHelper helper, int indirection)
+ {
+ // look for two-argument static read method
+ Method readMethod;
+ try {
+ Class argTypes[] = {org.omg.CORBA.portable.InputStream.class, helper.get_class()};
+ readMethod = helper.getClass().getDeclaredMethod(kReadMethod, argTypes);
+ }
+ catch(NoSuchMethodException nsme) { // must be boxed value helper
+ java.lang.Object result = helper.read_value(parent);
+ return result;
+ }
+
+ // found two-argument read method, so must be non-boxed value...
+ // ...create a blank instance
+ 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){
+ // Value's constructor is protected or private
+ //
+ // So, use the helper to read the value.
+ //
+ // NOTE : This means that in this particular case a recursive ref.
+ // would fail.
+ return helper.read_value(parent);
+ }
+
+ // add blank instance to cache table
+ if (valueCache == null)
+ valueCache = new CacheTable(orb,false);
+ valueCache.put(val, indirection);
+
+ // if custom type, call unmarshal method
+ if (val instanceof CustomMarshal && isCustomType(helper)) {
+ ((CustomMarshal)val).unmarshal(parent);
+ return val;
+ }
+
+ // call two-argument read method using reflection
+ try {
+ java.lang.Object args[] = {parent, val};
+ readMethod.invoke(helper, args);
+ return val;
+ } catch(IllegalAccessException iae2) {
+ throw wrapper.couldNotInvokeHelperReadMethod( iae2, helper.get_class() ) ;
+ } catch(InvocationTargetException ite){
+ throw wrapper.couldNotInvokeHelperReadMethod( ite, helper.get_class() ) ;
+ }
+ }
+
+ private java.lang.Object readBoxedIDLEntity(Class clazz, String codebase)
+ {
+ Class cls = null ;
+
+ try {
+ ClassLoader clazzLoader = (clazz == null ? null : clazz.getClassLoader());
+
+ cls = Utility.loadClassForClass(clazz.getName()+"Helper", codebase,
+ clazzLoader, clazz, clazzLoader);
+ final Class helperClass = cls ;
+
+ final Class argTypes[] = {org.omg.CORBA.portable.InputStream.class};
+
+ // getDeclaredMethod requires RuntimePermission accessDeclaredMembers
+ // if a different class loader is used (even though the javadoc says otherwise)
+ Method readMethod = null;
+ try {
+ readMethod = (Method)AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public java.lang.Object run() throws NoSuchMethodException {
+ return helperClass.getDeclaredMethod(kReadMethod, argTypes);
+ }
+ }
+ );
+ } catch (PrivilegedActionException pae) {
+ // this gets caught below
+ throw (NoSuchMethodException)pae.getException();
+ }
+
+ java.lang.Object args[] = {parent};
+ return readMethod.invoke(null, args);
+
+ } 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 ) ;
+ }
+ }
+
+ private java.lang.Object readIDLValue(int indirection, String repId,
+ Class clazz, 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 (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 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 find a factory (including the DefaultFactory).
+ try {
+ // use new-style OBV support (factory object)
+ factory = Utility.getFactory(clazz, codebase, orb, repId);
+ } catch (MARSHAL marshal) {
+ // XXX log marshal at one of the INFO levels
+
+ // Could not get a factory, so try alternatives
+ if (!StreamableValue.class.isAssignableFrom(clazz) &&
+ !CustomValue.class.isAssignableFrom(clazz) &&
+ ValueBase.class.isAssignableFrom(clazz)) {
+ // use old-style OBV support (helper object)
+ BoxedValueHelper helper = Utility.getHelper(clazz, codebase, repId);
+ if (helper instanceof ValueHelper)
+ return readIDLValueWithHelper((ValueHelper)helper, indirection);
+ else
+ return helper.read_value(parent);
+ } else {
+ // must be a boxed IDLEntity, so make a reflective call to the
+ // helper's static read method...
+ return readBoxedIDLEntity(clazz, codebase);
+ }
+ }
+
+ // If there was no error in getting the factory, use it.
+ valueIndirection = indirection; // for callback
+ return factory.read_value(parent);
+ }
+
+ /**
+ * 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.
+ *
+ * ORB versioning and end tag compaction are handled here.
+ */
+ private void readEndTag() {
+ if (isChunked) {
+
+ // Read the end tag
+ int anEndTag = read_long();
+
+ // End tags should always be negative, and the outermost
+ // enclosing chunked valuetype should have a -1 end tag.
+ //
+ // handleEndOfValue should have assured that we were
+ // at the end tag position!
+ if (anEndTag >= 0) {
+ throw wrapper.positiveEndTag( CompletionStatus.COMPLETED_MAYBE,
+ new Integer(anEndTag), new Integer( 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 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.
+ if (anEndTag < chunkedValueNestingLevel)
+ throw wrapper.unexpectedEnclosingValuetype(
+ CompletionStatus.COMPLETED_MAYBE, new Integer( anEndTag ),
+ new Integer( 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
+ // next time readEndTag is called, it will get down here
+ // again. Even with fragmentation, we'll always be able
+ // to do this.
+ if (anEndTag != chunkedValueNestingLevel) {
+ bbwi.position(bbwi.position() - 4);
+ }
+
+ } else {
+
+ // When talking to Kestrel or Ladybird, we use our old
+ // 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) {
+ bbwi.position(bbwi.position() - 4);
+ }
+ }
+
+ // This only keeps track of the enclosing chunked
+ // valuetypes
+ chunkedValueNestingLevel++;
+ }
+
+ // This keeps track of all enclosing valuetypes
+ end_flag++;
+ }
+
+ protected int get_offset() {
+ return bbwi.position();
+ }
+
+ private void start_block() {
+
+ // if (outerValueDone)
+ if (!isChunked)
+ return;
+
+ // if called from alignAndCheck, need to reset blockLength
+ // to avoid an infinite recursion loop on read_long() call
+ blockLength = maxBlockLength;
+
+ blockLength = read_long();
+
+ // Must remember where we began the chunk to calculate how far
+ // along we are. See notes above about chunkBeginPos.
+
+ if (blockLength > 0 && blockLength < maxBlockLength) {
+ blockLength += get_offset(); // _REVISIT_ unsafe, should use a Java long
+
+ // inBlock = true;
+ } else {
+
+ // System.out.println("start_block snooped a " + Integer.toHexString(blockLength));
+
+ // not a chunk length field
+ blockLength = maxBlockLength;
+
+ bbwi.position(bbwi.position() - 4);
+ }
+ }
+
+ // 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
+ // unmarshalling code read.
+ //
+ // After calling this method, if we are chunking, we should be
+ // in position to read the end tag.
+ private void handleEndOfValue() {
+
+ // If we're not chunking, we don't have to worry about
+ // skipping remaining chunks or finding end tags
+ if (!isChunked)
+ return;
+
+ // Skip any remaining chunks
+ while (blockLength != maxBlockLength) {
+ end_block();
+ start_block();
+ }
+
+ // Now look for the end tag
+
+ // This is a little wasteful since we're reading
+ // this long up to 3 times in the worst cases (once
+ // in start_block, once here, and once in readEndTag
+ //
+ // Peek next long
+ int nextLong = read_long();
+ bbwi.position(bbwi.position() - 4);
+
+ // 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,
+ // chunk lengths, and valuetags have non overlapping
+ // ranges, we can tell by the value what the longs are.
+ if (nextLong < 0)
+ return;
+
+ if (nextLong == 0 || nextLong >= maxBlockLength) {
+
+ // A custom marshaled valuetype left extra data
+ // on the wire, and that data had another
+ // 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
+ // recursively to read any further chunks that the containing
+ // valuetype might still have after the nested
+ // value.
+ read_value();
+ handleEndOfValue();
+ } else {
+ // This probably means that the code to skip chunks has
+ // an error, and ended up setting blockLength to something
+ // other than maxBlockLength even though we weren't
+ // starting a new chunk.
+ throw wrapper.couldNotSkipBytes( CompletionStatus.COMPLETED_MAYBE,
+ new Integer( nextLong ), new Integer( get_offset() ) ) ;
+ }
+ }
+
+ private void end_block() {
+
+ // if in a chunk, check for underflow or overflow
+ if (blockLength != maxBlockLength) {
+ if (blockLength == get_offset()) {
+ // Chunk ended correctly
+ blockLength = maxBlockLength;
+ } else {
+ // Skip over anything left by bad unmarshaling code (ex:
+ // a buggy custom unmarshaler). See handleEndOfValue.
+ if (blockLength > get_offset()) {
+ skipToOffset(blockLength);
+ } else {
+ throw wrapper.badChunkLength( new Integer( blockLength ),
+ new Integer( get_offset() ) ) ;
+ }
+ }
+ }
+ }
+
+ private int readValueTag(){
+ // outerValueDone = false;
+ return read_long();
+ }
+
+ public org.omg.CORBA.ORB 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();
+ }
+ }
+
+ public final void read_char_array(char[] value, int offset, int length) {
+ 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();
+ }
+ }
+
+ public final void read_short_array(short[] value, int offset, int length) {
+ for(int i=0; i < length; i++) {
+ value[i+offset] = read_short();
+ }
+ }
+
+ public final void read_ushort_array(short[] value, int offset, int length) {
+ read_short_array(value, offset, 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();
+ }
+ }
+
+ public final void read_ulong_array(int[] value, int offset, int length) {
+ read_long_array(value, offset, 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();
+ }
+ }
+
+ public final void read_ulonglong_array(long[] value, int offset, int length) {
+ read_longlong_array(value, offset, 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();
+ }
+ }
+
+ public final void read_double_array(double[] value, int offset, int length) {
+ 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();
+ }
+ }
+
+ //--------------------------------------------------------------------//
+ // CDRInputStream state management.
+ //
+
+ /**
+ * Are we at the end of the input stream?
+ */
+// public final boolean isAtEnd() {
+// return bbwi.position() == bbwi.buflen;
+// }
+
+// public int available() throws IOException {
+// return bbwi.buflen - bbwi.position();
+// }
+
+ private String read_repositoryIds() {
+
+ // Read # of repository ids
+ int numRepIds = read_long();
+ if (numRepIds == 0xffffffff) {
+ int indirection = read_long() + get_offset() - 4;
+ if (repositoryIdCache != null && repositoryIdCache.containsOrderedVal(indirection))
+ return (String)repositoryIdCache.getKey(indirection);
+ else
+ throw wrapper.unableToLocateRepIdArray( new Integer( indirection ) ) ;
+ } else {
+
+ // read first array element and store it as an indirection to the whole array
+ int indirection = get_offset();
+ String repID = read_repositoryId();
+ if (repositoryIdCache == null)
+ repositoryIdCache = new CacheTable(orb,false);
+ repositoryIdCache.put(repID, indirection);
+
+ // read and ignore the subsequent array elements, but put them in the
+ // indirection table in case there are later indirections back to them
+ for (int i = 1; i < numRepIds; i++) {
+ read_repositoryId();
+ }
+
+ return repID;
+ }
+ }
+
+ private final String read_repositoryId()
+ {
+ String result = readStringOrIndirection(true);
+
+ if (result == null) { // Indirection
+ int indirection = read_long() + get_offset() - 4;
+
+ if (repositoryIdCache != null && repositoryIdCache.containsOrderedVal(indirection))
+ return (String)repositoryIdCache.getKey(indirection);
+ else
+ throw wrapper.badRepIdIndirection( CompletionStatus.COMPLETED_MAYBE,
+ new Integer(bbwi.position()) ) ;
+ } else {
+ if (repositoryIdCache == null)
+ repositoryIdCache = new CacheTable(orb,false);
+ repositoryIdCache.put(result, stringIndirection);
+ }
+
+ return result ;
+ }
+
+ private final String read_codebase_URL()
+ {
+ String result = readStringOrIndirection(true);
+
+ if (result == null) { // Indirection
+ int indirection = read_long() + get_offset() - 4;
+
+ if (codebaseCache != null && codebaseCache.containsVal(indirection))
+ return (String)codebaseCache.getKey(indirection);
+ else
+ throw wrapper.badCodebaseIndirection(
+ CompletionStatus.COMPLETED_MAYBE,
+ new Integer(bbwi.position()) ) ;
+ } else {
+ if (codebaseCache == null)
+ codebaseCache = new CacheTable(orb,false);
+ codebaseCache.put(result, stringIndirection);
+ }
+
+ return result;
+ }
+
+ /* DataInputStream methods */
+
+ public java.lang.Object read_Abstract () {
+ return read_abstract_interface();
+ }
+
+ public java.io.Serializable read_Value () {
+ return read_value();
+ }
+
+ 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) {
+ read_boolean_array(seq.value, offset, 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) {
+ read_wchar_array(seq.value, offset, 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) {
+ read_short_array(seq.value, offset, 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) {
+ read_long_array(seq.value, offset, 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) {
+ read_ulonglong_array(seq.value, offset, 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) {
+ read_float_array(seq.value, offset, length);
+ }
+
+ public void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length) {
+ read_double_array(seq.value, offset, length);
+ }
+
+ public java.math.BigDecimal read_fixed(short digits, short scale) {
+ // digits isn't really needed here
+ StringBuffer buffer = read_fixed_buffer();
+ if (digits != buffer.length())
+ throw wrapper.badFixed( new Integer(digits),
+ new Integer(buffer.length()) ) ;
+ buffer.insert(digits - scale, '.');
+ return new BigDecimal(buffer.toString());
+ }
+
+ // This method is unable to yield the correct scale.
+ public java.math.BigDecimal read_fixed() {
+ return new BigDecimal(read_fixed_buffer().toString());
+ }
+
+ // Each octet contains (up to) two decimal digits.
+ // If the fixed type has an odd number of decimal digits, then the representation
+ // begins with the first (most significant) digit.
+ // Otherwise, this first half-octet is all zero, and the first digit
+ // is in the second half-octet.
+ // The sign configuration, in the last half-octet of the representation,
+ // is 0xD for negative numbers and 0xC for positive and zero values.
+ private StringBuffer read_fixed_buffer() {
+ StringBuffer buffer = new StringBuffer(64);
+ byte doubleDigit;
+ int firstDigit;
+ int secondDigit;
+ boolean wroteFirstDigit = false;
+ boolean more = true;
+ while (more) {
+ doubleDigit = this.read_octet();
+ firstDigit = (int)((doubleDigit & 0xf0) >> 4);
+ secondDigit = (int)(doubleDigit & 0x0f);
+ if (wroteFirstDigit || firstDigit != 0) {
+ buffer.append(Character.forDigit(firstDigit, 10));
+ wroteFirstDigit = true;
+ }
+ if (secondDigit == 12) {
+ // positive number or zero
+ if ( ! wroteFirstDigit) {
+ // zero
+ return new StringBuffer("0.0");
+ } else {
+ // positive number
+ // done
+ }
+ more = false;
+ } else if (secondDigit == 13) {
+ // negative number
+ buffer.insert(0, '-');
+ more = false;
+ } else {
+ buffer.append(Character.forDigit(secondDigit, 10));
+ wroteFirstDigit = true;
+ }
+ }
+ return buffer;
+ }
+
+ private final static String _id = "IDL:omg.org/CORBA/DataInputStream:1.0";
+ private final static String[] _ids = { _id };
+
+ public String[] _truncatable_ids() {
+ if (_ids == null)
+ return null;
+
+ return (String[])_ids.clone();
+ }
+
+ /* for debugging */
+
+ public void printBuffer() {
+ CDRInputStream_1_0.printBuffer(this.bbwi);
+ }
+
+ public static void printBuffer(ByteBufferWithInfo bbwi) {
+
+ System.out.println("----- Input Buffer -----");
+ System.out.println();
+ System.out.println("Current position: " + bbwi.position());
+ System.out.println("Total length : " + bbwi.buflen);
+ System.out.println();
+
+ try {
+
+ char[] charBuf = new char[16];
+
+ for (int i = 0; i < bbwi.buflen; i += 16) {
+
+ int j = 0;
+
+ // For every 16 bytes, there is one line
+ // of output. First, the hex output of
+ // the 16 bytes with each byte separated
+ // by a space.
+ while (j < 16 && j + i < bbwi.buflen) {
+ int k = bbwi.byteBuffer.get(i + j);
+ if (k < 0)
+ k = 256 + k;
+ String hex = Integer.toHexString(k);
+ if (hex.length() == 1)
+ hex = "0" + hex;
+ System.out.print(hex + " ");
+ j++;
+ }
+
+ // Add any extra spaces to align the
+ // text column in case we didn't end
+ // at 16
+ while (j < 16) {
+ System.out.print(" ");
+ j++;
+ }
+
+ // Now output the ASCII equivalents. Non-ASCII
+ // characters are shown as periods.
+ int x = 0;
+ while (x < 16 && x + i < bbwi.buflen) {
+ if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x)))
+ charBuf[x] = (char)bbwi.byteBuffer.get(i + x);
+ else
+ charBuf[x] = '.';
+ x++;
+ }
+ System.out.println(new String(charBuf, 0, x));
+ }
+
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+
+ System.out.println("------------------------");
+ }
+
+ public ByteBuffer getByteBuffer() {
+ ByteBuffer result = null;
+ if (bbwi != null) {
+ result = bbwi.byteBuffer;
+ }
+ return result;
+ }
+
+ public int getBufferLength() {
+ return bbwi.buflen;
+ }
+
+ public void setBufferLength(int value) {
+ bbwi.buflen = value;
+ bbwi.byteBuffer.limit(bbwi.buflen);
+ }
+
+ public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
+ this.bbwi = bbwi;
+ }
+
+ public void setByteBuffer(ByteBuffer byteBuffer) {
+ bbwi.byteBuffer = byteBuffer;
+ }
+
+ public int getIndex() {
+ return bbwi.position();
+ }
+
+ public void setIndex(int value) {
+ bbwi.position(value);
+ }
+
+ public boolean isLittleEndian() {
+ return littleEndian;
+ }
+
+ public void orb(org.omg.CORBA.ORB orb) {
+ this.orb = (ORB)orb;
+ }
+
+ public BufferManagerRead getBufferManager() {
+ return bufferManagerRead;
+ }
+
+ private void skipToOffset(int offset) {
+
+ // Number of bytes to skip
+ int len = offset - get_offset();
+
+ int n = 0;
+
+ while (n < len) {
+ int avail;
+ int bytes;
+ int wanted;
+
+ avail = bbwi.buflen - bbwi.position();
+ if (avail <= 0) {
+ grow(1, 1);
+ avail = bbwi.buflen - bbwi.position();
+ }
+
+ wanted = len - n;
+ bytes = (wanted < avail) ? wanted : avail;
+ bbwi.position(bbwi.position() + bytes);
+ n += bytes;
+ }
+ }
+
+
+ // Mark and reset -------------------------------------------------
+
+ protected MarkAndResetHandler markAndResetHandler = null;
+
+ protected class StreamMemento
+ {
+ // These are the fields that may change after marking
+ // the stream position, so we need to save them.
+ private int blockLength_;
+ private int end_flag_;
+ private int chunkedValueNestingLevel_;
+ private int valueIndirection_;
+ private int stringIndirection_;
+ private boolean isChunked_;
+ private javax.rmi.CORBA.ValueHandler valueHandler_;
+ private ByteBufferWithInfo bbwi_;
+ private boolean specialNoOptionalDataState_;
+
+ public StreamMemento()
+ {
+ blockLength_ = blockLength;
+ end_flag_ = end_flag;
+ chunkedValueNestingLevel_ = chunkedValueNestingLevel;
+ valueIndirection_ = valueIndirection;
+ stringIndirection_ = stringIndirection;
+ isChunked_ = isChunked;
+ valueHandler_ = valueHandler;
+ specialNoOptionalDataState_ = specialNoOptionalDataState;
+ bbwi_ = new ByteBufferWithInfo(bbwi);
+ }
+ }
+
+ public java.lang.Object createStreamMemento() {
+ return new StreamMemento();
+ }
+
+ public void restoreInternalState(java.lang.Object streamMemento) {
+
+ StreamMemento mem = (StreamMemento)streamMemento;
+
+ blockLength = mem.blockLength_;
+ end_flag = mem.end_flag_;
+ chunkedValueNestingLevel = mem.chunkedValueNestingLevel_;
+ valueIndirection = mem.valueIndirection_;
+ stringIndirection = mem.stringIndirection_;
+ isChunked = mem.isChunked_;
+ valueHandler = mem.valueHandler_;
+ specialNoOptionalDataState = mem.specialNoOptionalDataState_;
+ bbwi = mem.bbwi_;
+ }
+
+ public int getPosition() {
+ return get_offset();
+ }
+
+ public void mark(int readlimit) {
+ markAndResetHandler.mark(this);
+ }
+
+ public void reset() {
+ markAndResetHandler.reset();
+ }
+
+ // ---------------------------------- end Mark and Reset
+
+ // Provides a hook so subclasses of CDRInputStream can provide
+ // a CodeBase. This ultimately allows us to grab a Connection
+ // instance in IIOPInputStream, the only subclass where this
+ // is actually used.
+ CodeBase getCodeBase() {
+ return parent.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.
+ */
+ private Class getClassFromString(String repositoryIDString,
+ String codebaseURL,
+ Class expectedType)
+ {
+ RepositoryIdInterface repositoryID
+ = repIdStrs.getFromString(repositoryIDString);
+
+ try {
+ try {
+ // First try to load the class locally, then use
+ // the provided URL (if it isn't null)
+ return repositoryID.getClassFromType(expectedType,
+ codebaseURL);
+ } catch (ClassNotFoundException cnfeOuter) {
+
+ try {
+
+ if (getCodeBase() == null) {
+ 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);
+ } catch (ClassNotFoundException cnfeInner) {
+ dprintThrowable(cnfeInner);
+ // Failed to load the class
+ return null;
+ }
+ }
+ } catch (MalformedURLException mue) {
+ // Always report a bad URL
+ throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
+ mue, repositoryIDString, codebaseURL ) ;
+ }
+ }
+
+ /**
+ * Attempts to find the class described by the given
+ * repository ID string. At most, three attempts are made:
+ * Try to find it locally, through the provided URL, and
+ * finally, via a URL from the remote CodeBase.
+ */
+ private Class getClassFromString(String repositoryIDString,
+ String codebaseURL)
+ {
+ RepositoryIdInterface repositoryID
+ = repIdStrs.getFromString(repositoryIDString);
+
+ for (int i = 0; i < 3; i++) {
+
+ try {
+
+ switch (i)
+ {
+ case 0:
+ // First try to load the class locally
+ return repositoryID.getClassFromType();
+ case 1:
+ // Try to load the class using the provided
+ // codebase URL (falls out below)
+ break;
+ case 2:
+ // Try to load the class using a URL from the
+ // remote CodeBase
+ codebaseURL = getCodeBase().implementation(repositoryIDString);
+ break;
+ }
+
+ // Don't bother if the codebaseURL is null
+ if (codebaseURL == null)
+ continue;
+
+ return repositoryID.getClassFromType(codebaseURL);
+
+ } catch(ClassNotFoundException cnfe) {
+ // Will ultimately return null if all three
+ // attempts fail, but don't do anything here.
+ } catch (MalformedURLException mue) {
+ throw wrapper.malformedUrl( CompletionStatus.COMPLETED_MAYBE,
+ mue, repositoryIDString, codebaseURL ) ;
+ }
+ }
+
+ // If we get here, we have failed to load the class
+ dprint("getClassFromString failed with rep id "
+ + repositoryIDString
+ + " and codebase "
+ + codebaseURL);
+
+ return null;
+ }
+
+ // Utility method used to get chars from bytes
+ char[] getConvertedChars(int numBytes,
+ CodeSetConversion.BTCConverter converter) {
+
+ // REVISIT - Look at CodeSetConversion.BTCConverter to see
+ // if it can work with an NIO ByteBuffer. We should
+ // avoid getting the bytes into an array if possible.
+
+ // To be honest, I doubt this saves much real time
+ if (bbwi.buflen - bbwi.position() >= numBytes) {
+ // If the entire string is in this buffer,
+ // just convert directly from the bbwi rather than
+ // allocating and copying.
+ byte[] tmpBuf;
+ if (bbwi.byteBuffer.hasArray())
+ {
+ tmpBuf = bbwi.byteBuffer.array();
+ }
+ else
+ {
+ tmpBuf = new byte[bbwi.buflen];
+ // Microbenchmarks are showing a loop of ByteBuffer.get(int)
+ // being faster than ByteBuffer.get(byte[], int, int).
+ for (int i = 0; i < bbwi.buflen; i++)
+ tmpBuf[i] = bbwi.byteBuffer.get(i);
+ }
+ char[] result = converter.getChars(tmpBuf,bbwi.position(),numBytes);
+
+ bbwi.position(bbwi.position() + numBytes);
+ return result;
+ } else {
+ // Stretches across buffers. Unless we provide an
+ // incremental conversion interface, allocate and
+ // copy the bytes.
+ byte[] bytes = new byte[numBytes];
+ read_octet_array(bytes, 0, bytes.length);
+
+ return converter.getChars(bytes, 0, numBytes);
+ }
+ }
+
+ protected CodeSetConversion.BTCConverter getCharConverter() {
+ if (charConverter == null)
+ charConverter = parent.createCharBTCConverter();
+
+ return charConverter;
+ }
+
+ protected CodeSetConversion.BTCConverter getWCharConverter() {
+ if (wcharConverter == null)
+ wcharConverter = parent.createWCharBTCConverter();
+
+ return wcharConverter;
+ }
+
+ protected void dprintThrowable(Throwable t) {
+ if (debug && t != null)
+ t.printStackTrace();
+ }
+
+ protected void dprint(String msg) {
+ if (debug) {
+ ORBUtility.dprint(this, msg);
+ }
+ }
+
+ /**
+ * 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(bbwi.position(), octetBoundary);
+
+ if (bbwi.position() + needed <= bbwi.buflen)
+ {
+ bbwi.position(bbwi.position() + needed);
+ }
+ }
+
+ public void resetCodeSetConverters() {
+ charConverter = null;
+ wcharConverter = null;
+ }
+
+ public void start_value() {
+ // Read value tag
+ int vType = readValueTag();
+
+ 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
+ // tries to read more, we need to throw an
+ // exception before reading beyond where
+ // we're supposed to
+ specialNoOptionalDataState = true;
+
+ return;
+ }
+
+ if (vType == 0xffffffff) {
+ // One should never indirect to a custom wrapper
+ throw wrapper.customWrapperIndirection(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ if (repIdUtil.isCodeBasePresent(vType)) {
+ throw wrapper.customWrapperWithCodebase(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ if (repIdUtil.getTypeInfo(vType)
+ != RepositoryIdUtility.SINGLE_REP_TYPE_INFO) {
+ throw wrapper.customWrapperNotSingleRepid(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+
+
+ // REVISIT - Could verify repository ID even though
+ // it isn't used elsewhere
+ read_repositoryId();
+
+ // 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--;
+ }
+
+ public void end_value() {
+
+ if (specialNoOptionalDataState) {
+ specialNoOptionalDataState = false;
+ return;
+ }
+
+ handleEndOfValue();
+ readEndTag();
+
+ // Note that isChunked should still be true here.
+ // If the containing valuetype is the highest
+ // chunked value, it will get set to false
+ // at the end of read_value.
+
+ // allow for possible continuation chunk
+ start_block();
+ }
+
+ public void close() throws IOException
+ {
+
+ // tell BufferManagerRead to release any ByteBuffers
+ getBufferManager().close(bbwi);
+
+ // It's possible bbwi.byteBuffer is shared between
+ // this InputStream and an OutputStream. Thus, we check
+ // if the Input/Output streams are using the same ByteBuffer.
+ // If they sharing the same ByteBuffer we need to ensure only
+ // one of those ByteBuffers are released to the ByteBufferPool.
+
+ if (bbwi != null && getByteBuffer() != null)
+ {
+ MessageMediator messageMediator = parent.getMessageMediator();
+ if (messageMediator != null)
+ {
+ CDROutputObject outputObj =
+ (CDROutputObject)messageMediator.getOutputObject();
+ if (outputObj != null)
+ {
+ if (outputObj.isSharing(getByteBuffer()))
+ {
+ // Set OutputStream's ByteBuffer and bbwi to null
+ // so its ByteBuffer cannot be released to the pool
+ outputObj.setByteBuffer(null);
+ outputObj.setByteBufferWithInfo(null);
+ }
+ }
+ }
+
+ // release this stream's ByteBuffer to the pool
+ ByteBufferPool byteBufferPool = orb.getByteBufferPool();
+ if (debug)
+ {
+ // print address of ByteBuffer being released
+ int bbAddress = System.identityHashCode(bbwi.byteBuffer);
+ StringBuffer sb = new StringBuffer(80);
+ sb.append(".close - releasing ByteBuffer id (");
+ sb.append(bbAddress).append(") to ByteBufferPool.");
+ String msg = sb.toString();
+ dprint(msg);
+ }
+ byteBufferPool.releaseByteBuffer(bbwi.byteBuffer);
+ bbwi.byteBuffer = null;
+ bbwi = null;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_1.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_1.java
new file mode 100644
index 0000000..76bc297
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_1.java
@@ -0,0 +1,189 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+public class CDRInputStream_1_1 extends CDRInputStream_1_0
+{
+ // See notes in CDROutputStream
+ protected int fragmentOffset = 0;
+
+ public GIOPVersion getGIOPVersion() {
+ return GIOPVersion.V1_1;
+ }
+
+ // Template method
+ public CDRInputStreamBase dup() {
+ CDRInputStreamBase result = super.dup();
+
+ ((CDRInputStream_1_1)result).fragmentOffset = this.fragmentOffset;
+
+ return result;
+ }
+
+ protected int get_offset() {
+ return bbwi.position() + fragmentOffset;
+ }
+
+ 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(bbwi.position(), align);
+
+ if (bbwi.position() + n + alignment > bbwi.buflen) {
+
+ // Some other ORBs may have found a way to send 1.1
+ // fragments which put alignment bytes at the end
+ // of a fragment
+ if (bbwi.position() + alignment == bbwi.buflen)
+ {
+ bbwi.position(bbwi.position() + alignment);
+ }
+
+ grow(align, n);
+
+ // We must recalculate the alignment after a possible
+ // fragmentation since the new bbwi.position() (after the header)
+ // may require a different alignment.
+
+ alignment = computeAlignment(bbwi.position(), align);
+ }
+
+ bbwi.position(bbwi.position() + alignment);
+ }
+
+ //
+ // This can be overridden....
+ //
+ protected void grow(int align, int n) {
+
+ bbwi.needed = n;
+
+ // Save the size of the current buffer for
+ // possible fragmentOffset calculation
+ int oldSize = bbwi.position();
+
+ bbwi = bufferManagerRead.underflow(bbwi);
+
+ if (bbwi.fragmented) {
+
+ // By this point we should be guaranteed to have
+ // a new fragment whose header has already been
+ // unmarshalled. bbwi.position() should point to the
+ // end of the header.
+ fragmentOffset += (oldSize - bbwi.position());
+
+ markAndResetHandler.fragmentationOccured(bbwi);
+
+ // Clear the flag
+ bbwi.fragmented = false;
+ }
+ }
+
+ // Mark/reset ---------------------------------------
+
+ private class FragmentableStreamMemento extends StreamMemento
+ {
+ private int fragmentOffset_;
+
+ public FragmentableStreamMemento()
+ {
+ super();
+
+ fragmentOffset_ = fragmentOffset;
+ }
+ }
+
+ public java.lang.Object createStreamMemento() {
+ return new FragmentableStreamMemento();
+ }
+
+ public void restoreInternalState(java.lang.Object streamMemento)
+ {
+ super.restoreInternalState(streamMemento);
+
+ fragmentOffset
+ = ((FragmentableStreamMemento)streamMemento).fragmentOffset_;
+ }
+
+ // --------------------------------------------------
+
+ 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
+ // byte order marker, so it must default to big endian!
+ alignAndCheck(2, 2);
+
+ // Because of the alignAndCheck, we should be guaranteed
+ // 2 bytes of real data.
+ char[] result = getConvertedChars(2, getWCharConverter());
+
+ // Did the provided bytes convert to more than one
+ // 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() ;
+
+ return result[0];
+ }
+
+ 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.
+ int len = read_long();
+
+ // Workaround for ORBs which send string lengths of
+ // zero to mean empty string.
+ //
+ // IMPORTANT: Do not replace 'new String("")' with "", it may result
+ // in a Serialization bug (See serialization.zerolengthstring) and
+ // bug id: 4728756 for details
+ if (len == 0)
+ return new String("");
+
+ checkForNegativeLength(len);
+
+ // Don't include the two byte null for the
+ // 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;
+
+ char[] result = getConvertedChars(len * 2, getWCharConverter());
+
+ // Skip over the 2 byte null
+ read_short();
+
+ return new String(result, 0, getWCharConverter().getNumChars());
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_2.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_2.java
new file mode 100644
index 0000000..6b2ef38
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDRInputStream_1_2.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+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;
+
+ // Called by RequestMessage_1_2 or ReplyMessage_1_2 classes only.
+ void setHeaderPadding(boolean headerPadding) {
+ this.headerPadding = headerPadding;
+ }
+
+ // the mark and reset methods have been overridden to remember the
+ // headerPadding flag.
+
+ public void mark(int readlimit) {
+ super.mark(readlimit);
+ restoreHeaderPadding = headerPadding;
+ }
+
+ public void reset() {
+ super.reset();
+ headerPadding = restoreHeaderPadding;
+ restoreHeaderPadding = false;
+ }
+
+ // Template method
+ // This method has been overriden to ensure that the duplicated stream
+ // inherits the headerPadding flag, in case of GIOP 1.2 and above, streams.
+ public CDRInputStreamBase dup() {
+ CDRInputStreamBase result = super.dup();
+ ((CDRInputStream_1_2)result).headerPadding = this.headerPadding;
+ return result;
+ }
+
+ protected void alignAndCheck(int align, int n) {
+
+ // headerPadding bit is set by read method of the RequestMessage_1_2
+ // or ReplyMessage_1_2 classes. When set, the very first body read
+ // operation (from the stub code) would trigger an alignAndCheck
+ // method call, that would in turn skip the header padding that was
+ // inserted during the earlier write operation by the sender. The
+ // padding ensures that the body is aligned on an 8-octet boundary,
+ // for GIOP versions 1.2 and beyond.
+ if (headerPadding == true) {
+ headerPadding = false;
+ alignOnBoundary(ORBConstants.GIOP_12_MSG_BODY_ALIGNMENT);
+ }
+
+ checkBlockLength(align, n);
+
+ // WARNING: Must compute real alignment after calling
+ // checkBlockLength since it may move the position
+
+ // 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
+ // never requires alignment with the header since it ends
+ // on an 8 byte boundary.
+
+ int alignIncr = computeAlignment(bbwi.position(),align);
+ bbwi.position(bbwi.position() + alignIncr);
+
+ if (bbwi.position() + n > bbwi.buflen) {
+ grow(1, n);
+ }
+ }
+
+ public GIOPVersion getGIOPVersion() {
+ return GIOPVersion.V1_2;
+ }
+
+ public char read_wchar() {
+ // In GIOP 1.2, a wchar is encoded as an unsigned octet length
+ // followed by the octets of the converted wchar.
+ int numBytes = read_octet();
+
+ char[] result = getConvertedChars(numBytes, getWCharConverter());
+
+ // Did the provided bytes convert to more than one
+ // 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() ;
+
+ return result[0];
+ }
+
+ public String read_wstring() {
+ // 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.
+
+ int len = read_long();
+
+ //
+ // IMPORTANT: Do not replace 'new String("")' with "", it may result
+ // in a Serialization bug (See serialization.zerolengthstring) and
+ // bug id: 4728756 for details
+ if (len == 0)
+ return new String("");
+
+ checkForNegativeLength(len);
+
+ return new String(getConvertedChars(len, getWCharConverter()),
+ 0,
+ getWCharConverter().getNumChars());
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputObject.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputObject.java
new file mode 100644
index 0000000..4c91de2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputObject.java
@@ -0,0 +1,323 @@
+/*
+ * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.InputStream;
+
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.spi.encoding.CorbaOutputObject ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.impl.encoding.BufferManagerFactory;
+import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+import com.sun.corba.se.impl.encoding.CDROutputStream_1_0;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+
+/**
+ * @author Harold Carr
+ */
+public class CDROutputObject extends CorbaOutputObject
+{
+ private Message header;
+ private ORB orb;
+ private ORBUtilSystemException wrapper;
+ private OMGSystemException omgWrapper;
+
+ // REVISIT - only used on sendCancelRequest.
+ private CorbaConnection connection;
+
+ private CDROutputObject(
+ ORB orb, GIOPVersion giopVersion, Message header,
+ BufferManagerWrite manager, byte streamFormatVersion,
+ CorbaMessageMediator mediator)
+ {
+ super(orb, giopVersion, header.getEncodingVersion(),
+ false, manager, streamFormatVersion,
+ ((mediator != null && mediator.getConnection() != null) ?
+ ((CorbaConnection)mediator.getConnection()).
+ shouldUseDirectByteBuffers() : false));
+
+ this.header = header;
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.RPC_ENCODING ) ;
+ this.omgWrapper = OMGSystemException.get( orb, CORBALogDomains.RPC_ENCODING ) ;
+
+ getBufferManager().setOutputObject(this);
+ this.corbaMessageMediator = mediator;
+ }
+
+ public CDROutputObject(ORB orb,
+ MessageMediator messageMediator,
+ Message header,
+ byte streamFormatVersion)
+ {
+ this(
+ orb,
+ ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
+ header,
+ BufferManagerFactory.newBufferManagerWrite(
+ ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
+ header.getEncodingVersion(),
+ orb),
+ streamFormatVersion,
+ (CorbaMessageMediator)messageMediator);
+ }
+
+ // 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)
+ {
+ this(
+ orb,
+ ((CorbaMessageMediator)messageMediator).getGIOPVersion(),
+ header,
+ BufferManagerFactory.
+ newBufferManagerWrite(strategy,
+ header.getEncodingVersion(),
+ orb),
+ streamFormatVersion,
+ (CorbaMessageMediator)messageMediator);
+ }
+
+ // REVISIT
+ // Used on sendCancelRequest.
+ // Used for needs addressing mode.
+ public CDROutputObject(ORB orb, CorbaMessageMediator mediator,
+ GIOPVersion giopVersion,
+ CorbaConnection connection, Message header,
+ byte streamFormatVersion)
+ {
+ this(
+ orb,
+ giopVersion,
+ header,
+ BufferManagerFactory.
+ newBufferManagerWrite(giopVersion,
+ header.getEncodingVersion(),
+ orb),
+ streamFormatVersion,
+ mediator);
+ this.connection = connection ;
+ }
+
+ // XREVISIT
+ // Header should only be in message mediator.
+ // Another possibility: merge header and message mediator.
+ // REVISIT - make protected once all encoding together
+ public Message getMessageHeader() {
+ return header;
+ }
+
+ public final void finishSendingMessage() {
+ getBufferManager().sendMessage();
+ }
+
+ /**
+ * Write the contents of the CDROutputStream to the specified
+ * output stream. Has the side-effect of pushing any current
+ * Message onto the Message list.
+ * @param connection The output stream to write to.
+ */
+ public void writeTo(CorbaConnection connection)
+ throws java.io.IOException
+ {
+
+ //
+ // Update the GIOP MessageHeader size field.
+ //
+
+ ByteBufferWithInfo bbwi = getByteBufferWithInfo();
+
+ getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
+
+ if (orb() != null) {
+ if (((ORB)orb()).transportDebugFlag) {
+ dprint(".writeTo: " + connection);
+ }
+ if (((ORB)orb()).giopDebugFlag) {
+ CDROutputStream_1_0.printBuffer(bbwi);
+ }
+ }
+ bbwi.byteBuffer.position(0).limit(bbwi.getSize());
+ connection.write(bbwi.byteBuffer);
+ }
+
+ /** overrides create_input_stream from CDROutputStream */
+ public org.omg.CORBA.portable.InputStream create_input_stream()
+ {
+ // XREVISIT
+ return null;
+ //return new XIIOPInputStream(orb(), getByteBuffer(), getIndex(),
+ //isLittleEndian(), getMessageHeader(), conn);
+ }
+
+ public CorbaConnection getConnection()
+ {
+ // REVISIT - only set when doing sendCancelRequest.
+ if (connection != null) {
+ return connection;
+ }
+ return (CorbaConnection) corbaMessageMediator.getConnection();
+ }
+
+ // XREVISIT - If CDROutputObject doesn't live in the iiop
+ // package, it will need this, here, to give package access
+ // to xgiop.
+ // REVISIT - make protected once all encoding together
+ public final ByteBufferWithInfo getByteBufferWithInfo() {
+ return super.getByteBufferWithInfo();
+ }
+
+ // REVISIT - make protected once all encoding together
+ public final void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
+ super.setByteBufferWithInfo(bbwi);
+ }
+
+ /**
+ * 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.
+ */
+ protected CodeSetConversion.CTBConverter createCharCTBConverter() {
+ CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
+
+ // If the connection doesn't have its negotiated
+ // code sets by now, fall back on the defaults defined
+ // in CDRInputStream.
+ if (codesets == null)
+ return super.createCharCTBConverter();
+
+ OSFCodeSetRegistry.Entry charSet
+ = OSFCodeSetRegistry.lookupEntry(codesets.getCharCodeSet());
+
+ if (charSet == null)
+ throw wrapper.unknownCodeset( charSet ) ;
+
+ return CodeSetConversion.impl().getCTBConverter(charSet,
+ isLittleEndian(),
+ false);
+ }
+
+ protected CodeSetConversion.CTBConverter createWCharCTBConverter() {
+
+ CodeSetComponentInfo.CodeSetContext codesets = getCodeSets();
+
+ // If the connection doesn't have its negotiated
+ // code sets by now, we have to throw an exception.
+ // See CORBA formal 00-11-03 13.9.2.6.
+ if (codesets == null) {
+ if (getConnection().isServer())
+ throw omgWrapper.noClientWcharCodesetCtx() ;
+ else
+ throw omgWrapper.noServerWcharCodesetCmp() ;
+ }
+
+ OSFCodeSetRegistry.Entry wcharSet
+ = OSFCodeSetRegistry.lookupEntry(codesets.getWCharCodeSet());
+
+ if (wcharSet == null)
+ throw wrapper.unknownCodeset( wcharSet ) ;
+
+ 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)
+ //
+ // For GIOP 1.1, we don't use BOMs and use the endianness of
+ // the stream.
+ if (wcharSet == OSFCodeSetRegistry.UTF_16) {
+ if (getGIOPVersion().equals(GIOPVersion.V1_2)) {
+ return CodeSetConversion.impl().getCTBConverter(wcharSet,
+ false,
+ useByteOrderMarkers);
+ }
+
+ if (getGIOPVersion().equals(GIOPVersion.V1_1)) {
+ return CodeSetConversion.impl().getCTBConverter(wcharSet,
+ isLittleEndian(),
+ false);
+ }
+ }
+
+ // In the normal case, let the converter system handle it
+ return CodeSetConversion.impl().getCTBConverter(wcharSet,
+ isLittleEndian(),
+ useByteOrderMarkers);
+ }
+
+ // If we're local and don't have a Connection, use the
+ // local code sets, otherwise get them from the connection.
+ // If the connection doesn't have negotiated code sets
+ // yet, then we use ISO8859-1 for char/string and wchar/wstring
+ // are illegal.
+ private CodeSetComponentInfo.CodeSetContext getCodeSets() {
+ if (getConnection() == null)
+ return CodeSetComponentInfo.LOCAL_CODE_SETS;
+ else
+ return getConnection().getCodeSetContext();
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("CDROutputObject", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream.java
new file mode 100644
index 0000000..2275dc5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream.java
@@ -0,0 +1,438 @@
+/*
+ * Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.Any;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+/**
+ * This is delegates to the real implementation.
+ */
+public abstract class CDROutputStream
+ extends org.omg.CORBA_2_3.portable.OutputStream
+ implements com.sun.corba.se.impl.encoding.MarshalOutputStream,
+ org.omg.CORBA.DataOutputStream, org.omg.CORBA.portable.ValueOutputStream
+{
+ private CDROutputStreamBase impl;
+ protected ORB orb ;
+ protected ORBUtilSystemException wrapper ;
+ protected CorbaMessageMediator corbaMessageMediator;
+
+
+ // 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(
+ ORB orb, GIOPVersion version, byte encodingVersion) {
+ 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:
+ if (encodingVersion != Message.CDR_ENC_VERSION) {
+ return
+ new IDLJavaSerializationOutputStream(encodingVersion);
+ }
+ return new CDROutputStream_1_2();
+ default:
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+ // REVISIT - what is appropriate? INTERNAL exceptions
+ // are really hard to track later.
+ throw wrapper.unsupportedGiopVersion( version ) ;
+ }
+ }
+ }
+
+ // REVISIT - These two constructors should be re-factored to better hide
+ // the fact that someone extending this class 'can' construct a CDROutputStream
+ // that does not use pooled ByteBuffers. Right now, only EncapsOutputStream
+ // does _not_ use pooled ByteBuffers, see EncapsOutputStream.
+
+ // NOTE: When a stream is constructed for non-channel-backed sockets
+ // it notifies the constructor not to use pooled (i.e, direct)
+ // ByteBuffers.
+
+ public CDROutputStream(ORB orb,
+ GIOPVersion version,
+ byte encodingVersion,
+ boolean littleEndian,
+ BufferManagerWrite bufferManager,
+ byte streamFormatVersion,
+ boolean usePooledByteBuffers)
+ {
+ impl = OutputStreamFactory.newOutputStream(orb, version,
+ encodingVersion);
+ impl.init(orb, littleEndian, bufferManager,
+ streamFormatVersion, usePooledByteBuffers);
+
+ impl.setParent(this);
+ this.orb = orb ;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+ }
+
+ public CDROutputStream(ORB orb,
+ GIOPVersion version,
+ byte encodingVersion,
+ boolean littleEndian,
+ BufferManagerWrite bufferManager,
+ byte streamFormatVersion)
+ {
+ this(orb, version, encodingVersion, littleEndian,
+ bufferManager, streamFormatVersion, true);
+ }
+
+ // org.omg.CORBA.portable.OutputStream
+
+ // Provided by IIOPOutputStream and EncapsOutputStream
+ public abstract org.omg.CORBA.portable.InputStream create_input_stream();
+
+ 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);
+ }
+
+ 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){
+ 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) {
+ 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);
+ }
+
+ public final void write_Principal(Principal value) {
+ impl.write_Principal(value);
+ }
+
+ public final void write(int b) throws java.io.IOException {
+ impl.write(b);
+ }
+
+ public final void write_fixed(java.math.BigDecimal value) {
+ impl.write_fixed(value);
+ }
+
+ public final void write_Context(org.omg.CORBA.Context ctx,
+ org.omg.CORBA.ContextList contexts) {
+ impl.write_Context(ctx, contexts);
+ }
+
+ public final org.omg.CORBA.ORB orb() {
+ return impl.orb();
+ }
+
+ // org.omg.CORBA_2_3.portable.OutputStream
+ public final void write_value(java.io.Serializable value) {
+ impl.write_value(value);
+ }
+
+ public final void write_value(java.io.Serializable value, java.lang.Class clz) {
+ impl.write_value(value, clz);
+ }
+
+ public final void write_value(java.io.Serializable value, String repository_id) {
+ impl.write_value(value, repository_id);
+ }
+
+ public final void write_value(java.io.Serializable value,
+ org.omg.CORBA.portable.BoxedValueHelper factory) {
+ impl.write_value(value, factory);
+ }
+
+ public final void write_abstract_interface(java.lang.Object obj) {
+ impl.write_abstract_interface(obj);
+ }
+
+ // java.io.OutputStream
+ public final void write(byte b[]) throws IOException {
+ impl.write(b);
+ }
+
+ public final void write(byte b[], int off, int len) throws IOException {
+ impl.write(b, off, len);
+ }
+
+ public final void flush() throws IOException {
+ impl.flush();
+ }
+
+ public final void close() throws IOException {
+ impl.close();
+ }
+
+ // com.sun.corba.se.impl.encoding.MarshalOutputStream
+ public final void start_block() {
+ impl.start_block();
+ }
+
+ public final void end_block() {
+ impl.end_block();
+ }
+
+ public final void putEndian() {
+ impl.putEndian();
+ }
+
+ public void writeTo(java.io.OutputStream s)
+ throws IOException
+ {
+ impl.writeTo(s);
+ }
+
+ public final byte[] toByteArray() {
+ return impl.toByteArray();
+ }
+
+ // org.omg.CORBA.DataOutputStream
+ public final void write_Abstract (java.lang.Object value) {
+ impl.write_Abstract(value);
+ }
+
+ public final void write_Value (java.io.Serializable value) {
+ impl.write_Value(value);
+ }
+
+ public final void write_any_array(org.omg.CORBA.Any[] seq, int offset, int length) {
+ impl.write_any_array(seq, offset, length);
+ }
+
+ public void setMessageMediator(MessageMediator messageMediator)
+ {
+ this.corbaMessageMediator = (CorbaMessageMediator) messageMediator;
+ }
+
+ public MessageMediator getMessageMediator()
+ {
+ return corbaMessageMediator;
+ }
+
+ // org.omg.CORBA.portable.ValueBase
+ public final String[] _truncatable_ids() {
+ return impl._truncatable_ids();
+ }
+
+ // Other
+ protected final int getSize() {
+ return impl.getSize();
+ }
+
+ protected final int getIndex() {
+ return impl.getIndex();
+ }
+
+ protected int getRealIndex(int index) {
+ // Used in indirections. Overridden by TypeCodeOutputStream.
+ return index;
+ }
+
+ protected final void setIndex(int value) {
+ impl.setIndex(value);
+ }
+
+ protected final ByteBuffer getByteBuffer() {
+ return impl.getByteBuffer();
+ }
+
+ protected final void setByteBuffer(ByteBuffer byteBuffer) {
+ impl.setByteBuffer(byteBuffer);
+ }
+
+ /**
+ * return true if our ByteBuffer is sharing/equal to bb
+ */
+ protected final boolean isSharing(ByteBuffer bb) {
+ return (getByteBuffer() == bb);
+ }
+
+ public final boolean isLittleEndian() {
+ return impl.isLittleEndian();
+ }
+
+ // XREVISIT - return to final if possible
+ // REVISIT - was protected - need access from msgtypes test.
+ public ByteBufferWithInfo getByteBufferWithInfo() {
+ return impl.getByteBufferWithInfo();
+ }
+
+ protected void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
+ impl.setByteBufferWithInfo(bbwi);
+ }
+
+ // REVISIT: was protected - but need to access from xgiop.
+ public final BufferManagerWrite getBufferManager() {
+ return impl.getBufferManager();
+ }
+
+ public final void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) {
+ impl.write_fixed(bigDecimal, digits, scale);
+ }
+
+ public final void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) {
+ impl.writeOctetSequenceTo(s);
+ }
+
+ public final GIOPVersion getGIOPVersion() {
+ return impl.getGIOPVersion();
+ }
+
+ public final void writeIndirection(int tag, int posIndirectedTo) {
+ impl.writeIndirection(tag, posIndirectedTo);
+ }
+
+ // Use Latin-1 for GIOP 1.0 or when code set negotiation was not
+ // performed.
+ protected CodeSetConversion.CTBConverter createCharCTBConverter() {
+ return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1);
+ }
+
+ // Subclasses must decide what to do here. It's inconvenient to
+ // make the class and this method abstract because of dup().
+ protected abstract CodeSetConversion.CTBConverter createWCharCTBConverter();
+
+ protected final void freeInternalCaches() {
+ impl.freeInternalCaches();
+ }
+
+ void printBuffer() {
+ impl.printBuffer();
+ }
+
+ public void alignOnBoundary(int octetBoundary) {
+ impl.alignOnBoundary(octetBoundary);
+ }
+
+ // Needed by request and reply messages for GIOP versions >= 1.2 only.
+ public void setHeaderPadding(boolean headerPadding) {
+ impl.setHeaderPadding(headerPadding);
+ }
+
+ // ValueOutputStream -----------------------------
+
+ public void start_value(String rep_id) {
+ impl.start_value(rep_id);
+ }
+
+ public void end_value() {
+ impl.end_value();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStreamBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStreamBase.java
new file mode 100644
index 0000000..b4b1c68
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStreamBase.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.io.IOException;
+import java.io.Serializable;
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.Any;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+
+/**
+ * Describes CDROutputStream 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
+{
+ protected CDROutputStream parent;
+
+ // Required by parent CDROutputStream
+ public void setParent(CDROutputStream parent) {
+ this.parent = parent;
+ }
+
+ public void init(org.omg.CORBA.ORB orb,
+ BufferManagerWrite bufferManager,
+ byte streamFormatVersion) {
+ init(orb, false, bufferManager, streamFormatVersion, true);
+ }
+
+ // See EncapsOutputStream, the only one that uses the
+ // non-pooled ByteBuffers, for additional info.
+ protected abstract void init(org.omg.CORBA.ORB orb,
+ boolean littleEndian,
+ 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);
+ public abstract void write_Principal(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) {
+ 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_abstract_interface(java.lang.Object obj);
+
+ // java.io.OutputStream
+// public abstract void write(byte b[]) throws IOException;
+// public abstract void write(byte b[], int off, int len) throws IOException;
+// public abstract void flush() throws IOException;
+// public abstract void close() throws IOException;
+
+ // com.sun.corba.se.impl.encoding.MarshalOutputStream
+ 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 byte[] toByteArray();
+
+ // org.omg.CORBA.DataOutputStream
+ public abstract void write_Abstract (java.lang.Object 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();
+
+ // Needed by request and reply messages for GIOP versions >= 1.2 only.
+ abstract void setHeaderPadding(boolean headerPadding);
+
+ // Required by IIOPOutputStream and other subclasses
+ public abstract int getSize();
+
+ public abstract int getIndex();
+ public abstract void setIndex(int value);
+
+ public abstract ByteBuffer getByteBuffer();
+ public abstract void setByteBuffer(ByteBuffer byteBuffer);
+
+ public abstract boolean isLittleEndian();
+
+ public abstract ByteBufferWithInfo getByteBufferWithInfo();
+ public abstract void setByteBufferWithInfo(ByteBufferWithInfo bbwi);
+
+ 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();
+
+ public abstract void writeIndirection(int tag, int posIndirectedTo);
+
+ abstract void freeInternalCaches();
+
+ abstract void printBuffer();
+
+ abstract void alignOnBoundary(int octetBoundary);
+
+ // org.omg.CORBA.portable.ValueOutputStream
+
+ public abstract void start_value(String rep_id);
+
+ public abstract void end_value();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java
new file mode 100644
index 0000000..3e60c48
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_0.java
@@ -0,0 +1,1929 @@
+/*
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.Serializable;
+import java.io.ByteArrayOutputStream;
+import java.io.ObjectOutputStream;
+import java.io.IOException;
+import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
+import java.math.BigDecimal;
+import java.nio.ByteBuffer;
+import java.rmi.Remote;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+import java.util.Hashtable;
+import java.util.Stack;
+
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+import javax.rmi.CORBA.ValueHandlerMultiFormat;
+
+import org.omg.CORBA.CustomMarshal;
+import org.omg.CORBA.DataOutputStream;
+import org.omg.CORBA.TypeCodePackage.BadKind;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.VM_CUSTOM;
+import org.omg.CORBA.VM_TRUNCATABLE;
+import org.omg.CORBA.VM_NONE;
+import org.omg.CORBA.portable.IDLEntity;
+import org.omg.CORBA.portable.CustomValue;
+import org.omg.CORBA.portable.StreamableValue;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ValueBase;
+
+import com.sun.org.omg.CORBA.portable.ValueHelper;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.orb.ORBVersion;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
+import com.sun.corba.se.impl.encoding.MarshalOutputStream;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.corba.TypeCodeImpl;
+import com.sun.corba.se.impl.orbutil.CacheTable;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.orbutil.RepositoryIdStrings;
+import com.sun.corba.se.impl.orbutil.RepositoryIdUtility;
+import com.sun.corba.se.impl.orbutil.RepositoryIdFactory;
+import com.sun.corba.se.impl.util.Utility;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+public class CDROutputStream_1_0 extends CDROutputStreamBase
+{
+ private static final int INDIRECTION_TAG = 0xffffffff;
+
+ protected boolean littleEndian;
+ protected BufferManagerWrite bufferManagerWrite;
+ ByteBufferWithInfo bbwi;
+
+ protected ORB orb;
+ protected ORBUtilSystemException wrapper ;
+
+ protected boolean debug = false;
+
+ protected int blockSizeIndex = -1;
+ protected int blockSizePosition = 0;
+
+ protected byte streamFormatVersion;
+
+ private static final int DEFAULT_BUFFER_SIZE = 1024;
+ private static final String kWriteMethod = "write";
+
+ // Codebase cache
+ private CacheTable codebaseCache = null;
+
+ // Value cache
+ private CacheTable valueCache = null;
+
+ // Repository ID cache
+ private CacheTable repositoryIdCache = null;
+
+ // Write end flag
+ private int end_flag = 0;
+
+ // 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
+ // the old computation around for interoperability with our
+ // older ORBs.
+ private int chunkedValueNestingLevel = 0;
+
+ private boolean mustChunk = false;
+
+ // In block marker
+ protected boolean inBlock = false;
+
+ // Last end tag position
+ private int end_flag_position = 0;
+ private int end_flag_index = 0;
+
+ // ValueHandler
+ private ValueHandler valueHandler = null;
+
+ // Repository ID handlers
+ private RepositoryIdUtility repIdUtil;
+ private RepositoryIdStrings repIdStrs;
+
+ // Code set converters (created when first needed)
+ private CodeSetConversion.CTBConverter charConverter;
+ private CodeSetConversion.CTBConverter wcharConverter;
+
+ // 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,
+ boolean littleEndian,
+ BufferManagerWrite bufferManager,
+ byte streamFormatVersion,
+ boolean usePooledByteBuffers)
+ {
+ // ORB must not be null. See CDROutputStream constructor.
+ this.orb = (ORB)orb;
+ this.wrapper = ORBUtilSystemException.get( this.orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+ debug = this.orb.transportDebugFlag;
+
+ this.littleEndian = littleEndian;
+ this.bufferManagerWrite = bufferManager;
+ this.bbwi = new ByteBufferWithInfo(orb, bufferManager, usePooledByteBuffers);
+ this.streamFormatVersion = streamFormatVersion;
+
+ createRepositoryIdHandlers();
+ }
+
+ public void init(org.omg.CORBA.ORB orb,
+ boolean littleEndian,
+ BufferManagerWrite bufferManager,
+ byte streamFormatVersion)
+ {
+ init(orb, littleEndian, bufferManager, streamFormatVersion, true);
+ }
+
+ private final void createRepositoryIdHandlers()
+ {
+ repIdUtil = RepositoryIdFactory.getRepIdUtility();
+ repIdStrs = RepositoryIdFactory.getRepIdStringsFactory();
+ }
+
+ public BufferManagerWrite getBufferManager()
+ {
+ return bufferManagerWrite;
+ }
+
+ public byte[] toByteArray() {
+ byte[] it;
+
+ it = new byte[bbwi.position()];
+
+ // Micro-benchmarks show ByteBuffer.get(int) out perform the bulk
+ // ByteBuffer.get(byte[], offset, length).
+ for (int i = 0; i < bbwi.position(); i++)
+ it[i] = bbwi.byteBuffer.get(i);
+
+ return it;
+ }
+
+ 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) {
+ throw wrapper.giopVersionError();
+ }
+
+ protected void handleSpecialChunkBegin(int requiredSize)
+ {
+ // No-op for GIOP 1.0
+ }
+
+ protected void handleSpecialChunkEnd()
+ {
+ // No-op for GIOP 1.0
+ }
+
+ protected final int computeAlignment(int align) {
+ if (align > 1) {
+ int incr = bbwi.position() & (align - 1);
+ if (incr != 0)
+ return align - incr;
+ }
+
+ return 0;
+ }
+
+ protected void alignAndReserve(int align, int n) {
+
+ bbwi.position(bbwi.position() + computeAlignment(align));
+
+ if (bbwi.position() + n > bbwi.buflen)
+ grow(align, n);
+ }
+
+ //
+ // Default implementation of grow. Subclassers may override this.
+ // Always grow the single buffer. This needs to delegate
+ // fragmentation policy for IIOP 1.1.
+ //
+ protected void grow(int align, int n)
+ {
+ bbwi.needed = n;
+
+ bufferManagerWrite.overflow(bbwi);
+ }
+
+ public final void putEndian() throws SystemException {
+ write_boolean(littleEndian);
+ }
+
+ public final boolean littleEndian() {
+ return littleEndian;
+ }
+
+ void freeInternalCaches() {
+ if (codebaseCache != null)
+ codebaseCache.done();
+
+ if (valueCache != null)
+ valueCache.done();
+
+ if (repositoryIdCache != null)
+ repositoryIdCache.done();
+ }
+
+ // No such type in java
+ public final void write_longdouble(double x)
+ {
+ throw wrapper.longDoubleNotImplemented(
+ CompletionStatus.COMPLETED_MAYBE ) ;
+ }
+
+ public void write_octet(byte x)
+ {
+ // The 'if' stmt is commented out since we need the alignAndReserve to
+ // be called, particularly when the first body byte is written,
+ // to induce header padding to align the body on a 8-octet boundary,
+ // for GIOP versions 1.2 and above. Refer to internalWriteOctetArray()
+ // method that also has a similar change.
+ //if (bbwi.position() + 1 > bbwi.buflen)
+ alignAndReserve(1, 1);
+
+// REVISIT - Should just use ByteBuffer.put(byte) and let it
+// increment the ByteBuffer position. This is true
+// for all write operations in this file.
+
+ bbwi.byteBuffer.put(bbwi.position(), x);
+ bbwi.position(bbwi.position() + 1);
+
+ }
+
+ public final void write_boolean(boolean x)
+ {
+ write_octet(x? (byte)1:(byte)0);
+ }
+
+ public void write_char(char x)
+ {
+ CodeSetConversion.CTBConverter converter = getCharConverter();
+
+ converter.convert(x);
+
+ // CORBA formal 99-10-07 15.3.1.6: "In the case of multi-byte encodings
+ // of characters, a single instance of the char type may only
+ // hold one octet of any multi-byte character encoding."
+ if (converter.getNumBytes() > 1)
+ throw wrapper.invalidSingleCharCtb(CompletionStatus.COMPLETED_MAYBE);
+
+ write_octet(converter.getBytes()[0]);
+ }
+
+ // These wchar methods are only used when talking to
+ // legacy ORBs, now.
+ private final void writeLittleEndianWchar(char x) {
+ bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
+ bbwi.position(bbwi.position() + 2);
+ }
+
+ private final void writeBigEndianWchar(char x) {
+ bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 8) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 1, (byte)(x & 0xFF));
+ bbwi.position(bbwi.position() + 2);
+ }
+
+ private final void writeLittleEndianShort(short x) {
+ bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
+ bbwi.position(bbwi.position() + 2);
+ }
+
+ private final void writeBigEndianShort(short x) {
+ bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 8) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 1, (byte)(x & 0xFF));
+ bbwi.position(bbwi.position() + 2);
+ }
+
+ private final void writeLittleEndianLong(int x) {
+ bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 16) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 24) & 0xFF));
+ bbwi.position(bbwi.position() + 4);
+ }
+
+ private final void writeBigEndianLong(int x) {
+ bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 24) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 16) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 8) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 3, (byte)(x & 0xFF));
+ bbwi.position(bbwi.position() + 4);
+ }
+
+ private final void writeLittleEndianLongLong(long x) {
+ bbwi.byteBuffer.put(bbwi.position(), (byte)(x & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 8) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 16) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 24) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 4, (byte)((x >>> 32) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 5, (byte)((x >>> 40) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 6, (byte)((x >>> 48) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 7, (byte)((x >>> 56) & 0xFF));
+ bbwi.position(bbwi.position() + 8);
+ }
+
+ private final void writeBigEndianLongLong(long x) {
+ bbwi.byteBuffer.put(bbwi.position(), (byte)((x >>> 56) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 1, (byte)((x >>> 48) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 2, (byte)((x >>> 40) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 3, (byte)((x >>> 32) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 4, (byte)((x >>> 24) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 5, (byte)((x >>> 16) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 6, (byte)((x >>> 8) & 0xFF));
+ bbwi.byteBuffer.put(bbwi.position() + 7, (byte)(x & 0xFF));
+ bbwi.position(bbwi.position() + 8);
+ }
+
+ public void write_wchar(char x)
+ {
+ // Don't allow transmission of wchar/wstring data with
+ // foreign ORBs since it's against the spec.
+ if (ORBUtility.isForeignORB(orb)) {
+ throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ // If it's one of our legacy ORBs, do what they did:
+ alignAndReserve(2, 2);
+
+ if (littleEndian) {
+ writeLittleEndianWchar(x);
+ } else {
+ writeBigEndianWchar(x);
+ }
+ }
+
+ public void write_short(short x)
+ {
+ alignAndReserve(2, 2);
+
+ if (littleEndian) {
+ writeLittleEndianShort(x);
+ } else {
+ writeBigEndianShort(x);
+ }
+ }
+
+ public final void write_ushort(short x)
+ {
+ write_short(x);
+ }
+
+ public void write_long(int x)
+ {
+ alignAndReserve(4, 4);
+
+ if (littleEndian) {
+ writeLittleEndianLong(x);
+ } else {
+ writeBigEndianLong(x);
+ }
+ }
+
+ public final void write_ulong(int x)
+ {
+ write_long(x);
+ }
+
+ public void write_longlong(long x)
+ {
+ alignAndReserve(8, 8);
+
+ if (littleEndian) {
+ writeLittleEndianLongLong(x);
+ } else {
+ writeBigEndianLongLong(x);
+ }
+ }
+
+ public final void write_ulonglong(long x)
+ {
+ write_longlong(x);
+ }
+
+ public final void write_float(float x)
+ {
+ write_long(Float.floatToIntBits(x));
+ }
+
+ public final void write_double(double x)
+ {
+ write_longlong(Double.doubleToLongBits(x));
+ }
+
+ public void write_string(String value)
+ {
+ writeString(value);
+ }
+
+ protected int writeString(String value)
+ {
+ if (value == null) {
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ CodeSetConversion.CTBConverter converter = getCharConverter();
+
+ converter.convert(value);
+
+ // A string is encoded as an unsigned CORBA long for the
+ // number of bytes to follow (including a terminating null).
+ // There is only one octet per character in the string.
+ int len = converter.getNumBytes() + 1;
+
+ handleSpecialChunkBegin(computeAlignment(4) + 4 + len);
+
+ write_long(len);
+ int indirection = get_offset() - 4;
+
+ internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes());
+
+ // Write the null ending
+ write_octet((byte)0);
+
+ handleSpecialChunkEnd();
+ return indirection;
+ }
+
+ public void write_wstring(String value)
+ {
+ if (value == null)
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ // Don't allow transmission of wchar/wstring data with
+ // foreign ORBs since it's against the spec.
+ if (ORBUtility.isForeignORB(orb)) {
+ throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ // When talking to our legacy ORBs, do what they did:
+ int len = value.length() + 1;
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkBegin(4 + (len * 2) + computeAlignment(4));
+
+ write_long(len);
+
+ for (int i = 0; i < len - 1; i++)
+ write_wchar(value.charAt(i));
+
+ // Write the null ending
+ write_short((short)0);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkEnd();
+ }
+
+ // Performs no checks and doesn't tamper with chunking
+ void internalWriteOctetArray(byte[] value, int offset, int length)
+ {
+ int n = offset;
+
+ // This flag forces the alignAndReserve method to be called the
+ // first time an octet is written. This is necessary to ensure
+ // that the body is aligned on an 8-octet boundary. Note the 'if'
+ // condition inside the 'while' loop below. Also, refer to the
+ // write_octet() method that has a similar change.
+ boolean align = true;
+
+ while (n < length+offset) {
+ int avail;
+ int bytes;
+ int wanted;
+
+ if ((bbwi.position() + 1 > bbwi.buflen) || align) {
+ align = false;
+ alignAndReserve(1, 1);
+ }
+ avail = bbwi.buflen - bbwi.position();
+ wanted = (length + offset) - n;
+ bytes = (wanted < avail) ? wanted : avail;
+ for (int i = 0; i < bytes; i++)
+ bbwi.byteBuffer.put(bbwi.position() + i, value[n+i]);
+ bbwi.position(bbwi.position() + bytes);
+ n += bytes;
+ }
+ }
+
+ public final void write_octet_array(byte b[], int offset, int length)
+ {
+ if ( b == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkBegin(length);
+
+ internalWriteOctetArray(b, offset, length);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkEnd();
+ }
+
+ public void write_Principal(Principal p)
+ {
+ write_long(p.name().length);
+ write_octet_array(p.name(), 0, p.name().length);
+ }
+
+ public void write_any(Any any)
+ {
+ if ( any == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ write_TypeCode(any.type());
+ any.write_value(parent);
+ }
+
+ public void write_TypeCode(TypeCode tc)
+ {
+ if ( tc == null ) {
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+ }
+ TypeCodeImpl tci;
+ if (tc instanceof TypeCodeImpl) {
+ tci = (TypeCodeImpl)tc;
+ }
+ else {
+ tci = new TypeCodeImpl(orb, tc);
+ }
+
+ tci.write_value((org.omg.CORBA_2_3.portable.OutputStream)parent);
+ }
+
+ public void write_Object(org.omg.CORBA.Object ref)
+ {
+ if (ref == null) {
+ IOR nullIOR = IORFactories.makeIOR( orb ) ;
+ nullIOR.write(parent);
+ return;
+ }
+
+ // IDL to Java formal 01-06-06 1.21.4.2
+ if (ref instanceof org.omg.CORBA.LocalObject)
+ throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);
+
+ IOR ior = ORBUtility.connectAndGetIOR( orb, ref ) ;
+ ior.write(parent);
+ return;
+ }
+
+ // ------------ RMI related methods --------------------------
+
+ public void write_abstract_interface(java.lang.Object obj) {
+ boolean corbaObject = false; // Assume value type.
+ org.omg.CORBA.Object theObject = null;
+
+ // Is it a CORBA.Object?
+
+ if (obj != null && obj instanceof org.omg.CORBA.Object) {
+
+ // Yes.
+
+ theObject = (org.omg.CORBA.Object)obj;
+ corbaObject = true;
+ }
+
+ // Write our flag...
+
+ write_boolean(corbaObject);
+
+ // Now write out the object...
+
+ if (corbaObject) {
+ write_Object(theObject);
+ } else {
+ try {
+ write_value((java.io.Serializable)obj);
+ } catch(ClassCastException cce) {
+ if (obj instanceof java.io.Serializable)
+ throw cce;
+ else
+ ORBUtility.throwNotSerializableForCorba(obj.getClass().getName());
+ }
+ }
+ }
+
+ public void write_value(Serializable object, Class clz) {
+
+ write_value(object);
+ }
+
+ private void writeWStringValue(String string) {
+
+ int indirection = writeValueTag(mustChunk, true, null);
+
+ // Write WStringValue's repository ID
+ write_repositoryId(repIdStrs.getWStringValueRepId());
+
+ // Add indirection for object to indirection table
+ updateIndirectionTable(indirection, string, string);
+
+ // Write Value chunk
+ if (mustChunk) {
+ start_block();
+ end_flag--;
+ chunkedValueNestingLevel--;
+ } else
+ end_flag--;
+
+ write_wstring(string);
+
+ if (mustChunk)
+ end_block();
+
+ // Write end tag
+ writeEndTag(mustChunk);
+ }
+
+ private void writeArray(Serializable array, Class clazz) {
+
+ if (valueHandler == null)
+ valueHandler = ORBUtility.createValueHandler(); //d11638
+
+ // Write value_tag
+ int indirection = writeValueTag(mustChunk, true,
+ Util.getCodebase(clazz));
+
+ // Write repository ID
+ write_repositoryId(repIdStrs.createSequenceRepID(clazz));
+
+ // Add indirection for object to indirection table
+ updateIndirectionTable(indirection, array, array);
+
+ // Write Value chunk
+ if (mustChunk) {
+ start_block();
+ end_flag--;
+ chunkedValueNestingLevel--;
+ } else
+ end_flag--;
+
+ if (valueHandler instanceof ValueHandlerMultiFormat) {
+ ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
+ vh.writeValue(parent, array, streamFormatVersion);
+ } else
+ valueHandler.writeValue(parent, array);
+
+ if (mustChunk)
+ end_block();
+
+ // Write end tag
+ writeEndTag(mustChunk);
+ }
+
+ private void writeValueBase(org.omg.CORBA.portable.ValueBase object,
+ Class clazz) {
+ // _REVISIT_ could check to see whether chunking really needed
+ mustChunk = true;
+
+ // Write value_tag
+ int indirection = writeValueTag(true, true, Util.getCodebase(clazz));
+
+ // Get rep id
+ String repId = ((ValueBase)object)._truncatable_ids()[0];
+
+ // Write rep id
+ write_repositoryId(repId);
+
+ // Add indirection for object to indirection table
+ updateIndirectionTable(indirection, object, object);
+
+ // Write Value chunk
+ start_block();
+ end_flag--;
+ chunkedValueNestingLevel--;
+ writeIDLValue(object, repId);
+ end_block();
+
+ // Write end tag
+ writeEndTag(true);
+ }
+
+ private void writeRMIIIOPValueType(Serializable object, Class clazz) {
+ if (valueHandler == null)
+ valueHandler = ORBUtility.createValueHandler(); //d11638
+
+ Serializable key = object;
+
+ // Allow the ValueHandler to call writeReplace on
+ // the Serializable (if the method is present)
+ object = valueHandler.writeReplace(key);
+
+ if (object == null) {
+ // Write null tag and return
+ write_long(0);
+ return;
+ }
+
+ if (object != key) {
+ if (valueCache != null && valueCache.containsKey(object)) {
+ writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
+ return;
+ }
+
+ clazz = object.getClass();
+ }
+
+ if (mustChunk || valueHandler.isCustomMarshaled(clazz)) {
+ mustChunk = true;
+ }
+
+ // Write value_tag
+ int indirection = writeValueTag(mustChunk, true, Util.getCodebase(clazz));
+
+ // Write rep. id
+ write_repositoryId(repIdStrs.createForJavaType(clazz));
+
+ // Add indirection for object to indirection table
+ updateIndirectionTable(indirection, object, key);
+
+ if (mustChunk) {
+ // Write Value chunk
+ end_flag--;
+ chunkedValueNestingLevel--;
+ start_block();
+ } else
+ end_flag--;
+
+ if (valueHandler instanceof ValueHandlerMultiFormat) {
+ ValueHandlerMultiFormat vh = (ValueHandlerMultiFormat)valueHandler;
+ vh.writeValue(parent, object, streamFormatVersion);
+ } else
+ valueHandler.writeValue(parent, object);
+
+ if (mustChunk)
+ end_block();
+
+ // Write end tag
+ writeEndTag(mustChunk);
+ }
+
+ public void write_value(Serializable object, String repository_id) {
+
+ // Handle null references
+ if (object == null) {
+ // Write null tag and return
+ write_long(0);
+ return;
+ }
+
+ // Handle shared references
+ if (valueCache != null && valueCache.containsKey(object)) {
+ writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
+ return;
+ }
+
+ Class clazz = object.getClass();
+ boolean oldMustChunk = mustChunk;
+
+ if (mustChunk)
+ mustChunk = true;
+
+ if (inBlock)
+ end_block();
+
+ if (clazz.isArray()) {
+ // Handle arrays
+ writeArray(object, clazz);
+ } else if (object instanceof org.omg.CORBA.portable.ValueBase) {
+ // Handle IDL Value types
+ writeValueBase((org.omg.CORBA.portable.ValueBase)object, clazz);
+ } else if (shouldWriteAsIDLEntity(object)) {
+ writeIDLEntity((IDLEntity)object);
+ } else if (object instanceof java.lang.String) {
+ writeWStringValue((String)object);
+ } else if (object instanceof java.lang.Class) {
+ writeClass(repository_id, (Class)object);
+ } else {
+ // RMI-IIOP value type
+ writeRMIIIOPValueType(object, clazz);
+ }
+
+ mustChunk = oldMustChunk;
+
+ // Check to see if we need to start another block for a
+ // possible outer value
+ if (mustChunk)
+ start_block();
+
+ }
+
+ public void write_value(Serializable object)
+ {
+ write_value(object, (String)null);
+ }
+
+ public void write_value(Serializable object, org.omg.CORBA.portable.BoxedValueHelper factory)
+ {
+ // Handle null references
+ if (object == null) {
+ // Write null tag and return
+ write_long(0);
+ return;
+ }
+
+ // Handle shared references
+ if ((valueCache != null) && valueCache.containsKey(object)) {
+ writeIndirection(INDIRECTION_TAG, valueCache.getVal(object));
+ return;
+ }
+
+ boolean oldMustChunk = mustChunk;
+
+ boolean isCustom = false;
+ if (factory instanceof ValueHelper) {
+ short modifier;
+ try {
+ modifier = ((ValueHelper)factory).get_type().type_modifier();
+ } catch(BadKind ex) { // tk_value_box
+ modifier = VM_NONE.value;
+ }
+ if (object instanceof CustomMarshal &&
+ modifier == VM_CUSTOM.value) {
+ isCustom = true;
+ mustChunk = true;
+ }
+ if (modifier == VM_TRUNCATABLE.value)
+ mustChunk = true;
+ }
+
+ if (mustChunk) {
+
+ if (inBlock)
+ end_block();
+
+ // Write value_tag
+ int indirection = writeValueTag(true,
+ orb.getORBData().useRepId(),
+ Util.getCodebase(object.getClass())
+ );
+
+ if (orb.getORBData().useRepId()) {
+ write_repositoryId(factory.get_id());
+ }
+
+ // Add indirection for object to indirection table
+ updateIndirectionTable(indirection, object, object);
+
+ // Write Value chunk
+ start_block();
+ end_flag--;
+ chunkedValueNestingLevel--;
+ if (isCustom)
+ ((CustomMarshal)object).marshal(parent);
+ else
+ factory.write_value(parent, object);
+ end_block();
+
+ // Write end tag
+ writeEndTag(true);
+ }
+ else {
+ // Write value_tag
+ int indirection = writeValueTag(false,
+ orb.getORBData().useRepId(),
+ Util.getCodebase(object.getClass())
+ );
+
+ if (orb.getORBData().useRepId()) {
+ write_repositoryId(factory.get_id());
+ }
+
+ // Add indirection for object to indirection table
+ updateIndirectionTable(indirection, object, object);
+
+ // Write Value chunk
+ end_flag--;
+ // no need to test for custom on the non-chunked path
+ factory.write_value(parent, object);
+
+ // Write end tag
+ writeEndTag(false);
+ }
+
+ mustChunk = oldMustChunk;
+
+ // Check to see if we need to start another block for a
+ // possible outer value
+ if (mustChunk)
+ start_block();
+
+ }
+
+ public int get_offset() {
+ return bbwi.position();
+ }
+
+ public void start_block() {
+ if (debug) {
+ dprint("CDROutputStream_1_0 start_block, position" + bbwi.position());
+ }
+
+ //Move inBlock=true to after write_long since write_long might
+ //trigger grow which will lead to erroneous behavior with a
+ //missing blockSizeIndex.
+ //inBlock = true;
+
+ // Save space in the buffer for block size
+ write_long(0);
+
+ //Has to happen after write_long since write_long could
+ //trigger grow which is overridden by supper classes to
+ //depend on inBlock.
+ inBlock = true;
+
+ blockSizePosition = get_offset();
+
+ // Remember where to put the size of the endblock less 4
+ blockSizeIndex = bbwi.position();
+
+ if (debug) {
+ dprint("CDROutputStream_1_0 start_block, blockSizeIndex "
+ + blockSizeIndex);
+ }
+
+ }
+
+ // 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
+ // recursive scenarios which lose the chunking state.
+ protected void writeLongWithoutAlign(int x) {
+ if (littleEndian) {
+ writeLittleEndianLong(x);
+ } else {
+ writeBigEndianLong(x);
+ }
+ }
+
+ public void end_block() {
+ if (debug) {
+ dprint("CDROutputStream_1_0.java end_block");
+ }
+
+ if (!inBlock)
+ return;
+
+ if (debug) {
+ dprint("CDROutputStream_1_0.java end_block, in a block");
+ }
+
+ inBlock = false;
+
+ // 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)
+ if (get_offset() == blockSizePosition) {
+ // Need to assert that blockSizeIndex == bbwi.position()? REVISIT
+
+ bbwi.position(bbwi.position() - 4);
+ blockSizeIndex = -1;
+ blockSizePosition = -1;
+ return;
+ }
+
+ int oldSize = bbwi.position();
+ bbwi.position(blockSizeIndex - 4);
+
+ writeLongWithoutAlign(oldSize - blockSizeIndex);
+
+ bbwi.position(oldSize);
+ blockSizeIndex = -1;
+ blockSizePosition = -1;
+
+ // System.out.println(" post end_block: " + get_offset() + " " + bbwi.position());
+ }
+
+ public org.omg.CORBA.ORB orb()
+ {
+ return orb;
+ }
+
+ // ------------ End RMI related methods --------------------------
+
+ public final void write_boolean_array(boolean[]value, int offset, int length) {
+ if ( value == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkBegin(length);
+
+ for (int i = 0; i < length; i++)
+ write_boolean(value[offset + i]);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkEnd();
+ }
+
+ public final void write_char_array(char[]value, int offset, int length) {
+ if ( value == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkBegin(length);
+
+ for (int i = 0; i < length; i++)
+ write_char(value[offset + i]);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkEnd();
+ }
+
+ public void write_wchar_array(char[]value, int offset, int length) {
+ if ( value == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkBegin(computeAlignment(2) + (length * 2));
+
+ for (int i = 0; i < length; i++)
+ write_wchar(value[offset + i]);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkEnd();
+ }
+
+ public final void write_short_array(short[]value, int offset, int length) {
+ if ( value == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkBegin(computeAlignment(2) + (length * 2));
+
+ for (int i = 0; i < length; i++)
+ write_short(value[offset + i]);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkEnd();
+ }
+
+ public final void write_ushort_array(short[]value, int offset, int length) {
+ write_short_array(value, offset, length);
+ }
+
+ public final void write_long_array(int[]value, int offset, int length) {
+ if ( value == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkBegin(computeAlignment(4) + (length * 4));
+
+ for (int i = 0; i < length; i++)
+ write_long(value[offset + i]);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkEnd();
+ }
+
+ public final void write_ulong_array(int[]value, int offset, int length) {
+ write_long_array(value, offset, length);
+ }
+
+ public final void write_longlong_array(long[]value, int offset, int length) {
+ if ( value == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkBegin(computeAlignment(8) + (length * 8));
+
+ for (int i = 0; i < length; i++)
+ write_longlong(value[offset + i]);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkEnd();
+ }
+
+ public final void write_ulonglong_array(long[]value, int offset, int length) {
+ write_longlong_array(value, offset, length);
+ }
+
+ public final void write_float_array(float[]value, int offset, int length) {
+ if ( value == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkBegin(computeAlignment(4) + (length * 4));
+
+ for (int i = 0; i < length; i++)
+ write_float(value[offset + i]);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkEnd();
+ }
+
+ public final void write_double_array(double[]value, int offset, int length) {
+ if ( value == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkBegin(computeAlignment(8) + (length * 8));
+
+ for (int i = 0; i < length; i++)
+ write_double(value[offset + i]);
+
+ // This will only have an effect if we're already chunking
+ handleSpecialChunkEnd();
+ }
+
+ public void write_string_array(String[] value, int offset, int length) {
+ if ( value == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ for(int i = 0; i < length; i++)
+ write_string(value[offset + i]);
+ }
+
+ public void write_wstring_array(String[] value, int offset, int length) {
+ if ( value == null )
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+
+ for(int i = 0; i < length; i++)
+ write_wstring(value[offset + i]);
+ }
+
+ public final void write_any_array(org.omg.CORBA.Any value[], int offset, int length)
+ {
+ for(int i = 0; i < length; i++)
+ write_any(value[offset + i]);
+ }
+
+ //--------------------------------------------------------------------//
+ // CDROutputStream state management.
+ //
+
+ public void writeTo(java.io.OutputStream s)
+ throws java.io.IOException
+ {
+ byte[] tmpBuf = null;
+
+ if (bbwi.byteBuffer.hasArray())
+ {
+ tmpBuf = bbwi.byteBuffer.array();
+ }
+ else
+ {
+ int size = bbwi.position();
+ tmpBuf = new byte[size];
+ // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is
+ // faster than ByteBuffer.get(byte[], offset, length)
+ for (int i = 0; i < size; i++)
+ tmpBuf[i] = bbwi.byteBuffer.get(i);
+ }
+
+ s.write(tmpBuf, 0, bbwi.position());
+ }
+
+ public void writeOctetSequenceTo(org.omg.CORBA.portable.OutputStream s) {
+
+ byte[] buf = null;
+
+ if (bbwi.byteBuffer.hasArray())
+ {
+ buf = bbwi.byteBuffer.array();
+ }
+ else
+ {
+ int size = bbwi.position();
+ buf = new byte[size];
+ // Micro-benchmarks are showing a loop of ByteBuffer.get(int) is
+ // faster than ByteBuffer.get(byte[], offset, length)
+ for (int i = 0; i < size; i++)
+ buf[i] = bbwi.byteBuffer.get(i);
+ }
+
+ s.write_long(bbwi.position());
+ s.write_octet_array(buf, 0, bbwi.position());
+
+ }
+
+ public final int getSize() {
+ return bbwi.position();
+ }
+
+ public int getIndex() {
+ return bbwi.position();
+ }
+
+ public boolean isLittleEndian() {
+ return littleEndian;
+ }
+
+ public void setIndex(int value) {
+ bbwi.position(value);
+ }
+
+ public ByteBufferWithInfo getByteBufferWithInfo() {
+ return bbwi;
+ }
+
+ public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
+ this.bbwi = bbwi;
+ }
+
+ public ByteBuffer getByteBuffer() {
+ ByteBuffer result = null;;
+ if (bbwi != null) {
+ result = bbwi.byteBuffer;
+ }
+ return result;
+ }
+
+ public void setByteBuffer(ByteBuffer byteBuffer) {
+ bbwi.byteBuffer = byteBuffer;
+ }
+
+ private final void updateIndirectionTable(int indirection, java.lang.Object object,
+ java.lang.Object key) {
+ // int indirection = get_offset();
+ if (valueCache == null)
+ valueCache = new CacheTable(orb,true);
+ valueCache.put(object, indirection);
+ if (key != object)
+ valueCache.put(key, indirection);
+ }
+
+ private final void write_repositoryId(String id) {
+ // Use an indirection if available
+ if (repositoryIdCache != null && repositoryIdCache.containsKey(id)) {
+ writeIndirection(INDIRECTION_TAG, repositoryIdCache.getVal(id));
+ return;
+ }
+
+ // 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.
+
+ // It's not a good idea to cache them now that we can have
+ // multiple code sets.
+ int indirection = writeString(id);
+
+ // Add indirection for id to indirection table
+ if (repositoryIdCache == null)
+ repositoryIdCache = new CacheTable(orb,true);
+ repositoryIdCache.put(id, indirection);
+ }
+
+ private void write_codebase(String str, int pos) {
+ if (codebaseCache != null && codebaseCache.containsKey(str)) {
+ writeIndirection(INDIRECTION_TAG, codebaseCache.getVal(str));
+ }
+ else {
+ write_string(str);
+ if (codebaseCache == null)
+ codebaseCache = new CacheTable(orb,true);
+ codebaseCache.put(str, pos);
+ }
+ }
+
+ private final int writeValueTag(boolean chunkIt, boolean useRepId,
+ String codebase) {
+ int indirection = 0;
+ if (chunkIt && !useRepId){
+ if (codebase == null) {
+ write_long(repIdUtil.getStandardRMIChunkedNoRepStrId());
+ indirection = get_offset() - 4;
+ } else {
+ write_long(repIdUtil.getCodeBaseRMIChunkedNoRepStrId());
+ indirection = get_offset() - 4;
+ write_codebase(codebase, get_offset());
+ }
+ } else if (chunkIt && useRepId){
+ if (codebase == null) {
+ write_long(repIdUtil.getStandardRMIChunkedId());
+ indirection = get_offset() - 4;
+ } else {
+ write_long(repIdUtil.getCodeBaseRMIChunkedId());
+ indirection = get_offset() - 4;
+ write_codebase(codebase, get_offset());
+ }
+ } else if (!chunkIt && !useRepId) {
+ if (codebase == null) {
+ write_long(repIdUtil.getStandardRMIUnchunkedNoRepStrId());
+ indirection = get_offset() - 4;
+ } else {
+ write_long(repIdUtil.getCodeBaseRMIUnchunkedNoRepStrId());
+ indirection = get_offset() - 4;
+ write_codebase(codebase, get_offset());
+ }
+ } else if (!chunkIt && useRepId) {
+ if (codebase == null) {
+ write_long(repIdUtil.getStandardRMIUnchunkedId());
+ indirection = get_offset() - 4;
+ } else {
+ write_long(repIdUtil.getCodeBaseRMIUnchunkedId());
+ indirection = get_offset() - 4;
+ write_codebase(codebase, get_offset());
+ }
+ }
+ return indirection;
+ }
+
+ private void writeIDLValue(Serializable object, String repID)
+ {
+ if (object instanceof StreamableValue) {
+ ((StreamableValue)object)._write(parent);
+
+ } else if (object instanceof CustomValue) {
+ ((CustomValue)object).marshal(parent);
+
+ } else {
+ BoxedValueHelper helper = Utility.getHelper(object.getClass(), null, repID);
+ boolean isCustom = false;
+ if (helper instanceof ValueHelper && object instanceof CustomMarshal) {
+ try {
+ if (((ValueHelper)helper).get_type().type_modifier() == VM_CUSTOM.value)
+ isCustom = true;
+ } catch(BadKind ex) {
+ throw wrapper.badTypecodeForCustomValue( CompletionStatus.COMPLETED_MAYBE,
+ ex ) ;
+ }
+ }
+ if (isCustom)
+ ((CustomMarshal)object).marshal(parent);
+ else
+ helper.write_value(parent, object);
+ }
+ }
+
+ // Handles end tag compaction...
+ private void writeEndTag(boolean chunked){
+
+ if (chunked) {
+ if (get_offset() == end_flag_position) {
+
+ if (bbwi.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
+ // and compact the tags.
+ bbwi.position(bbwi.position() - 4);
+
+ } else {
+
+ // 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
+ // 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.
+ }
+ }
+
+ writeNestingLevel();
+
+ // Remember the last index and position. These are only used when chunking.
+ end_flag_index = bbwi.position();
+ end_flag_position = get_offset();
+
+ chunkedValueNestingLevel++;
+ }
+
+ // Increment the nesting level
+ end_flag++;
+ }
+
+ /**
+ * 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 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.
+ */
+ private void writeNestingLevel() {
+ if (orb == null ||
+ ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
+ ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {
+
+ write_long(chunkedValueNestingLevel);
+
+ } else {
+ write_long(end_flag);
+ }
+ }
+
+ private void writeClass(String repository_id, Class clz) {
+
+ if (repository_id == null)
+ repository_id = repIdStrs.getClassDescValueRepId();
+
+ // Write value_tag
+ int indirection = writeValueTag(mustChunk, true, null);
+ updateIndirectionTable(indirection, clz, clz);
+
+ write_repositoryId(repository_id);
+
+ if (mustChunk) {
+ // Write Value chunk
+ start_block();
+ end_flag--;
+ chunkedValueNestingLevel--;
+ } else
+ end_flag--;
+
+ writeClassBody(clz);
+
+ if (mustChunk)
+ end_block();
+
+ // Write end tag
+ writeEndTag(mustChunk);
+ }
+
+ // Pre-Merlin/J2EE 1.3 ORBs wrote the repository ID
+ // and codebase strings in the wrong order. This handles
+ // backwards compatibility.
+ private void writeClassBody(Class clz) {
+ if (orb == null ||
+ ORBVersionFactory.getFOREIGN().equals(orb.getORBVersion()) ||
+ ORBVersionFactory.getNEWER().compareTo(orb.getORBVersion()) <= 0) {
+
+ write_value(Util.getCodebase(clz));
+ write_value(repIdStrs.createForAnyType(clz));
+ } else {
+
+ write_value(repIdStrs.createForAnyType(clz));
+ write_value(Util.getCodebase(clz));
+ }
+ }
+
+ // Casts and returns an Object as a Serializable
+ // This is required for JDK 1.1 only to avoid VerifyErrors when
+ // passing arrays as Serializable
+ // private java.io.Serializable make_serializable(java.lang.Object object)
+ // {
+ // return (java.io.Serializable)object;
+ // }
+
+ private boolean shouldWriteAsIDLEntity(Serializable object)
+ {
+ return ((object instanceof IDLEntity) && (!(object instanceof ValueBase)) &&
+ (!(object instanceof org.omg.CORBA.Object)));
+
+ }
+
+ private void writeIDLEntity(IDLEntity object) {
+
+ // _REVISIT_ could check to see whether chunking really needed
+ mustChunk = true;
+
+ String repository_id = repIdStrs.createForJavaType(object);
+ Class clazz = object.getClass();
+ String codebase = Util.getCodebase(clazz);
+
+ // Write value_tag
+ int indirection = writeValueTag(true, true, codebase);
+ updateIndirectionTable(indirection, object, object);
+
+ // Write rep. id
+ write_repositoryId(repository_id);
+
+ // Write Value chunk
+ end_flag--;
+ chunkedValueNestingLevel--;
+ start_block();
+
+ // 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 argTypes[] = {org.omg.CORBA.portable.OutputStream.class, clazz};
+ // getDeclaredMethod requires RuntimePermission accessDeclaredMembers
+ // if a different class loader is used (even though the javadoc says otherwise)
+ Method writeMethod = null;
+ try {
+ writeMethod = (Method)AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public java.lang.Object run() throws NoSuchMethodException {
+ return helperClass.getDeclaredMethod(kWriteMethod, argTypes);
+ }
+ }
+ );
+ } catch (PrivilegedActionException pae) {
+ // this gets caught below
+ throw (NoSuchMethodException)pae.getException();
+ }
+ java.lang.Object args[] = {parent, object};
+ writeMethod.invoke(null, args);
+ } catch (ClassNotFoundException cnfe) {
+ throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, cnfe ) ;
+ } catch(NoSuchMethodException nsme) {
+ throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, nsme ) ;
+ } catch(IllegalAccessException iae) {
+ throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, iae ) ;
+ } catch(InvocationTargetException ite) {
+ throw wrapper.errorInvokingHelperWrite( CompletionStatus.COMPLETED_MAYBE, ite ) ;
+ }
+ end_block();
+
+ // Write end tag
+ writeEndTag(true);
+ }
+
+ /* DataOutputStream methods */
+
+ public void write_Abstract (java.lang.Object value) {
+ write_abstract_interface(value);
+ }
+
+ public void write_Value (java.io.Serializable value) {
+ write_value(value);
+ }
+
+ // This will stay a custom add-on until the java-rtf issue is resolved.
+ // Then it should be declared in org.omg.CORBA.portable.OutputStream.
+ //
+ // Pads the string representation of bigDecimal with zeros to fit the given
+ // digits and scale before it gets written to the stream.
+ public void write_fixed(java.math.BigDecimal bigDecimal, short digits, short scale) {
+ String string = bigDecimal.toString();
+ String integerPart;
+ String fractionPart;
+ StringBuffer stringBuffer;
+
+ // Get rid of the sign
+ if (string.charAt(0) == '-' || string.charAt(0) == '+') {
+ string = string.substring(1);
+ }
+
+ // Determine integer and fraction parts
+ int dotIndex = string.indexOf('.');
+ if (dotIndex == -1) {
+ integerPart = string;
+ fractionPart = null;
+ } else if (dotIndex == 0 ) {
+ integerPart = null;
+ fractionPart = string;
+ } else {
+ integerPart = string.substring(0, dotIndex);
+ fractionPart = string.substring(dotIndex + 1);
+ }
+
+ // Pad both parts with zeros as necessary
+ stringBuffer = new StringBuffer(digits);
+ if (fractionPart != null) {
+ stringBuffer.append(fractionPart);
+ }
+ while (stringBuffer.length() < scale) {
+ stringBuffer.append('0');
+ }
+ if (integerPart != null) {
+ stringBuffer.insert(0, integerPart);
+ }
+ while (stringBuffer.length() < digits) {
+ stringBuffer.insert(0, '0');
+ }
+
+ // This string contains no sign or dot
+ this.write_fixed(stringBuffer.toString(), bigDecimal.signum());
+ }
+
+ // This method should be remove by the java-rtf issue.
+ // Right now the scale and digits information of the type code is lost.
+ public void write_fixed(java.math.BigDecimal bigDecimal) {
+ // This string might contain sign and/or dot
+ this.write_fixed(bigDecimal.toString(), bigDecimal.signum());
+ }
+
+ // The string may contain a sign and dot
+ public void write_fixed(String string, int signum) {
+ int stringLength = string.length();
+ // Each octet contains (up to) two decimal digits
+ byte doubleDigit = 0;
+ char ch;
+ byte digit;
+
+ // First calculate the length of the string without optional sign and dot
+ int numDigits = 0;
+ for (int i=0; i<stringLength; i++) {
+ ch = string.charAt(i);
+ if (ch == '-' || ch == '+' || ch == '.')
+ continue;
+ numDigits++;
+ }
+ for (int i=0; i<stringLength; i++) {
+ ch = string.charAt(i);
+ if (ch == '-' || ch == '+' || ch == '.')
+ continue;
+ digit = (byte)Character.digit(ch, 10);
+ if (digit == -1) {
+ throw wrapper.badDigitInFixed( CompletionStatus.COMPLETED_MAYBE ) ;
+ }
+ // If the fixed type has an odd number of decimal digits,
+ // then the representation begins with the first (most significant) digit.
+ // Otherwise, this first half-octet is all zero, and the first digit
+ // is in the second half-octet.
+ if (numDigits % 2 == 0) {
+ doubleDigit |= digit;
+ this.write_octet(doubleDigit);
+ doubleDigit = 0;
+ } else {
+ doubleDigit |= (digit << 4);
+ }
+ numDigits--;
+ }
+ // The sign configuration, in the last half-octet of the representation,
+ // is 0xD for negative numbers and 0xC for positive and zero values
+ if (signum == -1) {
+ doubleDigit |= 0xd;
+ } else {
+ doubleDigit |= 0xc;
+ }
+ this.write_octet(doubleDigit);
+ }
+
+ private final static String _id = "IDL:omg.org/CORBA/DataOutputStream:1.0";
+ private final static String[] _ids = { _id };
+
+ public String[] _truncatable_ids() {
+ if (_ids == null)
+ return null;
+
+ return (String[])_ids.clone();
+ }
+
+ /* for debugging */
+
+ public void printBuffer() {
+ CDROutputStream_1_0.printBuffer(this.bbwi);
+ }
+
+ public static void printBuffer(ByteBufferWithInfo bbwi) {
+
+ System.out.println("+++++++ Output Buffer ++++++++");
+ System.out.println();
+ System.out.println("Current position: " + bbwi.position());
+ System.out.println("Total length : " + bbwi.buflen);
+ System.out.println();
+
+ char[] charBuf = new char[16];
+
+ try {
+
+ for (int i = 0; i < bbwi.position(); i += 16) {
+
+ int j = 0;
+
+ // For every 16 bytes, there is one line
+ // of output. First, the hex output of
+ // the 16 bytes with each byte separated
+ // by a space.
+ while (j < 16 && j + i < bbwi.position()) {
+ int k = bbwi.byteBuffer.get(i + j);
+ if (k < 0)
+ k = 256 + k;
+ String hex = Integer.toHexString(k);
+ if (hex.length() == 1)
+ hex = "0" + hex;
+ System.out.print(hex + " ");
+ j++;
+ }
+
+ // Add any extra spaces to align the
+ // text column in case we didn't end
+ // at 16
+ while (j < 16) {
+ System.out.print(" ");
+ j++;
+ }
+
+ // Now output the ASCII equivalents. Non-ASCII
+ // characters are shown as periods.
+ int x = 0;
+
+ while (x < 16 && x + i < bbwi.position()) {
+ if (ORBUtility.isPrintable((char)bbwi.byteBuffer.get(i + x)))
+ charBuf[x] = (char)bbwi.byteBuffer.get(i + x);
+ else
+ charBuf[x] = '.';
+ x++;
+ }
+ System.out.println(new String(charBuf, 0, x));
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ System.out.println("++++++++++++++++++++++++++++++");
+ }
+
+ 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
+ // 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.
+
+ handleSpecialChunkBegin(computeAlignment(4) + 8);
+
+ // write indirection tag
+ write_long(tag);
+
+ // 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())));
+*/
+ write_long(posIndirectedTo - parent.getRealIndex(get_offset()));
+
+ handleSpecialChunkEnd();
+ }
+
+ protected CodeSetConversion.CTBConverter getCharConverter() {
+ if (charConverter == null)
+ charConverter = parent.createCharCTBConverter();
+
+ return charConverter;
+ }
+
+ protected CodeSetConversion.CTBConverter getWCharConverter() {
+ if (wcharConverter == null)
+ wcharConverter = parent.createWCharCTBConverter();
+
+ return wcharConverter;
+ }
+
+ protected void dprint(String msg) {
+ if (debug)
+ ORBUtility.dprint(this, msg);
+ }
+
+ void alignOnBoundary(int octetBoundary) {
+ alignAndReserve(octetBoundary, 0);
+ }
+
+ public void start_value(String rep_id) {
+
+ if (debug) {
+ dprint("start_value w/ rep id "
+ + rep_id
+ + " called at pos "
+ + get_offset()
+ + " position "
+ + bbwi.position());
+ }
+
+ if (inBlock)
+ end_block();
+
+ // Write value_tag
+ writeValueTag(true, true, null);
+
+ // Write rep. id
+ write_repositoryId(rep_id);
+
+ // Write Value chunk
+ end_flag--;
+ chunkedValueNestingLevel--;
+
+ // Make sure to chunk the custom data
+ start_block();
+ }
+
+ public void end_value() {
+
+ if (debug) {
+ dprint("end_value called at pos "
+ + get_offset()
+ + " position "
+ + bbwi.position());
+ }
+
+ end_block();
+
+ writeEndTag(true);
+
+ // Check to see if we need to start another block for a
+ // 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
+ // an end tag separating the superclass optional
+ // data and the subclass's default data.
+
+ if (debug) {
+ dprint("mustChunk is " + mustChunk);
+ }
+
+ if (mustChunk) {
+ start_block();
+ }
+ }
+
+ public void close() throws IOException
+ {
+ // tell BufferManagerWrite to release any ByteBuffers
+ getBufferManager().close();
+
+ // It's possible bbwi.byteBuffer is shared between
+ // this OutputStream and an InputStream. Thus, we check
+ // if the Input/Output streams are using the same ByteBuffer.
+ // If they sharing the same ByteBuffer we need to ensure only
+ // one of those ByteBuffers are released to the ByteBufferPool.
+
+ if (getByteBufferWithInfo() != null && getByteBuffer() != null)
+ {
+ MessageMediator messageMediator = parent.getMessageMediator();
+ if (messageMediator != null)
+ {
+ CDRInputObject inputObj =
+ (CDRInputObject)messageMediator.getInputObject();
+ if (inputObj != null)
+ {
+ if (inputObj.isSharing(getByteBuffer()))
+ {
+ // Set InputStream's ByteBuffer and bbwi to null
+ // so its ByteBuffer cannot be released to the pool
+ inputObj.setByteBuffer(null);
+ inputObj.setByteBufferWithInfo(null);
+ }
+ }
+ }
+
+ // release this stream's ByteBuffer to the pool
+ ByteBufferPool byteBufferPool = orb.getByteBufferPool();
+ if (debug)
+ {
+ // print address of ByteBuffer being released
+ int bbAddress = System.identityHashCode(bbwi.byteBuffer);
+ StringBuffer sb = new StringBuffer(80);
+ sb.append(".close - releasing ByteBuffer id (");
+ sb.append(bbAddress).append(") to ByteBufferPool.");
+ String msg = sb.toString();
+ dprint(msg);
+ }
+ byteBufferPool.releaseByteBuffer(getByteBuffer());
+ bbwi.byteBuffer = null;
+ bbwi = null;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_1.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_1.java
new file mode 100644
index 0000000..7fb977c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_1.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import org.omg.CORBA.CompletionStatus;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+
+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 }
+ //
+ protected int fragmentOffset = 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
+ // our fragments end on evenly divisible 8 byte
+ // 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.
+
+ int alignment = computeAlignment(align);
+
+ if (bbwi.position() + n + alignment > bbwi.buflen) {
+ grow(align, n);
+
+ // Must recompute the alignment after a grow.
+ // In the case of fragmentation, the alignment
+ // calculation may no longer be correct.
+
+ // People shouldn't be able to set their fragment
+ // sizes so small that the fragment header plus
+ // this alignment fills the entire buffer.
+ alignment = computeAlignment(align);
+ }
+
+ bbwi.position(bbwi.position() + alignment);
+ }
+
+ protected void grow(int align, int n) {
+ // Save the current size for possible post-fragmentation calculation
+ int oldSize = bbwi.position();
+
+ super.grow(align, n);
+
+ // At this point, if we fragmented, we should have a ByteBufferWithInfo
+ // with the fragment header already marshalled. The size and length fields
+ // should be updated accordingly, and the fragmented flag should be set.
+ if (bbwi.fragmented) {
+
+ // Clear the flag
+ bbwi.fragmented = false;
+
+ // 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
+ // fragment header of this buffer.
+ fragmentOffset += (oldSize - bbwi.position());
+ }
+ }
+
+ public int get_offset() {
+ return bbwi.position() + fragmentOffset;
+ }
+
+ public GIOPVersion getGIOPVersion() {
+ return GIOPVersion.V1_1;
+ }
+
+ 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.
+ // Note that the following code prohibits UTF-16 with a byte
+ // order marker (which would result in 4 bytes).
+ CodeSetConversion.CTBConverter converter = getWCharConverter();
+
+ converter.convert(x);
+
+ if (converter.getNumBytes() != 2)
+ throw wrapper.badGiop11Ctb(CompletionStatus.COMPLETED_MAYBE);
+
+ alignAndReserve(converter.getAlignment(),
+ converter.getNumBytes());
+
+ parent.write_octet_array(converter.getBytes(),
+ 0,
+ converter.getNumBytes());
+ }
+
+ public void write_wstring(String value)
+ {
+ if (value == null) {
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ // 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.
+
+ int len = value.length() + 1;
+
+ write_long(len);
+
+ CodeSetConversion.CTBConverter converter = getWCharConverter();
+
+ converter.convert(value);
+
+ internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes());
+
+ // Write the 2 byte null ending
+ write_short((short)0);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_2.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_2.java
new file mode 100644
index 0000000..165fd98
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CDROutputStream_1_2.java
@@ -0,0 +1,359 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+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
+ // as that for specialChunks.
+ //
+ // Unfortunately, given the current code, we can't reuse
+ // 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.
+ //
+ // All of the CDR code should be rewritten moving chunking
+ // to a different level, perhaps in the buffer managers.
+ // We want to move to a compositional model rather than
+ // using inheritance.
+ //
+ // Note that in the grow case, chunks are _NOT_ closed
+ // at grow points, now.
+ //
+ // **** NOTE ****
+ // Since we will not support valuetypes with GIOP 1.1, that
+ // also means we do not support chunking there.
+ //
+ protected boolean primitiveAcrossFragmentedChunk = false;
+
+ // 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
+ // 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
+ // 3 applies to ALL chunking:
+ // 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
+
+ protected boolean specialChunk = false;
+
+ // Indicates whether the header should be padded. In GIOP 1.2 and above, the
+ // body must be aligned on a 8-octet boundary, and so the header needs to be
+ // padded appropriately. However, if there is no body to a request or reply
+ // message, there is no need to pad the header, in the unfragmented case.
+ private boolean headerPadding;
+
+ protected void handleSpecialChunkBegin(int requiredSize)
+ {
+ // If we're chunking and the item won't fit in the buffer
+ if (inBlock && requiredSize + bbwi.position() > bbwi.buflen) {
+
+ // Duplicating some code from end_block. Compute
+ // and write the total chunk length.
+
+ int oldSize = bbwi.position();
+ bbwi.position(blockSizeIndex - 4);
+
+ //write_long(oldSize - blockSizeIndex);
+ writeLongWithoutAlign((oldSize - blockSizeIndex) + requiredSize);
+ bbwi.position(oldSize);
+
+ // Set the special flag so we don't end the chunk when
+ // we fragment
+ specialChunk = true;
+ }
+ }
+
+ protected void handleSpecialChunkEnd()
+ {
+ // If we're in a chunk and the item spanned fragments
+ if (inBlock && specialChunk) {
+
+ // This is unnecessary, but I just want to show that
+ // we're done with the current chunk. (the end_block
+ // call is inappropriate here)
+ inBlock = false;
+ blockSizeIndex = -1;
+ blockSizePosition = -1;
+
+ // Start a new chunk since we fragmented during the item.
+ // Thus, no one can go back to add more to the chunk length
+ start_block();
+
+ // Now turn off the flag so we go back to the normal
+ // behavior of closing a chunk when we fragment and
+ // reopening afterwards.
+ specialChunk = false;
+ }
+ }
+
+ // Called after writing primitives
+ private void checkPrimitiveAcrossFragmentedChunk()
+ {
+ if (primitiveAcrossFragmentedChunk) {
+ primitiveAcrossFragmentedChunk = false;
+
+ inBlock = false;
+
+ // It would be nice to have a StreamPosition
+ // abstraction if we could avoid allocation
+ // overhead.
+ blockSizeIndex = -1;
+ blockSizePosition = -1;
+
+ // Start a new chunk
+ start_block();
+ }
+ }
+
+
+ public void write_octet(byte x) {
+ super.write_octet(x);
+ checkPrimitiveAcrossFragmentedChunk();
+ }
+
+ public void write_short(short x) {
+ super.write_short(x);
+ checkPrimitiveAcrossFragmentedChunk();
+ }
+
+ public void write_long(int x) {
+ super.write_long(x);
+ checkPrimitiveAcrossFragmentedChunk();
+ }
+
+ public void write_longlong(long x) {
+ super.write_longlong(x);
+ checkPrimitiveAcrossFragmentedChunk();
+ }
+
+ // Called by RequestMessage_1_2 or ReplyMessage_1_2 classes only.
+ void setHeaderPadding(boolean headerPadding) {
+ this.headerPadding = headerPadding;
+ }
+
+ 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
+ // 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.
+ if (headerPadding == true) {
+ 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
+ // 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.
+
+ bbwi.position(bbwi.position() + computeAlignment(align));
+
+ if (bbwi.position() + n > bbwi.buflen)
+ grow(align, n);
+ }
+
+ protected void grow(int align, int n) {
+
+ // Save the current size for possible post-fragmentation calculation
+ int oldSize = bbwi.position();
+
+ // See notes where specialChunk is defined, as well as the
+ // above notes for primitiveAcrossFragmentedChunk.
+ //
+ // If we're writing a primitive and chunking, we need to update
+ // the chunk length to include the length of the primitive (unless
+ // this complexity is handled by specialChunk).
+ //
+ // Note that this is wasted processing in the grow case, but that
+ // we don't actually close the chunk in that case.
+ boolean handleChunk = (inBlock && !specialChunk);
+ if (handleChunk) {
+ int oldIndex = bbwi.position();
+
+ bbwi.position(blockSizeIndex - 4);
+
+ writeLongWithoutAlign((oldIndex - blockSizeIndex) + n);
+
+ bbwi.position(oldIndex);
+ }
+
+ bbwi.needed = n;
+ bufferManagerWrite.overflow(bbwi);
+
+ // At this point, if we fragmented, we should have a ByteBufferWithInfo
+ // with the fragment header already marshalled. The buflen and position
+ // should be updated accordingly, and the fragmented flag should be set.
+
+ // Note that fragmented is only true in the streaming and collect cases.
+ if (bbwi.fragmented) {
+
+ // Clear the flag
+ bbwi.fragmented = false;
+
+ // 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
+ // fragment header of this buffer.
+ fragmentOffset += (oldSize - bbwi.position());
+
+ // We just fragmented, and need to signal that we should
+ // start a new chunk after writing the primitive.
+ if (handleChunk)
+ primitiveAcrossFragmentedChunk = true;
+
+ }
+ }
+
+ public GIOPVersion getGIOPVersion() {
+ return GIOPVersion.V1_2;
+ }
+
+ 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
+ // want that octet to get put in a different chunk at the end
+ // of the previous fragment.
+ //
+ // Ensure that this won't happen by overriding write_wchar_array
+ // and doing our own handleSpecialChunkBegin/End here.
+ CodeSetConversion.CTBConverter converter = getWCharConverter();
+
+ converter.convert(x);
+
+ handleSpecialChunkBegin(1 + converter.getNumBytes());
+
+ write_octet((byte)converter.getNumBytes());
+
+ byte[] result = converter.getBytes();
+
+ // Write the bytes without messing with chunking
+ // See CDROutputStream_1_0
+ internalWriteOctetArray(result, 0, converter.getNumBytes());
+
+ handleSpecialChunkEnd();
+ }
+
+ public void write_wchar_array(char[] value, int offset, int length)
+ {
+ if (value == null) {
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ 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
+ // 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);
+ byte[] buffer = new byte[maxLength + length];
+
+ for (int i = 0; i < length; i++) {
+ // Convert one wchar
+ converter.convert(value[offset + i]);
+
+ // Make sure to add the octet length
+ buffer[totalNumBytes++] = (byte)converter.getNumBytes();
+
+ // Copy it into our buffer
+ System.arraycopy(converter.getBytes(), 0,
+ buffer, totalNumBytes,
+ converter.getNumBytes());
+
+ totalNumBytes += converter.getNumBytes();
+ }
+
+ // Now that we know the total length, we can deal with chunking.
+ // Note that we don't have to worry about alignment since they're
+ // just octets.
+ handleSpecialChunkBegin(totalNumBytes);
+
+ // Must use totalNumBytes rather than buffer.length since the
+ // buffer.length is only the upper bound estimate.
+ internalWriteOctetArray(buffer, 0, totalNumBytes);
+
+ handleSpecialChunkEnd();
+ }
+
+ public void write_wstring(String value) {
+ if (value == null) {
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ // 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.
+ if (value.length() == 0) {
+ write_long(0);
+ return;
+ }
+
+ CodeSetConversion.CTBConverter converter = getWCharConverter();
+
+ converter.convert(value);
+
+ handleSpecialChunkBegin(computeAlignment(4) + 4 + converter.getNumBytes());
+
+ write_long(converter.getNumBytes());
+
+ // Write the octet array without tampering with chunking
+ internalWriteOctetArray(converter.getBytes(), 0, converter.getNumBytes());
+
+ handleSpecialChunkEnd();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java
new file mode 100644
index 0000000..3e69876
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CachedCodeBase.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.util.Hashtable;
+import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
+import com.sun.org.omg.SendingContext.CodeBase;
+import com.sun.org.omg.SendingContext.CodeBaseHelper;
+import com.sun.org.omg.SendingContext._CodeBaseImplBase;
+import com.sun.org.omg.SendingContext._CodeBaseStub;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.orb.ORB;
+/**
+ * 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
+ *
+ * Needs cache management.
+ */
+public class CachedCodeBase extends _CodeBaseImplBase
+{
+ private Hashtable implementations, fvds, bases;
+ private volatile CodeBase delegate;
+ private CorbaConnection conn;
+
+ private static Object iorMapLock = new Object();
+ private static Hashtable<IOR,CodeBase> iorMap = new Hashtable<>();
+
+ public static synchronized void cleanCache( ORB orb ) {
+ synchronized (iorMapLock) {
+ for (IOR ior : iorMap.keySet()) {
+ if (ior.getORB() == orb) {
+ iorMap.remove(ior);
+ }
+ }
+ }
+ }
+
+ public CachedCodeBase(CorbaConnection connection) {
+ conn = connection;
+ }
+
+ public com.sun.org.omg.CORBA.Repository get_ir () {
+ return null;
+ }
+
+ public synchronized String implementation (String repId) {
+ String urlResult = null;
+
+ if (implementations == null)
+ implementations = new Hashtable();
+ else
+ urlResult = (String)implementations.get(repId);
+
+ if (urlResult == null && connectedCodeBase()) {
+ urlResult = delegate.implementation(repId);
+
+ if (urlResult != null)
+ implementations.put(repId, urlResult);
+ }
+
+ return urlResult;
+ }
+
+ public synchronized String[] implementations (String[] repIds) {
+ String[] urlResults = new String[repIds.length];
+
+ for (int i = 0; i < urlResults.length; i++)
+ urlResults[i] = implementation(repIds[i]);
+
+ return urlResults;
+ }
+
+ public synchronized FullValueDescription meta (String repId) {
+ FullValueDescription result = null;
+
+ if (fvds == null)
+ fvds = new Hashtable();
+ else
+ result = (FullValueDescription)fvds.get(repId);
+
+ if (result == null && connectedCodeBase()) {
+ result = delegate.meta(repId);
+
+ if (result != null)
+ fvds.put(repId, result);
+ }
+
+ return result;
+ }
+
+ 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]);
+
+ return results;
+ }
+
+ public synchronized String[] bases (String repId) {
+
+ String[] results = null;
+
+ if (bases == null)
+ bases = new Hashtable();
+ else
+ results = (String[])bases.get(repId);
+
+ if (results == null && connectedCodeBase()) {
+ results = delegate.bases(repId);
+
+ if (results != null)
+ bases.put(repId, results);
+ }
+
+ return results;
+ }
+
+ // Ensures that we've used the connection's IOR to create
+ // a valid CodeBase delegate. If this returns false, then
+ // it is not valid to access the delegate.
+ private synchronized boolean connectedCodeBase() {
+ if (delegate != null)
+ return true;
+
+ // 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 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.
+ if (conn.getCodeBaseIOR() == null) {
+ // REVISIT. Use Merlin logging service to report that
+ // codebase functionality was requested but unavailable.
+ if (conn.getBroker().transportDebugFlag)
+ conn.dprint("CodeBase unavailable on connection: " + conn);
+
+ return false;
+ }
+
+ synchronized(iorMapLock) {
+
+ // Recheck the condition to make sure another
+ // thread didn't already do this while we waited
+ if (delegate != null)
+ return true;
+
+ // Do we have a reference initialized by another connection?
+ delegate = CachedCodeBase.iorMap.get(conn.getCodeBaseIOR());
+
+ if (delegate != null)
+ return true;
+
+ // Connect the delegate and update the cache
+ delegate = CodeBaseHelper.narrow(getObjectFromIOR());
+
+ // Save it for the benefit of other connections
+ CachedCodeBase.iorMap.put(conn.getCodeBaseIOR(), delegate);
+ }
+
+ // It's now safe to use the delegate
+ return true;
+ }
+
+ private final org.omg.CORBA.Object getObjectFromIOR() {
+ return CDRInputStream_1_0.internalIORToObject(
+ conn.getCodeBaseIOR(), null /*stubFactory*/, conn.getBroker());
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetCache.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetCache.java
new file mode 100644
index 0000000..bcd417b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetCache.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharsetEncoder;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+/**
+ * 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.
+ *
+ * This is used internally by CodeSetConversion.
+ */
+class CodeSetCache
+{
+ /**
+ * The ThreadLocal data is a 2 element Map array indexed
+ * by BTC_CACHE_MAP and CTB_CACHE_MAP.
+ */
+ private ThreadLocal converterCaches = new ThreadLocal() {
+ public java.lang.Object initialValue() {
+ return new Map[] { new WeakHashMap(), new WeakHashMap() };
+ }
+ };
+
+ /**
+ * Index in the thread local converterCaches array for
+ * the byte to char converter Map. A key is the Java
+ * name corresponding to the desired code set.
+ */
+ private static final int BTC_CACHE_MAP = 0;
+
+ /**
+ * Index in the thread local converterCaches array for
+ * the char to byte converter Map. A key is the Java
+ * name corresponding to the desired code set.
+ */
+ private static final int CTB_CACHE_MAP = 1;
+
+ /**
+ * Retrieve a CharsetDecoder from the Map using the given key.
+ */
+ CharsetDecoder getByteToCharConverter(Object key) {
+ Map btcMap = ((Map[])converterCaches.get())[BTC_CACHE_MAP];
+
+ return (CharsetDecoder)btcMap.get(key);
+ }
+
+ /**
+ * Retrieve a CharsetEncoder from the Map using the given key.
+ */
+ CharsetEncoder getCharToByteConverter(Object key) {
+ Map ctbMap = ((Map[])converterCaches.get())[CTB_CACHE_MAP];
+
+ return (CharsetEncoder)ctbMap.get(key);
+ }
+
+ /**
+ * Stores the given CharsetDecoder in the thread local cache,
+ * and returns the same converter.
+ */
+ CharsetDecoder setConverter(Object key, CharsetDecoder converter) {
+ Map btcMap = ((Map[])converterCaches.get())[BTC_CACHE_MAP];
+
+ btcMap.put(key, converter);
+
+ return converter;
+ }
+
+ /**
+ * Stores the given CharsetEncoder in the thread local cache,
+ * and returns the same converter.
+ */
+ CharsetEncoder setConverter(Object key, CharsetEncoder converter) {
+
+ Map ctbMap = ((Map[])converterCaches.get())[CTB_CACHE_MAP];
+
+ ctbMap.put(key, converter);
+
+ return converter;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java
new file mode 100644
index 0000000..8f0e7c0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetComponentInfo.java
@@ -0,0 +1,340 @@
+/*
+ * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.util.StringTokenizer;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.NoSuchElementException;
+import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+public final class CodeSetComponentInfo {
+
+ /**
+ * 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;
+
+ public boolean equals( Object obj )
+ {
+ if (this == obj)
+ return true ;
+
+ if (!(obj instanceof CodeSetComponent))
+ return false ;
+
+ CodeSetComponent other = (CodeSetComponent)obj ;
+
+ return (nativeCodeSet == other.nativeCodeSet) &&
+ Arrays.equals( conversionCodeSets, other.conversionCodeSets ) ;
+ }
+
+ public int hashCode()
+ {
+ int result = nativeCodeSet ;
+ for (int ctr=0; ctr<conversionCodeSets.length; ctr++)
+ result = 37*result + conversionCodeSets[ctr] ;
+ return result ;
+ }
+
+ public CodeSetComponent() {}
+
+ public CodeSetComponent(int nativeCodeSet, int[] conversionCodeSets) {
+ this.nativeCodeSet = nativeCodeSet;
+ if (conversionCodeSets == null)
+ this.conversionCodeSets = new int[0];
+ else
+ this.conversionCodeSets = conversionCodeSets;
+ }
+
+ public void read(MarshalInputStream in) {
+ nativeCodeSet = in.read_ulong();
+ int len = in.read_long();
+ conversionCodeSets = new int[len];
+ in.read_ulong_array(conversionCodeSets, 0, len);
+
+ }
+
+ public void write(MarshalOutputStream out) {
+ out.write_ulong(nativeCodeSet);
+ out.write_long(conversionCodeSets.length);
+ out.write_ulong_array(conversionCodeSets, 0, conversionCodeSets.length);
+ }
+
+ public String toString() {
+ StringBuffer sbuf = new StringBuffer("CodeSetComponent(");
+
+ sbuf.append("native:");
+ sbuf.append(Integer.toHexString(nativeCodeSet));
+ sbuf.append(" conversion:");
+ if (conversionCodeSets == null)
+ sbuf.append("null");
+ else {
+ for (int i = 0; i < conversionCodeSets.length; i++) {
+ sbuf.append(Integer.toHexString(conversionCodeSets[i]));
+ sbuf.append(' ');
+ }
+ }
+ sbuf.append( ")" ) ;
+
+ return sbuf.toString();
+ }
+ }
+
+ private CodeSetComponent forCharData;
+ private CodeSetComponent forWCharData;
+
+ public boolean equals( Object obj )
+ {
+ if (this == obj)
+ return true ;
+
+ if (!(obj instanceof CodeSetComponentInfo))
+ return false ;
+
+ CodeSetComponentInfo other = (CodeSetComponentInfo)obj ;
+ return forCharData.equals( other.forCharData ) &&
+ forWCharData.equals( other.forWCharData ) ;
+ }
+
+ public int hashCode()
+ {
+ return forCharData.hashCode() ^ forWCharData.hashCode() ;
+ }
+
+ public String toString() {
+ StringBuffer sbuf = new StringBuffer("CodeSetComponentInfo(");
+
+ sbuf.append("char_data:");
+ sbuf.append(forCharData.toString());
+ sbuf.append(" wchar_data:");
+ sbuf.append(forWCharData.toString());
+ sbuf.append(")");
+
+ return sbuf.toString();
+ }
+
+ public CodeSetComponentInfo() {
+ forCharData = CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.forCharData;
+ forWCharData = CodeSetComponentInfo.JAVASOFT_DEFAULT_CODESETS.forWCharData;
+ }
+
+ public CodeSetComponentInfo(CodeSetComponent charData,
+ CodeSetComponent wcharData) {
+ forCharData = charData;
+ forWCharData = wcharData;
+ }
+
+ public void read(MarshalInputStream in) {
+ forCharData = new CodeSetComponent();
+ forCharData.read(in);
+ forWCharData = new CodeSetComponent();
+ forWCharData.read(in);
+ }
+
+ public void write(MarshalOutputStream out) {
+ forCharData.write(out);
+ forWCharData.write(out);
+ }
+
+ public CodeSetComponent getCharComponent() {
+ return forCharData;
+ }
+
+ public CodeSetComponent getWCharComponent() {
+ return forWCharData;
+ }
+
+ /**
+ * CodeSetContext goes in a GIOP service context
+ */
+ public static final class CodeSetContext {
+ private int char_data;
+ private int wchar_data;
+
+ public CodeSetContext() {}
+
+ public CodeSetContext(int charEncoding, int wcharEncoding) {
+ char_data = charEncoding;
+ wchar_data = wcharEncoding;
+ }
+
+ public void read(MarshalInputStream in) {
+ char_data = in.read_ulong();
+ wchar_data = in.read_ulong();
+ }
+
+ public void write(MarshalOutputStream out) {
+ out.write_ulong(char_data);
+ out.write_ulong(wchar_data);
+ }
+
+ public int getCharCodeSet() {
+ return char_data;
+ }
+
+ public int getWCharCodeSet() {
+ return wchar_data;
+ }
+
+ public String toString() {
+ StringBuffer sbuf = new StringBuffer();
+ sbuf.append("CodeSetContext char set: ");
+ sbuf.append(Integer.toHexString(char_data));
+ sbuf.append(" wchar set: ");
+ sbuf.append(Integer.toHexString(wchar_data));
+ return sbuf.toString();
+ }
+ }
+
+ /**
+ * Our default code set scheme is as follows:
+ *
+ * char data:
+ *
+ * Native code set: ISO 8859-1 (8-bit)
+ * Conversion sets: UTF-8, ISO 646 (7-bit)
+ *
+ * wchar data:
+ *
+ * Native code set: UTF-16
+ * Conversion sets: UCS-2
+ *
+ * Pre-Merlin/J2EE 1.3 JavaSoft ORBs listed ISO646 for char and
+ * UCS-2 for wchar, and provided no conversion sets. They also
+ * didn't do correct negotiation or provide the fallback sets.
+ * UCS-2 is still in the conversion list for backwards compatibility.
+ *
+ * The fallbacks are UTF-8 for char and UTF-16 for wchar.
+ *
+ * In GIOP 1.1, interoperability with wchar is limited to 2 byte fixed
+ * width encodings since its wchars aren't preceded by a length.
+ * Thus, I've chosen not to include UTF-8 in the conversion set
+ * for wchar data.
+ *
+ */
+ public static final CodeSetComponentInfo JAVASOFT_DEFAULT_CODESETS;
+ static {
+ CodeSetComponent charData
+ = new CodeSetComponent(OSFCodeSetRegistry.ISO_8859_1.getNumber(),
+ new int[] {
+ OSFCodeSetRegistry.UTF_8.getNumber(),
+ OSFCodeSetRegistry.ISO_646.getNumber()
+ });
+
+ CodeSetComponent wcharData
+ = new CodeSetComponent(OSFCodeSetRegistry.UTF_16.getNumber(),
+ new int[]
+ {
+ OSFCodeSetRegistry.UCS_2.getNumber()
+ });
+
+ JAVASOFT_DEFAULT_CODESETS = new CodeSetComponentInfo(charData, wcharData);
+ }
+
+ /**
+ * Creates a CodeSetComponent from a String which contains a comma
+ * delimited list of OSF Code Set Registry numbers. An INITIALIZE
+ * exception is thrown if any of the numbers are not known by our
+ * registry. Used by corba.ORB init.
+ *
+ * The first number in the list is taken as the native code set,
+ * and the rest is the conversion code set list.
+ *
+ * The numbers can either be decimal or hex.
+ */
+ public static CodeSetComponent createFromString(String str) {
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ if (str == null || str.length() == 0)
+ throw wrapper.badCodeSetString() ;
+
+ StringTokenizer stok = new StringTokenizer(str, ", ", false);
+ int nativeSet = 0;
+ int conversionInts[] = null;
+
+ try {
+
+ // The first value is the native code set
+ nativeSet = Integer.decode(stok.nextToken()).intValue();
+
+ if (OSFCodeSetRegistry.lookupEntry(nativeSet) == null)
+ throw wrapper.unknownNativeCodeset( new Integer(nativeSet) ) ;
+
+ List 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 ) ;
+
+ conversionList.add(value);
+ }
+
+ conversionInts = new int[conversionList.size()];
+
+ for (int i = 0; i < conversionInts.length; i++)
+ conversionInts[i] = ((Integer)conversionList.get(i)).intValue();
+
+ } catch (NumberFormatException nfe) {
+ throw wrapper.invalidCodeSetNumber( nfe ) ;
+ } catch (NoSuchElementException nsee) {
+ throw wrapper.invalidCodeSetString( nsee, str ) ;
+ }
+
+ // Otherwise return the CodeSetComponent representing
+ // the given values
+ return new CodeSetComponent(nativeSet, conversionInts);
+ }
+
+ /**
+ * 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());
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetConversion.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetConversion.java
new file mode 100644
index 0000000..3247d9f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/CodeSetConversion.java
@@ -0,0 +1,708 @@
+/*
+ * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.nio.ByteBuffer;
+import java.nio.CharBuffer;
+import java.nio.charset.Charset;
+import java.nio.charset.CharsetEncoder;
+import java.nio.charset.CharsetDecoder;
+import java.nio.charset.CharacterCodingException;
+import java.nio.charset.IllegalCharsetNameException;
+import java.nio.charset.MalformedInputException;
+import java.nio.charset.UnsupportedCharsetException;
+import java.nio.charset.UnmappableCharacterException;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+/**
+ * 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
+ * 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
+ * {@code char[] & CharBuffer} and
+ * {@code byte[] & ByteBuffer}, especially
+ * DirectByteBuffers.
+ *
+ */
+public class CodeSetConversion
+{
+ /**
+ * 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)
+ */
+ 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?
+ public abstract int getNumBytes();
+
+ // What's the maximum number of bytes per character?
+ public abstract float getMaxBytesPerChar();
+
+ public abstract boolean isFixedWidthEncoding();
+
+ // What byte boundary should the stream align to before
+ // 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)
+ //
+ // 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()
+ // to determine the end of the data in the byte array instead
+ // of array.length! The array may be used internally, so don't
+ // save references.
+ public abstract byte[] getBytes();
+ }
+
+ /**
+ * Abstraction for byte to char conversion.
+ */
+ public abstract static class BTCConverter
+ {
+ // In GIOP 1.1, interoperability can only be achieved with
+ // fixed width encodings like UTF-16. This is because wstrings
+ // specified how many code points follow rather than specifying
+ // the length in octets.
+ public abstract boolean isFixedWidthEncoding();
+ public abstract int getFixedCharWidth();
+
+ // Called after getChars to determine the true size of the
+ // converted array.
+ public abstract int getNumChars();
+
+ // Perform the conversion using length bytes from the given
+ // 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);
+ }
+
+ /**
+ * 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 ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ private OMGSystemException omgWrapper = OMGSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ // 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,
+ // 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.
+ private char[] chars = null;
+
+ // How many bytes are generated from the conversion?
+ private int numBytes = 0;
+
+ // How many characters were converted (temporary variable
+ // for cross method communication)
+ private int numChars = 0;
+
+ // 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;
+
+ // What code set are we using?
+ private OSFCodeSetRegistry.Entry codeset;
+
+ public JavaCTBConverter(OSFCodeSetRegistry.Entry codeset,
+ int alignmentForEncoding) {
+
+ try {
+ ctb = cache.getCharToByteConverter(codeset.getName());
+ if (ctb == null) {
+ Charset tmpCharset = Charset.forName(codeset.getName());
+ ctb = tmpCharset.newEncoder();
+ cache.setConverter(codeset.getName(), ctb);
+ }
+ } 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) {
+
+ // This can only happen if one of our Entries has
+ // an unsupported name.
+ throw wrapper.invalidCtbConverterName(ucne,codeset.getName());
+ }
+
+ this.codeset = codeset;
+ alignment = alignmentForEncoding;
+ }
+
+ public final float getMaxBytesPerChar() {
+ return ctb.maxBytesPerChar();
+ }
+
+ public void convert(char chToConvert) {
+ if (chars == null)
+ chars = new char[1];
+
+ // The CharToByteConverter only takes a char[]
+ chars[0] = chToConvert;
+ numChars = 1;
+
+ convertCharArray();
+ }
+
+ 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
+ // 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();
+
+ strToConvert.getChars(0, numChars, chars, 0);
+
+ convertCharArray();
+ }
+
+ public final int getNumBytes() {
+ return numBytes;
+ }
+
+ public final int getAlignment() {
+ return alignment;
+ }
+
+ public final boolean isFixedWidthEncoding() {
+ return codeset.isFixedWidth();
+ }
+
+ public byte[] getBytes() {
+ // Note that you can't use buffer.length since the buffer might
+ // be larger than the actual number of converted bytes depending
+ // on the encoding.
+ return buffer.array();
+ }
+
+ 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
+ // confusing partial conversion scheme for when we couldn't
+ // fit everything in the buffer but needed to know the
+ // converted length before proceeding due to fragmentation.
+ // 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
+ // factor of 2 increase.
+
+ // Convert the characters
+ 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.
+ numBytes = buffer.limit();
+
+ } catch (IllegalStateException ise) {
+ // an encoding operation is already in progress
+ throw wrapper.ctbConverterFailure( ise ) ;
+ } catch (MalformedInputException mie) {
+ // There were illegal Unicode char pairs
+ 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 ) ;
+ } catch (CharacterCodingException cce) {
+ // If this happens, then some other encoding error occured
+ throw wrapper.ctbConverterFailure( cce ) ;
+ }
+ }
+ }
+
+ /**
+ * Special UTF16 converter which can either always write a BOM
+ * or use a specified byte order without one.
+ */
+ private class UTF16CTBConverter extends JavaCTBConverter
+ {
+ // Using this constructor, we will always write a BOM
+ public UTF16CTBConverter() {
+ super(OSFCodeSetRegistry.UTF_16, 2);
+ }
+
+ // Using this constructor, we don't use a BOM and use the
+ // byte order specified
+ public UTF16CTBConverter(boolean littleEndian) {
+ super(littleEndian ?
+ OSFCodeSetRegistry.UTF_16LE :
+ OSFCodeSetRegistry.UTF_16BE,
+ 2);
+ }
+ }
+
+ /**
+ * 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
+ {
+ private ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ private OMGSystemException omgWrapper = OMGSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ protected CharsetDecoder btc;
+ private char[] buffer;
+ private int resultingNumChars;
+ private OSFCodeSetRegistry.Entry codeset;
+
+ public JavaBTCConverter(OSFCodeSetRegistry.Entry codeset) {
+
+ // Obtain a Decoder
+ btc = this.getConverter(codeset.getName());
+
+ this.codeset = codeset;
+ }
+
+ public final boolean isFixedWidthEncoding() {
+ return codeset.isFixedWidth();
+ }
+
+ // Should only be called if isFixedWidthEncoding is true
+ // IMPORTANT: This calls OSFCodeSetRegistry.Entry, not
+ // CharsetDecoder.maxCharsPerByte().
+ public final int getFixedCharWidth() {
+ return codeset.getMaxBytesPerChar();
+ }
+
+ public final int getNumChars() {
+ return resultingNumChars;
+ }
+
+ 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
+ // 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.
+ // Also makes the interface more difficult.
+
+
+ try {
+
+ ByteBuffer byteBuf = ByteBuffer.wrap(bytes, offset, numBytes);
+ CharBuffer charBuf = btc.decode(byteBuf);
+
+ // CharBuffer returned by the decoder will set its limit
+ // to byte immediately after the last written byte.
+ 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.
+ if (charBuf.limit() == charBuf.capacity()) {
+ buffer = charBuf.array();
+ } else {
+ buffer = new char[charBuf.limit()];
+ charBuf.get(buffer, 0, charBuf.limit()).position(0);
+ }
+
+ return buffer;
+
+ } catch (IllegalStateException ile) {
+ // There were a decoding operation already in progress
+ throw wrapper.btcConverterFailure( ile ) ;
+ } catch (MalformedInputException mie) {
+ // There were illegal Unicode char pairs
+ 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 ) ;
+ } catch (CharacterCodingException cce) {
+ // If this happens, then a character decoding error occured.
+ 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.
+ */
+ protected CharsetDecoder getConverter(String javaCodeSetName) {
+
+ CharsetDecoder result = null;
+ try {
+ result = cache.getByteToCharConverter(javaCodeSetName);
+
+ if (result == null) {
+ Charset tmpCharset = Charset.forName(javaCodeSetName);
+ result = tmpCharset.newDecoder();
+ cache.setConverter(javaCodeSetName, result);
+ }
+
+ } catch(IllegalCharsetNameException icne) {
+ // This can only happen if one of our charset entries has
+ // an illegal name.
+ throw wrapper.invalidBtcConverterName( icne, javaCodeSetName ) ;
+ }
+
+ return result;
+ }
+ }
+
+ /**
+ * 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.
+ */
+ private class UTF16BTCConverter extends JavaBTCConverter
+ {
+ private boolean defaultToLittleEndian;
+ private boolean converterUsesBOM = true;
+
+ private static final char UTF16_BE_MARKER = (char) 0xfeff;
+ private static final char UTF16_LE_MARKER = (char) 0xfffe;
+
+ // When there isn't a byte order marker, used the byte
+ // order specified.
+ public UTF16BTCConverter(boolean defaultToLittleEndian) {
+ super(OSFCodeSetRegistry.UTF_16);
+
+ this.defaultToLittleEndian = defaultToLittleEndian;
+ }
+
+ public char[] getChars(byte[] bytes, int offset, int numBytes) {
+
+ if (hasUTF16ByteOrderMarker(bytes, offset, numBytes)) {
+ if (!converterUsesBOM)
+ switchToConverter(OSFCodeSetRegistry.UTF_16);
+
+ converterUsesBOM = true;
+
+ return super.getChars(bytes, offset, numBytes);
+ } else {
+ if (converterUsesBOM) {
+ if (defaultToLittleEndian)
+ switchToConverter(OSFCodeSetRegistry.UTF_16LE);
+ else
+ switchToConverter(OSFCodeSetRegistry.UTF_16BE);
+
+ converterUsesBOM = false;
+ }
+
+ return super.getChars(bytes, offset, numBytes);
+ }
+ }
+
+ /**
+ * Utility method for determining if a UTF-16 byte order marker is present.
+ */
+ private boolean hasUTF16ByteOrderMarker(byte[] array, int offset, int length) {
+ // If there aren't enough bytes to represent the marker and data,
+ // return false.
+ if (length >= 4) {
+
+ int b1 = array[offset] & 0x00FF;
+ int b2 = array[offset + 1] & 0x00FF;
+
+ char marker = (char)((b1 << 8) | (b2 << 0));
+
+ 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.
+ */
+ private void switchToConverter(OSFCodeSetRegistry.Entry newCodeSet) {
+
+ // Use the getConverter method from our superclass.
+ btc = super.getConverter(newCodeSet.getName());
+ }
+ }
+
+ /**
+ * CTB converter factory for single byte or variable length encodings.
+ */
+ public CTBConverter getCTBConverter(OSFCodeSetRegistry.Entry codeset) {
+ 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.
+ *
+ * If you select useByteOrderMarkers, there is no guarantee that the encoding
+ * will use the endianness specified.
+ *
+ */
+ public 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.
+ // They should be identical with only minor differences in
+ // negative cases.
+ if (codeset == OSFCodeSetRegistry.UCS_2)
+ return new UTF16CTBConverter(littleEndian);
+
+ // We can write UTF-16 with or without a byte order marker.
+ if (codeset == OSFCodeSetRegistry.UTF_16) {
+ if (useByteOrderMarkers)
+ return new UTF16CTBConverter();
+ else
+ return new UTF16CTBConverter(littleEndian);
+ }
+
+ // Everything else uses the generic JavaCTBConverter.
+ //
+ // 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
+ // 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());
+
+ return new JavaCTBConverter(codeset, alignment);
+ }
+
+ /**
+ * BTCConverter factory for single byte or variable width encodings.
+ */
+ public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset) {
+ return new JavaBTCConverter(codeset);
+ }
+
+ /**
+ * BTCConverter factory for fixed width multibyte encodings.
+ */
+ public BTCConverter getBTCConverter(OSFCodeSetRegistry.Entry codeset,
+ boolean defaultToLittleEndian) {
+
+ if (codeset == OSFCodeSetRegistry.UTF_16 ||
+ codeset == OSFCodeSetRegistry.UCS_2) {
+
+ return new UTF16BTCConverter(defaultToLittleEndian);
+ } else {
+ return new JavaBTCConverter(codeset);
+ }
+ }
+
+ /**
+ * 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.
+ */
+ 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
+ // 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.
+ int serverNative = server.nativeCodeSet;
+
+ if (serverNative == 0) {
+ if (server.conversionCodeSets.length > 0)
+ serverNative = server.conversionCodeSets[0];
+ else
+ return CodeSetConversion.FALLBACK_CODESET;
+ }
+
+ if (client.nativeCodeSet == serverNative) {
+ // Best case -- client and server don't have to convert
+ return serverNative;
+ }
+
+ // Is this client capable of converting to the server's
+ // native code set?
+ for (int i = 0; i < client.conversionCodeSets.length; i++) {
+ if (serverNative == client.conversionCodeSets[i]) {
+ // The client will convert to the server's
+ // native code set.
+ return serverNative;
+ }
+ }
+
+ // Is the server capable of converting to the client's
+ // native code set?
+ for (int i = 0; i < server.conversionCodeSets.length; i++) {
+ if (client.nativeCodeSet == server.conversionCodeSets[i]) {
+ // The server will convert to the client's
+ // native code set.
+ return client.nativeCodeSet;
+ }
+ }
+
+ // See if there are any code sets that both the server and client
+ // 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++) {
+ if (server.conversionCodeSets[i] == client.conversionCodeSets[y]) {
+ return server.conversionCodeSets[i];
+ }
+ }
+ }
+
+ // Before using the fallback codesets, the spec calls for a
+ // 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
+ // 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.
+ */
+ 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());
+
+ if (wcharData == CodeSetConversion.FALLBACK_CODESET) {
+ wcharData = OSFCodeSetRegistry.UTF_16.getNumber();
+ }
+
+ return new CodeSetComponentInfo.CodeSetContext(charData,
+ wcharData);
+ }
+
+ // No one should instantiate a CodeSetConversion but the singleton
+ // instance method
+ private CodeSetConversion() {}
+
+ // initialize-on-demand holder
+ private static class CodeSetConversionHolder {
+ static final CodeSetConversion csc = new CodeSetConversion() ;
+ }
+
+ /**
+ * CodeSetConversion is a singleton, and this is the access point.
+ */
+ public final static CodeSetConversion impl() {
+ return CodeSetConversionHolder.csc ;
+ }
+
+ // Singleton instance
+ private static CodeSetConversion implementation;
+
+ // Number used internally to indicate the fallback code
+ // set.
+ private static final int FALLBACK_CODESET = 0;
+
+ // Provides a thread local cache for the sun.io
+ // converters.
+ private CodeSetCache cache = new CodeSetCache();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java
new file mode 100644
index 0000000..7853812
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsInputStream.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.nio.ByteBuffer;
+import org.omg.CORBA.CompletionStatus;
+import com.sun.org.omg.SendingContext.CodeBase;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.BufferManagerFactory;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+import sun.corba.EncapsInputStreamFactory;
+/**
+ * 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.
+ *
+ * When more encapsulations arise that have their own special code
+ * sets defined, we can make all constructors take such parameters.
+ */
+public class EncapsInputStream extends CDRInputStream
+{
+ private ORBUtilSystemException wrapper ;
+
+ // corba/EncapsOutputStream
+ // corba/ORBSingleton
+ // iiop/ORB
+ public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] buf,
+ int size, boolean littleEndian,
+ GIOPVersion version) {
+ super(orb, ByteBuffer.wrap(buf), size, littleEndian,
+ version, Message.CDR_ENC_VERSION,
+ BufferManagerFactory.newBufferManagerRead(
+ BufferManagerFactory.GROW,
+ Message.CDR_ENC_VERSION,
+ (ORB)orb));
+
+ wrapper = ORBUtilSystemException.get( (ORB)orb,
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ performORBVersionSpecificInit();
+ }
+
+ public EncapsInputStream(org.omg.CORBA.ORB orb, ByteBuffer byteBuffer,
+ int size, boolean littleEndian,
+ GIOPVersion version) {
+ super(orb, byteBuffer, size, littleEndian,
+ version, Message.CDR_ENC_VERSION,
+ BufferManagerFactory.newBufferManagerRead(
+ BufferManagerFactory.GROW,
+ Message.CDR_ENC_VERSION,
+ (com.sun.corba.se.spi.orb.ORB)orb));
+
+ performORBVersionSpecificInit();
+ }
+
+ // ior/IdentifiableBase
+ // ior/IIOPProfile
+ // corba/ORBSingleton
+ // iiop/ORB
+ public EncapsInputStream(org.omg.CORBA.ORB orb, byte[] data, int size)
+ {
+ this(orb, data, size, GIOPVersion.V1_2);
+ }
+
+ // corba/AnyImpl
+ public EncapsInputStream(EncapsInputStream eis)
+ {
+ super(eis);
+
+ wrapper = ORBUtilSystemException.get( (ORB)(eis.orb()),
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ performORBVersionSpecificInit();
+ }
+
+ // CDREncapsCodec
+ // ServiceContext
+ //
+ // 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)
+ {
+ this(orb, data, size, false, 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.
+ */
+ public EncapsInputStream(org.omg.CORBA.ORB orb,
+ byte[] data,
+ int size,
+ GIOPVersion version,
+ CodeBase codeBase) {
+ super(orb,
+ ByteBuffer.wrap(data),
+ size,
+ false,
+ version, Message.CDR_ENC_VERSION,
+ BufferManagerFactory.newBufferManagerRead(
+ BufferManagerFactory.GROW,
+ Message.CDR_ENC_VERSION,
+ (ORB)orb));
+
+ this.codeBase = codeBase;
+
+ performORBVersionSpecificInit();
+ }
+
+ public CDRInputStream dup() {
+ return EncapsInputStreamFactory.newEncapsInputStream(this);
+ }
+
+ protected CodeSetConversion.BTCConverter createCharBTCConverter() {
+ return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.ISO_8859_1);
+ }
+
+ protected CodeSetConversion.BTCConverter createWCharBTCConverter() {
+ // Wide characters don't exist in GIOP 1.0
+ if (getGIOPVersion().equals(GIOPVersion.V1_0))
+ throw wrapper.wcharDataInGiop10( CompletionStatus.COMPLETED_MAYBE);
+
+ // 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,
+ isLittleEndian());
+
+ // Assume anything else adheres to GIOP 1.2 requirements.
+ //
+ // 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.
+ // formal 00-11-03 15.3.16.
+ return CodeSetConversion.impl().getBTCConverter(OSFCodeSetRegistry.UTF_16,
+ false);
+ }
+
+ public CodeBase getCodeBase() {
+ return codeBase;
+ }
+
+ private CodeBase codeBase;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java
new file mode 100644
index 0000000..4f908dc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/EncapsOutputStream.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+import com.sun.corba.se.impl.encoding.BufferManagerWrite;
+import com.sun.corba.se.impl.encoding.BufferManagerFactory;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+import sun.corba.EncapsInputStreamFactory;
+
+/**
+ * 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.
+ *
+ * When more encapsulations arise that have their own special code
+ * sets defined, we can make all constructors take such parameters.
+ */
+public class EncapsOutputStream extends CDROutputStream
+{
+
+ // REVISIT - Right now, EncapsOutputStream's do not use
+ // pooled byte buffers. This is controlled by the following
+ // static constant. This should be re-factored such that
+ // the EncapsOutputStream doesn't know it's using pooled
+ // byte buffers.
+ final static boolean usePooledByteBuffers = false;
+
+ // REVISIT - Right now, valuetypes in encapsulations will
+ // only use stream format version 1, which may create problems
+ // for service contexts or codecs (?).
+
+ // corba/ORB
+ // corba/ORBSingleton
+ // iiop/ORB
+ // iiop/GIOPImpl
+ // corba/AnyImpl
+ public EncapsOutputStream(ORB orb) {
+ // GIOP version 1.2 with no fragmentation, big endian,
+ // UTF8 for char data and UTF-16 for wide char data;
+ this(orb, GIOPVersion.V1_2);
+ }
+
+ // CDREncapsCodec
+ //
+ // REVISIT. A UTF-16 encoding with GIOP 1.1 will not work
+ // with byte order markers.
+ public EncapsOutputStream(ORB orb, GIOPVersion version) {
+ this(orb, version, false);
+ }
+
+ // Used by IIOPProfileTemplate
+ //
+ public EncapsOutputStream(ORB orb, boolean isLittleEndian) {
+ this(orb, GIOPVersion.V1_2, isLittleEndian);
+ }
+
+ public EncapsOutputStream(ORB orb,
+ GIOPVersion version,
+ boolean isLittleEndian)
+ {
+ super(orb, version, Message.CDR_ENC_VERSION, isLittleEndian,
+ BufferManagerFactory.newBufferManagerWrite(
+ BufferManagerFactory.GROW,
+ Message.CDR_ENC_VERSION,
+ orb),
+ ORBConstants.STREAM_FORMAT_VERSION_1,
+ usePooledByteBuffers);
+ }
+
+ public org.omg.CORBA.portable.InputStream create_input_stream() {
+ freeInternalCaches();
+
+ return EncapsInputStreamFactory.newEncapsInputStream(orb(),
+ getByteBuffer(),
+ getSize(),
+ isLittleEndian(),
+ getGIOPVersion());
+ }
+
+ protected CodeSetConversion.CTBConverter createCharCTBConverter() {
+ return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.ISO_8859_1);
+ }
+
+ protected CodeSetConversion.CTBConverter createWCharCTBConverter() {
+ if (getGIOPVersion().equals(GIOPVersion.V1_0))
+ throw wrapper.wcharDataInGiop10(CompletionStatus.COMPLETED_MAYBE);
+
+ // 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))
+ return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16,
+ isLittleEndian(),
+ false);
+
+ // Assume anything else meets GIOP 1.2 requirements
+ //
+ // 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();
+
+ return CodeSetConversion.impl().getCTBConverter(OSFCodeSetRegistry.UTF_16,
+ false,
+ useBOM);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java
new file mode 100644
index 0000000..12ca370
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationInputStream.java
@@ -0,0 +1,1083 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.io.Serializable;
+import java.io.ObjectInputStream;
+import java.io.ByteArrayInputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.math.BigDecimal;
+import java.util.LinkedList;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
+import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
+
+import com.sun.corba.se.impl.util.Utility;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.corba.TypeCodeImpl;
+import com.sun.corba.se.impl.util.RepositoryId;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * Implementation class that uses Java serialization for input streams.
+ * This assumes a GIOP version 1.2 message format.
+ *
+ * This class uses a ByteArrayInputStream as the underlying buffer. The
+ * first 16 bytes are directly read out of the underlying buffer. This allows
+ * [GIOPHeader (12 bytes) + requestID (4 bytes)] to be read as bytes.
+ * Subsequent write operations on this output stream object uses
+ * ObjectInputStream class to read into the buffer. This allows unmarshaling
+ * complex types and graphs using the ObjectInputStream implementation.
+ *
+ * Note, this class assumes a GIOP 1.2 style header. Further, the first
+ * 12 bytes, that is, the GIOPHeader is read directly from the received
+ * message, before this stream object is called. So, this class effectively
+ * reads only the requestID (4 bytes) directly, and uses the
+ * ObjectInputStream for further unmarshaling.
+ *
+ * @author Ram Jeyaraman
+ */
+public class IDLJavaSerializationInputStream extends CDRInputStreamBase {
+
+ private ORB orb;
+ private int bufSize;
+ private ByteBuffer buffer;
+ private byte encodingVersion;
+ private ObjectInputStream is;
+ private _ByteArrayInputStream bis;
+ private BufferManagerRead bufferManager;
+
+ // [GIOPHeader(12) + requestID(4)] bytes
+ private final int directReadLength = Message.GIOPMessageHeaderLength + 4;
+
+ // Used for mark / reset operations.
+ private boolean markOn;
+ private int peekIndex, peekCount;
+ private LinkedList markedItemQ = new LinkedList();
+
+ protected ORBUtilSystemException wrapper;
+
+ class _ByteArrayInputStream extends ByteArrayInputStream {
+
+ _ByteArrayInputStream(byte[] buf) {
+ super(buf);
+ }
+
+ int getPosition() {
+ return this.pos;
+ }
+
+ void setPosition(int value) {
+ if (value < 0 || value > count) {
+ throw new IndexOutOfBoundsException();
+ }
+ this.pos = value;
+ }
+ }
+
+ class MarshalObjectInputStream extends ObjectInputStream {
+
+ ORB orb;
+
+ MarshalObjectInputStream(java.io.InputStream out, ORB orb)
+ throws IOException {
+
+ super(out);
+ this.orb = orb;
+
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ // needs SerializablePermission("enableSubstitution")
+ enableResolveObject(true);
+ return null;
+ }
+ }
+ );
+ }
+
+ /**
+ * Connect the Stub to the ORB.
+ */
+ protected final Object resolveObject(Object obj) throws IOException {
+ try {
+ if (StubAdapter.isStub(obj)) {
+ StubAdapter.connect(obj, orb);
+ }
+ } catch (java.rmi.RemoteException re) {
+ IOException ie = new IOException("resolveObject failed");
+ ie.initCause(re);
+ throw ie;
+ }
+ return obj;
+ }
+ }
+
+ public IDLJavaSerializationInputStream(byte encodingVersion) {
+ super();
+ this.encodingVersion = encodingVersion;
+ }
+
+ public void init(org.omg.CORBA.ORB orb,
+ ByteBuffer byteBuffer,
+ int bufSize,
+ boolean littleEndian,
+ BufferManagerRead bufferManager) {
+ this.orb = (ORB) orb;
+ this.bufSize = bufSize;
+ this.bufferManager = bufferManager;
+ buffer = byteBuffer;
+ wrapper =
+ ORBUtilSystemException.get((ORB)orb, CORBALogDomains.RPC_ENCODING);
+
+ byte[] buf;
+ if (buffer.hasArray()) {
+ buf = buffer.array();
+ } else {
+ buf = new byte[bufSize];
+ buffer.get(buf);
+ }
+ // Note: at this point, the buffer position is zero. The setIndex()
+ // method call can be used to set a desired read index.
+ bis = new _ByteArrayInputStream(buf);
+ }
+
+ // Called from read_octet or read_long or read_ulong method.
+ private void initObjectInputStream() {
+ //System.out.print(" is ");
+ if (is != null) {
+ throw wrapper.javaStreamInitFailed();
+ }
+ try {
+ is = new MarshalObjectInputStream(bis, orb);
+ } catch (Exception e) {
+ throw wrapper.javaStreamInitFailed(e);
+ }
+ }
+
+ // org.omg.CORBA.portable.InputStream
+
+ // Primitive types.
+
+ public boolean read_boolean() {
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return ((Boolean)markedItemQ.removeFirst()).booleanValue();
+ }
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return ((Boolean)markedItemQ.get(peekIndex++)).booleanValue();
+ }
+ try {
+ boolean value = is.readBoolean();
+ if (markOn) { // enqueue
+ markedItemQ.addLast(Boolean.valueOf(value));
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_boolean");
+ }
+ }
+
+ public char read_char() {
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return ((Character)markedItemQ.removeFirst()).charValue();
+ }
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return ((Character)markedItemQ.get(peekIndex++)).charValue();
+ }
+ try {
+ char value = is.readChar();
+ if (markOn) { // enqueue
+ markedItemQ.addLast(new Character(value));
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_char");
+ }
+ }
+
+ public char read_wchar() {
+ return this.read_char();
+ }
+
+ public byte read_octet() {
+
+ // check if size < [ GIOPHeader(12) + requestID(4)] bytes
+ if (bis.getPosition() < directReadLength) {
+ byte b = (byte) bis.read();
+ if (bis.getPosition() == directReadLength) {
+ initObjectInputStream();
+ }
+ return b;
+ }
+
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return ((Byte)markedItemQ.removeFirst()).byteValue();
+ }
+
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return ((Byte)markedItemQ.get(peekIndex++)).byteValue();
+ }
+
+ try {
+ byte value = is.readByte();
+ if (markOn) { // enqueue
+ //markedItemQ.addLast(Byte.valueOf(value)); // only in JDK 1.5
+ markedItemQ.addLast(new Byte(value));
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_octet");
+ }
+ }
+
+ public short read_short() {
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return ((Short)markedItemQ.removeFirst()).shortValue();
+ }
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return ((Short)markedItemQ.get(peekIndex++)).shortValue();
+ }
+
+ try {
+ short value = is.readShort();
+ if (markOn) { // enqueue
+ markedItemQ.addLast(new Short(value));
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_short");
+ }
+ }
+
+ public short read_ushort() {
+ return this.read_short();
+ }
+
+ public int read_long() {
+
+ // check if size < [ GIOPHeader(12) + requestID(4)] bytes
+ if (bis.getPosition() < directReadLength) {
+
+ // Use big endian (network byte order). This is fixed.
+ // Both the writer and reader use the same byte order.
+ int b1 = (bis.read() << 24) & 0xFF000000;
+ int b2 = (bis.read() << 16) & 0x00FF0000;
+ int b3 = (bis.read() << 8) & 0x0000FF00;
+ int b4 = (bis.read() << 0) & 0x000000FF;
+
+ if (bis.getPosition() == directReadLength) {
+ initObjectInputStream();
+ } else if (bis.getPosition() > directReadLength) {
+ // Cannot happen. All direct reads are contained
+ // within the first 16 bytes.
+ wrapper.javaSerializationException("read_long");
+ }
+
+ return (b1 | b2 | b3 | b4);
+ }
+
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return ((Integer)markedItemQ.removeFirst()).intValue();
+ }
+
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return ((Integer)markedItemQ.get(peekIndex++)).intValue();
+ }
+
+ try {
+ int value = is.readInt();
+ if (markOn) { // enqueue
+ markedItemQ.addLast(new Integer(value));
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_long");
+ }
+ }
+
+ public int read_ulong() {
+ return this.read_long();
+ }
+
+ public long read_longlong() {
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return ((Long)markedItemQ.removeFirst()).longValue();
+ }
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return ((Long)markedItemQ.get(peekIndex++)).longValue();
+ }
+
+ try {
+ long value = is.readLong();
+ if (markOn) { // enqueue
+ markedItemQ.addLast(new Long(value));
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_longlong");
+ }
+ }
+
+ public long read_ulonglong() {
+ return read_longlong();
+ }
+
+ public float read_float() {
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return ((Float)markedItemQ.removeFirst()).floatValue();
+ }
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return ((Float)markedItemQ.get(peekIndex++)).floatValue();
+ }
+
+ try {
+ float value = is.readFloat();
+ if (markOn) { // enqueue
+ markedItemQ.addLast(new Float(value));
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_float");
+ }
+ }
+
+ public double read_double() {
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return ((Double)markedItemQ.removeFirst()).doubleValue();
+ }
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return ((Double)markedItemQ.get(peekIndex++)).doubleValue();
+ }
+
+ try {
+ double value = is.readDouble();
+ if (markOn) { // enqueue
+ markedItemQ.addLast(new Double(value));
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_double");
+ }
+ }
+
+ // String types.
+
+ public String read_string() {
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return (String) markedItemQ.removeFirst();
+ }
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return (String) markedItemQ.get(peekIndex++);
+ }
+ try {
+ String value = is.readUTF();
+ if (markOn) { // enqueue
+ markedItemQ.addLast(value);
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_string");
+ }
+ }
+
+ public String read_wstring() {
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return (String) markedItemQ.removeFirst();
+ }
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return (String) markedItemQ.get(peekIndex++);
+ }
+ try {
+ String value = (String) is.readObject();
+ if (markOn) { // enqueue
+ markedItemQ.addLast(value);
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_wstring");
+ }
+ }
+
+ // Array types.
+
+ public void read_boolean_array(boolean[] value, int offset, int length){
+ for(int i = 0; i < length; i++) {
+ value[i+offset] = read_boolean();
+ }
+ }
+
+ public void read_char_array(char[] value, int offset, int length) {
+ for(int i=0; i < length; i++) {
+ value[i+offset] = read_char();
+ }
+ }
+
+ public void read_wchar_array(char[] value, int offset, int length) {
+ read_char_array(value, offset, length);
+ }
+
+ public void read_octet_array(byte[] value, int offset, int length) {
+ for(int i=0; i < length; i++) {
+ value[i+offset] = read_octet();
+ }
+ /* // Cannot use this efficient read due to mark/reset support.
+ try {
+ while (length > 0) {
+ int n = is.read(value, offset, length);
+ offset += n;
+ length -= n;
+ }
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_octet_array");
+ }
+ */
+ }
+
+ public void read_short_array(short[] value, int offset, int length) {
+ for(int i=0; i < length; i++) {
+ value[i+offset] = read_short();
+ }
+ }
+
+ public void read_ushort_array(short[] value, int offset, int length) {
+ read_short_array(value, offset, length);
+ }
+
+ public void read_long_array(int[] value, int offset, int length) {
+ for(int i=0; i < length; i++) {
+ value[i+offset] = read_long();
+ }
+ }
+
+ public void read_ulong_array(int[] value, int offset, int length) {
+ read_long_array(value, offset, length);
+ }
+
+ public void read_longlong_array(long[] value, int offset, int length) {
+ for(int i=0; i < length; i++) {
+ value[i+offset] = read_longlong();
+ }
+ }
+
+ public void read_ulonglong_array(long[] value, int offset, int length) {
+ read_longlong_array(value, offset, length);
+ }
+
+ public void read_float_array(float[] value, int offset, int length) {
+ for(int i=0; i < length; i++) {
+ value[i+offset] = read_float();
+ }
+ }
+
+ public void read_double_array(double[] value, int offset, int length) {
+ for(int i=0; i < length; i++) {
+ value[i+offset] = read_double();
+ }
+ }
+
+ // Complex types.
+
+ public org.omg.CORBA.Object read_Object() {
+ return read_Object(null);
+ }
+
+ public TypeCode read_TypeCode() {
+ TypeCodeImpl tc = new TypeCodeImpl(orb);
+ tc.read_value(parent);
+ return tc;
+ }
+
+ public Any read_any() {
+
+ Any any = orb.create_any();
+ TypeCodeImpl tc = new TypeCodeImpl(orb);
+
+ // 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 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,
+ // including encapsulations, is read off.
+ try {
+ tc.read_value(parent);
+ } catch (org.omg.CORBA.MARSHAL ex) {
+ if (tc.kind().value() != org.omg.CORBA.TCKind._tk_value) {
+ throw ex;
+ }
+ // We can be sure that the whole typecode encapsulation has been
+ // read off.
+ ex.printStackTrace();
+ }
+
+ // read off the value of the any.
+ any.read_value(parent, tc);
+
+ return any;
+ }
+
+ public Principal read_Principal() {
+ // We don't need an implementation for this method, since principal
+ // is absent in GIOP version 1.2 or above.
+ int len = read_long();
+ byte[] pvalue = new byte[len];
+ read_octet_array(pvalue,0,len);
+ Principal p = new com.sun.corba.se.impl.corba.PrincipalImpl();
+ p.name(pvalue);
+ return p;
+ }
+
+ public BigDecimal read_fixed() {
+ return new BigDecimal(read_fixed_buffer().toString());
+ }
+
+ // Each octet contains (up to) two decimal digits. If the fixed type has
+ // an odd number of decimal digits, then the representation
+ // begins with the first (most significant) digit.
+ // Otherwise, this first half-octet is all zero, and the first digit
+ // is in the second half-octet.
+ // The sign configuration, in the last half-octet of the representation,
+ // is 0xD for negative numbers and 0xC for positive and zero values.
+ private StringBuffer read_fixed_buffer() {
+ StringBuffer buffer = new StringBuffer(64);
+ byte doubleDigit;
+ int firstDigit;
+ int secondDigit;
+ boolean wroteFirstDigit = false;
+ boolean more = true;
+ while (more) {
+ doubleDigit = read_octet();
+ firstDigit = (int)((doubleDigit & 0xf0) >> 4);
+ secondDigit = (int)(doubleDigit & 0x0f);
+ if (wroteFirstDigit || firstDigit != 0) {
+ buffer.append(Character.forDigit(firstDigit, 10));
+ wroteFirstDigit = true;
+ }
+ if (secondDigit == 12) {
+ // positive number or zero
+ if ( ! wroteFirstDigit) {
+ // zero
+ return new StringBuffer("0.0");
+ } else {
+ // positive number
+ // done
+ }
+ more = false;
+ } else if (secondDigit == 13) {
+ // negative number
+ buffer.insert(0, '-');
+ more = false;
+ } else {
+ buffer.append(Character.forDigit(secondDigit, 10));
+ wroteFirstDigit = true;
+ }
+ }
+ return buffer;
+ }
+
+ public org.omg.CORBA.Object read_Object(java.lang.Class clz) {
+
+ // In any case, we must first read the IOR.
+ IOR ior = IORFactories.makeIOR(parent) ;
+ if (ior.isNil()) {
+ return 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();
+ boolean isIDLInterface = rid.isIDLType();
+
+ if (className == null || className.equals( "" )) {
+ stubFactory = null;
+ } else {
+ try {
+ stubFactory = sff.createStubFactory(className,
+ isIDLInterface, codeBase, (Class) null,
+ (ClassLoader) null);
+ } catch (Exception exc) {
+ // Could not create stubFactory, so use null.
+ // XXX stubFactory handling is still too complex:
+ // Can we resolve the stubFactory question once in
+ // a single place?
+ stubFactory = null ;
+ }
+ }
+ } else if (StubAdapter.isStubClass(clz)) {
+ stubFactory = PresentationDefaults.makeStaticStubFactory(clz);
+ } else {
+ // clz is an interface class
+ boolean isIDL = IDLEntity.class.isAssignableFrom(clz);
+
+ stubFactory = sff.createStubFactory(
+ clz.getName(), isIDL, codeBase, clz, clz.getClassLoader());
+ }
+
+ return CDRInputStream_1_0.internalIORToObject(ior, stubFactory, orb);
+ }
+
+ public org.omg.CORBA.ORB orb() {
+ return this.orb;
+ }
+
+ // org.omg.CORBA_2_3.portable.InputStream
+
+ public java.io.Serializable read_value() {
+ if (!markOn && !(markedItemQ.isEmpty())) { // dequeue
+ return (Serializable) markedItemQ.removeFirst();
+ }
+ if (markOn && !(markedItemQ.isEmpty()) &&
+ (peekIndex < peekCount)) { // peek
+ return (Serializable) markedItemQ.get(peekIndex++);
+ }
+ try {
+ Serializable value = (java.io.Serializable) is.readObject();
+ if (markOn) { // enqueue
+ markedItemQ.addLast(value);
+ }
+ return value;
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "read_value");
+ }
+ }
+
+ public java.io.Serializable read_value(java.lang.Class clz) {
+ return read_value();
+ }
+
+ public java.io.Serializable read_value(
+ org.omg.CORBA.portable.BoxedValueHelper factory) {
+ return read_value();
+ }
+
+ public java.io.Serializable read_value(java.lang.String rep_id) {
+ return read_value();
+ }
+
+ public java.io.Serializable read_value(java.io.Serializable value) {
+ return read_value();
+ }
+
+ public java.lang.Object read_abstract_interface() {
+ return read_abstract_interface(null);
+ }
+
+ public java.lang.Object read_abstract_interface(java.lang.Class clz) {
+ boolean isObject = read_boolean();
+ if (isObject) {
+ return read_Object(clz);
+ } else {
+ return read_value();
+ }
+ }
+
+ // com.sun.corba.se.impl.encoding.MarshalInputStream
+ public void consumeEndian() {
+ throw wrapper.giopVersionError();
+ }
+
+ public int getPosition() {
+ try {
+ return bis.getPosition();
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "getPosition");
+ }
+ }
+
+ // org.omg.CORBA.DataInputStream
+ public java.lang.Object read_Abstract() {
+ return read_abstract_interface();
+ }
+
+ public java.io.Serializable read_Value() {
+ return read_value();
+ }
+
+ public void read_any_array (org.omg.CORBA.AnySeqHolder seq,
+ int offset, int length) {
+ read_any_array(seq.value, offset, length);
+ }
+
+ private 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();
+ }
+ }
+
+ 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){
+ read_char_array(seq.value, offset, 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){
+ read_octet_array(seq.value, offset, 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){
+ read_ushort_array(seq.value, offset, 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){
+ read_ulong_array(seq.value, offset, 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){
+ read_longlong_array(seq.value, offset, 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){
+ read_double_array(seq.value, offset, length);
+ }
+
+ // org.omg.CORBA.portable.ValueBase
+
+ public String[] _truncatable_ids() {
+ throw wrapper.giopVersionError();
+ }
+
+ // java.io.InputStream
+ // REVISIT - should we make these throw UnsupportedOperationExceptions?
+ // Right now, they'll go up to the java.io versions!
+
+ // public int read(byte b[]) throws IOException;
+ // public int read(byte b[], int off, int len) throws IOException
+ // public long skip(long n) throws IOException;
+ // public int available() throws IOException;
+ // public void close() throws IOException;
+
+ public void mark(int readLimit) {
+ // Nested mark disallowed.
+ // Further, mark is not supported until first 16 bytes are read.
+ if (markOn || is == null) {
+ throw wrapper.javaSerializationException("mark");
+ }
+ markOn = true;
+ if (!(markedItemQ.isEmpty())) {
+ peekIndex = 0;
+ peekCount = markedItemQ.size();
+ }
+ /*
+ // Note: only ByteArrayInputStream supports mark/reset.
+ if (is == null || is.markSupported() == false) {
+ throw wrapper.javaSerializationException("mark");
+ }
+ is.mark(readLimit);
+ */
+ }
+
+ public void reset() {
+ markOn = false;
+ peekIndex = 0;
+ peekCount = 0;
+ /*
+ // Note: only ByteArrayInputStream supports mark/reset.
+ if (is == null || is.markSupported() == false) {
+ throw wrapper.javaSerializationException("mark");
+ }
+ try {
+ is.reset();
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "reset");
+ }
+ */
+ }
+
+ // 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
+ // like expect obj1a == obj1b in the following code:
+ //
+ // is.mark(10000);
+ // Object obj1a = is.readObject();
+ // is.reset();
+ // Object obj1b = is.readObject();
+ //
+ public boolean markSupported() {
+ return true;
+ }
+
+ // Needed by AnyImpl and ServiceContexts
+ public CDRInputStreamBase dup() {
+
+ CDRInputStreamBase result = null ;
+
+ try {
+ result = (CDRInputStreamBase) this.getClass().newInstance();
+ } catch (Exception e) {
+ throw wrapper.couldNotDuplicateCdrInputStream(e);
+ }
+
+ result.init(this.orb, this.buffer, this.bufSize, false, null);
+
+ // Set the buffer position.
+ ((IDLJavaSerializationInputStream)result).skipBytes(getPosition());
+
+ // Set mark related data.
+ ((IDLJavaSerializationInputStream)result).
+ setMarkData(markOn, peekIndex, peekCount,
+ (LinkedList) markedItemQ.clone());
+
+ return result;
+ }
+
+ // Used exclusively by the dup() method.
+ void skipBytes(int len) {
+ try {
+ is.skipBytes(len);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "skipBytes");
+ }
+ }
+
+ // Used exclusively by the dup() method.
+ void setMarkData(boolean markOn, int peekIndex, int peekCount,
+ LinkedList markedItemQ) {
+ this.markOn = markOn;
+ this.peekIndex = peekIndex;
+ this.peekCount = peekCount;
+ this.markedItemQ = markedItemQ;
+ }
+
+ // Needed by TCUtility
+ public java.math.BigDecimal read_fixed(short digits, short scale) {
+ // digits isn't really needed here
+ StringBuffer buffer = read_fixed_buffer();
+ if (digits != buffer.length())
+ throw wrapper.badFixed( new Integer(digits),
+ new Integer(buffer.length()) ) ;
+ buffer.insert(digits - scale, '.');
+ return new BigDecimal(buffer.toString());
+ }
+
+ // Needed by TypeCodeImpl
+ public boolean isLittleEndian() {
+ throw wrapper.giopVersionError();
+ }
+
+ // Needed by request and reply messages for GIOP versions >= 1.2 only.
+ void setHeaderPadding(boolean headerPadding) {
+ // no-op. We don't care about body alignment while using
+ // Java serialization. What the GIOP spec states does not apply here.
+ }
+
+ // Needed by IIOPInputStream and other subclasses
+
+ public ByteBuffer getByteBuffer() {
+ throw wrapper.giopVersionError();
+ }
+
+ public void setByteBuffer(ByteBuffer byteBuffer) {
+ throw wrapper.giopVersionError();
+ }
+
+ public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
+ throw wrapper.giopVersionError();
+ }
+
+ public int getBufferLength() {
+ return bufSize;
+ }
+
+ public void setBufferLength(int value) {
+ // this is redundant, since buffer size was already specified
+ // as part of the init call. So, ignore.
+ }
+
+ public int getIndex() {
+ return bis.getPosition();
+ }
+
+ public void setIndex(int value) {
+ try {
+ bis.setPosition(value);
+ } catch (IndexOutOfBoundsException e) {
+ throw wrapper.javaSerializationException(e, "setIndex");
+ }
+ }
+
+ public void orb(org.omg.CORBA.ORB orb) {
+ this.orb = (ORB) orb;
+ }
+
+ public BufferManagerRead getBufferManager() {
+ return bufferManager;
+ }
+
+ public GIOPVersion getGIOPVersion() {
+ return GIOPVersion.V1_2;
+ }
+
+ com.sun.org.omg.SendingContext.CodeBase getCodeBase() {
+ return parent.getCodeBase();
+ }
+
+ void printBuffer() {
+ byte[] buf = this.buffer.array();
+
+ System.out.println("+++++++ Input Buffer ++++++++");
+ System.out.println();
+ System.out.println("Current position: " + getPosition());
+ System.out.println("Total length : " + this.bufSize);
+ System.out.println();
+
+ char[] charBuf = new char[16];
+
+ try {
+
+ for (int i = 0; i < buf.length; i += 16) {
+
+ int j = 0;
+
+ // For every 16 bytes, there is one line
+ // of output. First, the hex output of
+ // the 16 bytes with each byte separated
+ // by a space.
+ while (j < 16 && j + i < buf.length) {
+ int k = buf[i + j];
+ if (k < 0)
+ k = 256 + k;
+ String hex = Integer.toHexString(k);
+ if (hex.length() == 1)
+ hex = "0" + hex;
+ System.out.print(hex + " ");
+ j++;
+ }
+
+ // Add any extra spaces to align the
+ // text column in case we didn't end
+ // at 16
+ while (j < 16) {
+ System.out.print(" ");
+ j++;
+ }
+
+ // Now output the ASCII equivalents. Non-ASCII
+ // characters are shown as periods.
+ int x = 0;
+
+ while (x < 16 && x + i < buf.length) {
+ if (ORBUtility.isPrintable((char)buf[i + x])) {
+ charBuf[x] = (char) buf[i + x];
+ } else {
+ charBuf[x] = '.';
+ }
+ x++;
+ }
+ System.out.println(new String(charBuf, 0, x));
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ System.out.println("++++++++++++++++++++++++++++++");
+ }
+
+ void alignOnBoundary(int octetBoundary) {
+ throw wrapper.giopVersionError();
+ }
+
+ void performORBVersionSpecificInit() {
+ // No-op.
+ }
+
+ public void resetCodeSetConverters() {
+ // No-op.
+ }
+
+ // ValueInputStream -------------------------
+
+ public void start_value() {
+ throw wrapper.giopVersionError();
+ }
+
+ public void end_value() {
+ throw wrapper.giopVersionError();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java
new file mode 100644
index 0000000..6914e0e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/IDLJavaSerializationOutputStream.java
@@ -0,0 +1,798 @@
+/*
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.io.IOException;
+import java.io.ObjectOutputStream;
+import java.io.ByteArrayOutputStream;
+
+import java.nio.ByteBuffer;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+
+import com.sun.corba.se.impl.util.Utility;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.corba.TypeCodeImpl;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.CompletionStatus;
+
+/**
+ * Implementation class that uses Java serialization for output streams.
+ * This assumes a GIOP version 1.2 message format.
+ *
+ * This class uses a ByteArrayOutputStream as the underlying buffer. The
+ * first 16 bytes are direct writes into the underlying buffer. This allows
+ * [GIOPHeader (12 bytes) + requestID (4 bytes)] to be written as bytes.
+ * Subsequent write operations on this output stream object uses
+ * ObjectOutputStream class to write into the buffer. This allows marshaling
+ * complex types and graphs using the ObjectOutputStream implementation.
+ *
+ * Note, this class assumes a GIOP 1.2 style header. Note, we expect that the
+ * first 16 bytes are written only using the write_octet, write_long or
+ * write_ulong method calls.
+ *
+ * @author Ram Jeyaraman
+ */
+final class IDLJavaSerializationOutputStream extends CDROutputStreamBase {
+
+ private ORB orb;
+ private byte encodingVersion;
+ private ObjectOutputStream os;
+ private _ByteArrayOutputStream bos;
+ private BufferManagerWrite bufferManager;
+
+ // [GIOPHeader(12) + requestID(4)] bytes
+ private final int directWriteLength = Message.GIOPMessageHeaderLength + 4;
+
+ protected ORBUtilSystemException wrapper;
+
+ class _ByteArrayOutputStream extends ByteArrayOutputStream {
+
+ _ByteArrayOutputStream(int initialSize) {
+ super(initialSize);
+ }
+
+ byte[] getByteArray() {
+ return this.buf;
+ }
+ }
+
+ class MarshalObjectOutputStream extends ObjectOutputStream {
+
+ ORB orb;
+
+ MarshalObjectOutputStream(java.io.OutputStream out, ORB orb)
+ throws IOException {
+
+ super(out);
+ this.orb = orb;
+ java.security.AccessController.doPrivileged(
+ new java.security.PrivilegedAction() {
+ public Object run() {
+ // needs SerializablePermission("enableSubstitution")
+ enableReplaceObject(true);
+ return null;
+ }
+ }
+ );
+ }
+
+ /**
+ * Checks for objects that are instances of java.rmi.Remote
+ * that need to be serialized as proxy (Stub) objects.
+ */
+ protected final Object replaceObject(Object obj) throws IOException {
+ try {
+ if ((obj instanceof java.rmi.Remote) &&
+ !(StubAdapter.isStub(obj))) {
+ return Utility.autoConnect(obj, orb, true);
+ }
+ } catch (Exception e) {
+ IOException ie = new IOException("replaceObject failed");
+ ie.initCause(e);
+ throw ie;
+ }
+ return obj;
+ }
+ }
+
+ public IDLJavaSerializationOutputStream(byte encodingVersion) {
+ super();
+ this.encodingVersion = encodingVersion;
+ }
+
+ public void init(org.omg.CORBA.ORB orb, boolean littleEndian,
+ BufferManagerWrite bufferManager,
+ byte streamFormatVersion,
+ boolean usePooledByteBuffers) {
+ this.orb = (ORB) orb;
+ this.bufferManager = bufferManager;
+ wrapper = ORBUtilSystemException.get((ORB) orb,
+ CORBALogDomains.RPC_ENCODING);
+ bos =
+ new _ByteArrayOutputStream(ORBConstants.GIOP_DEFAULT_BUFFER_SIZE);
+ }
+
+ // Called from read_octet or read_long or read_ulong method.
+ private void initObjectOutputStream() {
+ //System.out.print(" os ");
+ if (os != null) {
+ throw wrapper.javaStreamInitFailed();
+ }
+ try {
+ os = new MarshalObjectOutputStream(bos, orb);
+ } catch (Exception e) {
+ throw wrapper.javaStreamInitFailed(e);
+ }
+ }
+
+ // org.omg.CORBA.portable.OutputStream
+
+ // Primitive types.
+
+ public final void write_boolean(boolean value) {
+ try {
+ os.writeBoolean(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_boolean");
+ }
+ }
+
+ public final void write_char(char value) {
+ try {
+ os.writeChar(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_char");
+ }
+ }
+
+ public final void write_wchar(char value) {
+ this.write_char(value);
+ }
+
+ public final void write_octet(byte value) {
+
+ // check if size < [ GIOPHeader(12) + requestID(4)] bytes
+ if (bos.size() < directWriteLength) {
+ bos.write(value); // direct write.
+ if (bos.size() == directWriteLength) {
+ initObjectOutputStream();
+ }
+ return;
+ }
+
+ try {
+ os.writeByte(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_octet");
+ }
+ }
+
+ public final void write_short(short value) {
+ try {
+ os.writeShort(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_short");
+ }
+ }
+
+ public final void write_ushort(short value) {
+ this.write_short(value);
+ }
+
+ public final void write_long(int value) {
+
+ // check if size < [ GIOPHeader(12) + requestID(4)] bytes
+ if (bos.size() < directWriteLength) {
+
+ // Use big endian (network byte order). This is fixed.
+ // Both the writer and reader use the same byte order.
+ bos.write((byte)((value >>> 24) & 0xFF));
+ bos.write((byte)((value >>> 16) & 0xFF));
+ bos.write((byte)((value >>> 8) & 0xFF));
+ bos.write((byte)((value >>> 0) & 0xFF));
+
+ if (bos.size() == directWriteLength) {
+ initObjectOutputStream();
+ } else if (bos.size() > directWriteLength) {
+ // Cannot happen. All direct writes are contained
+ // within the first 16 bytes.
+ wrapper.javaSerializationException("write_long");
+ }
+ return;
+ }
+
+ try {
+ os.writeInt(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_long");
+ }
+ }
+
+ public final void write_ulong(int value) {
+ this.write_long(value);
+ }
+
+ public final void write_longlong(long value) {
+ try {
+ os.writeLong(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_longlong");
+ }
+ }
+
+ public final void write_ulonglong(long value) {
+ this.write_longlong(value);
+ }
+
+ public final void write_float(float value) {
+ try {
+ os.writeFloat(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_float");
+ }
+ }
+
+ public final void write_double(double value) {
+ try {
+ os.writeDouble(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_double");
+ }
+ }
+
+ // String types.
+
+ public final void write_string(String value) {
+ try {
+ os.writeUTF(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_string");
+ }
+ }
+
+ public final void write_wstring(String value) {
+ try {
+ os.writeObject(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_wstring");
+ }
+ }
+
+ // Array types.
+
+ public final void write_boolean_array(boolean[] value,
+ int offset, int length) {
+ for (int i = 0; i < length; i++) {
+ write_boolean(value[offset + i]);
+ }
+ }
+
+ public final void write_char_array(char[] value, int offset, int length) {
+ for (int i = 0; i < length; i++) {
+ write_char(value[offset + i]);
+ }
+ }
+
+ public final void write_wchar_array(char[] value, int offset, int length) {
+ write_char_array(value, offset, length);
+ }
+
+ public final void write_octet_array(byte[] value, int offset, int length) {
+ try {
+ os.write(value, offset, length);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_octet_array");
+ }
+ }
+
+ public final void write_short_array(short[] value,
+ int offset, int length) {
+ for (int i = 0; i < length; i++) {
+ write_short(value[offset + i]);
+ }
+ }
+
+ public final void write_ushort_array(short[] value,
+ int offset, int length){
+ write_short_array(value, offset, length);
+ }
+
+ public final void write_long_array(int[] value, int offset, int length) {
+ for (int i = 0; i < length; i++) {
+ write_long(value[offset + i]);
+ }
+ }
+
+ public final void write_ulong_array(int[] value, int offset, int length) {
+ write_long_array(value, offset, length);
+ }
+
+ public final void write_longlong_array(long[] value,
+ int offset, int length) {
+ for (int i = 0; i < length; i++) {
+ write_longlong(value[offset + i]);
+ }
+ }
+
+ public final void write_ulonglong_array(long[] value,
+ int offset,int length) {
+ write_longlong_array(value, offset, length);
+ }
+
+ public final void write_float_array(float[] value,
+ int offset, int length) {
+ for (int i = 0; i < length; i++) {
+ write_float(value[offset + i]);
+ }
+ }
+
+ public final void write_double_array(double[] value,
+ int offset, int length) {
+ for (int i = 0; i < length; i++) {
+ write_double(value[offset + i]);
+ }
+ }
+
+ // Complex types (objects and graphs).
+
+ public final void write_Object(org.omg.CORBA.Object value) {
+ if (value == null) {
+ IOR nullIOR = IORFactories.makeIOR(orb);
+ nullIOR.write(parent);
+ return;
+ }
+ // IDL to Java formal 01-06-06 1.21.4.2
+ if (value instanceof org.omg.CORBA.LocalObject) {
+ throw wrapper.writeLocalObject(CompletionStatus.COMPLETED_MAYBE);
+ }
+ IOR ior = ORBUtility.connectAndGetIOR(orb, value);
+ ior.write(parent);
+ return;
+ }
+
+ public final void write_TypeCode(TypeCode tc) {
+ if (tc == null) {
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+ }
+ TypeCodeImpl tci;
+ if (tc instanceof TypeCodeImpl) {
+ tci = (TypeCodeImpl) tc;
+ } else {
+ tci = new TypeCodeImpl(orb, tc);
+ }
+ tci.write_value((org.omg.CORBA_2_3.portable.OutputStream) parent);
+ }
+
+ public final void write_any(Any any) {
+ if (any == null) {
+ throw wrapper.nullParam(CompletionStatus.COMPLETED_MAYBE);
+ }
+ write_TypeCode(any.type());
+ any.write_value(parent);
+ }
+
+ public final void write_Principal(Principal p) {
+ // We don't need an implementation for this method, since principal
+ // is absent in GIOP version 1.2 or above.
+ write_long(p.name().length);
+ write_octet_array(p.name(), 0, p.name().length);
+ }
+
+ public final void write_fixed(java.math.BigDecimal bigDecimal) {
+ // This string might contain sign and/or dot
+ this.write_fixed(bigDecimal.toString(), bigDecimal.signum());
+ }
+
+ // The string may contain a sign and dot
+ private void write_fixed(String string, int signum) {
+
+ int stringLength = string.length();
+
+ // Each octet contains (up to) two decimal digits.
+ byte doubleDigit = 0;
+ char ch;
+ byte digit;
+
+ // First calculate the string length without optional sign and dot.
+ int numDigits = 0;
+ for (int i=0; i<stringLength; i++) {
+ ch = string.charAt(i);
+ if (ch == '-' || ch == '+' || ch == '.')
+ continue;
+ numDigits++;
+ }
+
+ for (int i=0; i<stringLength; i++) {
+ ch = string.charAt(i);
+ if (ch == '-' || ch == '+' || ch == '.')
+ continue;
+ digit = (byte)Character.digit(ch, 10);
+ if (digit == -1) {
+ throw wrapper.badDigitInFixed(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ // If the fixed type has an odd number of decimal digits, then the
+ // representation begins with the first (most significant) digit.
+ // Otherwise, this first half-octet is all zero, and the first
+ // digit is in the second half-octet.
+ if (numDigits % 2 == 0) {
+ doubleDigit |= digit;
+ this.write_octet(doubleDigit);
+ doubleDigit = 0;
+ } else {
+ doubleDigit |= (digit << 4);
+ }
+ numDigits--;
+ }
+
+ // The sign configuration in the last half-octet of the representation,
+ // is 0xD for negative numbers and 0xC for positive and zero values.
+ if (signum == -1) {
+ doubleDigit |= 0xd;
+ } else {
+ doubleDigit |= 0xc;
+ }
+ this.write_octet(doubleDigit);
+ }
+
+ public final org.omg.CORBA.ORB orb() {
+ return this.orb;
+ }
+
+ // org.omg.CORBA_2_3.portable.OutputStream
+
+ public final void write_value(java.io.Serializable value) {
+ write_value(value, (String) null);
+ }
+
+ public final void write_value(java.io.Serializable value,
+ java.lang.Class clz) {
+ write_value(value);
+ }
+
+ public final void write_value(java.io.Serializable value,
+ String repository_id) {
+ try {
+ os.writeObject(value);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_value");
+ }
+ }
+
+ public final void write_value(java.io.Serializable value,
+ org.omg.CORBA.portable.BoxedValueHelper factory) {
+ this.write_value(value, (String) null);
+ }
+
+ public final void write_abstract_interface(java.lang.Object obj) {
+
+ boolean isCorbaObject = false; // Assume value type.
+ org.omg.CORBA.Object theCorbaObject = null;
+
+ // Is it a CORBA.Object?
+ if (obj != null && obj instanceof org.omg.CORBA.Object) {
+ theCorbaObject = (org.omg.CORBA.Object)obj;
+ isCorbaObject = true;
+ }
+
+ // Write the boolean flag.
+ this.write_boolean(isCorbaObject);
+
+ // Now write out the object.
+ if (isCorbaObject) {
+ write_Object(theCorbaObject);
+ } else {
+ try {
+ write_value((java.io.Serializable)obj);
+ } catch(ClassCastException cce) {
+ if (obj instanceof java.io.Serializable) {
+ throw cce;
+ } else {
+ ORBUtility.throwNotSerializableForCorba(
+ obj.getClass().getName());
+ }
+ }
+ }
+ }
+
+ // com.sun.corba.se.os.encoding.MarshalOutputStream
+
+ public final void start_block() {
+ throw wrapper.giopVersionError();
+ }
+
+ public final void end_block() {
+ throw wrapper.giopVersionError();
+ }
+
+ public final void putEndian() {
+ throw wrapper.giopVersionError();
+ }
+
+ public void writeTo(java.io.OutputStream s) throws IOException {
+ try {
+ os.flush();
+ bos.writeTo(s);
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "writeTo");
+ }
+ }
+
+ public final byte[] toByteArray() {
+ try {
+ os.flush();
+ return bos.toByteArray(); // new copy.
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "toByteArray");
+ }
+ }
+
+ // org.omg.CORBA.DataOutputStream
+
+ public final void write_Abstract (java.lang.Object value) {
+ write_abstract_interface(value);
+ }
+
+ public final void write_Value(java.io.Serializable value) {
+ write_value(value);
+ }
+
+ public final void write_any_array(org.omg.CORBA.Any[] value,
+ int offset, int length) {
+ for(int i = 0; i < length; i++) {
+ write_any(value[offset + i]);
+ }
+ }
+
+ // org.omg.CORBA.portable.ValueBase
+
+ public final String[] _truncatable_ids() {
+ throw wrapper.giopVersionError();
+ }
+
+ // Other.
+
+ public final int getSize() {
+ try {
+ os.flush();
+ return bos.size();
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(e, "write_boolean");
+ }
+ }
+
+ public final int getIndex() {
+ return getSize();
+ }
+
+ protected int getRealIndex(int index) {
+ return getSize();
+ }
+
+ public final void setIndex(int value) {
+ throw wrapper.giopVersionError();
+ }
+
+ public final ByteBuffer getByteBuffer() {
+ throw wrapper.giopVersionError();
+ }
+
+ public final void setByteBuffer(ByteBuffer byteBuffer) {
+ throw wrapper.giopVersionError();
+ }
+
+ public final boolean isLittleEndian() {
+ // Java serialization uses network byte order, that is, big-endian.
+ return false;
+ }
+
+ public ByteBufferWithInfo getByteBufferWithInfo() {
+ try {
+ os.flush();
+ } catch (Exception e) {
+ throw wrapper.javaSerializationException(
+ e, "getByteBufferWithInfo");
+ }
+ ByteBuffer byteBuffer = ByteBuffer.wrap(bos.getByteArray());
+ byteBuffer.limit(bos.size());
+ return new ByteBufferWithInfo(this.orb, byteBuffer, bos.size());
+ }
+
+ public void setByteBufferWithInfo(ByteBufferWithInfo bbwi) {
+ throw wrapper.giopVersionError();
+ }
+
+ public final BufferManagerWrite getBufferManager() {
+ return bufferManager;
+ }
+
+ // This will stay a custom add-on until the java-rtf issue is resolved.
+ // Then it should be declared in org.omg.CORBA.portable.OutputStream.
+ //
+ // Pads the string representation of bigDecimal with zeros to fit the given
+ // digits and scale before it gets written to the stream.
+ public final void write_fixed(java.math.BigDecimal bigDecimal,
+ short digits, short scale) {
+ String string = bigDecimal.toString();
+ String integerPart;
+ String fractionPart;
+ StringBuffer stringBuffer;
+
+ // Get rid of the sign
+ if (string.charAt(0) == '-' || string.charAt(0) == '+') {
+ string = string.substring(1);
+ }
+
+ // Determine integer and fraction parts
+ int dotIndex = string.indexOf('.');
+ if (dotIndex == -1) {
+ integerPart = string;
+ fractionPart = null;
+ } else if (dotIndex == 0 ) {
+ integerPart = null;
+ fractionPart = string;
+ } else {
+ integerPart = string.substring(0, dotIndex);
+ fractionPart = string.substring(dotIndex + 1);
+ }
+
+ // Pad both parts with zeros as necessary
+ stringBuffer = new StringBuffer(digits);
+ if (fractionPart != null) {
+ stringBuffer.append(fractionPart);
+ }
+ while (stringBuffer.length() < scale) {
+ stringBuffer.append('0');
+ }
+ if (integerPart != null) {
+ stringBuffer.insert(0, integerPart);
+ }
+ while (stringBuffer.length() < digits) {
+ stringBuffer.insert(0, '0');
+ }
+
+ // This string contains no sign or dot
+ this.write_fixed(stringBuffer.toString(), bigDecimal.signum());
+ }
+
+ public final void writeOctetSequenceTo(
+ org.omg.CORBA.portable.OutputStream s) {
+ byte[] buf = this.toByteArray(); // new copy.
+ s.write_long(buf.length);
+ s.write_octet_array(buf, 0, buf.length);
+ }
+
+ public final GIOPVersion getGIOPVersion() {
+ return GIOPVersion.V1_2;
+ }
+
+ public final void writeIndirection(int tag, int posIndirectedTo) {
+ throw wrapper.giopVersionError();
+ }
+
+ void freeInternalCaches() {}
+
+ void printBuffer() {
+ byte[] buf = this.toByteArray();
+
+ System.out.println("+++++++ Output Buffer ++++++++");
+ System.out.println();
+ System.out.println("Current position: " + buf.length);
+ //System.out.println("Total length : " + buf.length);
+ System.out.println();
+
+ char[] charBuf = new char[16];
+
+ try {
+
+ for (int i = 0; i < buf.length; i += 16) {
+
+ int j = 0;
+
+ // For every 16 bytes, there is one line
+ // of output. First, the hex output of
+ // the 16 bytes with each byte separated
+ // by a space.
+ while (j < 16 && j + i < buf.length) {
+ int k = buf[i + j];
+ if (k < 0)
+ k = 256 + k;
+ String hex = Integer.toHexString(k);
+ if (hex.length() == 1)
+ hex = "0" + hex;
+ System.out.print(hex + " ");
+ j++;
+ }
+
+ // Add any extra spaces to align the
+ // text column in case we didn't end
+ // at 16
+ while (j < 16) {
+ System.out.print(" ");
+ j++;
+ }
+
+ // Now output the ASCII equivalents. Non-ASCII
+ // characters are shown as periods.
+ int x = 0;
+
+ while (x < 16 && x + i < buf.length) {
+ if (ORBUtility.isPrintable((char)buf[i + x])) {
+ charBuf[x] = (char) buf[i + x];
+ } else {
+ charBuf[x] = '.';
+ }
+ x++;
+ }
+ System.out.println(new String(charBuf, 0, x));
+ }
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ System.out.println("++++++++++++++++++++++++++++++");
+ }
+
+ public void alignOnBoundary(int octetBoundary) {
+ throw wrapper.giopVersionError();
+ }
+
+ // Needed by request and reply messages for GIOP versions >= 1.2 only.
+ public void setHeaderPadding(boolean headerPadding) {
+ // no-op. We don't care about body alignment while using
+ // Java serialization. What the GIOP spec states does not apply here.
+ }
+
+ // ValueOutputStream -----------------------------
+
+ public void start_value(String rep_id) {
+ throw wrapper.giopVersionError();
+ }
+
+ public void end_value() {
+ throw wrapper.giopVersionError();
+ }
+
+ // java.io.OutputStream
+
+ // Note: These methods are defined in the super class and accessible.
+
+ //public abstract void write(byte b[]) throws IOException;
+ //public abstract void write(byte b[], int off, int len)
+ // throws IOException;
+ //public abstract void flush() throws IOException;
+ //public abstract void close() throws IOException;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarkAndResetHandler.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarkAndResetHandler.java
new file mode 100644
index 0000000..7774ab6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarkAndResetHandler.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+
+/**
+ * Defines an abstraction for a RestorableInputStream to
+ * implement mark/reset.
+ */
+interface MarkAndResetHandler
+{
+ void mark(RestorableInputStream inputStream);
+
+ void fragmentationOccured(ByteBufferWithInfo newFragment);
+
+ void reset();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalInputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalInputStream.java
new file mode 100644
index 0000000..73e47af
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalInputStream.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+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 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();
+ public 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();
+
+ // Determines the current byte stream position
+ // (also handles fragmented streams)
+ public int getPosition();
+
+ // 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.
+ */
+ 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).
+ */
+ public void resetCodeSetConverters();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalOutputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalOutputStream.java
new file mode 100644
index 0000000..531f89d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/MarshalOutputStream.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+import java.io.IOException;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.Any;
+
+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);
+ public void write_Principal(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 byte[] toByteArray();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/OSFCodeSetRegistry.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/OSFCodeSetRegistry.java
new file mode 100644
index 0000000..6950082
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/OSFCodeSetRegistry.java
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+/**
+ *
+ * Information from the OSF code set registry version 1.2g.
+ *
+ * Use the Entry corresponding to the desired code set.
+ *
+ * Consider rename to CodeSetRegistry since OSF is dead.
+ */
+public final class OSFCodeSetRegistry
+{
+ // Numbers from the OSF code set registry version 1.2g.
+ //
+ // Please see the individual Entry definitions for
+ // more details.
+ public static final int ISO_8859_1_VALUE = 0x00010001;
+ public static final int UTF_16_VALUE = 0x00010109;
+ public static final int UTF_8_VALUE = 0x05010001;
+ public static final int UCS_2_VALUE = 0x00010100;
+ public static final int ISO_646_VALUE = 0x00010020;
+
+ 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.
+ */
+ 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) {
+ this.javaName = javaName;
+ this.encodingNum = encodingNum;
+ this.isFixedWidth = isFixedWidth;
+ this.maxBytesPerChar = maxBytesPerChar;
+ }
+
+ /**
+ * 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.
+ */
+ public String getName() {
+ return javaName;
+ }
+
+ /**
+ * Get the OSF registry number for this code set.
+ */
+ 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)
+ */
+ public boolean isFixedWidth() {
+ return isFixedWidth;
+ }
+
+ public int getMaxBytesPerChar() {
+ return maxBytesPerChar;
+ }
+
+ /**
+ * First checks reference equality since it's expected
+ * people will use the pre-defined constant Entries.
+ */
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+
+ if (!(obj instanceof OSFCodeSetRegistry.Entry))
+ return false;
+
+ OSFCodeSetRegistry.Entry other
+ = (OSFCodeSetRegistry.Entry)obj;
+
+ return (javaName.equals(other.javaName) &&
+ encodingNum == other.encodingNum &&
+ isFixedWidth == other.isFixedWidth &&
+ maxBytesPerChar == other.maxBytesPerChar);
+ }
+
+ /**
+ * Uses the registry number as the hash code.
+ */
+ public int hashCode() {
+ return encodingNum;
+ }
+ }
+
+ /**
+ * 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);
+
+ /**
+ * 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);
+
+ /**
+ * 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.
+ */
+ 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.
+ */
+ 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.
+ *
+ * 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!
+ */
+ 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.
+ */
+ 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.
+ */
+ 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;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/RestorableInputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/RestorableInputStream.java
new file mode 100644
index 0000000..8d1c9b6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/RestorableInputStream.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.encoding;
+
+/**
+ * Defines the methods on an input stream which provide
+ * a way to get and restore its internal state without
+ * violating encapsulation.
+ */
+interface RestorableInputStream
+{
+ Object createStreamMemento();
+
+ void restoreInternalState(Object streamMemento);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java
new file mode 100644
index 0000000..ae91457
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeInputStream.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.ByteArrayOutputStream;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+
+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.Principal ;
+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_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.corba.TypeCodeImpl;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+import com.sun.corba.se.impl.encoding.MarshalInputStream;
+
+import sun.corba.EncapsInputStreamFactory;
+
+public class TypeCodeInputStream extends EncapsInputStream implements TypeCodeReader
+{
+ private Map typeMap = null;
+ private InputStream enclosure = null;
+ private boolean isEncapsulation = false;
+
+ 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,
+ boolean littleEndian,
+ GIOPVersion version) {
+ super(orb, data, size, littleEndian, version);
+ }
+
+ public TypeCodeInputStream(org.omg.CORBA.ORB orb,
+ ByteBuffer byteBuffer,
+ int size,
+ boolean littleEndian,
+ GIOPVersion version) {
+ super(orb, byteBuffer, size, littleEndian, version);
+ }
+
+ 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(this + " adding tc " + tc + " at position " + position);
+ typeMap.put(new Integer(position), tc);
+ }
+
+ public TypeCodeImpl getTypeCodeAtPosition(int position) {
+ if (typeMap == null)
+ return null;
+ //if (TypeCodeImpl.debug) {
+ //System.out.println("Getting tc " + (TypeCode)typeMap.get(new Integer(position)) +
+ //" at position " + position);
+ //}
+ return (TypeCodeImpl)typeMap.get(new Integer(position));
+ }
+
+ public void setEnclosingInputStream(InputStream enclosure) {
+ this.enclosure = enclosure;
+ }
+
+ public TypeCodeReader getTopLevelStream() {
+ if (enclosure == null)
+ return this;
+ if (enclosure instanceof TypeCodeReader)
+ return ((TypeCodeReader)enclosure).getTopLevelStream();
+ return this;
+ }
+
+ public int getTopLevelPosition() {
+ if (enclosure != null && enclosure instanceof TypeCodeReader) {
+ // 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();
+ // Substract getBufferLength from the parents pos because it read this stream
+ // from its own when creating it
+ int pos = topPos - getBufferLength() + getPosition();
+ //if (TypeCodeImpl.debug) {
+ //System.out.println("TypeCodeInputStream.getTopLevelPosition using getTopLevelPosition " + topPos +
+ //(isEncapsulation ? " - encaps length 4" : "") +
+ //" - getBufferLength() " + getBufferLength() +
+ //" + getPosition() " + getPosition() + " = " + pos);
+ //}
+ return pos;
+ }
+ //if (TypeCodeImpl.debug) {
+ //System.out.println("TypeCodeInputStream.getTopLevelPosition returning getPosition() = " +
+ //getPosition() + " because enclosure is " + enclosure);
+ //}
+ return getPosition();
+ }
+
+ public static TypeCodeInputStream readEncapsulation(InputStream is, org.omg.CORBA.ORB _orb) {
+ // _REVISIT_ Would be nice if we didn't have to copy the buffer!
+ TypeCodeInputStream encap;
+
+ int encapLength = is.read_long();
+
+ // read off part of the buffer corresponding to the encapsulation
+ byte[] encapBuffer = new byte[encapLength];
+ is.read_octet_array(encapBuffer, 0, encapBuffer.length);
+
+ // create an encapsulation using the marshal buffer
+ if (is instanceof CDRInputStream) {
+ encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
+ encapBuffer, encapBuffer.length,
+ ((CDRInputStream) is).isLittleEndian(),
+ ((CDRInputStream) is).getGIOPVersion());
+ } else {
+ encap = EncapsInputStreamFactory.newTypeCodeInputStream((ORB) _orb,
+ encapBuffer, encapBuffer.length);
+ }
+ encap.setEnclosingInputStream(is);
+ encap.makeEncapsulation();
+ //if (TypeCodeImpl.debug) {
+ //System.out.println("Created TypeCodeInputStream " + encap + " with parent " + is);
+ //encap.printBuffer();
+ //}
+ return encap;
+ }
+
+ protected void makeEncapsulation() {
+ // first entry in an encapsulation is the endianess
+ consumeEndian();
+ isEncapsulation = true;
+ }
+
+ public void printTypeMap() {
+ System.out.println("typeMap = {");
+ Iterator i = typeMap.keySet().iterator();
+ while (i.hasNext()) {
+ Integer pos = (Integer)i.next();
+ TypeCodeImpl tci = (TypeCodeImpl)typeMap.get(pos);
+ System.out.println(" key = " + pos.intValue() + ", value = " + tci.description());
+ }
+ System.out.println("}");
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java
new file mode 100644
index 0000000..93f7c97
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeOutputStream.java
@@ -0,0 +1,264 @@
+/*
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+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.Principal ;
+import org.omg.CORBA.CompletionStatus ;
+
+import org.omg.CORBA.TypeCodePackage.BadKind ;
+
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.encoding.MarshalInputStream;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.ByteArrayOutputStream;
+import java.math.BigDecimal;
+import java.math.BigInteger;
+import java.nio.ByteBuffer;
+
+import sun.corba.EncapsInputStreamFactory;
+
+public final class TypeCodeOutputStream extends EncapsOutputStream
+{
+ private OutputStream enclosure = null;
+ private Map typeMap = null;
+ private boolean isEncapsulation = false;
+
+ public TypeCodeOutputStream(ORB orb) {
+ super(orb, false);
+ }
+
+ public TypeCodeOutputStream(ORB orb, boolean littleEndian) {
+ super(orb, littleEndian);
+ }
+
+ public org.omg.CORBA.portable.InputStream create_input_stream()
+ {
+ TypeCodeInputStream tcis = EncapsInputStreamFactory
+ .newTypeCodeInputStream((ORB) orb(), getByteBuffer(),
+ getIndex(), isLittleEndian(), getGIOPVersion());
+ //if (TypeCodeImpl.debug) {
+ //System.out.println("Created TypeCodeInputStream " + tcis + " with no parent");
+ //tcis.printBuffer();
+ //}
+ return tcis;
+ }
+
+ public void setEnclosingOutputStream(OutputStream enclosure) {
+ this.enclosure = enclosure;
+ }
+
+ /*
+ public boolean isEncapsulatedIn(TypeCodeOutputStream outerEnclosure) {
+ if (outerEnclosure == this)
+ return true;
+ if (enclosure == null)
+ return false;
+ if (enclosure instanceof TypeCodeOutputStream)
+ return ((TypeCodeOutputStream)enclosure).isEncapsulatedIn(outerEnclosure);
+ // Last chance! Recursion ends with first non TypeCodeOutputStream.
+ return (enclosure == outerEnclosure);
+ }
+ */
+
+ public TypeCodeOutputStream getTopLevelStream() {
+ if (enclosure == null)
+ return this;
+ if (enclosure instanceof TypeCodeOutputStream)
+ 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 byte order
+ // which is included in getPosition().
+ if (isEncapsulation) pos += 4;
+ //if (TypeCodeImpl.debug) {
+ //System.out.println("TypeCodeOutputStream.getTopLevelPosition using getTopLevelPosition " +
+ //((TypeCodeOutputStream)enclosure).getTopLevelPosition() +
+ //" + getPosition() " + getPosition() +
+ //(isEncapsulation ? " + encaps length 4" : "") +
+ //" = " + pos);
+ //}
+ return pos;
+ }
+ //if (TypeCodeImpl.debug) {
+ //System.out.println("TypeCodeOutputStream.getTopLevelPosition returning getPosition() = " +
+ //getPosition() + ", enclosure is " + enclosure);
+ //}
+ return getPosition();
+ }
+
+ public void addIDAtPosition(String id, int position) {
+ if (typeMap == null)
+ typeMap = new HashMap(16);
+ //if (TypeCodeImpl.debug) System.out.println(this + " adding id " + id + " at position " + position);
+ typeMap.put(id, new Integer(position));
+ }
+
+ public int getPositionForID(String id) {
+ if (typeMap == null)
+ throw wrapper.refTypeIndirType( CompletionStatus.COMPLETED_NO ) ;
+ //if (TypeCodeImpl.debug) System.out.println("Getting position " + ((Integer)typeMap.get(id)).intValue() +
+ //" for id " + id);
+ return ((Integer)typeMap.get(id)).intValue();
+ }
+
+ public void writeRawBuffer(org.omg.CORBA.portable.OutputStream s, int firstLong) {
+ // Writes this streams buffer to the given OutputStream
+ // without byte order flag and length as is the case for encapsulations.
+
+ // Make sure to align s to 4 byte boundaries.
+ // Unfortunately we can't do just this:
+ // s.alignAndReserve(4, 4);
+ // So we have to take the first four bytes given in firstLong and write them
+ // with a call to write_long which will trigger the alignment.
+ // Then write the rest of the byte array.
+
+ //if (TypeCodeImpl.debug) {
+ //System.out.println(this + ".writeRawBuffer(" + s + ", " + firstLong + ")");
+ //if (s instanceof CDROutputStream) {
+ //System.out.println("Parent position before writing kind = " + ((CDROutputStream)s).getIndex());
+ //}
+ //}
+ s.write_long(firstLong);
+ //if (TypeCodeImpl.debug) {
+ //if (s instanceof CDROutputStream) {
+ //System.out.println("Parent position after writing kind = " + ((CDROutputStream)s).getIndex());
+ //}
+ //}
+ ByteBuffer byteBuffer = getByteBuffer();
+ if (byteBuffer.hasArray())
+ {
+ s.write_octet_array(byteBuffer.array(), 4, getIndex() - 4);
+ }
+ else
+ {
+ // get bytes from DirectByteBuffer
+ // NOTE: Microbenchmarks are showing it is faster to do
+ // a loop of ByteBuffer.get(int) than it is to do
+ // a bulk ByteBuffer.get(byte[], offset, length)
+ byte[] buf = new byte[byteBuffer.limit()];
+ for (int i = 0; i < buf.length; i++)
+ buf[i] = byteBuffer.get(i);
+ s.write_octet_array(buf, 4, getIndex() - 4);
+ }
+ //if (TypeCodeImpl.debug) {
+ //if (s instanceof CDROutputStream) {
+ //System.out.println("Parent position after writing all " + getIndex() + " bytes = " + ((CDROutputStream)s).getIndex());
+ //}
+ //}
+ }
+
+ public TypeCodeOutputStream createEncapsulation(org.omg.CORBA.ORB _orb) {
+ TypeCodeOutputStream encap =
+ sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)_orb, isLittleEndian());
+ encap.setEnclosingOutputStream(this);
+ encap.makeEncapsulation();
+ //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + encap + " with parent " + this);
+ return encap;
+ }
+
+ protected void makeEncapsulation() {
+ // first entry in an encapsulation is the endianess
+ putEndian();
+ isEncapsulation = true;
+ }
+
+ public static TypeCodeOutputStream wrapOutputStream(OutputStream os) {
+ boolean littleEndian = ((os instanceof CDROutputStream) ? ((CDROutputStream)os).isLittleEndian() : false);
+ TypeCodeOutputStream tos =
+ sun.corba.OutputStreamFactory.newTypeCodeOutputStream((ORB)os.orb(), littleEndian);
+ tos.setEnclosingOutputStream(os);
+ //if (TypeCodeImpl.debug) System.out.println("Created TypeCodeOutputStream " + tos + " with parent " + os);
+ return tos;
+ }
+
+ public int getPosition() {
+ return getIndex();
+ }
+
+ public int getRealIndex(int index) {
+ int topPos = getTopLevelPosition();
+ //if (TypeCodeImpl.debug) System.out.println("TypeCodeOutputStream.getRealIndex using getTopLevelPosition " +
+ //topPos + " instead of getPosition " + getPosition());
+ return topPos;
+ }
+/*
+ protected void printBuffer() {
+ super.printBuffer();
+ }
+*/
+ public byte[] getTypeCodeBuffer() {
+ // Returns the buffer trimmed of the trailing zeros and without the
+ // known _kind value at the beginning.
+ ByteBuffer theBuffer = getByteBuffer();
+ //System.out.println("outBuffer length = " + (getIndex() - 4));
+ byte[] tcBuffer = new byte[getIndex() - 4];
+ // Micro-benchmarks show that DirectByteBuffer.get(int) is faster
+ // than DirectByteBuffer.get(byte[], offset, length).
+ // REVISIT - May want to check if buffer is direct or non-direct
+ // and use array copy if ByteBuffer is non-direct.
+ for (int i = 0; i < tcBuffer.length; i++)
+ tcBuffer[i] = theBuffer.get(i+4);
+ return tcBuffer;
+ }
+
+ public void printTypeMap() {
+ System.out.println("typeMap = {");
+ Iterator i = typeMap.keySet().iterator();
+ while (i.hasNext()) {
+ String id = (String)i.next();
+ Integer pos = (Integer)typeMap.get(id);
+ System.out.println(" key = " + id + ", value = " + pos);
+ }
+ System.out.println("}");
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeReader.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeReader.java
new file mode 100644
index 0000000..8f55fc2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/TypeCodeReader.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.ByteArrayOutputStream;
+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.Principal ;
+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_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.corba.TypeCodeImpl;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.encoding.MarshalInputStream;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+
+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();
+ // for debugging
+ //public void printBuffer();
+ public int getPosition();
+ public void printTypeMap();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/WrapperInputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/WrapperInputStream.java
new file mode 100644
index 0000000..aad4380
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/encoding/WrapperInputStream.java
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.encoding;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Collections;
+import java.util.ArrayList;
+import java.io.IOException;
+import java.io.PrintStream;
+import java.io.ByteArrayOutputStream;
+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.Principal ;
+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_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.corba.TypeCodeImpl;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.encoding.MarshalInputStream;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+
+public class WrapperInputStream extends org.omg.CORBA_2_3.portable.InputStream implements TypeCodeReader
+{
+ private CDRInputStream stream;
+ private Map typeMap = null;
+ private int startPos = 0;
+
+ public WrapperInputStream(CDRInputStream s) {
+ super();
+ stream = 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(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 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(); }
+ public 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(this + " adding tc " + tc + " at position " + position);
+ typeMap.put(new Integer(position), tc);
+ }
+
+ public TypeCodeImpl getTypeCodeAtPosition(int position) {
+ if (typeMap == null)
+ return null;
+ //if (TypeCodeImpl.debug) System.out.println("Getting tc " + (TypeCodeImpl)typeMap.get(new Integer(position)) +
+ //" at position " + position);
+ return (TypeCodeImpl)typeMap.get(new Integer(position));
+ }
+
+ public void setEnclosingInputStream(InputStream enclosure) {
+ // WrapperInputStream has no enclosure
+ }
+
+ public TypeCodeReader getTopLevelStream() {
+ // WrapperInputStream has no enclosure
+ return this;
+ }
+
+ public int getTopLevelPosition() {
+ //if (TypeCodeImpl.debug) System.out.println("WrapperInputStream.getTopLevelPosition " +
+ //"returning getPosition " + getPosition() + " - startPos " + startPos +
+ //" = " + (getPosition() - startPos));
+ return getPosition() - startPos;
+ }
+
+ public void performORBVersionSpecificInit() {
+ // This is never actually called on a WrapperInputStream, but
+ // exists to satisfy the interface requirement.
+ stream.performORBVersionSpecificInit();
+ }
+
+ public void resetCodeSetConverters() {
+ stream.resetCodeSetConverters();
+ }
+
+ //public void printBuffer() { stream.printBuffer(); }
+
+ public void printTypeMap() {
+ System.out.println("typeMap = {");
+ List sortedKeys = new ArrayList(typeMap.keySet());
+ Collections.sort(sortedKeys);
+ Iterator i = sortedKeys.iterator();
+ while (i.hasNext()) {
+ Integer pos = (Integer)i.next();
+ TypeCodeImpl tci = (TypeCodeImpl)typeMap.get(pos);
+ System.out.println(" key = " + pos.intValue() + ", value = " + tci.description());
+ }
+ System.out.println("}");
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java
new file mode 100644
index 0000000..235b895
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CDREncapsCodec.java
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.interceptors;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.LocalObject;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import sun.corba.EncapsInputStreamFactory;
+
+import com.sun.corba.se.impl.corba.AnyImpl;
+import com.sun.corba.se.impl.encoding.EncapsInputStream;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+import org.omg.IOP.Codec;
+import org.omg.IOP.CodecPackage.FormatMismatch;
+import org.omg.IOP.CodecPackage.InvalidTypeForEncoding;
+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.
+ */
+public final class CDREncapsCodec
+ extends org.omg.CORBA.LocalObject
+ implements Codec
+{
+ // The ORB that created the factory this codec was created from
+ private ORB orb;
+ ORBUtilSystemException wrapper;
+
+ // The GIOP version we are encoding for
+ private GIOPVersion giopVersion;
+
+ /*
+ *******************************************************************
+ * 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.
+ *
+ * @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 ) {
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get(
+ (com.sun.corba.se.spi.orb.ORB)orb, CORBALogDomains.RPC_PROTOCOL ) ;
+
+ giopVersion = GIOPVersion.getInstance( (byte)major, (byte)minor );
+ }
+
+ /**
+ * Convert the given any into a CDR encapsulated octet sequence
+ */
+ public byte[] encode( Any data )
+ throws InvalidTypeForEncoding
+ {
+ if ( data == null )
+ throw wrapper.nullParam() ;
+ return encodeImpl( data, true );
+ }
+
+ /**
+ * 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.nullParam() ;
+ return decodeImpl( data, null );
+ }
+
+ /**
+ * 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.nullParam() ;
+ 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.
+ */
+ public Any decode_value( byte[] data, TypeCode tc )
+ throws FormatMismatch, TypeMismatch
+ {
+ if( data == null )
+ throw wrapper.nullParam() ;
+ if( tc == null )
+ throw wrapper.nullParam() ;
+ 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.
+ */
+ private byte[] encodeImpl( Any data, boolean sendTypeCode )
+ throws InvalidTypeForEncoding
+ {
+ if( data == null )
+ throw wrapper.nullParam() ;
+
+ // _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
+ // 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.
+
+ // Create output stream with default endianness.
+ EncapsOutputStream cdrOut =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream(
+ (com.sun.corba.se.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() );
+ }
+
+ // Encode value and return.
+ data.write_value( cdrOut );
+
+ return cdrOut.toByteArray();
+ }
+
+ /**
+ * 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.nullParam() ;
+
+ 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,
+ // it is turned into a FormatMismatch exception.
+
+ try {
+ EncapsInputStream cdrIn = EncapsInputStreamFactory.newEncapsInputStream( orb, data,
+ data.length, giopVersion );
+
+
+ cdrIn.consumeEndian();
+
+ // If type code not specified, read it from octet stream:
+ if( tc == null ) {
+ tc = cdrIn.read_TypeCode();
+ }
+
+ // Create a new Any object:
+ any = new AnyImpl( (com.sun.corba.se.spi.orb.ORB)orb );
+ any.read_value( cdrIn, tc );
+ }
+ catch( RuntimeException e ) {
+ // See above note.
+ throw new FormatMismatch();
+ }
+
+ return any;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java
new file mode 100644
index 0000000..94e3f95
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ClientRequestInfoImpl.java
@@ -0,0 +1,978 @@
+/*
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.interceptors;
+
+import java.util.HashMap ;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.CTX_RESTRICT_SCOPE;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.ParameterMode;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.servicecontext.UnknownServiceContext;
+
+import org.omg.IOP.ServiceContext;
+import org.omg.IOP.ServiceContextHelper;
+import org.omg.IOP.TaggedProfile;
+import org.omg.IOP.TaggedProfileHelper;
+import org.omg.IOP.TaggedComponent;
+import org.omg.IOP.TaggedComponentHelper;
+import org.omg.IOP.TAG_INTERNET_IOP;
+import org.omg.Dynamic.Parameter;
+import org.omg.PortableInterceptor.ClientRequestInfo;
+import org.omg.PortableInterceptor.LOCATION_FORWARD;
+import org.omg.PortableInterceptor.SUCCESSFUL;
+import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
+import org.omg.PortableInterceptor.TRANSPORT_RETRY;
+import org.omg.PortableInterceptor.USER_EXCEPTION;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.protocol.RetryType;
+import com.sun.corba.se.spi.transport.CorbaContactInfo;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator;
+
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.protocol.CorbaInvocationInfo;
+import com.sun.corba.se.impl.util.RepositoryId;
+
+/**
+ * Implementation of the ClientRequestInfo interface as specified in
+ * orbos/99-12-02 section 5.4.2.
+ */
+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;
+ static final int CALL_RECEIVE_OTHER = 2;
+
+ //////////////////////////////////////////////////////////////////////
+ //
+ // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
+ //
+ //////////////////////////////////////////////////////////////////////
+
+ // 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
+ // incremented every time a request is retried, and decremented every
+ // 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;
+
+ // The RequestImpl is set when the call is DII based.
+ // The DII query calls like ParameterList, ExceptionList,
+ // ContextList will be delegated to RequestImpl.
+ private org.omg.CORBA.Request request;
+
+ // Sources of client request information
+ private boolean diiInitiate;
+ private CorbaMessageMediator messageMediator;
+
+ // Cached information:
+ private org.omg.CORBA.Object cachedTargetObject;
+ private org.omg.CORBA.Object cachedEffectiveTargetObject;
+ private Parameter[] cachedArguments;
+ private TypeCode[] cachedExceptions;
+ private String[] cachedContexts;
+ private String[] cachedOperationContext;
+ private String cachedReceivedExceptionId;
+ private Any cachedResult;
+ private Any cachedReceivedException;
+ private TaggedProfile cachedEffectiveProfile;
+ // key = Integer, value = IOP.ServiceContext.
+ private HashMap cachedRequestServiceContexts;
+ // key = Integer, value = IOP.ServiceContext.
+ private HashMap cachedReplyServiceContexts;
+ // key = Integer, value = TaggedComponent
+ private HashMap cachedEffectiveComponents;
+
+
+ protected 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.
+ */
+ void reset() {
+ super.reset();
+
+ // Please keep these in the same order that they're declared above.
+
+ // 6763340
+ retryRequest = RetryType.NONE;
+
+ // Do not reset entryCount because we need to know when to pop this
+ // from the stack.
+
+ request = null;
+ diiInitiate = false;
+ messageMediator = null;
+
+ // Clear cached attributes:
+ cachedTargetObject = null;
+ cachedEffectiveTargetObject = null;
+ cachedArguments = null;
+ cachedExceptions = null;
+ cachedContexts = null;
+ cachedOperationContext = null;
+ cachedReceivedExceptionId = null;
+ cachedResult = null;
+ cachedReceivedException = null;
+ cachedEffectiveProfile = null;
+ cachedRequestServiceContexts = null;
+ cachedReplyServiceContexts = null;
+ cachedEffectiveComponents = null;
+
+ piCurrentPushed = false;
+
+ startingPointCall = CALL_SEND_REQUEST;
+ endingPointCall = CALL_RECEIVE_REPLY;
+
+ }
+
+ /*
+ **********************************************************************
+ * Access protection
+ **********************************************************************/
+
+ // Method IDs for all methods in ClientRequestInfo. This allows for a
+ // convenient O(1) lookup for checkAccess().
+ protected static final int MID_TARGET = MID_RI_LAST + 1;
+ protected static final int MID_EFFECTIVE_TARGET = MID_RI_LAST + 2;
+ protected static final int MID_EFFECTIVE_PROFILE = MID_RI_LAST + 3;
+ protected static final int MID_RECEIVED_EXCEPTION = MID_RI_LAST + 4;
+ protected static final int MID_RECEIVED_EXCEPTION_ID = MID_RI_LAST + 5;
+ protected static final int MID_GET_EFFECTIVE_COMPONENT = MID_RI_LAST + 6;
+ protected static final int MID_GET_EFFECTIVE_COMPONENTS
+ = MID_RI_LAST + 7;
+ protected static final int MID_GET_REQUEST_POLICY = MID_RI_LAST + 8;
+ protected 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 }
+ };
+
+
+ /*
+ **********************************************************************
+ * Public ClientRequestInfo interfaces
+ **********************************************************************/
+
+ /**
+ * Creates a new ClientRequestInfo implementation.
+ * The constructor is package scope since no other package need create
+ * an instance of this class.
+ */
+ protected ClientRequestInfoImpl( ORB myORB ) {
+ super( myORB );
+ startingPointCall = CALL_SEND_REQUEST;
+ endingPointCall = CALL_RECEIVE_REPLY;
+ }
+
+ /**
+ * The object which the client called to perform the operation.
+ */
+ public org.omg.CORBA.Object target (){
+ // access is currently valid for all states:
+ //checkAccess( MID_TARGET );
+ if (cachedTargetObject == null) {
+ CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
+ 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.
+ */
+ public org.omg.CORBA.Object effective_target() {
+ // access is currently valid for all states:
+ //checkAccess( MID_EFFECTIVE_TARGET );
+
+ // Note: This is not necessarily the same as locatedIOR.
+ // Reason: See the way we handle COMM_FAILURES in
+ // ClientRequestDispatcher.createRequest, v1.32
+
+ if (cachedEffectiveTargetObject == null) {
+ CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
+ messageMediator.getContactInfo();
+ // REVISIT - get through chain like getLocatedIOR helper below.
+ 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.
+ */
+ public TaggedProfile effective_profile (){
+ // access is currently valid for all states:
+ //checkAccess( MID_EFFECTIVE_PROFILE );
+
+ if( cachedEffectiveProfile == null ) {
+ CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
+ messageMediator.getContactInfo();
+ cachedEffectiveProfile =
+ corbaContactInfo.getEffectiveProfile().getIOPProfile();
+ }
+
+ // Good citizen: In the interest of efficiency, we assume interceptors
+ // will not modify the returned TaggedProfile in any way so we need
+ // not make a deep copy of it.
+
+ return cachedEffectiveProfile;
+ }
+
+ /**
+ * Contains the exception to be returned to the client.
+ */
+ public Any received_exception (){
+ checkAccess( MID_RECEIVED_EXCEPTION );
+
+ if( cachedReceivedException == null ) {
+ cachedReceivedException = exceptionToAny( exception );
+ }
+
+ // Good citizen: In the interest of efficiency, we assume interceptors
+ // will not modify the returned Any in any way so we need
+ // not make a deep copy of it.
+
+ return cachedReceivedException;
+ }
+
+ /**
+ * The CORBA::RepositoryId of the exception to be returned to the client.
+ */
+ public String received_exception_id (){
+ checkAccess( MID_RECEIVED_EXCEPTION_ID );
+
+ if( cachedReceivedExceptionId == null ) {
+ String result = 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 ) {
+ String name = exception.getClass().getName();
+ result = ORBUtility.repositoryIdOf(name);
+ } 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?
+
+ 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).
+ */
+ public TaggedComponent get_effective_component (int id){
+ checkAccess( MID_GET_EFFECTIVE_COMPONENT );
+
+ return get_effective_components( id )[0];
+ }
+
+ /**
+ * Returns all the tagged components with the given ID from the profile
+ * selected for this request.
+ */
+ public TaggedComponent[] get_effective_components (int id){
+ checkAccess( MID_GET_EFFECTIVE_COMPONENTS );
+ Integer integerId = new Integer( id );
+ TaggedComponent[] result = null;
+ boolean justCreatedCache = false;
+
+ if( cachedEffectiveComponents == null ) {
+ cachedEffectiveComponents = new HashMap();
+ justCreatedCache = true;
+ }
+ else {
+ // Look in cache:
+ result = (TaggedComponent[])cachedEffectiveComponents.get(
+ integerId );
+ }
+
+ // null could mean we cached null or not in cache.
+ if( (result == null) &&
+ (justCreatedCache ||
+ !cachedEffectiveComponents.containsKey( integerId ) ) )
+ {
+ // Not in cache. Get it from the profile:
+ CorbaContactInfo corbaContactInfo = (CorbaContactInfo)
+ messageMediator.getContactInfo();
+ IIOPProfileTemplate ptemp =
+ (IIOPProfileTemplate)corbaContactInfo.getEffectiveProfile().
+ getTaggedProfileTemplate();
+ result = ptemp.getIOPComponents(myORB, id);
+ cachedEffectiveComponents.put( integerId, 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) ) {
+ throw stdWrapper.invalidComponentId( integerId ) ;
+ }
+
+ // 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
+ // clone the array and make a deep copy of its contents.
+
+ return result;
+ }
+
+ /**
+ * Returns the given policy in effect for this operation.
+ */
+ 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() ;
+ }
+
+ /**
+ * Allows interceptors to add service contexts to the request.
+ * <p>
+ * There is no declaration of the order of the service contexts. They
+ * may or may not appear in the order they are added.
+ */
+ public void add_request_service_context (ServiceContext service_context,
+ boolean replace)
+ {
+ checkAccess( MID_ADD_REQUEST_SERVICE_CONTEXT );
+
+ if( cachedRequestServiceContexts == null ) {
+ cachedRequestServiceContexts = new HashMap();
+ }
+
+ 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
+ // 3. Define entries in the validCall[][] table for interception points.
+
+ /*
+ **********************************************************************
+ * 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.
+ **********************************************************************/
+
+ /**
+ * See RequestInfoImpl for javadoc.
+ */
+ 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.
+ */
+ return messageMediator.getRequestId();
+ }
+
+ /**
+ * See RequestInfoImpl for javadoc.
+ */
+ public String operation (){
+ // access is currently valid for all states:
+ //checkAccess( MID_OPERATION );
+ return messageMediator.getOperationName();
+ }
+
+ /**
+ * See RequestInfoImpl for javadoc.
+ */
+ public Parameter[] arguments (){
+ checkAccess( MID_ARGUMENTS );
+
+ 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() );
+ }
+
+ // 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;
+ }
+
+ /**
+ * See RequestInfoImpl for javadoc.
+ */
+ public TypeCode[] exceptions (){
+ checkAccess( MID_EXCEPTIONS );
+
+ 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( );
+ int count = excList.count();
+ TypeCode[] excTCList = new TypeCode[count];
+ try {
+ for( int i = 0; i < count; i++ ) {
+ excTCList[i] = excList.item( i );
+ }
+ } catch( Exception e ) {
+ throw wrapper.exceptionInExceptions( e ) ;
+ }
+
+ cachedExceptions = excTCList;
+ }
+
+ // 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
+ // they will not change the values of the containing TypeCodes.
+
+ return cachedExceptions;
+ }
+
+ /**
+ * See RequestInfoImpl for javadoc.
+ */
+ public String[] contexts (){
+ checkAccess( MID_CONTEXTS );
+
+ 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( );
+ int count = ctxList.count();
+ String[] ctxListToReturn = new String[count];
+ try {
+ for( int i = 0; i < count; i++ ) {
+ ctxListToReturn[i] = ctxList.item( i );
+ }
+ } catch( Exception e ) {
+ throw wrapper.exceptionInContexts( e ) ;
+ }
+
+ cachedContexts = ctxListToReturn;
+ }
+
+ // Good citizen: In the interest of efficiency, we assume
+ // interceptors will be "good citizens" in that they will not
+ // modify the contents of the String[] array.
+
+ return cachedContexts;
+ }
+
+ /**
+ * See RequestInfoImpl for javadoc.
+ */
+ public String[] operation_context (){
+ checkAccess( MID_OPERATION_CONTEXT );
+
+ 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( );
+ // _REVISIT_ The API for get_values is not compliant with the spec,
+ // Revisit this code once it's fixed.
+ // _REVISIT_ Our ORB doesn't support Operation Context, This code
+ // will not be excerscised until it's supported.
+ // 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 != null ) &&( 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++ ) {
+ NamedValue nv;
+ try {
+ nv = nvList.item( i );
+ }
+ catch (Exception e ) {
+ return (String[]) null;
+ }
+ context[index] = nv.name();
+ index++;
+ context[index] = nv.value().extract_string();
+ index++;
+ }
+ }
+
+ cachedOperationContext = context;
+ }
+
+ // Good citizen: In the interest of efficiency, we assume
+ // interceptors will be "good citizens" in that they will not
+ // modify the contents of the String[] array.
+
+ return cachedOperationContext;
+ }
+
+ /**
+ * See RequestInfoImpl for javadoc.
+ */
+ public Any result (){
+ checkAccess( MID_RESULT );
+
+ if( cachedResult == null ) {
+ if( request == null ) {
+ throw stdWrapper.piOperationNotSupported5() ;
+ }
+ // Get the result from the DII request data.
+ NamedValue nvResult = request.result( );
+
+ if( nvResult == null ) {
+ throw wrapper.piDiiResultIsNull() ;
+ }
+
+ cachedResult = nvResult.value();
+ }
+
+ // Good citizen: In the interest of efficiency, we assume that
+ // interceptors will not modify the contents of the result Any.
+ // Otherwise, we would need to create a deep copy of the Any.
+
+ return cachedResult;
+ }
+
+ /**
+ * See RequestInfoImpl for javadoc.
+ */
+ public boolean response_expected (){
+ // access is currently valid for all states:
+ //checkAccess( MID_RESPONSE_EXPECTED );
+ return ! messageMediator.isOneWay();
+ }
+
+ /**
+ * See RequestInfoImpl for javadoc.
+ */
+ 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() ;
+ }
+
+ // Do not cache this value since if an interceptor raises
+ // forward request then the next interceptor in the
+ // list should see the new value.
+ IOR ior = getLocatedIOR();
+ return iorToObject(ior);
+ }
+
+ private IOR getLocatedIOR()
+ {
+ IOR ior;
+ CorbaContactInfoList contactInfoList = (CorbaContactInfoList)
+ messageMediator.getContactInfo().getContactInfoList();
+ ior = contactInfoList.getEffectiveTargetIOR();
+ return ior;
+ }
+
+ protected void setLocatedIOR(IOR ior)
+ {
+ ORB orb = (ORB) messageMediator.getBroker();
+
+ CorbaContactInfoListIterator iterator = (CorbaContactInfoListIterator)
+ ((CorbaInvocationInfo)orb.getInvocationInfo())
+ .getContactInfoListIterator();
+
+ // REVISIT - this most likely causes reportRedirect to happen twice.
+ // Once here and once inside the request dispatcher.
+ iterator.reportRedirect(
+ (CorbaContactInfo)messageMediator.getContactInfo(),
+ ior);
+ }
+
+ /**
+ * See RequestInfoImpl for javadoc.
+ */
+ public org.omg.IOP.ServiceContext get_request_service_context( int id ) {
+ checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT );
+
+ if( cachedRequestServiceContexts == null ) {
+ cachedRequestServiceContexts = new HashMap();
+ }
+
+ 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.
+ */
+ public org.omg.IOP.ServiceContext get_reply_service_context( int id ) {
+ checkAccess( MID_GET_REPLY_SERVICE_CONTEXT );
+
+ if( cachedReplyServiceContexts == null ) {
+ cachedReplyServiceContexts = new HashMap();
+ }
+
+ // In the event this is called from a oneway, we will have no
+ // response object.
+ //
+ // 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.
+ //
+ // REVISIT: this is the only thing used
+ // from response at this time. However, a more general solution
+ // would avoid accessing other parts of response's header.
+ //
+ // Instead of throwing a NullPointer, we will
+ // "gracefully" handle these with a BAD_PARAM with minor code 25.
+
+ try {
+ ServiceContexts serviceContexts =
+ messageMediator.getReplyServiceContexts();
+ if (serviceContexts == null) {
+ throw new NullPointerException();
+ }
+ return getServiceContext(cachedReplyServiceContexts,
+ serviceContexts, id);
+ } catch (NullPointerException e) {
+ // REVISIT how this is programmed - not what it does.
+ // 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( e ) ;
+ }
+ }
+
+ //
+ // REVISIT
+ // Override RequestInfoImpl connection to work in framework.
+ //
+
+ public com.sun.corba.se.spi.legacy.connection.Connection connection()
+ {
+ return (com.sun.corba.se.spi.legacy.connection.Connection)
+ messageMediator.getConnection();
+ }
+
+
+
+ /*
+ **********************************************************************
+ * Package-scope interfaces
+ **********************************************************************/
+
+ protected void setInfo(MessageMediator messageMediator)
+ {
+ this.messageMediator = (CorbaMessageMediator)messageMediator;
+ // REVISIT - so mediator can handle DII in subcontract.
+ this.messageMediator.setDIIInfo(request);
+ }
+
+ /**
+ * Set or reset the retry request flag.
+ */
+ void setRetryRequest( RetryType retryRequest ) {
+ this.retryRequest = retryRequest;
+ }
+
+ /**
+ * Retrieve the current retry request status.
+ */
+ RetryType getRetryRequest() {
+ // 6763340
+ return this.retryRequest;
+ }
+
+ /**
+ * Increases the entry count by 1.
+ */
+ void incrementEntryCount() {
+ this.entryCount++;
+ }
+
+ /**
+ * Decreases the entry count by 1.
+ */
+ void decrementEntryCount() {
+ this.entryCount--;
+ }
+
+ /**
+ * Retrieve the current entry count
+ */
+ int getEntryCount() {
+ return this.entryCount;
+ }
+
+ /**
+ * 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 ) {
+ 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;
+ }
+ }
+
+ /**
+ * Sets DII request object in the RequestInfoObject.
+ */
+ protected void setDIIRequest(org.omg.CORBA.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.
+ */
+ protected void setDIIInitiate( boolean diiInitiate ) {
+ this.diiInitiate = diiInitiate;
+ }
+
+ /**
+ * See comment for setDIIInitiate
+ */
+ 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.
+ */
+ protected void setPICurrentPushed( boolean piCurrentPushed ) {
+ this.piCurrentPushed = piCurrentPushed;
+ }
+
+ protected boolean isPICurrentPushed() {
+ return this.piCurrentPushed;
+ }
+
+ /**
+ * Overridden from RequestInfoImpl.
+ */
+ protected void setException( Exception exception ) {
+ super.setException( exception );
+
+ // Clear cached values:
+ cachedReceivedException = null;
+ cachedReceivedExceptionId = null;
+ }
+
+ protected boolean getIsOneWay() {
+ return ! response_expected();
+ }
+
+ /**
+ * See description for RequestInfoImpl.checkAccess
+ */
+ 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 ) {
+ case EXECUTION_POINT_STARTING:
+ switch( startingPointCall ) {
+ case CALL_SEND_REQUEST:
+ validCallIndex = 0;
+ break;
+ case CALL_SEND_POLL:
+ validCallIndex = 1;
+ break;
+ }
+ break;
+ case EXECUTION_POINT_ENDING:
+ switch( endingPointCall ) {
+ case CALL_RECEIVE_REPLY:
+ validCallIndex = 2;
+ break;
+ case CALL_RECEIVE_EXCEPTION:
+ validCallIndex = 3;
+ break;
+ case CALL_RECEIVE_OTHER:
+ validCallIndex = 4;
+ break;
+ }
+ break;
+ }
+
+ // Check the validCall table:
+ if( !validCall[methodID][validCallIndex] ) {
+ throw stdWrapper.invalidPiCall2() ;
+ }
+ }
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CodecFactoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CodecFactoryImpl.java
new file mode 100644
index 0000000..5274b55
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/CodecFactoryImpl.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.interceptors;
+
+import org.omg.IOP.Codec;
+import org.omg.IOP.CodecFactory;
+import org.omg.IOP.CodecFactoryPackage.UnknownEncoding;
+import org.omg.IOP.Encoding;
+import org.omg.IOP.ENCODING_CDR_ENCAPS;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.LocalObject;
+
+/**
+ * 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
+{
+ // The ORB that created this Codec Factory
+ private ORB orb;
+ private ORBUtilSystemException wrapper ;
+
+ // The maximum minor version of GIOP supported by this codec factory.
+ // Currently, this is 1.2.
+ private static final int MAX_MINOR_VERSION_SUPPORTED = 2;
+
+ // The pre-created minor versions of Codec version 1.0, 1.1, ...,
+ // 1.(MAX_MINOR_VERSION_SUPPORTED)
+ 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.
+ */
+ public CodecFactoryImpl( ORB orb ) {
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get(
+ (com.sun.corba.se.spi.orb.ORB)orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+
+ // 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 );
+ }
+ }
+
+ /**
+ * 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.
+ */
+ 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) )
+ {
+ result = codecs[enc.minor_version];
+ }
+ }
+
+ if( result == null ) {
+ throw new UnknownEncoding();
+ }
+
+ return result;
+ }
+
+ /**
+ * Called when an invalid null parameter was passed. Throws a
+ * BAD_PARAM with a minor code of 1
+ */
+ private void nullParam()
+ {
+ throw wrapper.nullParam() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/IORInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/IORInfoImpl.java
new file mode 100644
index 0000000..6f0a106
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/IORInfoImpl.java
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.interceptors;
+
+import java.util.Iterator ;
+
+import org.omg.IOP.TaggedComponent;
+
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INV_POLICY;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.LocalObject;
+
+import org.omg.PortableInterceptor.IORInfo;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
+import org.omg.PortableInterceptor.ObjectReferenceFactory;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+
+import com.sun.corba.se.spi.legacy.interceptor.IORInfoExt;
+import com.sun.corba.se.spi.legacy.interceptor.UnknownType;
+
+import com.sun.corba.se.spi.ior.IORTemplate;
+import com.sun.corba.se.spi.ior.TaggedProfileTemplate;
+import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.InterceptorsSystemException ;
+import com.sun.corba.se.impl.logging.OMGSystemException ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/**
+ * 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
+{
+ // 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 ;
+
+ // adapter_template, and R/W to current_factory are valid
+ private static final int STATE_ESTABLISHED = 1 ;
+
+ // No methods are valid in this state
+ private static final int STATE_DONE = 2 ;
+
+ // The current state of this object
+ private int state = STATE_INITIAL ;
+
+ // The ObjectAdapter associated with this IORInfo object.
+ private ObjectAdapter adapter;
+
+ private ORB orb ;
+
+ private ORBUtilSystemException orbutilWrapper ;
+ private InterceptorsSystemException wrapper ;
+ private OMGSystemException omgWrapper ;
+
+ /**
+ * 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() ;
+
+ orbutilWrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ wrapper = InterceptorsSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ omgWrapper = OMGSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+
+ 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.
+ * <p>
+ * 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 tpye is
+ * in effect, then this operation will return a nil object reference.
+ */
+ public Policy get_effective_policy (int type) {
+ checkState( STATE_INITIAL, STATE_ESTABLISHED ) ;
+
+ 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.
+ * <p>
+ * 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 ) ;
+
+ 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.
+ * <p>
+ * Any number of components may exist with the same component ID.
+ * <p>
+ * 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.
+ */
+ 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).
+ * @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);
+ if (port == -1) {
+ throw new UnknownType();
+ }
+ return port;
+ }
+
+ public ObjectAdapter getObjectAdapter()
+ {
+ return adapter;
+ }
+
+ public int manager_id()
+ {
+ checkState( STATE_INITIAL, STATE_ESTABLISHED) ;
+
+ return adapter.getManagerId() ;
+ }
+
+ public short state()
+ {
+ checkState( STATE_INITIAL, STATE_ESTABLISHED) ;
+
+ return adapter.getState() ;
+ }
+
+ 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
+ // is called when a certain POA is created in a certain ORB
+ // 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
+ // an ObjectReferenceTemplate here.
+
+ return adapter.getAdapterTemplate() ;
+ }
+
+ public ObjectReferenceFactory current_factory()
+ {
+ checkState( STATE_ESTABLISHED) ;
+
+ return adapter.getCurrentFactory() ;
+ }
+
+ public void current_factory( ObjectReferenceFactory factory )
+ {
+ checkState( STATE_ESTABLISHED) ;
+
+ adapter.setCurrentFactory( factory ) ;
+ }
+
+ /**
+ * 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 )
+ {
+ // Convert the given IOP::TaggedComponent into the appropriate
+ // type for the TaggedProfileTemplate
+ TaggedComponentFactoryFinder finder =
+ orb.getTaggedComponentFactoryFinder();
+ Object 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() ) {
+ found = true;
+ 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() ;
+ }
+ }
+
+ /**
+ * Called when an invalid null parameter was passed. Throws a
+ * BAD_PARAM with a minor code of 1
+ */
+ private void nullParam()
+ {
+ throw orbutilWrapper.nullParam() ;
+ }
+
+ // REVISIT: add minor codes!
+
+ private void checkState( int expectedState )
+ {
+ if (expectedState != state)
+ throw wrapper.badState1( new Integer(expectedState), new Integer(state) ) ;
+ }
+
+ private void checkState( int expectedState1, int expectedState2 )
+ {
+ if ((expectedState1 != state) && (expectedState2 != state))
+ throw wrapper.badState2( new Integer(expectedState1),
+ new Integer(expectedState2), new Integer(state) ) ;
+ }
+
+ void makeStateEstablished()
+ {
+ checkState( STATE_INITIAL ) ;
+
+ state = STATE_ESTABLISHED ;
+ }
+
+ void makeStateDone()
+ {
+ checkState( STATE_ESTABLISHED ) ;
+
+ state = STATE_DONE ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorInvoker.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorInvoker.java
new file mode 100644
index 0000000..367ed23
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorInvoker.java
@@ -0,0 +1,662 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.interceptors;
+
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.PortableInterceptor.LOCATION_FORWARD;
+import org.omg.PortableInterceptor.SUCCESSFUL;
+import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
+import org.omg.PortableInterceptor.TRANSPORT_RETRY;
+import org.omg.PortableInterceptor.USER_EXCEPTION;
+import org.omg.PortableInterceptor.ClientRequestInfo;
+import org.omg.PortableInterceptor.ClientRequestInterceptor;
+import org.omg.PortableInterceptor.ForwardRequest;
+import org.omg.PortableInterceptor.IORInterceptor;
+import org.omg.PortableInterceptor.IORInterceptor_3_0;
+import org.omg.PortableInterceptor.ServerRequestInfo;
+import org.omg.PortableInterceptor.ServerRequestInterceptor;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+/**
+ * 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.
+ */
+public class InterceptorInvoker {
+
+ // The ORB
+ private ORB orb;
+
+ // The list of interceptors to be invoked
+ private InterceptorList interceptorList;
+
+ // True if interceptors are to be invoked, or false if not
+ // Note: This is a global enable/disable flag, whereas the enable flag
+ // in the RequestInfoStack in PIHandlerImpl is only for a particular Thread.
+ private boolean enabled = false;
+
+ // 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
+ // 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().
+ */
+ InterceptorInvoker( ORB orb, InterceptorList interceptorList,
+ PICurrent piCurrent )
+ {
+ this.orb = orb;
+ this.interceptorList = interceptorList;
+ this.enabled = false;
+ this.current = piCurrent;
+ }
+
+ /**
+ * Enables or disables the interceptor invoker
+ */
+ void setEnabled( boolean enabled ) {
+ this.enabled = enabled;
+ }
+
+ /*
+ **********************************************************************
+ * IOR Interceptor invocation
+ **********************************************************************/
+
+ /**
+ * Called when a new POA is created.
+ *
+ * @param oa The Object Adapter associated with the IOR interceptor.
+ */
+ void objectAdapterCreated( ObjectAdapter oa ) {
+ // If invocation is not yet enabled, don't do anything.
+ if( enabled ) {
+ // Create IORInfo object to pass to IORInterceptors:
+ IORInfoImpl info = new IORInfoImpl( oa );
+
+ // Call each IORInterceptor:
+ 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,
+ // it doesn't really matter much, but it's simply a force of habit.
+
+ for( int i = (size - 1); i >= 0; i-- ) {
+ IORInterceptor interceptor = iorInterceptors[i];
+ try {
+ 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.
+ }
+ }
+
+ // Change the state so that only template operations are valid
+ info.makeStateEstablished() ;
+
+ 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 ;
+ // Note that exceptions here are NOT ignored, as per the
+ // ORT spec (orbos/01-01-04)
+ interceptor30.components_established( info );
+ }
+ }
+
+ // Change the state so that no operations are valid,
+ // in case a reference to info escapes this scope.
+ // This also completes the actions associated with the
+ // template interceptors on this POA.
+ info.makeStateDone() ;
+ }
+ }
+
+ void adapterManagerStateChanged( int managerId, short newState )
+ {
+ if (enabled) {
+ IORInterceptor[] interceptors =
+ (IORInterceptor[])interceptorList.getInterceptors(
+ InterceptorList.INTERCEPTOR_TYPE_IOR );
+ int size = interceptors.length;
+
+ 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 );
+ }
+ } catch (Exception exc) {
+ // No-op: ignore exception in this case
+ }
+ }
+ }
+ }
+
+ void adapterStateChanged( ObjectReferenceTemplate[] templates,
+ short newState )
+ {
+ if (enabled) {
+ IORInterceptor[] interceptors =
+ (IORInterceptor[])interceptorList.getInterceptors(
+ InterceptorList.INTERCEPTOR_TYPE_IOR );
+ int size = interceptors.length;
+
+ 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 );
+ }
+ } catch (Exception exc) {
+ // No-op: ignore exception in this case
+ }
+ }
+ }
+ }
+
+ /*
+ **********************************************************************
+ * Client Interceptor invocation
+ **********************************************************************/
+
+ /**
+ * Invokes either send_request, or send_poll, depending on the value
+ * of info.getStartingPointCall()
+ */
+ void invokeClientInterceptorStartingPoint( ClientRequestInfoImpl info ) {
+ // If invocation is not yet enabled, don't do anything.
+ if( enabled ) {
+ 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( info.EXECUTION_POINT_STARTING );
+
+ // Get all ClientRequestInterceptors:
+ ClientRequestInterceptor[] clientInterceptors =
+ (ClientRequestInterceptor[])interceptorList.
+ getInterceptors( InterceptorList.INTERCEPTOR_TYPE_CLIENT );
+ int size = clientInterceptors.length;
+
+ // We will assume that all interceptors returned successfully,
+ // and adjust the flowStackIndex to the appropriate value if
+ // we later discover otherwise.
+ int flowStackIndex = size;
+ boolean continueProcessing = true;
+
+ // Determine whether we are calling send_request or send_poll:
+ // (This is currently commented out because our ORB does not
+ // yet support the Messaging specification, so send_poll will
+ // never occur. Once we have implemented messaging, this may
+ // be uncommented.)
+ // int startingPointCall = info.getStartingPointCall();
+ for( int i = 0; continueProcessing && (i < size); i++ ) {
+ try {
+ clientInterceptors[i].send_request( info );
+
+ // Again, it is not necessary for a switch here, since
+ // there is only one starting point call type (see
+ // above comment).
+
+ //switch( startingPointCall ) {
+ //case ClientRequestInfoImpl.CALL_SEND_REQUEST:
+ //clientInterceptors[i].send_request( info );
+ //break;
+ //case ClientRequestInfoImpl.CALL_SEND_POLL:
+ //clientInterceptors[i].send_poll( info );
+ //break;
+ //}
+
+ }
+ catch( ForwardRequest e ) {
+ // 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 );
+
+ 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
+ // check a boolean value instead and it seems to work
+ // fine.
+ continueProcessing = false;
+ }
+ catch( SystemException 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 );
+
+ // 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
+ // check a boolean value instead and it seems to
+ // work fine.
+ continueProcessing = false;
+ }
+ }
+
+ // Remember where we left off in the flow stack:
+ info.setFlowStackIndex( flowStackIndex );
+ }
+ finally {
+ // Make the SlotTable fresh for the next interception point.
+ current.resetSlotTable( );
+ }
+ } // end enabled check
+ }
+
+ /**
+ * Invokes either receive_reply, receive_exception, or receive_other,
+ * depending on the value of info.getEndingPointCall()
+ */
+ void invokeClientInterceptorEndingPoint( ClientRequestInfoImpl info ) {
+ // If invocation is not yet enabled, don't do anything.
+ if( enabled ) {
+ try {
+ // NOTE: It is assumed someplace else prepared a
+ // fresh TSC slot table.
+
+ info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );
+
+ // Get all ClientRequestInterceptors:
+ ClientRequestInterceptor[] clientInterceptors =
+ (ClientRequestInterceptor[])interceptorList.
+ getInterceptors( InterceptorList.INTERCEPTOR_TYPE_CLIENT );
+ int flowStackIndex = info.getFlowStackIndex();
+
+ // Determine whether we are calling receive_reply,
+ // receive_exception, or receive_other:
+ int endingPointCall = info.getEndingPointCall();
+
+ // 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() )
+ {
+ endingPointCall = ClientRequestInfoImpl.CALL_RECEIVE_OTHER;
+ info.setEndingPointCall( endingPointCall );
+ }
+
+ // Only step through the interceptors whose starting points
+ // have successfully returned.
+ // 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-- ) {
+
+ try {
+ switch( endingPointCall ) {
+ case ClientRequestInfoImpl.CALL_RECEIVE_REPLY:
+ clientInterceptors[i].receive_reply( info );
+ break;
+ case ClientRequestInfoImpl.CALL_RECEIVE_EXCEPTION:
+ clientInterceptors[i].receive_exception( info );
+ break;
+ case ClientRequestInfoImpl.CALL_RECEIVE_OTHER:
+ clientInterceptors[i].receive_other( info );
+ break;
+ }
+ }
+ catch( ForwardRequest e ) {
+
+ // 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 ) {
+
+ // 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 );
+ }
+ }
+ }
+ finally {
+ // See doc for setPICurrentPushed as to why this is necessary.
+ // Check info for null in case errors happen before initiate.
+ if (info != null && info.isPICurrentPushed()) {
+ current.popSlotTable( );
+ // After the pop, original client's TSC slot table
+ // remains avaiable via PICurrent.
+ }
+ }
+ } // end enabled check
+ }
+
+ /*
+ **********************************************************************
+ * Server Interceptor invocation
+ **********************************************************************/
+
+ /**
+ * Invokes receive_request_service_context interception points.
+ */
+ void invokeServerInterceptorStartingPoint( ServerRequestInfoImpl info ) {
+ // If invocation is not yet enabled, don't do anything.
+ if( enabled ) {
+ try {
+ // Make a fresh slot table for RSC.
+ current.pushSlotTable();
+ info.setSlotTable(current.getSlotTable());
+
+ // Make a fresh slot table for TSC in case
+ // interceptors need to make out calls.
+ current.pushSlotTable( );
+
+ info.setCurrentExecutionPoint( info.EXECUTION_POINT_STARTING );
+
+ // Get all ServerRequestInterceptors:
+ ServerRequestInterceptor[] serverInterceptors =
+ (ServerRequestInterceptor[])interceptorList.
+ getInterceptors( InterceptorList.INTERCEPTOR_TYPE_SERVER );
+ int size = serverInterceptors.length;
+
+ // We will assume that all interceptors returned successfully,
+ // and adjust the flowStackIndex to the appropriate value if
+ // we later discover otherwise.
+ int flowStackIndex = size;
+ boolean continueProcessing = true;
+
+ // Currently, there is only one server-side starting point
+ // interceptor called receive_request_service_contexts.
+ for( int i = 0; continueProcessing && (i < size); i++ ) {
+
+ try {
+ serverInterceptors[i].
+ receive_request_service_contexts( info );
+ }
+ catch( ForwardRequest e ) {
+ // 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 );
+
+ // 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
+ // check a boolean value instead and it seems to work
+ // fine.
+ continueProcessing = false;
+ }
+ catch( SystemException 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 );
+
+ // 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
+ // check a boolean value instead and it seems to
+ // work fine.
+ continueProcessing = false;
+ }
+
+ }
+
+ // Remember where we left off in the flow stack:
+ info.setFlowStackIndex( flowStackIndex );
+ }
+ finally {
+ // The remaining points, ServantManager and Servant
+ // all run in the same logical thread.
+ current.popSlotTable( );
+ // Now TSC and RSC are equivalent.
+ }
+ } // end enabled check
+ }
+
+ /**
+ * Invokes receive_request interception points
+ */
+ void invokeServerInterceptorIntermediatePoint(
+ ServerRequestInfoImpl info )
+ {
+ int intermediatePointCall = info.getIntermediatePointCall();
+ // If invocation is not yet enabled, don't do anything.
+ if( enabled && ( intermediatePointCall !=
+ ServerRequestInfoImpl.CALL_INTERMEDIATE_NONE ) )
+ {
+ // NOTE: do not touch the slotStack. The RSC and TSC are
+ // equivalent at this point.
+
+ info.setCurrentExecutionPoint( info.EXECUTION_POINT_INTERMEDIATE );
+
+ // Get all ServerRequestInterceptors:
+ 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++ ) {
+
+ try {
+ serverInterceptors[i].receive_request( info );
+ }
+ catch( ForwardRequest e ) {
+
+ // 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 );
+ break;
+ }
+ catch( SystemException 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 );
+ break;
+ }
+ }
+ } // end enabled check
+ }
+
+ /**
+ * Invokes either send_reply, send_exception, or send_other,
+ * depending on the value of info.getEndingPointCall()
+ */
+ void invokeServerInterceptorEndingPoint( ServerRequestInfoImpl info ) {
+ // If invocation is not yet enabled, don't do anything.
+ if( enabled ) {
+ try {
+ // 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
+ // 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).
+ //info.setCurrentExecutionPoint( info.EXECUTION_POINT_ENDING );
+
+ // Get all ServerRequestInterceptors:
+ ServerRequestInterceptor[] serverInterceptors =
+ (ServerRequestInterceptor[])interceptorList.
+ getInterceptors( InterceptorList.INTERCEPTOR_TYPE_SERVER );
+ int flowStackIndex = info.getFlowStackIndex();
+
+ // Determine whether we are calling
+ // send_exception, or send_other:
+ int endingPointCall = info.getEndingPointCall();
+
+ // Only step through the interceptors whose starting points
+ // have successfully returned.
+ for( int i = (flowStackIndex - 1); i >= 0; i-- ) {
+ try {
+ switch( endingPointCall ) {
+ case ServerRequestInfoImpl.CALL_SEND_REPLY:
+ serverInterceptors[i].send_reply( info );
+ break;
+ case ServerRequestInfoImpl.CALL_SEND_EXCEPTION:
+ serverInterceptors[i].send_exception( info );
+ break;
+ case ServerRequestInfoImpl.CALL_SEND_OTHER:
+ serverInterceptors[i].send_other( info );
+ break;
+ }
+ }
+ catch( ForwardRequest e ) {
+ // 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 );
+ info.setForwardRequestRaisedInEnding();
+ }
+ catch( SystemException 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 );
+ }
+ }
+
+ // Remember that all interceptors' starting and ending points
+ // have already been executed so we need not do anything.
+ 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.
+ */
+ 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
+ // delegate ForwardRequest object.
+ if( forwardRequest != null ) {
+ org.omg.CORBA.Object object = forwardRequest.forward;
+
+ // Convert the forward object into an IOR:
+ IOR ior = ORBUtility.getIOR( object ) ;
+ info.setLocatedIOR( ior );
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorList.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorList.java
new file mode 100644
index 0000000..b8e6466
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/InterceptorList.java
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.interceptors;
+
+import org.omg.PortableInterceptor.Interceptor;
+import org.omg.PortableInterceptor.ORBInitInfo;
+import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
+
+import org.omg.CORBA.INTERNAL;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+import java.lang.reflect.Array;
+
+import com.sun.corba.se.impl.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.
+ */
+public class InterceptorList {
+
+ // 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
+ // 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
+ // 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
+ };
+
+ // True if no further interceptors may be registered with this list.
+ private boolean locked = false;
+ private InterceptorsSystemException wrapper ;
+
+ // 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][];
+
+ /**
+ * Creates a new Interceptor List. Constructor is package scope so
+ * only the ORB can create it.
+ */
+ InterceptorList( InterceptorsSystemException wrapper ) {
+ this.wrapper = wrapper ;
+ // Create empty interceptors arrays for each type:
+ initInterceptorArrays();
+ }
+
+ /**
+ * Registers an interceptor of the given type into the interceptor list.
+ * The type is one of:
+ * <ul>
+ * <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
+ * <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
+ * <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
+ * </ul>
+ *
+ * @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
+ {
+ // If locked, deny any further addition of interceptors.
+ if( locked ) {
+ throw wrapper.interceptorListLocked() ;
+ }
+
+ // Cache interceptor name:
+ String interceptorName = interceptor.name();
+ boolean anonymous = interceptorName.equals( "" );
+ boolean foundDuplicate = false;
+ Interceptor[] interceptorList = interceptors[type];
+
+ // If this is not an anonymous interceptor,
+ // search for an interceptor of the same name in this category:
+ 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 ) ) {
+ foundDuplicate = true;
+ break;
+ }
+ }
+ }
+
+ 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.
+ */
+ void lock() {
+ locked = true;
+ }
+
+ /**
+ * Retrieves an array of interceptors of the given type. For efficiency,
+ * the type parameter is assumed to be valid.
+ */
+ Interceptor[] getInterceptors( int type ) {
+ return interceptors[type];
+ }
+
+ /**
+ * Returns true if there is at least one interceptor of the given type,
+ * or false if not.
+ */
+ 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.
+ */
+ private void initInterceptorArrays() {
+ 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 );
+ }
+ }
+
+ /**
+ * Grows the given interceptor array by one:
+ */
+ 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
+ // 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 );
+ interceptors[type] = replacementArray;
+ }
+
+ /**
+ * Destroys all interceptors in this list by invoking their destroy()
+ * method.
+ */
+ void destroyAll() {
+ int numTypes = interceptors.length;
+
+ for( int i = 0; i < numTypes; i++ ) {
+ int numInterceptors = interceptors[i].length;
+ for( int j = 0; j < numInterceptors; j++ ) {
+ interceptors[i][j].destroy();
+ }
+ }
+ }
+
+ /**
+ * Sort interceptors.
+ */
+ void sortInterceptors() {
+ List sorted = null;
+ List unsorted = null;
+
+ int numTypes = interceptors.length;
+
+ 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++ ) {
+ Interceptor interceptor = interceptors[i][j];
+ if (interceptor instanceof Comparable) {
+ sorted.add(interceptor);
+ } else {
+ unsorted.add(interceptor);
+ }
+ }
+ if (numInterceptors > 0 && sorted.size() > 0) {
+ // Let the RuntimeExceptions thrown by sort
+ // (i.e., ClassCastException and UnsupportedOperationException)
+ // flow back to the user.
+ Collections.sort(sorted);
+ Iterator sortedIterator = sorted.iterator();
+ Iterator unsortedIterator = unsorted.iterator();
+ for( int j = 0; j < numInterceptors; j++ ) {
+ if (sortedIterator.hasNext()) {
+ interceptors[i][j] =
+ (Interceptor) sortedIterator.next();
+ } else if (unsortedIterator.hasNext()) {
+ interceptors[i][j] =
+ (Interceptor) unsortedIterator.next();
+ } else {
+ throw wrapper.sortSizeMismatch() ;
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ORBInitInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ORBInitInfoImpl.java
new file mode 100644
index 0000000..f8ac397
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ORBInitInfoImpl.java
@@ -0,0 +1,381 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.interceptors;
+
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.PolicyError;
+import org.omg.IOP.CodecFactory;
+import org.omg.PortableInterceptor.ORBInitInfo;
+import org.omg.PortableInterceptor.ClientRequestInterceptor;
+import org.omg.PortableInterceptor.IORInterceptor;
+import org.omg.PortableInterceptor.PolicyFactory;
+import org.omg.PortableInterceptor.ServerRequestInterceptor;
+import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
+import org.omg.PortableInterceptor.ORBInitInfoPackage.InvalidName;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.legacy.interceptor.ORBInitInfoExt ;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+import com.sun.corba.se.impl.logging.InterceptorsSystemException;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+
+/**
+ * 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
+{
+ // The ORB we are initializing
+ private ORB orb;
+
+ private InterceptorsSystemException wrapper ;
+ private ORBUtilSystemException orbutilWrapper ;
+ private OMGSystemException omgWrapper ;
+
+ // The arguments passed to ORB_init
+ private String[] args;
+
+ // The ID of the ORB being initialized
+ private String orbId;
+
+ // The CodecFactory
+ private CodecFactory codecFactory;
+
+ // The current stage of initialization
+ private int stage = STAGE_PRE_INIT;
+
+ // The pre-initialization stage (pre_init() being called)
+ public static final int STAGE_PRE_INIT = 0;
+
+ // The post-initialization stage (post_init() being called)
+ public static final int STAGE_POST_INIT = 1;
+
+ // Reject all calls - this object should no longer be around.
+ 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";
+
+ /**
+ * 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 )
+ {
+ this.orb = orb;
+
+ wrapper = InterceptorsSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ orbutilWrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ omgWrapper = OMGSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+
+ this.args = args;
+ this.orbId = orbId;
+ this.codecFactory = codecFactory;
+ }
+
+ /** Return the ORB behind this ORBInitInfo. This is defined in the
+ * ORBInitInfoExt interface.
+ */
+ public ORB getORB()
+ {
+ return orb ;
+ }
+
+ /**
+ * Sets the current stage we are in. This limits access to certain
+ * functionality.
+ */
+ 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.
+ */
+ private void checkStage() {
+ if( stage == STAGE_CLOSED ) {
+ throw wrapper.orbinitinfoInvalid() ;
+ }
+ }
+
+ /*
+ *******************************************************************
+ * The following are implementations of the ORBInitInfo operations.
+ *******************************************************************/
+
+ /**
+ * This attribute contains the arguments passed to ORB_init. They may
+ * or may not contain the ORB's arguments
+ */
+ public String[] arguments () {
+ checkStage();
+ return args;
+ }
+
+ /**
+ * This attribute is the ID of the ORB being initialized
+ */
+ 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.
+ */
+ 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.
+ * <p>
+ * This method may not be called during post_init.
+ */
+ public void register_initial_reference( String id,
+ org.omg.CORBA.Object obj )
+ throws InvalidName
+ {
+ checkStage();
+ if( id == null ) nullParam();
+
+ // 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() ;
+ }
+
+ // This check was made to determine that the objref is a
+ // non-local objref that is fully
+ // initialized: this was called only for its side-effects of
+ // possibly throwing exceptions. However, registering
+ // local objects should be permitted!
+ // XXX/Revisit?
+ // IOR ior = ORBUtility.getIOR( obj ) ;
+
+ // 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 ;
+ }
+ }
+
+ /**
+ * 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.
+ * <p>
+ * (incorporates changes from errata in orbos/00-01-01)
+ * <p>
+ * This method may not be called during pre_init.
+ */
+ public org.omg.CORBA.Object resolve_initial_references (String id)
+ throws InvalidName
+ {
+ checkStage();
+ if( id == null ) nullParam();
+
+ if( stage == STAGE_PRE_INIT ) {
+ // Initializer is not allowed to invoke this method during
+ // this stage.
+
+ // _REVISIT_ Spec issue: What exception should really be
+ // thrown here?
+ throw wrapper.rirInvalidPreInit() ;
+ }
+
+ org.omg.CORBA.Object objRef = null;
+
+ try {
+ objRef = orb.resolve_initial_references( id );
+ }
+ catch( org.omg.CORBA.ORBPackage.InvalidName e ) {
+ // Convert PIDL to IDL exception:
+ throw new InvalidName();
+ }
+
+ return objRef;
+ }
+
+ // New method from CORBA 3.1
+ public void add_client_request_interceptor_with_policy (
+ ClientRequestInterceptor interceptor, Policy[] policies )
+ throws DuplicateName
+ {
+ // XXX ignore policies for now
+ add_client_request_interceptor( interceptor ) ;
+ }
+
+ /**
+ * This operation is used to add a client-side request Interceptor to
+ * the list of client-side request Interceptors.
+ * <p>
+ * 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
+ {
+ checkStage();
+ if( interceptor == null ) nullParam();
+
+ 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
+ {
+ // XXX ignore policies for now
+ add_server_request_interceptor( interceptor ) ;
+ }
+
+ /**
+ * This operation is used to add a server-side request Interceptor to
+ * the list of server-side request Interceptors.
+ * <p>
+ * 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
+ {
+ checkStage();
+ 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
+ {
+ // XXX ignore policies for now
+ add_ior_interceptor( interceptor ) ;
+ }
+
+ /**
+ * This operation is used to add an IOR Interceptor to
+ * the list of IOR Interceptors.
+ * <p>
+ * 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
+ {
+ checkStage();
+ if( interceptor == null ) nullParam();
+
+ orb.getPIHandler().register_interceptor( interceptor,
+ InterceptorList.INTERCEPTOR_TYPE_IOR );
+ }
+
+ /**
+ * 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 () {
+ checkStage();
+
+ return ((PICurrent)orb.getPIHandler().getPICurrent()).allocateSlotId( );
+
+ }
+
+ /**
+ * Register a PolicyFactory for the given PolicyType.
+ * <p>
+ * 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 )
+ {
+ checkStage();
+ 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
+ */
+ private void nullParam()
+ throws BAD_PARAM
+ {
+ throw orbutilWrapper.nullParam() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PICurrent.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PICurrent.java
new file mode 100644
index 0000000..5502be3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PICurrent.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.interceptors;
+
+import com.sun.corba.se.spi.orb.ORB;
+import org.omg.PortableInterceptor.Current;
+import org.omg.PortableInterceptor.InvalidSlot;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.OMGSystemException ;
+
+/**
+ * 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
+{
+ // slotCounter is used to keep track of ORBInitInfo.allocate_slot_id()
+ private int slotCounter;
+
+ // The ORB associated with this PICurrent object.
+ private ORB myORB;
+
+ private OMGSystemException wrapper ;
+
+ // True if the orb is still initialzing and get_slot and set_slot are not
+ // to be called.
+ private boolean orbInitializing;
+
+ // ThreadLocal contains a stack of SlotTable which are used
+ // for resolve_initial_references( "PICurrent" );
+ private ThreadLocal threadLocalSlotTable
+ = new ThreadLocal( ) {
+ protected Object initialValue( ) {
+ SlotTable table = new SlotTable( myORB, slotCounter );
+ return new SlotTableStack( myORB, table );
+ }
+ };
+
+ /**
+ * PICurrent constructor which will be called for every ORB
+ * initialization.
+ */
+ PICurrent( ORB myORB ) {
+ this.myORB = myORB;
+ wrapper = OMGSystemException.get( myORB,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ this.orbInitializing = true;
+ slotCounter = 0;
+ }
+
+
+ /**
+ * This method will be called from ORBInitInfo.allocate_slot_id( ).
+ * simply returns a slot id by incrementing slotCounter.
+ */
+ int allocateSlotId( ) {
+ int slotId = slotCounter;
+ slotCounter = slotCounter + 1;
+ return slotId;
+ }
+
+
+ /**
+ * This method gets the SlotTable which is on the top of the
+ * ThreadLocalStack.
+ */
+ SlotTable getSlotTable( ) {
+ SlotTable table = (SlotTable)
+ ((SlotTableStack)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.
+ */
+ void pushSlotTable( ) {
+ SlotTableStack st = (SlotTableStack)threadLocalSlotTable.get();
+ st.pushSlotTable( );
+ }
+
+
+ /**
+ * This method pops a SlotTable on the SlotTableStack.
+ */
+ void popSlotTable( ) {
+ SlotTableStack st = (SlotTableStack)threadLocalSlotTable.get();
+ 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.
+ */
+ 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,
+ // throw a BAD_INV_ORDER.
+ throw wrapper.invalidPiCall3() ;
+ }
+
+ 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.
+ */
+ 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,
+ // throw a BAD_INV_ORDER.
+ throw wrapper.invalidPiCall4() ;
+ }
+
+ 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.
+ */
+ void resetSlotTable( ) {
+ getSlotTable().resetSlots();
+ }
+
+ /**
+ * Called from ORB when the ORBInitializers are about to start
+ * initializing.
+ */
+ void setORBInitializing( boolean init ) {
+ this.orbInitializing = init;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java
new file mode 100644
index 0000000..9ad417e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PIHandlerImpl.java
@@ -0,0 +1,992 @@
+/*
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.interceptors;
+
+import java.util.*;
+import java.io.IOException;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.BAD_POLICY;
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.UNKNOWN;
+
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.RemarshalException;
+
+import org.omg.IOP.CodecFactory;
+
+import org.omg.PortableInterceptor.ForwardRequest;
+import org.omg.PortableInterceptor.Current;
+import org.omg.PortableInterceptor.Interceptor;
+import org.omg.PortableInterceptor.LOCATION_FORWARD;
+import org.omg.PortableInterceptor.ORBInitializer;
+import org.omg.PortableInterceptor.ORBInitInfo;
+import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName;
+import org.omg.PortableInterceptor.SUCCESSFUL;
+import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
+import org.omg.PortableInterceptor.TRANSPORT_RETRY;
+import org.omg.PortableInterceptor.USER_EXCEPTION;
+import org.omg.PortableInterceptor.PolicyFactory;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate;
+
+import com.sun.corba.se.pept.encoding.OutputObject;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orbutil.closure.ClosureFactory;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.protocol.ForwardException;
+import com.sun.corba.se.spi.protocol.PIHandler;
+import com.sun.corba.se.spi.protocol.RetryType;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.logging.InterceptorsSystemException;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+import com.sun.corba.se.impl.corba.RequestImpl;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.orbutil.StackImpl;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
+
+/**
+ * Provides portable interceptor functionality.
+ */
+public class PIHandlerImpl implements PIHandler
+{
+ // REVISIT - delete these after framework merging.
+ boolean printPushPopEnabled = false;
+ int pushLevel = 0;
+ private void printPush()
+ {
+ if (! printPushPopEnabled) return;
+ printSpaces(pushLevel);
+ pushLevel++;
+ System.out.println("PUSH");
+ }
+ private void printPop()
+ {
+ if (! printPushPopEnabled) return;
+ pushLevel--;
+ printSpaces(pushLevel);
+ System.out.println("POP");
+ }
+ private void printSpaces(int n)
+ {
+ for (int i = 0; i < n; i++) {
+ System.out.print(" ");
+ }
+ }
+
+ private ORB orb;
+ InterceptorsSystemException wrapper;
+ ORBUtilSystemException orbutilWrapper;
+ OMGSystemException omgWrapper;
+
+ // A unique id used in ServerRequestInfo.
+ // This does not correspond to the GIOP request id.
+ private int serverRequestIdCounter = 0;
+
+ // Stores the codec factory for producing codecs
+ CodecFactory codecFactory = 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;
+
+ // The list of portable interceptors, organized by type:
+ private InterceptorList interceptorList;
+
+ // Cached information for optimization - do we have any interceptors
+ // registered of the given types? Set during ORB initialization.
+ private boolean hasIORInterceptors;
+ private boolean hasClientInterceptors; // temp always true
+ private boolean hasServerInterceptors;
+
+ // The class responsible for invoking interceptors
+ private InterceptorInvoker interceptorInvoker;
+
+ // There will be one PICurrent instantiated for every ORB.
+ private PICurrent current;
+
+ // This table contains a list of PolicyFactories registered using
+ // ORBInitInfo.registerPolicyFactory() method.
+ // Key for the table is PolicyType which is an Integer
+ // Value is PolicyFactory.
+ private HashMap policyFactoryTable;
+
+ // Table to convert from a ReplyMessage.? to a PI replyStatus short.
+ // 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
+ };
+
+ // ThreadLocal containing a stack to store client request info objects
+ // and a disable count.
+ private ThreadLocal threadLocalClientRequestInfoStack =
+ new ThreadLocal() {
+ protected Object initialValue() {
+ return new RequestInfoStack();
+ }
+ };
+
+ // ThreadLocal containing the current server request info object.
+ private ThreadLocal threadLocalServerRequestInfoStack =
+ new ThreadLocal() {
+ protected Object initialValue() {
+ return new RequestInfoStack();
+ }
+ };
+
+ public void close() {
+ orb = null;
+ wrapper = null;
+ orbutilWrapper = null;
+ omgWrapper = 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.
+ //
+ // We use an ArrayList instead since it is not thread-safe.
+ // RequestInfoStack is used quite frequently.
+ private 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
+ // value indicates they are enabled.
+ // NOTE: The is only currently used on the client side.
+ public int disableCount = 0;
+ }
+
+ public PIHandlerImpl( ORB orb, String[] args ) {
+ this.orb = orb ;
+ wrapper = InterceptorsSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ orbutilWrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ omgWrapper = OMGSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ arguments = args ;
+
+ // Create codec factory:
+ codecFactory = new CodecFactoryImpl( orb );
+
+ // Create new interceptor list:
+ interceptorList = new InterceptorList( wrapper );
+
+ // Create a new PICurrent.
+ current = new PICurrent( orb );
+
+ // Create new interceptor invoker, initially disabled:
+ interceptorInvoker = new InterceptorInvoker( orb, interceptorList,
+ current );
+
+ // Register the PI current and Codec factory objects
+ orb.getLocalResolver().register( ORBConstants.PI_CURRENT_NAME,
+ ClosureFactory.makeConstant( current ) ) ;
+ orb.getLocalResolver().register( ORBConstants.CODEC_FACTORY_NAME,
+ ClosureFactory.makeConstant( codecFactory ) ) ;
+ }
+
+ public void initialize() {
+ // If we have any orb initializers, make use of them:
+ 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 );
+
+ // Call pre_init on all ORB initializers:
+ preInitORBInitializers( orbInitInfo );
+
+ // Call post_init on all ORB initializers:
+ postInitORBInitializers( orbInitInfo );
+
+ // Proprietary: sort interceptors:
+ interceptorList.sortInterceptors();
+
+ // Re-enable get_slot and set_slot to be called from within
+ // ORB initializers:
+ current.setORBInitializing( false );
+
+ // Ensure nobody makes any more calls on this object.
+ 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 );
+ // XXX 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
+ // ORBInitializer instances complete executing.
+ //hasClientInterceptors = interceptorList.hasInterceptorsOfType(
+ //InterceptorList.INTERCEPTOR_TYPE_CLIENT );
+ hasClientInterceptors = true;
+ hasServerInterceptors = interceptorList.hasInterceptorsOfType(
+ InterceptorList.INTERCEPTOR_TYPE_SERVER );
+
+ // Enable interceptor invoker (not necessary if no interceptors
+ // are registered). This should be the last stage of ORB
+ // initialization.
+ 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"
+ *
+ * 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.
+ */
+ public void destroyInterceptors() {
+ interceptorList.destroyAll();
+ }
+
+ public void objectAdapterCreated( ObjectAdapter oa )
+ {
+ if (!hasIORInterceptors)
+ return ;
+
+ interceptorInvoker.objectAdapterCreated( oa ) ;
+ }
+
+ public void adapterManagerStateChanged( int managerId,
+ short newState )
+ {
+ if (!hasIORInterceptors)
+ return ;
+
+ interceptorInvoker.adapterManagerStateChanged( managerId, newState ) ;
+ }
+
+ public void adapterStateChanged( ObjectReferenceTemplate[]
+ templates, short newState )
+ {
+ if (!hasIORInterceptors)
+ return ;
+
+ interceptorInvoker.adapterStateChanged( templates, newState ) ;
+ }
+
+ /*
+ *****************
+ * Client PI hooks
+ *****************/
+
+ public void disableInterceptorsThisThread() {
+ if( !hasClientInterceptors ) return;
+
+ RequestInfoStack infoStack =
+ (RequestInfoStack)threadLocalClientRequestInfoStack.get();
+ infoStack.disableCount++;
+ }
+
+ public void enableInterceptorsThisThread() {
+ if( !hasClientInterceptors ) return;
+
+ RequestInfoStack infoStack =
+ (RequestInfoStack)threadLocalClientRequestInfoStack.get();
+ infoStack.disableCount--;
+ }
+
+ public void invokeClientPIStartingPoint()
+ throws RemarshalException
+ {
+ 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 );
+
+ // 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) )
+ {
+ // 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
+ // 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) ) {
+ // It should not be possible for an interceptor to throw
+ // a UserException. By asserting instead of throwing the
+ // UserException, we need not declare anything but
+ // RemarshalException in the throws clause.
+ throw wrapper.exceptionInvalid() ;
+ }
+ }
+ 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 ) {
+
+ // 6763340
+ return handleClientPIEndingPoint( replyStatus, exception, false ) ;
+ }
+
+ public Exception invokeClientPIEndingPoint( int replyStatus,
+ Exception exception ) {
+
+ // 6763340
+ return handleClientPIEndingPoint( replyStatus, exception, true ) ;
+ }
+
+ 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
+ // is passed in (IndexOutOfBoundsException will be thrown otherwise)
+ short piReplyStatus = REPLY_MESSAGE_TO_PI_REPLY_STATUS[replyStatus];
+
+ // 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 );
+
+ if (invokeEndingPoint) {
+ // 6763340
+ interceptorInvoker.invokeClientInterceptorEndingPoint( info );
+ piReplyStatus = info.getReplyStatus();
+ }
+
+ // Check reply status:
+ 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 ) ;
+ } else {
+ 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) ) {
+ exception = info.getException();
+ }
+
+ return exception;
+ }
+
+ 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 =
+ (RequestInfoStack)threadLocalClientRequestInfoStack.get();
+ ClientRequestInfoImpl info = null;
+
+ if (!infoStack.empty() ) {
+ info = (ClientRequestInfoImpl)infoStack.peek();
+ }
+
+ if (!diiRequest && (info != null) && info.isDIIInitiate() ) {
+ // In RequestImpl.doInvocation we already called
+ // initiateClientPIRequest( true ), so ignore this initiate.
+ 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:
+
+ // 6763340: don't push unless this is not a retry
+ if( (info == null) || !info.getRetryRequest().isRetry() ) {
+ info = new ClientRequestInfoImpl( orb );
+ infoStack.push( info );
+ printPush();
+ // Note: the entry count is automatically initialized to 0.
+ }
+
+ // 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.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
+ // info was pushed before, so that this was not a problem.
+ info.setReplyStatus( RequestInfoImpl.UNINITIALIZED ) ;
+
+ // If this is a DII request, make sure we ignore the next initiate.
+ if( diiRequest ) {
+ info.setDIIInitiate( true );
+ }
+ }
+ }
+
+ public void cleanupClientPIRequest() {
+ if( !hasClientInterceptors ) return;
+ if( !isClientPIEnabledForThisThread() ) return;
+
+ ClientRequestInfoImpl info = peekClientRequestInfoImplStack();
+ RetryType rt = info.getRetryRequest() ;
+
+ // fix for 6763340
+ 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.
+ //
+ // _REVISIT_ We cannot handle any exceptions or ForwardRequests
+ // flagged by the ending points here because there is no way
+ // 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 == info.UNINITIALIZED ) {
+ invokeClientPIEndingPoint( ReplyMessage.SYSTEM_EXCEPTION,
+ wrapper.unknownRequestInvoke(
+ CompletionStatus.COMPLETED_MAYBE ) ) ;
+ }
+ }
+
+ // Decrement entry count, and if it is zero, pop it from the stack.
+ info.decrementEntryCount();
+
+ // fix for 6763340, and probably other cases (non-recursive retry)
+ if (info.getEntryCount() == 0 && !info.getRetryRequest().isRetry()) {
+ // RequestInfoStack<ClientRequestInfoImpl> infoStack =
+ // threadLocalClientRequestInfoStack.get();
+ RequestInfoStack infoStack =
+ (RequestInfoStack)threadLocalClientRequestInfoStack.get();
+ infoStack.pop();
+ printPop();
+ }
+ }
+
+ public void setClientPIInfo(CorbaMessageMediator messageMediator)
+ {
+ if( !hasClientInterceptors ) return;
+ if( !isClientPIEnabledForThisThread() ) return;
+
+ peekClientRequestInfoImplStack().setInfo(messageMediator);
+ }
+
+ public void setClientPIInfo( RequestImpl requestImpl ) {
+ if( !hasClientInterceptors ) return;
+ if( !isClientPIEnabledForThisThread() ) return;
+
+ peekClientRequestInfoImplStack().setDIIRequest( requestImpl );
+ }
+
+ /*
+ *****************
+ * Server PI hooks
+ *****************/
+
+ public void invokeServerPIStartingPoint()
+ {
+ if( !hasServerInterceptors ) return;
+
+ ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
+ interceptorInvoker.invokeServerInterceptorStartingPoint( info );
+
+ // Handle SystemException or ForwardRequest:
+ serverPIHandleExceptions( info );
+ }
+
+ public void invokeServerPIIntermediatePoint()
+ {
+ if( !hasServerInterceptors ) return;
+
+ ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
+ 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 );
+ }
+
+ 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 );
+
+ // REVISIT: This was done inside of invokeServerInterceptorEndingPoint
+ // but needs to be here for now. See comment in that method for why.
+ info.setCurrentExecutionPoint( info.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() ) {
+ 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];
+
+ // Make forwarded IOR available to interceptors, if applicable:
+ 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 );
+
+ // Remember exception so we can tell if an interceptor changed it.
+ Exception prevException = info.getException();
+
+ // _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(
+ CompletionStatus.COMPLETED_MAYBE ) ) ;
+ }
+
+ // Invoke the ending interception points:
+ info.setReplyStatus( piReplyStatus );
+ interceptorInvoker.invokeServerInterceptorEndingPoint( info );
+ short newPIReplyStatus = info.getReplyStatus();
+ Exception newException = info.getException();
+
+ // 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 we are to forward the location:
+ 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() ) {
+ // Treat a ForwardRequest by changing the IOR.
+ replyMessage.setIOR( info.getForwardRequestIOR() );
+ }
+ }
+ }
+ }
+
+ public void setServerPIInfo( Exception exception ) {
+ if( !hasServerInterceptors ) return;
+
+ ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
+ info.setException( exception );
+ }
+
+ public void setServerPIInfo( NVList arguments )
+ {
+ if( !hasServerInterceptors ) return;
+
+ ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
+ info.setDSIArguments( arguments );
+ }
+
+ public void setServerPIExceptionInfo( Any exception )
+ {
+ if( !hasServerInterceptors ) return;
+
+ ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
+ info.setDSIException( exception );
+ }
+
+ public void setServerPIInfo( Any result )
+ {
+ if( !hasServerInterceptors ) return;
+
+ ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
+ info.setDSIResult( result );
+ }
+
+ public void initializeServerPIInfo( CorbaMessageMediator request,
+ ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp )
+ {
+ if( !hasServerInterceptors ) return;
+
+ RequestInfoStack infoStack =
+ (RequestInfoStack)threadLocalServerRequestInfoStack.get();
+ ServerRequestInfoImpl info = new ServerRequestInfoImpl( orb );
+ infoStack.push( info );
+ printPush();
+
+ // Notify request object that once response is constructed, make
+ // sure we execute ending points.
+ request.setExecutePIInResponseConstructor( true );
+
+ info.setInfo( request, oa, objectId, oktemp );
+ }
+
+ public void setServerPIInfo( java.lang.Object servant,
+ String targetMostDerivedInterface )
+ {
+ if( !hasServerInterceptors ) return;
+
+ ServerRequestInfoImpl info = peekServerRequestInfoImplStack();
+ info.setInfo( servant, targetMostDerivedInterface );
+ }
+
+ public void cleanupServerPIRequest() {
+ if( !hasServerInterceptors ) return;
+
+ RequestInfoStack infoStack =
+ (RequestInfoStack)threadLocalServerRequestInfoStack.get();
+ infoStack.pop();
+ printPop();
+ }
+
+ /*
+ **********************************************************************
+ * 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.
+ * <p>
+ * This method will NOT work for ending points.
+ */
+ private void serverPIHandleExceptions( ServerRequestInfoImpl info )
+ {
+ int endingPointCall = info.getEndingPointCall();
+ 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) )
+ {
+ // If an interceptor throws a forward request, convert it
+ // into a ForwardException for easier handling:
+ IOR ior = info.getForwardRequestIOR();
+ 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.
+ */
+ 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 ) {
+ 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.
+ */
+ private ClientRequestInfoImpl peekClientRequestInfoImplStack() {
+ RequestInfoStack infoStack =
+ (RequestInfoStack)threadLocalClientRequestInfoStack.get();
+ ClientRequestInfoImpl info = null;
+ if( !infoStack.empty() ) {
+ info = (ClientRequestInfoImpl)infoStack.peek();
+ } else {
+ 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.
+ */
+ private ServerRequestInfoImpl peekServerRequestInfoImplStack() {
+ RequestInfoStack infoStack =
+ (RequestInfoStack)threadLocalServerRequestInfoStack.get();
+ ServerRequestInfoImpl info = null;
+
+ if( !infoStack.empty() ) {
+ info = (ServerRequestInfoImpl)infoStack.peek();
+ } else {
+ throw wrapper.serverInfoStackNull() ;
+ }
+
+ return info;
+ }
+
+ /**
+ * Convenience method to determine whether Client PI is enabled
+ * for requests on this thread.
+ */
+ private boolean isClientPIEnabledForThisThread() {
+ RequestInfoStack infoStack =
+ (RequestInfoStack)threadLocalClientRequestInfoStack.get();
+ return (infoStack.disableCount == 0);
+ }
+
+ /**
+ * Call pre_init on all ORB initializers
+ */
+ private void preInitORBInitializers( ORBInitInfoImpl info ) {
+
+ // Inform ORBInitInfo we are in pre_init stage
+ 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++ ) {
+ ORBInitializer init = orb.getORBData().getORBInitializers()[i];
+ if( init != null ) {
+ try {
+ 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."
+ }
+ }
+ }
+ }
+
+ /**
+ * Call post_init on all ORB initializers
+ */
+ private void postInitORBInitializers( ORBInitInfoImpl info ) {
+
+ // Inform ORBInitInfo we are in post_init stage
+ 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++ ) {
+ ORBInitializer init = orb.getORBData().getORBInitializers()[i];
+ if( init != null ) {
+ try {
+ 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."
+ }
+ }
+ }
+ }
+
+ /**
+ * Creates the ORBInitInfo object to be passed to ORB intializers'
+ * pre_init and post_init methods
+ */
+ private ORBInitInfoImpl createORBInitInfo() {
+ ORBInitInfoImpl result = 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() ;
+
+ result = new ORBInitInfoImpl( orb, arguments, orbId, codecFactory );
+
+ return result;
+ }
+
+ /**
+ * Called by ORBInitInfo when an interceptor needs to be registered.
+ * The type is one of:
+ * <ul>
+ * <li>INTERCEPTOR_TYPE_CLIENT - ClientRequestInterceptor
+ * <li>INTERCEPTOR_TYPE_SERVER - ServerRequestInterceptor
+ * <li>INTERCEPTOR_TYPE_IOR - IORInterceptor
+ * </ul>
+ *
+ * @exception DuplicateName Thrown if an interceptor of the given
+ * name already exists for the given type.
+ */
+ 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( new Integer( type ) ) ;
+ }
+
+ String interceptorName = interceptor.name();
+
+ if( interceptorName == null ) {
+ throw wrapper.nameNull() ;
+ }
+
+ // Register with interceptor list:
+ interceptorList.register_interceptor( interceptor, type );
+ }
+
+ public Current getPICurrent( ) {
+ return current;
+ }
+
+ /**
+ * 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() ;
+ }
+
+ /** 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.se.spi.orb.ORB.
+ */
+ 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 );
+ }
+ PolicyFactory factory = (PolicyFactory)policyFactoryTable.get(
+ new Integer(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 );
+ 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.
+ */
+ public void registerPolicyFactory( int type, PolicyFactory factory ) {
+ if( policyFactoryTable == null ) {
+ policyFactoryTable = new HashMap();
+ }
+ Integer key = new Integer( type );
+ java.lang.Object val = policyFactoryTable.get( key );
+ if( val == null ) {
+ policyFactoryTable.put( key, factory );
+ }
+ else {
+ throw omgWrapper.policyFactoryRegFailed( new Integer( type ) ) ;
+ }
+ }
+
+ public synchronized int allocateServerRequestId ()
+ {
+ return serverRequestIdCounter++;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java
new file mode 100644
index 0000000..93c047b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/PINoOpHandlerImpl.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.interceptors;
+
+import java.io.IOException;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.NVList;
+
+import org.omg.IOP.CodecFactory;
+
+import org.omg.CORBA.portable.RemarshalException;
+
+import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
+import org.omg.PortableInterceptor.ForwardRequest;
+import org.omg.PortableInterceptor.Interceptor;
+import org.omg.PortableInterceptor.PolicyFactory;
+import org.omg.PortableInterceptor.Current;
+
+import org.omg.PortableInterceptor.ORBInitInfoPackage.DuplicateName ;
+
+import com.sun.corba.se.pept.encoding.OutputObject;
+
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.protocol.PIHandler;
+import com.sun.corba.se.spi.protocol.ForwardException;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import com.sun.corba.se.impl.corba.RequestImpl;
+
+import com.sun.corba.se.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.
+ */
+public class PINoOpHandlerImpl implements PIHandler
+{
+ public PINoOpHandlerImpl( ) {
+ }
+
+ public void close() {
+ }
+
+ public void initialize() {
+ }
+
+ public void destroyInterceptors() {
+ }
+
+ public void objectAdapterCreated( ObjectAdapter oa )
+ {
+ }
+
+ public void adapterManagerStateChanged( int managerId,
+ short newState )
+ {
+ }
+
+ public void adapterStateChanged( ObjectReferenceTemplate[]
+ templates, short newState )
+ {
+ }
+
+
+ public void disableInterceptorsThisThread() {
+ }
+
+ public void enableInterceptorsThisThread() {
+ }
+
+ public void invokeClientPIStartingPoint()
+ throws RemarshalException
+ {
+ }
+
+ public Exception invokeClientPIEndingPoint(
+ int replyStatus, Exception exception )
+ {
+ return null;
+ }
+
+ public Exception makeCompletedClientRequest(
+ int replyStatus, Exception exception ) {
+ return null;
+ }
+
+ public void initiateClientPIRequest( boolean diiRequest ) {
+ }
+
+ public void cleanupClientPIRequest() {
+ }
+
+ public void setClientPIInfo(CorbaMessageMediator messageMediator)
+ {
+ }
+
+ public void setClientPIInfo( RequestImpl requestImpl )
+ {
+ }
+
+ final public void sendCancelRequestIfFinalFragmentNotSent()
+ {
+ }
+
+
+ public void invokeServerPIStartingPoint()
+ {
+ }
+
+ public void invokeServerPIIntermediatePoint()
+ {
+ }
+
+ public void invokeServerPIEndingPoint( ReplyMessage replyMessage )
+ {
+ }
+
+ public void setServerPIInfo( Exception exception ) {
+ }
+
+ public void setServerPIInfo( NVList arguments )
+ {
+ }
+
+ public void setServerPIExceptionInfo( Any exception )
+ {
+ }
+
+ public void setServerPIInfo( Any result )
+ {
+ }
+
+ public void initializeServerPIInfo( CorbaMessageMediator request,
+ ObjectAdapter oa, byte[] objectId, ObjectKeyTemplate oktemp )
+ {
+ }
+
+ public void setServerPIInfo( java.lang.Object servant,
+ String targetMostDerivedInterface )
+ {
+ }
+
+ public void cleanupServerPIRequest() {
+ }
+
+ public void register_interceptor( Interceptor interceptor, int type )
+ throws DuplicateName
+ {
+ }
+
+ public Current getPICurrent( ) {
+ return null;
+ }
+
+ 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 int allocateServerRequestId ()
+ {
+ return 0;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java
new file mode 100644
index 0000000..52e457f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/RequestInfoImpl.java
@@ -0,0 +1,929 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.interceptors;
+
+import java.io.IOException ;
+
+import java.lang.reflect.Method ;
+import java.lang.reflect.InvocationTargetException ;
+
+import java.util.HashMap ;
+
+import org.omg.PortableInterceptor.ForwardRequest;
+import org.omg.PortableInterceptor.InvalidSlot;
+import org.omg.PortableInterceptor.RequestInfo;
+import org.omg.PortableInterceptor.LOCATION_FORWARD;
+import org.omg.IOP.TaggedProfile;
+import org.omg.IOP.TaggedComponent;
+import org.omg.IOP.ServiceContextHelper;
+import org.omg.Messaging.SYNC_WITH_TRANSPORT;
+import org.omg.CORBA.ParameterMode;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.CTX_RESTRICT_SCOPE;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.UserException;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.InputStream;
+
+import org.omg.Dynamic.Parameter;
+
+import com.sun.corba.se.spi.legacy.connection.Connection;
+
+import com.sun.corba.se.spi.legacy.interceptor.RequestInfoExt;
+
+import com.sun.corba.se.spi.ior.IOR;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.servicecontext.UnknownServiceContext;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+import com.sun.corba.se.impl.util.RepositoryId;
+
+import com.sun.corba.se.impl.logging.InterceptorsSystemException;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+
+import sun.corba.SharedSecrets;
+
+/**
+ * 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
+{
+ //////////////////////////////////////////////////////////////////////
+ //
+ // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
+ //
+ //////////////////////////////////////////////////////////////////////
+
+ // The ORB from which to get PICurrent and other info
+ protected ORB myORB;
+ protected InterceptorsSystemException wrapper ;
+ protected OMGSystemException stdWrapper ;
+
+ // The number of interceptors actually invoked for this client request.
+ // See setFlowStackIndex for a detailed description.
+ protected int flowStackIndex = 0;
+
+ // The type of starting point call to make to the interceptors
+ // See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of
+ // appropriate constants.
+ protected 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.
+ protected int intermediatePointCall;
+
+ // The type of ending point call to make to the interceptors
+ // See ClientRequestInfoImpl and ServerRequestInfoImpl for a list of
+ // appropriate constants.
+ protected 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.
+ protected short replyStatus = UNINITIALIZED;
+
+ // Constant for an uninitizlied reply status.
+ protected static final short UNINITIALIZED = -1;
+
+ // Which points we are currently executing (so we can implement the
+ // validity table).
+ protected int currentExecutionPoint;
+ protected static final int EXECUTION_POINT_STARTING = 0;
+ protected static final int EXECUTION_POINT_INTERMEDIATE = 1;
+ protected static final int EXECUTION_POINT_ENDING = 2;
+
+ // Set to true if all interceptors have had all their points
+ // executed.
+ protected boolean alreadyExecuted;
+
+ // Sources of request information
+ protected Connection connection;
+ protected ServiceContexts serviceContexts;
+
+ // 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
+ // two attributes are always kept in sync.
+ protected ForwardRequest forwardRequest;
+ protected IOR forwardRequestIOR;
+
+ // PICurrent's SlotTable
+ protected SlotTable slotTable;
+
+ // The exception to be returned by received_exception and
+ // received_exception_id
+ protected Exception exception;
+
+ //////////////////////////////////////////////////////////////////////
+ //
+ // NOTE: IF AN ATTRIBUTE IS ADDED, PLEASE UPDATE RESET();
+ //
+ //////////////////////////////////////////////////////////////////////
+
+ /**
+ * Reset the info object so that it can be reused for a retry,
+ * for example.
+ */
+ void reset() {
+
+ // Please keep these in the same order as declared above.
+
+ flowStackIndex = 0;
+ startingPointCall = 0;
+ intermediatePointCall = 0;
+ endingPointCall = 0;
+ // 6763340
+ setReplyStatus( UNINITIALIZED ) ;
+ currentExecutionPoint = EXECUTION_POINT_STARTING;
+ alreadyExecuted = false;
+ connection = null;
+ serviceContexts = null;
+ forwardRequest = null;
+ forwardRequestIOR = null;
+ exception = null;
+
+ // We don't need to reset the Slots because they are
+ // already in the clean state after recieve_<point> interceptor
+ // are called.
+ }
+
+ /*
+ **********************************************************************
+ * Access protection
+ **********************************************************************/
+
+ // 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;
+ // The last value from RequestInfo (be sure to update this):
+ protected static final int MID_RI_LAST = 13;
+
+ /*
+ **********************************************************************
+ * Public interfaces
+ **********************************************************************/
+
+ /**
+ * Creates a new RequestInfoImpl object.
+ */
+ public RequestInfoImpl( ORB myORB ) {
+ super();
+
+ this.myORB = myORB;
+ wrapper = InterceptorsSystemException.get( myORB,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ stdWrapper = OMGSystemException.get( myORB,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+
+ // Capture the current TSC and make it the RSC of this request.
+ PICurrent current = (PICurrent)(myORB.getPIHandler().getPICurrent());
+ slotTable = current.getSlotTable( );
+ }
+
+ /**
+ * 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).
+ */
+ abstract public int request_id ();
+
+ /**
+ * Implementation for operation() differs for client and server
+ * implementations.
+ *
+ * The name of the operation being invoked.
+ */
+ 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.
+ */
+ abstract public Parameter[] arguments ();
+
+ /**
+ * This method returns the list of exceptios that was raised when the
+ * operation was invoked. It raises NO_RESOURCES exception if the operation
+ * is not invoked by using DII mechanism.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ abstract public Any result ();
+
+ /**
+ * 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.
+ */
+ 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:
+ * <ul>
+ * <li>Messaging::SYNC_NONE</li>
+ * <li>Messaging::SYNC_WITH_TRANSPORT</li>
+ * <li>Messaging::SYNC_WITH_SERVER</li>
+ * <li>Messaging::SYNC_WITH_TARGET</li>
+ * </ul>
+ */
+ 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:
+ * <ul>
+ * <li>PortableInterceptor::SUCCESSFUL</li>
+ * <li>PortableInterceptor::SYSTEM_EXCEPTION</li>
+ * <li>PortableInterceptor::USER_EXCEPTION</li>
+ * <li>PortableInterceptor::LOCATION_FORWARD</li>
+ * <li>PortableInterceptor::TRANSPORT_RETRY</li>
+ * </ul>
+ */
+ public short reply_status (){
+ checkAccess( MID_REPLY_STATUS );
+ return replyStatus;
+ }
+
+ /**
+ * 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.
+ */
+ abstract public Object forward_reference ();
+
+
+ /**
+ * Returns the data from the given slot of the PortableInterceptor::Current
+ * that is in the scope of the request.
+ * <p>
+ * If the given slot has not been set, then an any containing a type code
+ * with a TCKind value of tk_null is returned.
+ * <p>
+ * If the ID does not define an allocated slot, InvalidSlot is raised.
+ */
+ public Any get_slot (int id)
+ throws InvalidSlot
+ {
+ // access is currently valid for all states:
+ //checkAccess( MID_GET_SLOT );
+ // Delegate the call to the slotTable which was set when RequestInfo was
+ // created.
+ return slotTable.get_slot( id );
+ }
+
+ /**
+ * 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 etry for that ID, BAD_PARAM with a minor code of
+ * TBD_BP is raised.
+ */
+ abstract public org.omg.IOP.ServiceContext
+ get_request_service_context(int id);
+
+ /**
+ * 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.
+ */
+ 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.
+
+
+
+ /*
+ **********************************************************************
+ * Proprietary methods
+ **********************************************************************/
+
+ /**
+ * @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.
+ */
+ public com.sun.corba.se.spi.legacy.connection.Connection connection()
+ {
+ return connection;
+ }
+
+ /*
+ **********************************************************************
+ * Private utility methods
+ **********************************************************************/
+
+ /**
+ * 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.
+ */
+ 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() );
+ String className = repId.getClassName();
+
+ // Find the read method on the helper class:
+ String helperClassName = className + "Helper";
+ Class<?> helperClass =
+ SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName );
+ Class[] readParams = new Class[1];
+ readParams[0] = org.omg.CORBA.portable.InputStream.class;
+ 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
+ // as to not disturb it.
+ InputStream ueInputStream = appException.getInputStream();
+ 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 {
+ try {
+ ueInputStream.reset();
+ }
+ catch( IOException e ) {
+ throw wrapper.markAndResetFailed( e ) ;
+ }
+ }
+
+ // Insert this UserException into the provided Any using the
+ // helper class.
+ insertUserException( userException, result );
+ } catch( ClassNotFoundException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
+ } catch( NoSuchMethodException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
+ } catch( SecurityException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
+ } catch( IllegalAccessException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
+ } catch( IllegalArgumentException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e ) ;
+ } catch( InvocationTargetException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, 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.
+ */
+ private void insertUserException( UserException userException, Any result )
+ throws UNKNOWN
+ {
+ try {
+ // Insert this UserException into the provided Any using the
+ // helper class.
+ if( userException != null ) {
+ Class exceptionClass = userException.getClass();
+ String className = exceptionClass.getName();
+ String helperClassName = className + "Helper";
+ Class<?> helperClass =
+ SharedSecrets.getJavaCorbaAccess().loadClass( helperClassName );
+
+ // Find insert( Any, class ) method
+ Class[] insertMethodParams = new Class[2];
+ insertMethodParams[0] = org.omg.CORBA.Any.class;
+ insertMethodParams[1] = exceptionClass;
+ Method insertMethod = helperClass.getMethod(
+ "insert", insertMethodParams );
+
+ // Call helper.insert( result, userException ):
+ java.lang.Object[] insertMethodArguments =
+ new java.lang.Object[2];
+ insertMethodArguments[0] = result;
+ insertMethodArguments[1] = userException;
+ insertMethod.invoke( null, insertMethodArguments );
+ }
+ } catch( ClassNotFoundException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
+ } catch( NoSuchMethodException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
+ } catch( SecurityException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
+ } catch( IllegalAccessException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
+ } catch( IllegalArgumentException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
+ } catch( InvocationTargetException e ) {
+ throw stdWrapper.unknownUserException( CompletionStatus.COMPLETED_MAYBE, e );
+ }
+ }
+
+ /*
+ **********************************************************************
+ * Protected utility methods
+ **********************************************************************/
+
+ /**
+ * Internal utility method to convert an NVList into a PI Parameter[]
+ */
+ protected Parameter[] nvListToParameterArray( NVList parNVList ) {
+
+ // _REVISIT_ This utility method should probably be doing a deep
+ // copy so interceptor can't accidentally change the arguments.
+
+ int count = parNVList.count();
+ Parameter[] plist = new Parameter[count];
+ try {
+ for( int i = 0; i < count; i++ ) {
+ Parameter p = new Parameter();
+ plist[i] = p;
+ NamedValue nv = parNVList.item( i );
+ plist[i].argument = nv.value();
+ // ParameterMode spec can be found in 99-10-07.pdf
+ // Section:10.5.22
+ // nv.flags spec can be found in 99-10-07.pdf
+ // Section 7.1.1
+ // 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 );
+ }
+ } 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.
+ */
+ protected Any exceptionToAny( Exception exception ){
+ Any result = myORB.create_any();
+
+ 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 ) {
+ // 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 ) {
+ // 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
+ // insertApplicationException utility method.
+ ORBUtility.insertSystemException( e, result );
+ }
+ } else if( exception instanceof UserException ) {
+ try {
+ 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.
+ */
+ protected org.omg.IOP.ServiceContext
+ getServiceContext ( HashMap cachedServiceContexts,
+ ServiceContexts serviceContexts, int id )
+ {
+ org.omg.IOP.ServiceContext result = null;
+ Integer integerId = new Integer( id );
+
+ // Search cache first:
+ result = (org.omg.IOP.ServiceContext)
+ cachedServiceContexts.get( integerId );
+
+ // 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.
+ // Get the desired "core" service context.
+ com.sun.corba.se.spi.servicecontext.ServiceContext context =
+ serviceContexts.get( id );
+ if (context == null)
+ throw stdWrapper.invalidServiceContextId() ;
+
+ // Convert the "core" service context to an
+ // "IOP" ServiceContext by writing it to a
+ // CDROutputStream and reading it back.
+ EncapsOutputStream out =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
+
+ context.write( out, GIOPVersion.V1_2 );
+ InputStream inputStream = out.create_input_stream();
+ result = ServiceContextHelper.read( inputStream );
+
+ cachedServiceContexts.put( integerId, result );
+ }
+
+ // Good citizen: For increased efficiency, we assume that interceptors
+ // 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.
+ * <p>
+ * Raises BAD_INV_ORDER if replace is false and a service context with
+ * the given id already exists.
+ * <p>
+ * Uses the given HashMap as a cache. If a service context is placed
+ * in the container, it goes in the HashMap as well.
+ */
+ protected void addServiceContext(
+ HashMap cachedServiceContexts,
+ ServiceContexts serviceContexts,
+ org.omg.IOP.ServiceContext service_context,
+ boolean replace )
+ {
+ int id = 0 ;
+ // Convert IOP.service_context to core.ServiceContext:
+ EncapsOutputStream outputStream =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream(myORB);
+ InputStream inputStream = null;
+ UnknownServiceContext coreServiceContext = null;
+ ServiceContextHelper.write( outputStream, service_context );
+ inputStream = outputStream.create_input_stream();
+
+ // Constructor expects id to already have been read from stream.
+ coreServiceContext = new UnknownServiceContext(
+ inputStream.read_long(),
+ (org.omg.CORBA_2_3.portable.InputStream)inputStream );
+
+ id = coreServiceContext.getId();
+
+ if (serviceContexts.get(id) != null)
+ if (replace)
+ serviceContexts.delete( id );
+ else
+ throw stdWrapper.serviceContextAddFailed( new Integer(id) ) ;
+
+ serviceContexts.put( coreServiceContext );
+
+ // Place IOP.ServiceContext in cache as well:
+ cachedServiceContexts.put( new Integer( 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.*/
+ 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.
+ */
+ protected int getFlowStackIndex() {
+ return this.flowStackIndex;
+ }
+
+ /**
+ * Sets which ending interception point should be called
+ * for each interceptor in the virtual flow stack.
+ */
+ protected void setEndingPointCall( int call ) {
+ this.endingPointCall = call;
+ }
+
+ /**
+ * Retrieves the current ending point call type (see
+ * setEndingPointCall for more details).
+ */
+ protected int getEndingPointCall() {
+ return this.endingPointCall;
+ }
+
+ /**
+ * Sets which intermediate interception point should be called
+ * for each interceptor in the virtual flow stack.
+ */
+ protected void setIntermediatePointCall( int call ) {
+ this.intermediatePointCall = call;
+ }
+
+ /**
+ * Retrieves the current intermediate point call type (see
+ * setEndingPointCall for more details).
+ */
+ protected int getIntermediatePointCall() {
+ return this.intermediatePointCall;
+ }
+
+ /**
+ * Sets which starting interception point should be called
+ * for each interceptor in the virtual flow stack.
+ */
+ protected void setStartingPointCall( int call ) {
+ this.startingPointCall = call;
+ }
+
+ /**
+ * Retrieves the current starting point call type (see
+ * setStartingPointCall for more details).
+ */
+ 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.
+ */
+ protected boolean getAlreadyExecuted() {
+ return this.alreadyExecuted;
+ }
+
+ /**
+ * Sets whether all interceotrs' starting and ending points
+ * have already been executed to completion.
+ */
+ protected void setAlreadyExecuted( boolean alreadyExecuted ) {
+ this.alreadyExecuted = alreadyExecuted;
+ }
+
+ /**
+ * Sets the value to be returned by reply_status
+ */
+ protected void setReplyStatus( short replyStatus ) {
+ this.replyStatus = replyStatus;
+ }
+
+ /**
+ * Gets the current reply_status without doing an access check
+ * (available only to package and subclasses)
+ */
+ protected short getReplyStatus() {
+ return this.replyStatus;
+ }
+
+ /**
+ * Stores the given ForwardRequest object for later analysis.
+ * This version supplements setForwardRequest( IOR );
+ */
+ 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 );
+ */
+ protected void setForwardRequest( IOR ior ) {
+ this.forwardRequestIOR = ior;
+ this.forwardRequest = null;
+ }
+
+ /**
+ * Retrieves the ForwardRequest object as a ForwardRequest exception.
+ */
+ protected ForwardRequest getForwardRequestException() {
+ 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 );
+ }
+ }
+
+ return this.forwardRequest;
+ }
+
+ /**
+ * Retrieves the IOR of the ForwardRequest exception.
+ */
+ protected IOR getForwardRequestIOR() {
+ if( this.forwardRequestIOR == null ) {
+ if( this.forwardRequest != null ) {
+ this.forwardRequestIOR = ORBUtility.getIOR(
+ this.forwardRequest.forward ) ;
+ }
+ }
+
+ return this.forwardRequestIOR;
+ }
+
+ /**
+ * Sets the exception to be returned by received_exception and
+ * received_exception_id.
+ */
+ protected void setException( Exception exception ) {
+ this.exception = exception;
+ }
+
+ /**
+ * 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).
+ * This allows us to enforce the validity table.
+ */
+ 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.
+ *
+ * @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;
+
+ /**
+ * 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)
+ {
+ this.slotTable = slotTable;
+ }
+
+ protected org.omg.CORBA.Object iorToObject( IOR ior )
+ {
+ return ORBUtility.makeObjectReference( ior ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java
new file mode 100644
index 0000000..ecea44c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/ServerRequestInfoImpl.java
@@ -0,0 +1,907 @@
+/*
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.interceptors;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.NO_RESOURCES;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.TypeCode;
+
+import org.omg.PortableServer.Servant;
+
+import org.omg.IOP.TaggedProfile;
+import org.omg.IOP.ServiceContext;
+
+import org.omg.Dynamic.Parameter;
+
+import org.omg.PortableInterceptor.InvalidSlot;
+import org.omg.PortableInterceptor.ServerRequestInfo;
+import org.omg.PortableInterceptor.LOCATION_FORWARD;
+import org.omg.PortableInterceptor.SUCCESSFUL;
+import org.omg.PortableInterceptor.SYSTEM_EXCEPTION;
+import org.omg.PortableInterceptor.TRANSPORT_RETRY;
+import org.omg.PortableInterceptor.USER_EXCEPTION;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import java.util.*;
+
+/**
+ * Implementation of the ServerRequestInfo interface as specified in
+ * orbos/99-12-02 section 5.4.3.
+ */
+public final class ServerRequestInfoImpl
+ extends RequestInfoImpl
+ implements ServerRequestInfo
+{
+ // The available constants for startingPointCall
+ static final int CALL_RECEIVE_REQUEST_SERVICE_CONTEXT = 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;
+ static final int CALL_SEND_OTHER = 2;
+
+ //////////////////////////////////////////////////////////////////////
+ //
+ // 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;
+
+ // Sources of server request information:
+ private CorbaMessageMediator request;
+ private java.lang.Object servant;
+ private byte[] objectId;
+ private ObjectKeyTemplate oktemp ;
+
+ // Information cached from calls to oktemp
+ private byte[] adapterId;
+ private String[] adapterName;
+
+ private ArrayList addReplyServiceContextQueue;
+ private ReplyMessage replyMessage;
+ private String targetMostDerivedInterface;
+ private NVList dsiArguments;
+ private Any dsiResult;
+ private Any dsiException;
+ private boolean isDynamic;
+ private ObjectAdapter objectAdapter;
+ private int serverRequestId;
+
+ // Cached information:
+ private Parameter[] cachedArguments;
+ private Any cachedSendingException;
+ // key = Integer, value = IOP.ServiceContext.
+ private HashMap cachedRequestServiceContexts;
+ // key = Integer, value = IOP.ServiceContext.
+ 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.
+ */
+ void reset() {
+ super.reset();
+
+ // Please keep these in the same order as declared above.
+
+ forwardRequestRaisedInEnding = false;
+
+ request = null;
+ servant = null;
+ objectId = null;
+ oktemp = null;
+
+ adapterId = null;
+ adapterName = null;
+
+ addReplyServiceContextQueue = null;
+ replyMessage = null;
+ targetMostDerivedInterface = null;
+ dsiArguments = null;
+ dsiResult = null;
+ dsiException = null;
+ isDynamic = false;
+ objectAdapter = null;
+ serverRequestId = myORB.getPIHandler().allocateServerRequestId();
+
+ // reset cached attributes:
+ cachedArguments = null;
+ cachedSendingException = null;
+ cachedRequestServiceContexts = null;
+ cachedReplyServiceContexts = null;
+
+ startingPointCall = CALL_RECEIVE_REQUEST_SERVICE_CONTEXT;
+ intermediatePointCall = CALL_RECEIVE_REQUEST;
+ endingPointCall = CALL_SEND_REPLY;
+ }
+
+ /*
+ **********************************************************************
+ * Access protection
+ **********************************************************************/
+
+ // Method IDs for all methods in ServerRequestInfo. This allows for a
+ // convenient O(1) lookup for checkAccess().
+ protected static final int MID_SENDING_EXCEPTION = MID_RI_LAST + 1;
+ protected static final int MID_OBJECT_ID = MID_RI_LAST + 2;
+ protected static final int MID_ADAPTER_ID = MID_RI_LAST + 3;
+ protected static final int MID_TARGET_MOST_DERIVED_INTERFACE
+ = MID_RI_LAST + 4;
+ protected static final int MID_GET_SERVER_POLICY = MID_RI_LAST + 5;
+ protected static final int MID_SET_SLOT = MID_RI_LAST + 6;
+ protected static final int MID_TARGET_IS_A = MID_RI_LAST + 7;
+ protected static final int MID_ADD_REPLY_SERVICE_CONTEXT
+ = MID_RI_LAST + 8;
+ protected static final int MID_SERVER_ID = MID_RI_LAST + 9;
+ protected static final int MID_ORB_ID = MID_RI_LAST + 10;
+ protected 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 }
+ };
+
+ /*
+ **********************************************************************
+ * Public interfaces
+ **********************************************************************/
+
+ /**
+ * 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 );
+ 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 );
+
+ if( cachedSendingException == null ) {
+ Any result = null ;
+
+ if( dsiException != null ) {
+ result = dsiException;
+ } else if( exception != null ) {
+ result = exceptionToAny( exception );
+ } else {
+ // sending_exception should not be callable if both dsiException
+ // and exception are null.
+ throw wrapper.exceptionUnavailable() ;
+ }
+
+ cachedSendingException = result;
+ }
+
+ return cachedSendingException;
+ }
+
+ /**
+ * The opaque object_id describing the target of the operation invocation.
+ */
+ public byte[] object_id () {
+ checkAccess( MID_OBJECT_ID );
+
+ 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,
+ // we throw NO_RESOURCES
+ 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;
+ }
+
+ 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,
+ // we throw NO_RESOURCES
+ throw stdWrapper.piOperationNotSupported7() ;
+ }
+ }
+
+ public 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() ) ;
+ }
+
+ public String orb_id()
+ {
+ checkAccess( MID_ORB_ID ) ;
+
+ return myORB.getORBData().getORBId() ;
+ }
+
+ synchronized public String[] adapter_name()
+ {
+ checkAccess( MID_ADAPTER_NAME ) ;
+
+ if (adapterName == null) {
+ checkForNullTemplate() ;
+
+ ObjectAdapterId oaid = oktemp.getObjectAdapterId() ;
+ adapterName = oaid.getAdapterName() ;
+ }
+
+ return adapterName ;
+ }
+
+ /**
+ * The opaque identifier for the object adapter.
+ */
+ synchronized public byte[] adapter_id ()
+ {
+ checkAccess( MID_ADAPTER_ID );
+
+ if( adapterId == null ) {
+ checkForNullTemplate() ;
+ adapterId = oktemp.getAdapterId() ;
+ }
+
+ return adapterId;
+ }
+
+ /**
+ * The RepositoryID for the most derived interface of the servant.
+ */
+ 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.
+ */
+ public Policy get_server_policy (int type) {
+ // access is currently valid for all states:
+ //checkAccess( MID_GET_SERVER_POLICY );
+
+ Policy result = null;
+
+ if( objectAdapter != null ) {
+ result = objectAdapter.getEffectivePolicy( type );
+ }
+
+ // _REVISIT_ RTF Issue: get_server_policy spec not in sync with
+ // get_effective_policy spec.
+
+ 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.
+ */
+ 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 );
+ }
+
+ /**
+ * 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 );
+
+ 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() ;
+ }
+
+ return result;
+ }
+
+ /**
+ * Allows Interceptors to add service contexts to the request.
+ */
+ public void add_reply_service_context ( ServiceContext service_context,
+ boolean replace )
+ {
+ // access is currently valid for all states:
+ //checkAccess( MID_ADD_REPLY_SERVICE_CONTEXT );
+
+ if( currentExecutionPoint == EXECUTION_POINT_ENDING ) {
+ ServiceContexts scs = replyMessage.getServiceContexts();
+
+ // May be null. If this is null, create a new one in its place.
+ if( scs == null ) {
+ scs = new ServiceContexts( myORB );
+ replyMessage.setServiceContexts( scs );
+ }
+
+ 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 );
+ }
+
+ // 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.
+ // So we enqueue this add reply service context request.
+ // It is added when we do have a handle on the service contexts object.
+ //
+ // If we are in the ending point and we just add directly to the
+ // SC container but then an interceptor raises a SystemException
+ // then that add will be lost since a new container is created
+ // for the SystemException response.
+ //
+ // Therefore we always enqueue and never dequeue (per request) so
+ // that all adds will be completed.
+
+ AddReplyServiceContextCommand addReply =
+ new AddReplyServiceContextCommand();
+ addReply.service_context = service_context;
+ addReply.replace = replace;
+
+ if( addReplyServiceContextQueue == null ) {
+ addReplyServiceContextQueue = new ArrayList();
+ }
+
+ // REVISIT: this does not add to the cache.
+ enqueue( addReply );
+ }
+
+ // 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.
+
+ /*
+ **********************************************************************
+ * 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.
+ **********************************************************************/
+
+ /**
+ * See ServerRequestInfo for javadocs.
+ */
+ public int request_id (){
+ // access is currently valid for all states:
+ //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.
+ */
+ return serverRequestId;
+ }
+
+ /**
+ * See ServerRequestInfo for javadocs.
+ */
+ public String operation (){
+ // access is currently valid for all states:
+ //checkAccess( MID_OPERATION );
+ return request.getOperationName();
+ }
+
+ /**
+ * See ServerRequestInfo for javadocs.
+ */
+ public Parameter[] arguments (){
+ checkAccess( MID_ARGUMENTS );
+
+ if( cachedArguments == null ) {
+ if( !isDynamic ) {
+ throw stdWrapper.piOperationNotSupported1() ;
+ }
+
+ 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 );
+ }
+
+ // 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;
+ }
+
+ /**
+ * See ServerRequestInfo for javadocs.
+ */
+ public TypeCode[] exceptions (){
+ checkAccess( MID_EXCEPTIONS );
+
+ // _REVISIT_ PI RTF Issue: No exception list on server side.
+
+ throw stdWrapper.piOperationNotSupported2() ;
+ }
+
+ /**
+ * See ServerRequestInfo for javadocs.
+ */
+ public String[] contexts (){
+ checkAccess( MID_CONTEXTS );
+
+ // We do not support this because our ORB does not send contexts.
+
+ throw stdWrapper.piOperationNotSupported3() ;
+ }
+
+ /**
+ * See ServerRequestInfo for javadocs.
+ */
+ public String[] operation_context (){
+ checkAccess( MID_OPERATION_CONTEXT );
+
+ // We do not support this because our ORB does not send
+ // operation_context.
+
+ throw stdWrapper.piOperationNotSupported4() ;
+ }
+
+ /**
+ * See ServerRequestInfo for javadocs.
+ */
+ public Any result (){
+ checkAccess( MID_RESULT );
+
+ if( !isDynamic ) {
+ throw stdWrapper.piOperationNotSupported5() ;
+ }
+
+ if( dsiResult == null ) {
+ throw wrapper.piDsiResultIsNull() ;
+ }
+
+ // Good citizen: In the interest of efficiency, we assume that
+ // interceptors will not modify the contents of the result Any.
+ // Otherwise, we would need to create a deep copy of the Any.
+
+ return dsiResult;
+ }
+
+ /**
+ * See ServerRequestInfo for javadocs.
+ */
+ public boolean response_expected (){
+ // access is currently valid for all states:
+ //checkAccess( MID_RESPONSE_EXPECTED );
+ return !request.isOneWay();
+ }
+
+ /**
+ * See ServerRequestInfo for javadocs.
+ */
+ 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() ;
+ }
+
+ return getForwardRequestException().forward;
+ }
+
+ /**
+ * See ServerRequestInfo for javadocs.
+ */
+ public org.omg.IOP.ServiceContext get_request_service_context( int id ) {
+ checkAccess( MID_GET_REQUEST_SERVICE_CONTEXT );
+
+ if( cachedRequestServiceContexts == null ) {
+ cachedRequestServiceContexts = new HashMap();
+ }
+
+ 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 );
+
+ if( cachedReplyServiceContexts == null ) {
+ cachedReplyServiceContexts = new HashMap();
+ }
+
+ return getServiceContext( cachedReplyServiceContexts,
+ replyMessage.getServiceContexts(), id );
+ }
+
+ /*
+ **********************************************************************
+ * Private-scope classes and methods
+ **********************************************************************/
+
+ // A command encapsulating a request to add a reply service context.
+ // These commands are enqueued until we have a handle on the actual
+ // reply service context, at which point they are executed.
+ private class AddReplyServiceContextCommand {
+ ServiceContext service_context;
+ boolean replace;
+ }
+
+ // 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
+ // in the queue is replaced by this command.
+ private void enqueue( AddReplyServiceContextCommand addReply ) {
+ int size = addReplyServiceContextQueue.size();
+ boolean found = false;
+
+ for( int i = 0; i < size; i++ ) {
+ AddReplyServiceContextCommand cmd =
+ (AddReplyServiceContextCommand)
+ addReplyServiceContextQueue.get( i );
+
+ if( cmd.service_context.context_id ==
+ addReply.service_context.context_id )
+ {
+ found = true;
+ if( addReply.replace ) {
+ addReplyServiceContextQueue.set( i, addReply );
+ } else {
+ throw stdWrapper.serviceContextAddFailed(
+ new Integer( cmd.service_context.context_id ) ) ;
+ }
+ break;
+ }
+ }
+
+ if( !found ) {
+ addReplyServiceContextQueue.add( addReply );
+ }
+ }
+
+ /*
+ **********************************************************************
+ * Package and protected-scope methods
+ **********************************************************************/
+
+ /**
+ * 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 );
+
+ // 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) )
+ {
+ int size = addReplyServiceContextQueue.size();
+ for( int i = 0; i < size; i++ ) {
+ AddReplyServiceContextCommand addReply =
+ (AddReplyServiceContextCommand)
+ 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
+ // the original request.
+ }
+ }
+
+ // We specifically do not empty the SC queue so that if
+ // the interceptor raises an exception the queued service contexts
+ // will be put in the exception response.
+ }
+ }
+
+ /**
+ * Stores the various sources of information used for this info object.
+ */
+ protected void setInfo( CorbaMessageMediator request, ObjectAdapter oa,
+ byte[] objectId, ObjectKeyTemplate oktemp )
+ {
+ this.request = request;
+ this.objectId = objectId;
+ this.oktemp = oktemp;
+ this.objectAdapter = oa ;
+ this.connection = (com.sun.corba.se.spi.legacy.connection.Connection)
+ request.getConnection();
+ }
+
+ /**
+ * Stores the various sources of information used for this info object.
+ */
+ protected void setDSIArguments( NVList arguments ) {
+ this.dsiArguments = arguments;
+ }
+
+ /**
+ * Stores the various sources of information used for this info object.
+ */
+ protected void setDSIException( Any exception ) {
+ this.dsiException = exception;
+
+ // Clear cached exception value:
+ cachedSendingException = null;
+ }
+
+ /**
+ * Stores the various sources of information used for this info object.
+ */
+ protected void setDSIResult( Any result ) {
+ this.dsiResult = result;
+ }
+
+ /**
+ * Sets the exception to be returned by received_exception and
+ * received_exception_id.
+ */
+ protected void setException( Exception exception ) {
+ super.setException( exception );
+
+ // Make sure DSIException is null because this is the more recent one.
+ this.dsiException = null;
+
+ // Clear cached exception value:
+ cachedSendingException = null;
+ }
+
+ /**
+ * Stores the various sources of information used for this info object.
+ */
+ 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);
+ }
+
+ /**
+ * Set reply message
+ */
+ 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.
+ */
+ protected void setReplyStatus( short replyStatus ) {
+ super.setReplyStatus( replyStatus );
+ switch( replyStatus ) {
+ case SUCCESSFUL.value:
+ endingPointCall = CALL_SEND_REPLY;
+ break;
+ case SYSTEM_EXCEPTION.value:
+ case USER_EXCEPTION.value:
+ endingPointCall = CALL_SEND_EXCEPTION;
+ break;
+ case LOCATION_FORWARD.value:
+ case TRANSPORT_RETRY.value:
+ endingPointCall = CALL_SEND_OTHER;
+ break;
+ }
+ }
+
+ /**
+ * 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.
+ */
+ void setForwardRequestRaisedInEnding() {
+ this.forwardRequestRaisedInEnding = true;
+ }
+
+ /**
+ * Returns true if ForwardRequest was raised by a server ending point
+ * or false otherwise.
+ */
+ boolean isForwardRequestRaisedInEnding() {
+ return this.forwardRequestRaisedInEnding;
+ }
+
+ /**
+ * Returns true if this is a dynamic invocation, or false if not
+ */
+ boolean isDynamic() {
+ return this.isDynamic;
+ }
+
+ /**
+ * See description for RequestInfoImpl.checkAccess
+ */
+ protected void checkAccess( int methodID )
+ {
+ // Make sure currentPoint matches the appropriate index in the
+ // validCall table:
+ int validCallIndex = 0;
+ switch( currentExecutionPoint ) {
+ case EXECUTION_POINT_STARTING:
+ validCallIndex = 0;
+ break;
+ case EXECUTION_POINT_INTERMEDIATE:
+ validCallIndex = 1;
+ break;
+ case EXECUTION_POINT_ENDING:
+ switch( endingPointCall ) {
+ case CALL_SEND_REPLY:
+ validCallIndex = 2;
+ break;
+ case CALL_SEND_EXCEPTION:
+ validCallIndex = 3;
+ break;
+ case CALL_SEND_OTHER:
+ validCallIndex = 4;
+ break;
+ }
+ break;
+ }
+
+ // Check the validCall table:
+ if( !validCall[methodID][validCallIndex] ) {
+ throw stdWrapper.invalidPiCall2() ;
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTable.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTable.java
new file mode 100644
index 0000000..93908fd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTable.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.interceptors;
+
+import com.sun.corba.se.impl.corba.AnyImpl;
+import com.sun.corba.se.spi.orb.ORB;
+import org.omg.PortableInterceptor.Current;
+import org.omg.PortableInterceptor.InvalidSlot;
+import org.omg.CORBA.Any;
+
+/**
+ * SlotTable is used internally by PICurrent to store the slot information.
+ */
+public class SlotTable {
+ // The vector where all the slot data for the current thread is stored
+ private Any[] theSlotData;
+
+ // 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.
+ private boolean dirtyFlag;
+
+ /**
+ * The constructor instantiates an Array of Any[] of size given by slotSize
+ * parameter.
+ */
+ SlotTable( ORB orb, int slotSize ) {
+ dirtyFlag = false;
+ this.orb = orb;
+ theSlotData = new Any[slotSize];
+ }
+
+ /**
+ * This method sets the slot data at the given slot id (index).
+ */
+ 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 ) {
+ throw new InvalidSlot();
+ }
+ dirtyFlag = true;
+ theSlotData[id] = data;
+ }
+
+ /**
+ * This method get the slot data for the given slot id (index).
+ */
+ 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 ) {
+ throw new InvalidSlot();
+ }
+ if( theSlotData[id] == null ) {
+ theSlotData [id] = new AnyImpl(orb);
+ }
+ 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++ ) {
+ theSlotData[i] = null;
+ }
+ }
+ }
+
+ /**
+ * This method returns the size of the allocated slots.
+ */
+ int getSize( ) {
+ return theSlotData.length;
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTableStack.java b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTableStack.java
new file mode 100644
index 0000000..c19a384
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/interceptors/SlotTableStack.java
@@ -0,0 +1,188 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.interceptors;
+
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INTERNAL;
+import org.omg.PortableInterceptor.Current;
+import org.omg.PortableInterceptor.InvalidSlot;
+
+import com.sun.corba.se.impl.corba.AnyImpl;
+
+import com.sun.corba.se.impl.logging.InterceptorsSystemException;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+/**
+ * SlotTableStack is the container of SlotTable instances for each thread
+ */
+public class SlotTableStack
+{
+ // SlotTablePool is the container for reusable SlotTables'
+ private class SlotTablePool {
+
+ // Contains a list of reusable SlotTable
+ private SlotTable[] pool;
+
+ // High water mark for the pool
+ // If the pool size reaches this limit then putSlotTable will
+ // not put SlotTable to the pool.
+ private final int HIGH_WATER_MARK = 5;
+
+ // currentIndex points to the last SlotTable in the list
+ private int currentIndex;
+
+ SlotTablePool( ) {
+ pool = new SlotTable[HIGH_WATER_MARK];
+ currentIndex = 0;
+ }
+
+ /**
+ * Puts SlotTable to the re-usable pool.
+ */
+ void putSlotTable( SlotTable table ) {
+ // If there are enough SlotTables in the pool, then don't add
+ // this table to the pool.
+ if( currentIndex >= HIGH_WATER_MARK ) {
+ // Let the garbage collector collect it.
+ return;
+ }
+ pool[currentIndex] = table;
+ currentIndex++;
+ }
+
+ /**
+ * Gets SlotTable from the re-usable pool.
+ */
+ SlotTable getSlotTable( ) {
+ // If there are no entries in the pool then return null
+ if( currentIndex == 0 ) {
+ return null;
+ }
+ // Works like a stack, Gets the last one added first
+ currentIndex--;
+ return pool[currentIndex];
+ }
+ }
+
+ // Contains all the active SlotTables for each thread.
+ // The List is made to behave like a stack.
+ private java.util.List tableContainer;
+
+ // Keeps track of number of PICurrents in the stack.
+ private int currentIndex;
+
+ // For Every Thread there will be a pool of re-usable SlotTables'
+ // stored in SlotTablePool
+ private SlotTablePool tablePool;
+
+ // The ORB associated with this slot table stack
+ private ORB orb;
+
+ private InterceptorsSystemException wrapper ;
+
+ /**
+ * Constructs the stack and and SlotTablePool
+ */
+ SlotTableStack( ORB orb, SlotTable table ) {
+ this.orb = orb;
+ wrapper = InterceptorsSystemException.get( orb, CORBALogDomains.RPC_PROTOCOL ) ;
+
+ currentIndex = 0;
+ tableContainer = new java.util.ArrayList( );
+ tablePool = new SlotTablePool( );
+ // SlotTableStack will be created with one SlotTable on the stack.
+ // This table is used as the reference to query for number of
+ // allocated slots to create other slottables.
+ tableContainer.add( currentIndex, table );
+ currentIndex++;
+ }
+
+
+ /**
+ * pushSlotTable pushes a fresh Slot Table on to the stack by doing the
+ * following,
+ * 1: Checks to see if there is any SlotTable in SlotTablePool
+ * If present then use that instance to push into the SlotTableStack
+ *
+ * 2: If there is no SlotTable in the pool, then creates a new one and
+ * pushes that into the SlotTableStack
+ */
+ void pushSlotTable( ) {
+ SlotTable table = tablePool.getSlotTable( );
+ if( table == null ) {
+ // get an existing PICurrent to get the slotSize
+ SlotTable tableTemp = peekSlotTable();
+ table = new SlotTable( orb, tableTemp.getSize( ));
+ }
+ // 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 );
+ } else if (currentIndex > tableContainer.size()) {
+ throw wrapper.slotTableInvariant( new Integer( currentIndex ),
+ new Integer( tableContainer.size() ) ) ;
+ } else {
+ // Set will override unused slots.
+ tableContainer.set( currentIndex, table );
+ }
+ currentIndex++;
+ }
+
+ /**
+ * popSlotTable does the following
+ * 1: pops the top SlotTable in the SlotTableStack
+ *
+ * 2: resets the slots in the SlotTable which resets the slotvalues to
+ * null if there are any previous sets.
+ *
+ * 3: puts the reset SlotTable into the SlotTablePool to reuse
+ */
+ 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() ;
+ }
+ currentIndex--;
+ SlotTable table = (SlotTable)tableContainer.get( currentIndex );
+ tableContainer.set( currentIndex, null ); // Do not leak memory.
+ table.resetSlots( );
+ tablePool.putSlotTable( table );
+ }
+
+ /**
+ * peekSlotTable gets the top SlotTable from the SlotTableStack without
+ * popping.
+ */
+ SlotTable peekSlotTable( ) {
+ return (SlotTable) tableContainer.get( currentIndex - 1);
+ }
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java
new file mode 100644
index 0000000..c69fb42
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/FVDCodeBaseImpl.java
@@ -0,0 +1,184 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.io;
+
+import org.omg.CORBA.ORB;
+import java.util.Properties;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+import java.util.Hashtable;
+import java.util.Stack;
+
+import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
+import com.sun.org.omg.SendingContext._CodeBaseImplBase;
+import com.sun.org.omg.SendingContext.CodeBase;
+import com.sun.org.omg.SendingContext.CodeBaseHelper;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.ORB;
+
+import com.sun.corba.se.impl.logging.OMGSystemException;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+/**
+ * This class acts as the remote interface to receivers wishing to retrieve
+ * the information of a remote Class.
+ */
+public class FVDCodeBaseImpl extends _CodeBaseImplBase
+{
+ // Contains rep. ids as keys to FullValueDescriptions
+ private static Hashtable fvds = new Hashtable();
+
+ // Private ORBSingleton used when we need an ORB while not
+ // having a delegate set.
+ private transient ORB orb = null;
+
+ private transient OMGSystemException wrapper = OMGSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ // backward compatability so that appropriate rep-id calculations
+ // can take place
+ // this needs to be transient to prevent serialization during
+ // marshalling/unmarshalling
+ private transient ValueHandlerImpl vhandler = null;
+
+ void setValueHandler(ValueHandler vh)
+ {
+ vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
+ }
+
+ // Operation to obtain the IR from the sending context
+ 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{
+ // default to using the current ORB version in case the
+ // vhandler is not set
+ if (vhandler == null) {
+ vhandler = ValueHandlerImpl.getInstance(false);
+ }
+
+ // Util.getCodebase may return null which would
+ // cause a BAD_PARAM exception.
+ String result = Util.getCodebase(vhandler.getClassFromType(x));
+ if (result == null)
+ return "";
+ else
+ return result;
+ } catch(ClassNotFoundException cnfe){
+ throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE,
+ cnfe ) ;
+ }
+ }
+
+ public String[] implementations (String[] x){
+ String result[] = new String[x.length];
+
+ for (int i = 0; i < x.length; i++)
+ result[i] = implementation(x[i]);
+
+ return result;
+ }
+
+ // the same information
+ public FullValueDescription meta (String x){
+ try{
+ FullValueDescription result = (FullValueDescription)fvds.get(x);
+
+ if (result == null) {
+ // default to using the current ORB version in case the
+ // vhandler is not set
+ if (vhandler == null) {
+ vhandler = ValueHandlerImpl.getInstance(false);
+ }
+
+ try{
+ result = ValueUtility.translate(_orb(),
+ ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler);
+ } catch(Throwable t){
+ if (orb == null)
+ orb = ORB.init(); //d11638
+ result = ValueUtility.translate(orb,
+ ObjectStreamClass.lookup(vhandler.getAnyClassFromType(x)), vhandler);
+ }
+
+ if (result != null){
+ fvds.put(x, result);
+ } else {
+ throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ return result;
+ } catch(Throwable t){
+ throw wrapper.incompatibleValueImpl(CompletionStatus.COMPLETED_MAYBE,t);
+ }
+ }
+
+ public FullValueDescription[] metas (String[] x){
+ FullValueDescription descriptions[] = new FullValueDescription[x.length];
+
+ for (int i = 0; i < x.length; i++)
+ descriptions[i] = meta(x[i]);
+
+ return descriptions;
+ }
+
+ // information
+ public String[] bases (String x){
+ try {
+ // default to using the current ORB version in case the
+ // vhandler is not set
+ if (vhandler == null) {
+ vhandler = ValueHandlerImpl.getInstance(false);
+ }
+
+ Stack repIds = new Stack();
+ Class parent = ObjectStreamClass.lookup(vhandler.getClassFromType(x)).forClass().getSuperclass();
+
+ while (!parent.equals(java.lang.Object.class)) {
+ repIds.push(vhandler.createForAnyType(parent));
+ parent = parent.getSuperclass();
+ }
+
+ String result[] = new String[repIds.size()];
+ for (int i = result.length - 1; i >= 0; i++)
+ result[i] = (String)repIds.pop();
+
+ return result;
+ } catch (Throwable t) {
+ throw wrapper.missingLocalValueImpl( CompletionStatus.COMPLETED_MAYBE, t );
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
new file mode 100644
index 0000000..8993aa5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPInputStream.java
@@ -0,0 +1,2810 @@
+/*
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.io;
+
+import java.io.IOException;
+import java.io.StreamCorruptedException;
+import java.io.ObjectInputValidation;
+import java.io.NotActiveException;
+import java.io.InvalidObjectException;
+import java.io.InvalidClassException;
+import java.io.OptionalDataException;
+import java.io.Externalizable;
+import java.io.EOFException;
+import java.lang.reflect.*;
+import java.util.Vector;
+import java.util.Enumeration;
+
+import sun.corba.Bridge ;
+
+import java.security.AccessController ;
+import java.security.PrivilegedAction ;
+
+import com.sun.corba.se.impl.util.Utility;
+
+import org.omg.CORBA.portable.ValueInputStream;
+
+import org.omg.CORBA.ValueMember;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.portable.IndirectionException;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.TypeCode;
+
+import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
+import com.sun.org.omg.SendingContext.CodeBase;
+
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+
+import java.security.*;
+import java.util.*;
+
+import com.sun.corba.se.impl.logging.OMGSystemException ;
+import com.sun.corba.se.impl.logging.UtilSystemException ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+/**
+ * IIOPInputStream is used by the ValueHandlerImpl to handle Java serialization
+ * input semantics.
+ *
+ * @author Stephen Lewallen
+ * @since JDK1.1.6
+ */
+
+public class IIOPInputStream
+ extends com.sun.corba.se.impl.io.InputStreamHook
+{
+ private static Bridge bridge =
+ (Bridge)AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ return Bridge.get() ;
+ }
+ }
+ ) ;
+
+ private static OMGSystemException omgWrapper = OMGSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+ private static UtilSystemException utilWrapper = UtilSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ // Necessary to pass the appropriate fields into the
+ // defaultReadObjectDelegate method (which takes no
+ // 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
+ // to be obtained remotely because of a serializable
+ // 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 ValueHandlerImpl vhandler; //d4365188
+
+ private Object currentObject = null;
+
+ private ObjectStreamClass currentClassDesc = null;
+
+ private Class currentClass = null;
+
+ private int recursionDepth = 0;
+
+ private int simpleReadDepth = 0;
+
+ // The ActiveRecursionManager replaces the old RecursionManager which
+ // used to record how many recursions were made, and resolve them after
+ // an object was completely deserialized.
+ //
+ // That created problems (as in bug 4414154) because when custom
+ // unmarshaling in readObject, there can be recursive references
+ // to one of the objects currently being unmarshaled, and the
+ // passive recursion system failed.
+ ActiveRecursionManager activeRecursionMgr = new ActiveRecursionManager();
+
+ private IOException abortIOException = null;
+
+ /* Remember the first exception that stopped this stream. */
+ private ClassNotFoundException abortClassNotFoundException = null;
+
+ /* Vector of validation callback objects
+ * The vector is created as needed. The vector is maintained in
+ * order of highest (first) priority to lowest
+ */
+ private Vector 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. */
+ ObjectStreamClass[] classdesc;
+ Class[] classes;
+ int spClass;
+
+ private static final String kEmptyStr = "";
+
+ // TCKind TypeCodes used in FVD inputClassFields
+ //public static final TypeCode kRemoteTypeCode = new TypeCodeImpl(TCKind._tk_objref);
+ //public static final TypeCode kValueTypeCode = new TypeCodeImpl(TCKind._tk_value);
+ // removed TypeCodeImpl dependency
+ 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.
+ private static final boolean useFVDOnly = false;
+
+ private byte streamFormatVersion;
+
+ // Return the stream format version currently being used
+ // to deserialize an object
+ protected byte getStreamFormatVersion() {
+ return streamFormatVersion;
+ }
+
+ // At the beginning of data sent by a writeObject or
+ // writeExternal method there is a byte telling the
+ // reader the stream format version.
+ private void readFormatVersion() throws IOException {
+
+ streamFormatVersion = orbStream.read_octet();
+
+ if (streamFormatVersion < 1 ||
+ streamFormatVersion > vhandler.getMaximumStreamFormatVersion()) {
+ SystemException sysex = omgWrapper.unsupportedFormatVersion(
+ CompletionStatus.COMPLETED_MAYBE);
+ // XXX I18N? Logging for IOException?
+ IOException result = new IOException("Unsupported format version: "
+ + streamFormatVersion);
+ result.initCause( sysex ) ;
+ throw result ;
+ }
+
+ if (streamFormatVersion == 2) {
+ if (!(orbStream instanceof ValueInputStream)) {
+ SystemException sysex = omgWrapper.notAValueinputstream(
+ CompletionStatus.COMPLETED_MAYBE);
+ // XXX I18N? Logging for IOException?
+ IOException result = new IOException("Not a ValueInputStream");
+ result.initCause( sysex ) ;
+ throw result;
+ }
+ }
+ }
+
+ public static void setTestFVDFlag(boolean val){
+ // useFVDOnly = val;
+ }
+
+ /**
+ * Dummy constructor; passes upper stream a dummy stream;
+ **/
+ public IIOPInputStream()
+ throws java.io.IOException {
+ super();
+ resetStream();
+ }
+
+ final void setOrbStream(org.omg.CORBA_2_3.portable.InputStream os) {
+ orbStream = os;
+ }
+
+ final org.omg.CORBA_2_3.portable.InputStream getOrbStream() {
+ return orbStream;
+ }
+
+ //added setSender and getSender
+ public final void setSender(CodeBase cb) {
+ cbSender = cb;
+ }
+
+ public final CodeBase getSender() {
+ return cbSender;
+ }
+
+ // 4365188 this is added to enable backward compatability w/ wrong
+ // rep-ids
+ public final void setValueHandler(ValueHandler vh) {
+ vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
+ }
+
+ public final ValueHandler getValueHandler() {
+ return (javax.rmi.CORBA.ValueHandler) vhandler;
+ }
+
+ final void increaseRecursionDepth(){
+ recursionDepth++;
+ }
+
+ final int decreaseRecursionDepth(){
+ return --recursionDepth;
+ }
+
+ /**
+ * Override the actions of the final method "readObject()"
+ * in ObjectInputStream.
+ * @since JDK1.1.6
+ *
+ * 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. <p>
+ *
+ * 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.
+ * @exception java.lang.ClassNotFoundException Class of a serialized object
+ * cannot be found.
+ * @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.
+ * @since JDK1.1
+ */
+ public final synchronized Object readObjectDelegate() throws IOException
+ {
+ try {
+
+ readObjectState.readData(this);
+
+ return orbStream.read_abstract_interface();
+ } catch (MARSHAL marshalException) {
+ handleOptionalDataMarshalException(marshalException, true);
+ throw marshalException;
+ } 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).
+ return activeRecursionMgr.getObject(cdrie.offset);
+ }
+ }
+
+ final synchronized Object simpleReadObject(Class clz,
+ String repositoryID,
+ com.sun.org.omg.SendingContext.CodeBase sender,
+ int offset)
+ /* throws OptionalDataException, ClassNotFoundException, IOException */
+ {
+ /* 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
+ Object obj = null;
+
+ /*
+ * Check for reset, handle it before reading an object.
+ */
+ try {
+ // d4365188: backward compatability
+ if (vhandler.useFullValueDescription(clz, repositoryID)) {
+ obj = inputObjectUsingFVD(clz, repositoryID, sender, offset);
+ } else {
+ obj = inputObject(clz, repositoryID, sender, offset);
+ }
+
+ obj = currentClassDesc.readResolve(obj);
+ }
+ catch(ClassNotFoundException cnfe)
+ {
+ bridge.throwException( cnfe ) ;
+ return null;
+ }
+ catch(IOException ioe)
+ {
+ // System.out.println("CLZ = " + clz + "; " + ioe.toString());
+ bridge.throwException(ioe) ;
+ return null;
+ }
+ finally {
+ simpleReadDepth --;
+ currentObject = prevObject;
+ currentClassDesc = prevClassDesc;
+ currentClass = prevClass;
+ streamFormatVersion = oldStreamFormatVersion;
+ }
+
+
+ /* 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 ) ;
+ return null;
+ }
+
+
+ ClassNotFoundException exCNF = abortClassNotFoundException;
+ if (simpleReadDepth == 0)
+ abortClassNotFoundException = null;
+ if (exCNF != null) {
+ bridge.throwException( exCNF ) ;
+ return null;
+ }
+
+ return obj;
+ }
+
+ public final synchronized void simpleSkipObject(String repositoryID,
+ com.sun.org.omg.SendingContext.CodeBase sender)
+ /* throws OptionalDataException, ClassNotFoundException, IOException */
+ {
+
+ /* 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
+ Object obj = null;
+
+ /*
+ * Check for reset, handle it before reading an object.
+ */
+ try {
+ skipObjectUsingFVD(repositoryID, sender);
+ }
+ catch(ClassNotFoundException cnfe)
+ {
+ bridge.throwException( cnfe ) ;
+ return;
+ }
+ catch(IOException ioe)
+ {
+ bridge.throwException( ioe ) ;
+ return;
+ }
+ finally {
+ 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 .
+ */
+ IOException exIOE = abortIOException;
+ if (simpleReadDepth == 0)
+ abortIOException = null;
+ if (exIOE != null){
+ bridge.throwException( exIOE ) ;
+ return;
+ }
+
+
+ ClassNotFoundException exCNF = abortClassNotFoundException;
+ if (simpleReadDepth == 0)
+ abortClassNotFoundException = null;
+ if (exCNF != null) {
+ bridge.throwException( exCNF ) ;
+ return;
+ }
+
+ return;
+ }
+ /////////////////
+
+ /**
+ * 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.
+ *
+ * @see #ObjectInputStream()
+ * @see #readObject
+ * @since JDK 1.2
+ */
+ protected final Object readObjectOverride()
+ throws OptionalDataException, ClassNotFoundException, IOException
+ {
+ return readObjectDelegate();
+ }
+
+ /**
+ * 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.
+ *
+ * @exception java.lang.ClassNotFoundException if the class of a serialized
+ * object could not be found.
+ * @exception IOException if an I/O error occurs.
+ * @exception NotActiveException if the stream is not currently reading
+ * objects.
+ * @since JDK1.1
+ */
+ final synchronized void defaultReadObjectDelegate()
+ /* throws IOException, ClassNotFoundException, NotActiveException */
+ {
+ try {
+ if (currentObject == null || currentClassDesc == null)
+ // XXX I18N, logging needed.
+ throw new NotActiveException("defaultReadObjectDelegate");
+
+ if (!currentClassDesc.forClass().isAssignableFrom(
+ currentObject.getClass())) {
+ throw new IOException("Object Type mismatch");
+ }
+
+ // The array will be null unless fields were retrieved
+ // remotely because of a serializable version difference.
+ // Bug fix for 4365188. See the definition of
+ // defaultReadObjectFVDMembers for more information.
+ if (defaultReadObjectFVDMembers != null &&
+ defaultReadObjectFVDMembers.length > 0) {
+
+ // WARNING: Be very careful! What if some of
+ // these fields actually have to do this, too?
+ // This works because the defaultReadObjectFVDMembers
+ // reference is passed to inputClassFields, but
+ // there is no guarantee that
+ // defaultReadObjectFVDMembers will point to the
+ // same array after calling inputClassFields.
+
+ // Use the remote fields to unmarshal.
+ inputClassFields(currentObject,
+ currentClass,
+ currentClassDesc,
+ defaultReadObjectFVDMembers,
+ cbSender);
+
+ } else {
+
+ // Use the local fields to unmarshal.
+ ObjectStreamField[] fields =
+ currentClassDesc.getFieldsNoCopy();
+ if (fields.length > 0) {
+ inputClassFields(currentObject, currentClass, fields, cbSender);
+ }
+ }
+ }
+ catch(NotActiveException nae)
+ {
+ bridge.throwException( nae ) ;
+ }
+ catch(IOException ioe)
+ {
+ bridge.throwException( ioe ) ;
+ }
+ catch(ClassNotFoundException cnfe)
+ {
+ bridge.throwException( cnfe ) ;
+ }
+
+ }
+
+ /**
+ * Override the actions of the final method "enableResolveObject()"
+ * in ObjectInputStream.
+ * @since JDK1.1.6
+ *
+ * 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. <p>
+ *
+ * When enabled the resolveObject method is called for every object
+ * being deserialized.
+ *
+ * @exception SecurityException The classloader of this stream object is non-null.
+ * @since JDK1.1
+ */
+ public final boolean enableResolveObjectDelegate(boolean enable)
+ /* throws SecurityException */
+ {
+ return false;
+ }
+
+ // The following three methods allow the implementing orbStream
+ // to provide mark/reset behavior as defined in java.io.InputStream.
+
+ public final void mark(int readAheadLimit) {
+ orbStream.mark(readAheadLimit);
+ }
+
+ public final boolean markSupported() {
+ return orbStream.markSupported();
+ }
+
+ public final void reset() throws IOException {
+ try {
+ orbStream.reset();
+ } catch (Error e) {
+ IOException err = new IOException(e.getMessage());
+ err.initCause(e) ;
+ throw err ;
+ }
+ }
+
+ public final int available() throws IOException{
+ return 0; // unreliable
+ }
+
+ public final void close() throws IOException{
+ // no op
+ }
+
+ public final int read() throws IOException{
+ try{
+ readObjectState.readData(this);
+
+ return (orbStream.read_octet() << 0) & 0x000000FF;
+ } catch (MARSHAL marshalException) {
+ if (marshalException.minor
+ == OMGSystemException.RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1) {
+ setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
+ return -1;
+ }
+
+ throw marshalException;
+ } catch(Error e) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e) ;
+ throw exc ;
+ }
+ }
+
+ 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_INCOMPATIBLE1) {
+ setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
+ return -1;
+ }
+
+ throw marshalException;
+ } catch(Error e) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e) ;
+ throw exc ;
+ }
+
+ }
+
+ public final boolean readBoolean() throws IOException{
+ try{
+ readObjectState.readData(this);
+
+ return orbStream.read_boolean();
+ } catch (MARSHAL marshalException) {
+ handleOptionalDataMarshalException(marshalException, false);
+ throw marshalException;
+
+ } catch(Error e) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ public final byte readByte() throws IOException{
+ try{
+ readObjectState.readData(this);
+
+ return orbStream.read_octet();
+ } catch (MARSHAL marshalException) {
+ handleOptionalDataMarshalException(marshalException, false);
+ throw marshalException;
+
+ } catch(Error e) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ public final char readChar() throws IOException{
+ try{
+ readObjectState.readData(this);
+
+ return orbStream.read_wchar();
+ } catch (MARSHAL marshalException) {
+ handleOptionalDataMarshalException(marshalException, false);
+ throw marshalException;
+
+ } catch(Error e) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ 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) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ 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) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ public final void readFully(byte data[]) throws IOException{
+// d11623 : implement readFully, required for serializing some core classes
+
+ readFully(data, 0, data.length);
+ }
+
+ public final void readFully(byte data[], int offset, int size) throws IOException{
+// d11623 : implement readFully, required for serializing some core classes
+ try{
+ readObjectState.readData(this);
+
+ orbStream.read_octet_array(data, offset, size);
+ } catch (MARSHAL marshalException) {
+ handleOptionalDataMarshalException(marshalException, false);
+
+ throw marshalException;
+ } catch(Error e) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ 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) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ public final String readLine() throws IOException{
+ // XXX I18N, logging needed.
+ throw new IOException("Method readLine not supported");
+ }
+
+ 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) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ 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) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ protected final void readStreamHeader() throws IOException, StreamCorruptedException{
+ // no op
+ }
+
+ public final int readUnsignedByte() throws IOException{
+ try{
+ readObjectState.readData(this);
+
+ return (orbStream.read_octet() << 0) & 0x000000FF;
+ } catch (MARSHAL marshalException) {
+ handleOptionalDataMarshalException(marshalException, false);
+ throw marshalException;
+ } catch(Error e) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ public final int readUnsignedShort() throws IOException{
+ try{
+ readObjectState.readData(this);
+
+ return (orbStream.read_ushort() << 0) & 0x0000FFFF;
+ } catch (MARSHAL marshalException) {
+ handleOptionalDataMarshalException(marshalException, false);
+ throw marshalException;
+ } catch(Error e) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ /**
+ * Helper method for correcting the Kestrel bug 4367783 (dealing
+ * with larger than 8-bit chars). The old behavior is preserved
+ * in orbutil.IIOPInputStream_1_3 in order to interoperate with
+ * our legacy ORBs.
+ */
+ protected String internalReadUTF(org.omg.CORBA.portable.InputStream stream)
+ {
+ return stream.read_wstring();
+ }
+
+ public final String readUTF() throws IOException{
+ try{
+ readObjectState.readData(this);
+
+ return internalReadUTF(orbStream);
+ } catch (MARSHAL marshalException) {
+ handleOptionalDataMarshalException(marshalException, false);
+ throw marshalException;
+ } catch(Error e) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e);
+ throw exc ;
+ }
+ }
+
+ // If the ORB stream detects an incompatibility between what's
+ // on the wire and what our Serializable's readObject wants,
+ // it throws a MARSHAL exception with a specific minor code.
+ // This is rethrown to the readObject as an OptionalDataException.
+ // 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 {
+
+ // Java Object Serialization spec 3.4: "If the readObject method
+ // of the class attempts to read more data than is present in the
+ // optional part of the stream for this class, the stream will
+ // 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_INCOMPATIBLE1) {
+
+ IOException result;
+
+ if (!objectRead)
+ result = new EOFException("No more optional data");
+ else
+ result = bridge.newOptionalDataExceptionForSerialization(true);
+
+ result.initCause(marshalException);
+
+ setState(IN_READ_OBJECT_NO_MORE_OPT_DATA);
+
+ throw result;
+ }
+ }
+
+ public final synchronized void registerValidation(ObjectInputValidation obj,
+ int prio)
+ throws NotActiveException, InvalidObjectException{
+ // XXX I18N, logging needed.
+ throw new Error("Method registerValidation not supported");
+ }
+
+ protected final Class resolveClass(ObjectStreamClass v)
+ throws IOException, ClassNotFoundException{
+ // XXX I18N, logging needed.
+ throw new IOException("Method resolveClass not supported");
+ }
+
+ protected final Object resolveObject(Object obj) throws IOException{
+ // XXX I18N, logging needed.
+ throw new IOException("Method resolveObject not supported");
+ }
+
+ public final int skipBytes(int len) throws IOException{
+ try{
+ readObjectState.readData(this);
+
+ byte buf[] = new byte[len];
+ orbStream.read_octet_array(buf, 0, len);
+ return len;
+ } catch (MARSHAL marshalException) {
+ handleOptionalDataMarshalException(marshalException, false);
+
+ throw marshalException;
+ } catch(Error e) {
+ IOException exc = new IOException(e.getMessage());
+ exc.initCause(e) ;
+ throw exc ;
+ }
+ }
+
+ private synchronized Object inputObject(Class clz,
+ String repositoryID,
+ com.sun.org.omg.SendingContext.CodeBase sender,
+ int offset)
+ throws IOException, ClassNotFoundException
+ {
+
+ /*
+ * Get the descriptor and then class of the incoming object.
+ */
+
+ currentClassDesc = ObjectStreamClass.lookup(clz);
+ currentClass = currentClassDesc.forClass();
+ //currentClassDesc.setClass(currentClass);
+ if (currentClass == null)
+ // XXX I18N, logging needed.
+ throw new ClassNotFoundException(currentClassDesc.getName());
+
+ try {
+ /* If Externalizable,
+ * Create an instance and tell it to read its data.
+ * else,
+ * Handle it as a serializable class.
+ */
+ if (Enum.class.isAssignableFrom( clz )) {
+ int ordinal = orbStream.read_long() ;
+ String value = (String)orbStream.read_value( String.class ) ;
+ return Enum.valueOf( clz, value ) ;
+ } else if (currentClassDesc.isExternalizable()) {
+ try {
+ currentObject = (currentClass == null) ?
+ null : currentClassDesc.newInstance();
+ if (currentObject != null) {
+
+ // Store this object and its beginning position
+ // since there might be indirections to it while
+ // it's been unmarshalled.
+ activeRecursionMgr.addObject(offset, currentObject);
+
+ // Read format version
+ readFormatVersion();
+
+ Externalizable ext = (Externalizable)currentObject;
+ ext.readExternal(this);
+ }
+ } catch (InvocationTargetException e) {
+ 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 ;
+ } catch (InstantiationException e) {
+ InvalidClassException exc = new InvalidClassException(
+ currentClass.getName(),
+ "InstantiationException accessing no-arg constructor");
+ exc.initCause( e ) ;
+ throw exc ;
+ }
+ } // end : if (currentClassDesc.isExternalizable())
+ else {
+ /* Count number of classes and descriptors we might have
+ * to work on.
+ */
+
+ ObjectStreamClass currdesc = currentClassDesc;
+ Class currclass = currentClass;
+
+ int spBase = spClass; // current top of stack
+
+ if (currentClass.getName().equals("java.lang.String")) {
+ return this.readUTF();
+ }
+ /* The object's classes should be processed from supertype to subtype
+ * Push all the clases of the current object onto a stack.
+ * Note that only the serializable classes are represented
+ * in the descriptor list.
+ *
+ * Handle versioning where one or more supertypes of
+ * have been inserted or removed. The stack will
+ * contain pairs of descriptors and the corresponding
+ * class. If the object has a class that did not occur in
+ * the original the descriptor will be null. If the
+ * original object had a descriptor for a class not
+ * present in the local hierarchy of the object the class will be
+ * null.
+ *
+ */
+
+ /*
+ * This is your basic diff pattern, made simpler
+ * because reordering is not allowed.
+ */
+ // sun.4296963 ibm.11861
+ // d11861 we should stop when we find the highest serializable class
+ // We need this so that when we allocate the new object below, we
+ // can call the constructor of the non-serializable superclass.
+ // Note that in the JRMP variant of this code the
+ // ObjectStreamClass.lookup() method handles this, but we've put
+ // this fix here rather than change lookup because the new behaviour
+ // is needed in other cases.
+
+ for (currdesc = currentClassDesc, currclass = currentClass;
+ currdesc != null && currdesc.isSerializable(); /*sun.4296963 ibm.11861*/
+ currdesc = currdesc.getSuperclass()) {
+
+ /*
+ * Search the classes to see if the class of this
+ * descriptor appears further up the hierarchy. Until
+ * it's found assume its an inserted class. If it's
+ * not found, its the descriptor's class that has been
+ * removed.
+ */
+ Class cc = currdesc.forClass();
+ Class cl;
+ for (cl = currclass; cl != null; cl = cl.getSuperclass()) {
+ if (cc == cl) {
+ // found a superclass that matches this descriptor
+ break;
+ } else {
+ /* Ignore a class that doesn't match. No
+ * action is needed since it is already
+ * initialized.
+ */
+ }
+ } // end : for (cl = currclass; cl != null; cl = cl.getSuperclass())
+ /* Test if there is room for this new entry.
+ * If not, double the size of the arrays and copy the contents.
+ */
+ 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);
+
+ classes = newclasses;
+ classdesc = newclassdesc;
+ }
+
+ if (cl == null) {
+ /* Class not found corresponding to this descriptor.
+ * Pop off all the extra classes pushed.
+ * Push the descriptor and a null class.
+ */
+ classdesc[spClass] = currdesc;
+ classes[spClass] = null;
+ } else {
+ /* Current class descriptor matches current class.
+ * Some classes may have been inserted.
+ * Record the match and advance the class, continue
+ * with the next descriptor.
+ */
+ classdesc[spClass] = currdesc;
+ classes[spClass] = cl;
+ currclass = cl.getSuperclass();
+ }
+ } // end : for (currdesc = currentClassDesc, currclass = currentClass;
+
+ /* Allocate a new object. The object is only constructed
+ * above the highest serializable class and is set to
+ * default values for all more specialized classes.
+ */
+ try {
+ 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 ;
+ } catch (UnsupportedOperationException e) {
+ 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 ;
+ }
+
+ /*
+ * For all the pushed descriptors and classes.
+ * if the class has its own writeObject and readObject methods
+ * call the readObject method
+ * else
+ * invoke the defaultReadObject method
+ */
+ try {
+ for (spClass = spClass; spClass > spBase; spClass--) {
+ /*
+ * Set current descriptor and corresponding class
+ */
+ currentClassDesc = classdesc[spClass];
+ currentClass = classes[spClass];
+ if (classes[spClass] != null) {
+ /* Read the data from the stream described by the
+ * descriptor and store into the matching class.
+ */
+
+ ReadObjectState oldState = readObjectState;
+ setState(DEFAULT_STATE);
+
+ try {
+
+ // Changed since invokeObjectReader no longer does this.
+ if (currentClassDesc.hasWriteObject()) {
+
+ // Read format version
+ readFormatVersion();
+
+ // Read defaultWriteObject indicator
+ boolean calledDefaultWriteObject = readBoolean();
+
+ readObjectState.beginUnmarshalCustomValue(this,
+ calledDefaultWriteObject,
+ currentClassDesc.hasReadObject());
+ } else {
+ if (currentClassDesc.hasReadObject())
+ setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED);
+ }
+
+ if (!invokeObjectReader(currentClassDesc, currentObject, currentClass) ||
+ readObjectState == IN_READ_OBJECT_DEFAULTS_SENT) {
+
+ // Error case of no readObject and didn't call
+ // defaultWriteObject handled in default state
+
+ ObjectStreamField[] fields =
+ currentClassDesc.getFieldsNoCopy();
+ if (fields.length > 0) {
+ inputClassFields(currentObject, currentClass, fields, sender);
+ }
+ }
+
+ if (currentClassDesc.hasWriteObject())
+ readObjectState.endUnmarshalCustomValue(this);
+
+ } finally {
+ setState(oldState);
+ }
+
+ } 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.
+ */
+ ObjectStreamField[] fields =
+ currentClassDesc.getFieldsNoCopy();
+ if (fields.length > 0) {
+ inputClassFields(null, currentClass, fields, sender);
+ }
+
+ }
+
+ }
+ } finally {
+ // Make sure we exit at the same stack level as when we started.
+ spClass = spBase;
+ }
+ }
+ } finally {
+ // We've completed deserializing this object. Any
+ // future indirections will be handled correctly at the
+ // CDR level. The ActiveRecursionManager only deals with
+ // objects currently being deserialized.
+ activeRecursionMgr.removeObject(offset);
+ }
+
+ return currentObject;
+ }
+
+ // 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!
+ private Vector getOrderedDescriptions(String repositoryID,
+ com.sun.org.omg.SendingContext.CodeBase sender) {
+ Vector descs = new Vector();
+
+ if (sender == null) {
+ return descs;
+ }
+
+ FullValueDescription aFVD = sender.meta(repositoryID);
+ while (aFVD != null) {
+ descs.insertElementAt(aFVD, 0);
+ if ((aFVD.base_value != null) && !kEmptyStr.equals(aFVD.base_value)) {
+ aFVD = sender.meta(aFVD.base_value);
+ }
+ else return descs;
+ }
+
+ return descs;
+ }
+
+ /**
+ * 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.
+ *
+ */
+ private synchronized Object inputObjectUsingFVD(Class clz,
+ String repositoryID,
+ com.sun.org.omg.SendingContext.CodeBase sender,
+ int offset)
+ throws IOException, ClassNotFoundException
+ {
+ int spBase = spClass; // current top of stack
+ try{
+
+ /*
+ * Get the descriptor and then class of the incoming object.
+ */
+
+ ObjectStreamClass currdesc = currentClassDesc = ObjectStreamClass.lookup(clz);
+ Class currclass = currentClass = clz;
+
+ /* If Externalizable,
+ * Create an instance and tell it to read its data.
+ * else,
+ * Handle it as a serializable class.
+ */
+ if (currentClassDesc.isExternalizable()) {
+ try {
+ currentObject = (currentClass == null) ?
+ null : currentClassDesc.newInstance();
+ if (currentObject != null) {
+ // Store this object and its beginning position
+ // since there might be indirections to it while
+ // it's been unmarshalled.
+ activeRecursionMgr.addObject(offset, currentObject);
+
+ // Read format version
+ readFormatVersion();
+
+ Externalizable ext = (Externalizable)currentObject;
+ ext.readExternal(this);
+ }
+ } catch (InvocationTargetException e) {
+ 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 ;
+ } catch (InstantiationException e) {
+ InvalidClassException exc = new InvalidClassException(
+ currentClass.getName(),
+ "InstantiationException accessing no-arg constructor");
+ exc.initCause( e ) ;
+ throw exc ;
+ }
+ } else {
+ /*
+ * This is your basic diff pattern, made simpler
+ * because reordering is not allowed.
+ */
+ for (currdesc = currentClassDesc, currclass = currentClass;
+ currdesc != null && currdesc.isSerializable(); /*sun.4296963 ibm.11861*/
+
+ currdesc = currdesc.getSuperclass()) {
+
+ /*
+ * Search the classes to see if the class of this
+ * descriptor appears further up the hierarchy. Until
+ * it's found assume its an inserted class. If it's
+ * not found, its the descriptor's class that has been
+ * removed.
+ */
+ Class cc = currdesc.forClass();
+ Class cl;
+ for (cl = currclass; cl != null; cl = cl.getSuperclass()) {
+ if (cc == cl) {
+ // found a superclass that matches this descriptor
+ break;
+ } else {
+ /* Ignore a class that doesn't match. No
+ * action is needed since it is already
+ * initialized.
+ */
+ }
+ } // end : for (cl = currclass; cl != null; cl = cl.getSuperclass())
+ /* Test if there is room for this new entry.
+ * If not, double the size of the arrays and copy the contents.
+ */
+ 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);
+
+ classes = newclasses;
+ classdesc = newclassdesc;
+ }
+
+ if (cl == null) {
+ /* Class not found corresponding to this descriptor.
+ * Pop off all the extra classes pushed.
+ * Push the descriptor and a null class.
+ */
+ classdesc[spClass] = currdesc;
+ classes[spClass] = null;
+ } else {
+ /* Current class descriptor matches current class.
+ * Some classes may have been inserted.
+ * Record the match and advance the class, continue
+ * with the next descriptor.
+ */
+ classdesc[spClass] = currdesc;
+ classes[spClass] = cl;
+ currclass = cl.getSuperclass();
+ }
+ } // end : for (currdesc = currentClassDesc, currclass = currentClass;
+
+ /* Allocate a new object.
+ */
+ try {
+ 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 ;
+ } catch (UnsupportedOperationException e) {
+ 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 ;
+ }
+
+ Enumeration fvdsList = getOrderedDescriptions(repositoryID, sender).elements();
+
+ while((fvdsList.hasMoreElements()) && (spClass > spBase)) {
+ FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
+ // d4365188: backward compatability
+ String repIDForFVD = vhandler.getClassName(fvd.id);
+ String repIDForClass = vhandler.getClassName(vhandler.getRMIRepositoryID(currentClass));
+
+ while ((spClass > spBase) &&
+ (!repIDForFVD.equals(repIDForClass))) {
+ int pos = findNextClass(repIDForFVD, classes, spClass, spBase);
+ if (pos != -1) {
+ spClass = pos;
+ currclass = currentClass = classes[spClass];
+ 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
+
+ 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();
+ }
+
+ // WARNING: If stream format version is 1 and there's
+ // optional data, we'll get some form of exception down
+ // the line or data corruption.
+
+ } else {
+
+ inputClassFields(null, currentClass, null, fvd.members, sender);
+ }
+
+ if (fvdsList.hasMoreElements()){
+ fvd = (FullValueDescription)fvdsList.nextElement();
+ repIDForFVD = vhandler.getClassName(fvd.id);
+ }
+ else return currentObject;
+ }
+ }
+
+ 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
+ // defaultWriteObject/writeFields.
+
+ ReadObjectState oldState = readObjectState;
+ setState(DEFAULT_STATE);
+
+ try {
+
+ if (fvd.is_custom) {
+
+ // Read format version
+ readFormatVersion();
+
+ // Read defaultWriteObject indicator
+ boolean calledDefaultWriteObject = readBoolean();
+
+ readObjectState.beginUnmarshalCustomValue(this,
+ calledDefaultWriteObject,
+ currentClassDesc.hasReadObject());
+ }
+
+ boolean usedReadObject = false;
+
+ // Always use readObject if it exists, and fall back to default
+ // unmarshaling if it doesn't.
+ try {
+
+ if (!fvd.is_custom && currentClassDesc.hasReadObject())
+ setState(IN_READ_OBJECT_REMOTE_NOT_CUSTOM_MARSHALED);
+
+ // See the definition of defaultReadObjectFVDMembers
+ // for more information. This concerns making sure
+ // we use the remote FVD's members in defaultReadObject.
+ defaultReadObjectFVDMembers = fvd.members;
+ usedReadObject = invokeObjectReader(currentClassDesc,
+ currentObject,
+ currentClass);
+
+ } finally {
+ defaultReadObjectFVDMembers = null;
+ }
+
+ // 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);
+
+ if (fvd.is_custom)
+ readObjectState.endUnmarshalCustomValue(this);
+
+ } finally {
+ setState(oldState);
+ }
+
+ currclass = currentClass = classes[--spClass];
+
+ } 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
+ // custom marshaling, throw MARSHAL error.
+ inputClassFields(null, currentClass, null, fvd.members, sender);
+
+ while (fvdsList.hasMoreElements()){
+ fvd = (FullValueDescription)fvdsList.nextElement();
+
+ if (fvd.is_custom)
+ skipCustomUsingFVD(fvd.members, sender);
+ else
+ inputClassFields(null, currentClass, null, fvd.members, sender);
+ }
+
+ }
+
+ } // end : while(fvdsList.hasMoreElements())
+ while (fvdsList.hasMoreElements()){
+
+ FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
+ if (fvd.is_custom)
+ skipCustomUsingFVD(fvd.members, sender);
+ else
+ throwAwayData(fvd.members, sender);
+ }
+ }
+
+ return currentObject;
+ }
+ finally {
+ // Make sure we exit at the same stack level as when we started.
+ spClass = spBase;
+
+ // We've completed deserializing this object. Any
+ // future indirections will be handled correctly at the
+ // CDR level. The ActiveRecursionManager only deals with
+ // objects currently being deserialized.
+ activeRecursionMgr.removeObject(offset);
+ }
+
+ }
+
+ /**
+ * 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.
+ *
+ */
+ private Object skipObjectUsingFVD(String repositoryID,
+ com.sun.org.omg.SendingContext.CodeBase sender)
+ throws IOException, ClassNotFoundException
+ {
+
+ Enumeration fvdsList = getOrderedDescriptions(repositoryID, sender).elements();
+
+ while(fvdsList.hasMoreElements()) {
+ FullValueDescription fvd = (FullValueDescription)fvdsList.nextElement();
+ 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();
+ }
+
+ // WARNING: If stream format version is 1 and there's
+ // optional data, we'll get some form of exception down
+ // the line.
+
+ } else {
+ // Use default marshaling
+ inputClassFields(null, null, null, fvd.members, sender);
+ }
+ }
+
+ } // end : while(fvdsList.hasMoreElements())
+ return null;
+
+ }
+
+ ///////////////////
+
+ private int findNextClass(String classname, Class classes[], int _spClass, int _spBase){
+
+ for (int i = _spClass; i > _spBase; i--){
+ if (classname.equals(classes[i].getName())) {
+ return i;
+ }
+ }
+
+ 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.
+ */
+ private boolean invokeObjectReader(ObjectStreamClass osc, Object obj, Class aclass)
+ throws InvalidClassException, StreamCorruptedException,
+ ClassNotFoundException, IOException
+ {
+ try {
+ return osc.invokeReadObject( obj, this ) ;
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getTargetException();
+ if (t instanceof ClassNotFoundException)
+ throw (ClassNotFoundException)t;
+ else if (t instanceof IOException)
+ throw (IOException)t;
+ else if (t instanceof RuntimeException)
+ throw (RuntimeException) t;
+ else if (t instanceof Error)
+ throw (Error) t;
+ else
+ // XXX I18N, logging needed.
+ throw new Error("internal error");
+ }
+ }
+
+ /*
+ * Reset the stream to be just like it was after the constructor.
+ */
+ private void resetStream() throws IOException {
+
+ if (classes == null)
+ classes = new Class[20];
+ else {
+ for (int i = 0; i < classes.length; i++)
+ classes[i] = null;
+ }
+ if (classdesc == null)
+ classdesc = new ObjectStreamClass[20];
+ else {
+ for (int i = 0; i < classdesc.length; i++)
+ classdesc[i] = null;
+ }
+ spClass = 0;
+
+ if (callbacks != null)
+ callbacks.setSize(0); // discard any pending callbacks
+ }
+
+ /**
+ * 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.
+ */
+ private void inputPrimitiveField(Object o, Class cl, ObjectStreamField field)
+ throws InvalidClassException, IOException {
+
+ try {
+ switch (field.getTypeCode()) {
+ case 'B':
+ byte byteValue = orbStream.read_octet();
+ if (field.getField() != null) {
+ bridge.putByte( o, field.getFieldID(), byteValue ) ;
+ //reflective code: field.getField().setByte( o, byteValue ) ;
+ }
+ break;
+ case 'Z':
+ boolean booleanValue = orbStream.read_boolean();
+ if (field.getField() != null) {
+ bridge.putBoolean( o, field.getFieldID(), booleanValue ) ;
+ //reflective code: field.getField().setBoolean( o, booleanValue ) ;
+ }
+ break;
+ case 'C':
+ char charValue = orbStream.read_wchar();
+ if (field.getField() != null) {
+ bridge.putChar( o, field.getFieldID(), charValue ) ;
+ //reflective code: field.getField().setChar( o, charValue ) ;
+ }
+ break;
+ case 'S':
+ short shortValue = orbStream.read_short();
+ if (field.getField() != null) {
+ bridge.putShort( o, field.getFieldID(), shortValue ) ;
+ //reflective code: field.getField().setShort( o, shortValue ) ;
+ }
+ break;
+ case 'I':
+ int intValue = orbStream.read_long();
+ if (field.getField() != null) {
+ bridge.putInt( o, field.getFieldID(), intValue ) ;
+ //reflective code: field.getField().setInt( o, intValue ) ;
+ }
+ break;
+ case 'J':
+ long longValue = orbStream.read_longlong();
+ if (field.getField() != null) {
+ bridge.putLong( o, field.getFieldID(), longValue ) ;
+ //reflective code: field.getField().setLong( o, longValue ) ;
+ }
+ break;
+ case 'F' :
+ float floatValue = orbStream.read_float();
+ if (field.getField() != null) {
+ bridge.putFloat( o, field.getFieldID(), floatValue ) ;
+ //reflective code: field.getField().setFloat( o, floatValue ) ;
+ }
+ break;
+ case 'D' :
+ double doubleValue = orbStream.read_double();
+ if (field.getField() != null) {
+ bridge.putDouble( o, field.getFieldID(), doubleValue ) ;
+ //reflective code: field.getField().setDouble( o, doubleValue ) ;
+ }
+ break;
+ default:
+ // XXX I18N, logging needed.
+ throw new InvalidClassException(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 ;
+ }
+ }
+
+ 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;
+ String id = field.id;
+
+ try {
+ type = vhandler.getClassFromType(id);
+ } catch(ClassNotFoundException cnfe) {
+ // Make sure type = null
+ type = null;
+ }
+
+ String signature = null;
+ if (type != null)
+ signature = ValueUtility.getSignature(field);
+
+ if (signature != null && (signature.equals("Ljava/lang/Object;") ||
+ signature.equals("Ljava/io/Serializable;") ||
+ signature.equals("Ljava/io/Externalizable;"))) {
+ objectValue = javax.rmi.CORBA.Util.readAny(orbStream);
+ } else {
+ // Decide what method call to make based on the type. If
+ // it is a type for which we need to load a stub, convert
+ // the type to the correct stub type.
+ //
+ // 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)) {
+
+ if (field.type.kind().value() == kRemoteTypeCode.kind().value()) {
+
+ // RMI Object reference...
+ callType = ValueHandlerImpl.kRemoteType;
+
+ } else {
+
+ // 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)'s loadStubClass
+ // logic. Assumption is that the given type cannot
+ // evolve to become a CORBA abstract interface or
+ // a RMI abstract interface.
+
+ if (type != null && type.isInterface() &&
+ (vhandler.isAbstractBase(type) ||
+ ObjectStreamClassCorbaExt.isAbstractInterface(type))) {
+
+ callType = ValueHandlerImpl.kAbstractType;
+ }
+ }
+ }
+
+ // 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 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:
+ // XXX I18N, logging needed.
+ throw new StreamCorruptedException("Unknown callType: " + callType);
+ }
+ }
+
+ return objectValue;
+ }
+
+ /**
+ * Factored out of inputClassFields and reused in
+ * inputCurrentClassFieldsForReadFields.
+ *
+ * Reads the field (which of an Object type as opposed to a primitive)
+ * described by ObjectStreamField field and returns it.
+ */
+ private Object inputObjectField(ObjectStreamField field)
+ throws InvalidClassException, StreamCorruptedException,
+ ClassNotFoundException, IndirectionException, IOException {
+
+ if (ObjectStreamClassCorbaExt.isAny(field.getTypeString())) {
+ return javax.rmi.CORBA.Util.readAny(orbStream);
+ }
+
+ Object objectValue = null;
+
+ // fields have an API to provide the actual class
+ // corresponding to the data type
+ // 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;
+
+ if (fieldType.isInterface()) {
+ boolean loadStubClass = false;
+
+ if (java.rmi.Remote.class.isAssignableFrom(fieldType)) {
+
+ // RMI Object reference...
+ callType = ValueHandlerImpl.kRemoteType;
+
+ } else if (org.omg.CORBA.Object.class.isAssignableFrom(fieldType)){
+
+ // IDL Object reference...
+ callType = ValueHandlerImpl.kRemoteType;
+ loadStubClass = true;
+
+ } else if (vhandler.isAbstractBase(fieldType)) {
+ // IDL Abstract Object reference...
+
+ callType = ValueHandlerImpl.kAbstractType;
+ loadStubClass = true;
+ } else if (ObjectStreamClassCorbaExt.isAbstractInterface(fieldType)) {
+ // RMI Abstract Object reference...
+
+ callType = ValueHandlerImpl.kAbstractType;
+ }
+
+ if (loadStubClass) {
+ try {
+ String codebase = Util.getCodebase(fieldType);
+ String repID = vhandler.createForAnyType(fieldType);
+ Class stubType =
+ Utility.loadStubClass(repID, codebase, fieldType);
+ actualType = stubType;
+ } catch (ClassNotFoundException e) {
+ narrow = true;
+ }
+ } 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 = (Object)orbStream.read_abstract_interface(actualType);
+ else
+ objectValue = Utility.readAbstractAndNarrow(orbStream, actualType);
+ break;
+ case ValueHandlerImpl.kValueType:
+ objectValue = (Object)orbStream.read_value(actualType);
+ break;
+ default:
+ // XXX I18N, logging needed.
+ throw new StreamCorruptedException("Unknown callType: " + callType);
+ }
+
+ return objectValue;
+ }
+
+ private final boolean mustUseRemoteValueMembers() {
+ return defaultReadObjectFVDMembers != null;
+ }
+
+ void readFields(java.util.Map fieldToValueMap)
+ throws InvalidClassException, StreamCorruptedException,
+ ClassNotFoundException, IOException {
+
+ if (mustUseRemoteValueMembers()) {
+ inputRemoteMembersForReadFields(fieldToValueMap);
+ } else
+ inputCurrentClassFieldsForReadFields(fieldToValueMap);
+ }
+
+ private final void inputRemoteMembersForReadFields(java.util.Map fieldToValueMap)
+ throws InvalidClassException, StreamCorruptedException,
+ ClassNotFoundException, IOException {
+
+ // Must have this local variable since defaultReadObjectFVDMembers
+ // may get mangled by recursion.
+ ValueMember fields[] = defaultReadObjectFVDMembers;
+
+ try {
+
+ for (int i = 0; i < fields.length; i++) {
+
+ switch (fields[i].type.kind().value()) {
+
+ case TCKind._tk_octet:
+ byte byteValue = orbStream.read_octet();
+ fieldToValueMap.put(fields[i].name, new Byte(byteValue));
+ break;
+ case TCKind._tk_boolean:
+ boolean booleanValue = orbStream.read_boolean();
+ fieldToValueMap.put(fields[i].name, new Boolean(booleanValue));
+ break;
+ case TCKind._tk_char:
+ // 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, new Character(charValue));
+ break;
+ case TCKind._tk_short:
+ short shortValue = orbStream.read_short();
+ fieldToValueMap.put(fields[i].name, new Short(shortValue));
+ break;
+ case TCKind._tk_long:
+ int intValue = orbStream.read_long();
+ fieldToValueMap.put(fields[i].name, new Integer(intValue));
+ break;
+ case TCKind._tk_longlong:
+ long longValue = orbStream.read_longlong();
+ fieldToValueMap.put(fields[i].name, new Long(longValue));
+ break;
+ case TCKind._tk_float:
+ float floatValue = orbStream.read_float();
+ fieldToValueMap.put(fields[i].name, new Float(floatValue));
+ break;
+ case TCKind._tk_double:
+ double doubleValue = orbStream.read_double();
+ fieldToValueMap.put(fields[i].name, new Double(doubleValue));
+ break;
+ case TCKind._tk_value:
+ case TCKind._tk_objref:
+ case TCKind._tk_value_box:
+ Object objectValue = null;
+ try {
+ objectValue = inputObjectField(fields[i],
+ cbSender);
+
+ } 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).
+ objectValue = activeRecursionMgr.getObject(cdrie.offset);
+ }
+
+ fieldToValueMap.put(fields[i].name, objectValue);
+ break;
+ default:
+ // XXX I18N, logging needed.
+ throw new StreamCorruptedException("Unknown kind: "
+ + fields[i].type.kind().value());
+ }
+ }
+ } catch (Throwable t) {
+ StreamCorruptedException result = new StreamCorruptedException(t.getMessage());
+ result.initCause(t);
+ throw result;
+ }
+ }
+
+ /**
+ * 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.
+ */
+ private final void inputCurrentClassFieldsForReadFields(java.util.Map fieldToValueMap)
+ throws InvalidClassException, StreamCorruptedException,
+ ClassNotFoundException, IOException {
+
+ ObjectStreamField[] fields = currentClassDesc.getFieldsNoCopy();
+
+ int primFields = fields.length - currentClassDesc.objFields;
+
+ // 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(),
+ new Byte(byteValue));
+ break;
+ case 'Z':
+ boolean booleanValue = orbStream.read_boolean();
+ fieldToValueMap.put(fields[i].getName(),
+ new Boolean(booleanValue));
+ break;
+ case 'C':
+ char charValue = orbStream.read_wchar();
+ fieldToValueMap.put(fields[i].getName(),
+ new Character(charValue));
+ break;
+ case 'S':
+ short shortValue = orbStream.read_short();
+ fieldToValueMap.put(fields[i].getName(),
+ new Short(shortValue));
+ break;
+ case 'I':
+ int intValue = orbStream.read_long();
+ fieldToValueMap.put(fields[i].getName(),
+ new Integer(intValue));
+ break;
+ case 'J':
+ long longValue = orbStream.read_longlong();
+ fieldToValueMap.put(fields[i].getName(),
+ new Long(longValue));
+ break;
+ case 'F' :
+ float floatValue = orbStream.read_float();
+ fieldToValueMap.put(fields[i].getName(),
+ new Float(floatValue));
+ break;
+ case 'D' :
+ double doubleValue = orbStream.read_double();
+ fieldToValueMap.put(fields[i].getName(),
+ new Double(doubleValue));
+ break;
+ default:
+ // XXX I18N, logging needed.
+ throw new InvalidClassException(currentClassDesc.getName());
+ }
+ }
+
+ /* Read and set object fields from the input stream. */
+ if (currentClassDesc.objFields > 0) {
+ for (int i = primFields; i < fields.length; i++) {
+ Object objectValue = null;
+ try {
+ objectValue = inputObjectField(fields[i]);
+ } 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).
+ objectValue = activeRecursionMgr.getObject(cdrie.offset);
+ }
+
+ fieldToValueMap.put(fields[i].getName(), objectValue);
+ }
+ }
+ }
+
+ /*
+ * 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!
+ */
+ 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;
+
+ // this will leave primitives in the inputstream
+ // should really consume and discard where necessary
+ if (o != null) {
+ for (int i = 0; i < primFields; ++i) {
+ inputPrimitiveField(o, cl, fields[i]);
+ }
+ }
+
+ /* Read and set object fields from the input stream. */
+ if (currentClassDesc.objFields > 0) {
+ for (int i = primFields; i < fields.length; i++) {
+ Object objectValue = null;
+
+ try {
+ objectValue = inputObjectField(fields[i]);
+ } 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).
+ objectValue = activeRecursionMgr.getObject(cdrie.offset);
+ }
+
+ if ((o == null) || (fields[i].getField() == null)) {
+ continue;
+ }
+
+ try {
+ Class<?> fieldCl = fields[i].getClazz();
+ if ((objectValue != null)
+ && (!fieldCl.isAssignableFrom(
+ objectValue.getClass()))) {
+ throw new IllegalArgumentException("Field mismatch");
+ }
+ Field declaredClassField = null;
+ final String inputStreamFieldName = fields[i].getName();
+ try {
+ declaredClassField = getDeclaredField( cl, inputStreamFieldName);
+ } catch (PrivilegedActionException paEx) {
+ throw new IllegalArgumentException(
+ (NoSuchFieldException) paEx.getException());
+ } catch (SecurityException secEx) {
+ throw new IllegalArgumentException(secEx);
+ } catch (NullPointerException npEx) {
+ continue;
+ } catch (NoSuchFieldException e) {
+ continue;
+ }
+
+ if (declaredClassField == null) {
+ continue;
+ }
+
+ Class<?> declaredFieldClass = declaredClassField.getType();
+
+ // 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");
+ }
+ if (objectValue != null && !fieldCl.isInstance(objectValue)) {
+ throw new IllegalArgumentException();
+ }
+ bridge.putObject( o, fields[i].getFieldID(), objectValue ) ;
+ // reflective code: fields[i].getField().set( o, objectValue ) ;
+ } catch (IllegalArgumentException iaEx) {
+ String objectValueClassName = "null";
+ String currentClassDescClassName = "null";
+ String fieldName = "null";
+ if (objectValue != null) {
+ objectValueClassName = objectValue.getClass().getName();
+ }
+ if (currentClassDesc != null) {
+ currentClassDescClassName = currentClassDesc.getName();
+ }
+ if (fields[i] != null && fields[i].getField() != null) {
+ fieldName = fields[i].getField().getName();
+ }
+ ClassCastException ccEx = new ClassCastException(
+ "Assigning instance of class " + objectValueClassName
+ + " to field " + currentClassDescClassName + '#' + fieldName);
+ ccEx.initCause( iaEx ) ;
+ throw ccEx ;
+ }
+ } // end : for loop
+ }
+ }
+
+ /*
+ * 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.
+ */
+ private void inputClassFields(Object o, Class cl,
+ ObjectStreamClass osc,
+ ValueMember[] fields,
+ com.sun.org.omg.SendingContext.CodeBase sender)
+ throws InvalidClassException, StreamCorruptedException,
+ ClassNotFoundException, IOException
+ {
+ try{
+ for (int i = 0; i < fields.length; ++i) {
+ try {
+ switch (fields[i].type.kind().value()) {
+ case TCKind._tk_octet:
+ byte byteValue = orbStream.read_octet();
+ if ((o != null) && osc.hasField(fields[i]))
+ setByteField(o, cl, fields[i].name, byteValue);
+ break;
+ case TCKind._tk_boolean:
+ boolean booleanValue = orbStream.read_boolean();
+ if ((o != null) && osc.hasField(fields[i]))
+ setBooleanField(o, cl, fields[i].name, booleanValue);
+ break;
+ case TCKind._tk_char:
+ // 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();
+ if ((o != null) && osc.hasField(fields[i]))
+ setCharField(o, cl, fields[i].name, charValue);
+ break;
+ case TCKind._tk_short:
+ short shortValue = orbStream.read_short();
+ if ((o != null) && osc.hasField(fields[i]))
+ setShortField(o, cl, fields[i].name, shortValue);
+ break;
+ case TCKind._tk_long:
+ int intValue = orbStream.read_long();
+ if ((o != null) && osc.hasField(fields[i]))
+ setIntField(o, cl, fields[i].name, intValue);
+ break;
+ case TCKind._tk_longlong:
+ long longValue = orbStream.read_longlong();
+ if ((o != null) && osc.hasField(fields[i]))
+ setLongField(o, cl, fields[i].name, longValue);
+ break;
+ case TCKind._tk_float:
+ float floatValue = orbStream.read_float();
+ if ((o != null) && osc.hasField(fields[i]))
+ setFloatField(o, cl, fields[i].name, floatValue);
+ break;
+ case TCKind._tk_double:
+ double doubleValue = orbStream.read_double();
+ if ((o != null) && osc.hasField(fields[i]))
+ setDoubleField(o, cl, fields[i].name, doubleValue);
+ break;
+ case TCKind._tk_value:
+ case TCKind._tk_objref:
+ case TCKind._tk_value_box:
+ Object objectValue = null;
+ try {
+ objectValue = inputObjectField(fields[i], sender);
+ } 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).
+ objectValue = activeRecursionMgr.getObject(cdrie.offset);
+ }
+
+ if (o == null)
+ continue;
+ try {
+ if (osc.hasField(fields[i])){
+ setObjectField(o,
+ cl,
+ fields[i].name,
+ objectValue);
+ } else {
+ // REVISIT. Convert to a log message.
+ // This is a normal case when fields have
+ // been added as part of evolution, but
+ // silently skipping can make it hard to
+ // debug if there's an error
+// System.out.println("**** warning, not setting field: "
+// + fields[i].name
+// + " since not on class "
+// + osc.getName());
+
+ }
+ } catch (IllegalArgumentException e) {
+ // XXX I18N, logging needed.
+ ClassCastException cce = new ClassCastException("Assigning instance of class " +
+ objectValue.getClass().getName() + " to field " + fields[i].name);
+ cce.initCause(e) ;
+ throw cce ;
+ }
+ break;
+ default:
+ // XXX I18N, logging needed.
+ throw new StreamCorruptedException("Unknown kind: "
+ + fields[i].type.kind().value());
+ }
+ } 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. */
+ // XXX I18N, logging needed.
+ ClassCastException cce = new ClassCastException("Assigning instance of class " + fields[i].id +
+ " to field " + currentClassDesc.getName() + '#' + fields[i].name);
+ cce.initCause( e ) ;
+ throw cce ;
+ }
+ }
+ } catch(Throwable t){
+ // XXX I18N, logging needed.
+ StreamCorruptedException sce = new StreamCorruptedException(t.getMessage());
+ sce.initCause(t) ;
+ throw sce ;
+ }
+ }
+
+ private void skipCustomUsingFVD(ValueMember[] fields,
+ com.sun.org.omg.SendingContext.CodeBase sender)
+ throws InvalidClassException, StreamCorruptedException,
+ ClassNotFoundException, IOException
+ {
+ readFormatVersion();
+ boolean calledDefaultWriteObject = readBoolean();
+
+ if (calledDefaultWriteObject)
+ throwAwayData(fields, sender);
+
+ if (getStreamFormatVersion() == 2) {
+
+ ((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.
+ */
+ 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) {
+
+ try {
+
+ switch (fields[i].type.kind().value()) {
+ case TCKind._tk_octet:
+ orbStream.read_octet();
+ break;
+ case TCKind._tk_boolean:
+ orbStream.read_boolean();
+ break;
+ case TCKind._tk_char:
+ // 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:
+ orbStream.read_wchar();
+ break;
+ case TCKind._tk_short:
+ orbStream.read_short();
+ break;
+ case TCKind._tk_long:
+ orbStream.read_long();
+ break;
+ case TCKind._tk_longlong:
+ orbStream.read_longlong();
+ break;
+ case TCKind._tk_float:
+ orbStream.read_float();
+ break;
+ case TCKind._tk_double:
+ orbStream.read_double();
+ break;
+ case TCKind._tk_value:
+ case TCKind._tk_objref:
+ case TCKind._tk_value_box:
+ Class type = null;
+ String id = fields[i].id;
+
+ try {
+ type = vhandler.getClassFromType(id);
+ }
+ catch(ClassNotFoundException cnfe){
+ // Make sure type = null
+ type = null;
+ }
+ String signature = null;
+ 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;")) ) {
+ javax.rmi.CORBA.Util.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 do not
+ // have the ability to optimize this check.
+
+ int callType = ValueHandlerImpl.kValueType;
+
+ if (!vhandler.isSequence(id)) {
+ FullValueDescription fieldFVD = sender.meta(fields[i].id);
+ if (kRemoteTypeCode == fields[i].type) {
+
+ // RMI Object reference...
+ callType = ValueHandlerImpl.kRemoteType;
+ } else if (fieldFVD.is_abstract) {
+ // RMI Abstract Object reference...
+
+ callType = ValueHandlerImpl.kAbstractType;
+ }
+ }
+
+ // 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 the wire.
+
+ switch (callType) {
+ case ValueHandlerImpl.kRemoteType:
+ orbStream.read_Object();
+ break;
+ case ValueHandlerImpl.kAbstractType:
+ orbStream.read_abstract_interface();
+ break;
+ case ValueHandlerImpl.kValueType:
+ if (type != null) {
+ orbStream.read_value(type);
+ } else {
+ orbStream.read_value();
+ }
+ break;
+ default:
+ // XXX I18N, logging needed.
+ throw new StreamCorruptedException("Unknown callType: "
+ + callType);
+ }
+ }
+
+ }
+ catch(IndirectionException cdrie) {
+ // Since we are throwing this away, don't bother handling recursion.
+ continue;
+ }
+
+ break;
+ default:
+ // XXX I18N, logging needed.
+ throw new StreamCorruptedException("Unknown kind: "
+ + fields[i].type.kind().value());
+
+ }
+ } 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. */
+ // XXX I18N, logging needed.
+ ClassCastException cce = new ClassCastException("Assigning instance of class " +
+ fields[i].id + " to field " + currentClassDesc.getName() +
+ '#' + fields[i].name);
+ cce.initCause(e) ;
+ throw cce ;
+ }
+ }
+ }
+
+ private static void setObjectField(Object o, Class<?> c, String fieldName, Object v) {
+ try {
+ Field fld = getDeclaredField( c, fieldName ) ;
+ Class fieldCl = fld.getType();
+ if(v != null && !fieldCl.isInstance(v)) {
+ throw new Exception();
+ }
+ 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() ) ;
+ } else {
+ throw utilWrapper.errorSetObjectField( e, fieldName,
+ "null " + c.getName() + " object",
+ v.toString() ) ;
+ }
+ }
+ }
+
+ private static void setBooleanField(Object o, Class<?> c, String fieldName, boolean v)
+ {
+ try {
+ Field fld = getDeclaredField( c, fieldName ) ;
+ if ((fld != null) && (fld.getType() == Boolean.TYPE)) {
+ 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) ) ;
+ }
+ }
+ }
+
+ private static void setByteField(Object o, Class<?> c, String fieldName, byte v)
+ {
+ try {
+ Field fld = getDeclaredField( c, fieldName ) ;
+ if ((fld != null) && (fld.getType() == Byte.TYPE)) {
+ 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) ) ;
+ } else {
+ throw utilWrapper.errorSetByteField( e, fieldName,
+ "null " + c.getName() + " object",
+ new Byte(v) ) ;
+ }
+ }
+ }
+
+ private static void setCharField(Object o, Class<?> c, String fieldName, char v)
+ {
+ try {
+ Field fld = getDeclaredField( c, fieldName ) ;
+ if ((fld != null) && (fld.getType() == Character.TYPE)) {
+ 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) ) ;
+ } else {
+ throw utilWrapper.errorSetCharField( e, fieldName,
+ "null " + c.getName() + " object",
+ new Character(v) ) ;
+ }
+ }
+ }
+
+ private static void setShortField(Object o, Class<?> c, String fieldName, short v)
+ {
+ try {
+ Field fld = getDeclaredField( c, fieldName ) ;
+ if ((fld != null) && (fld.getType() == Short.TYPE)) {
+ 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) ) ;
+ } else {
+ throw utilWrapper.errorSetShortField( e, fieldName,
+ "null " + c.getName() + " object",
+ new Short(v) ) ;
+ }
+ }
+ }
+
+ private static void setIntField(Object o, Class<?> c, String fieldName, int v)
+ {
+ try {
+ Field fld = getDeclaredField( c, fieldName ) ;
+ if ((fld != null) && (fld.getType() == Integer.TYPE)) {
+ 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) ) ;
+ } else {
+ throw utilWrapper.errorSetIntField( e, fieldName,
+ "null " + c.getName() + " object",
+ new Integer(v) ) ;
+ }
+ }
+ }
+
+ private static void setLongField(Object o, Class<?> c, String fieldName, long v)
+ {
+ try {
+ Field fld = getDeclaredField( c, fieldName ) ;
+ if ((fld != null) && (fld.getType() == Long.TYPE)) {
+ 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) ) ;
+ } else {
+ throw utilWrapper.errorSetLongField( e, fieldName,
+ "null " + c.getName() + " object",
+ new Long(v) ) ;
+ }
+ }
+ }
+
+ private static void setFloatField(Object o, Class<?> c, String fieldName, float v)
+ {
+ try {
+ Field fld = getDeclaredField( c, fieldName ) ;
+ if ((fld != null) && (fld.getType() == Float.TYPE)) {
+ 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) ) ;
+ } else {
+ throw utilWrapper.errorSetFloatField( e, fieldName,
+ "null " + c.getName() + " object",
+ new Float(v) ) ;
+ }
+ }
+ }
+
+ private static void setDoubleField(Object o, Class<?> c, String fieldName, double v)
+ {
+ try {
+ Field fld = getDeclaredField( c, fieldName ) ;
+ if ((fld != null) && (fld.getType() == Double.TYPE)) {
+ 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) ) ;
+ } else {
+ throw utilWrapper.errorSetDoubleField( e, fieldName,
+ "null " + c.getName() + " object",
+ new Double(v) ) ;
+ }
+ }
+ }
+
+
+ private static Field getDeclaredField(final Class<?> c,
+ final String fieldName)
+ throws PrivilegedActionException, NoSuchFieldException, SecurityException {
+ if (System.getSecurityManager() == null) {
+ return c.getDeclaredField(fieldName);
+ } else {
+ return AccessController
+ .doPrivileged(new PrivilegedExceptionAction<Field>() {
+ public Field run() throws NoSuchFieldException {
+ return c.getDeclaredField(fieldName);
+ }
+ });
+ }
+ }
+
+ /**
+ * 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<Integer, Object> offsetToObjectMap;
+
+ public ActiveRecursionManager() {
+ // A hash map is unsynchronized and allows
+ // null values
+ offsetToObjectMap = new HashMap<>();
+ }
+
+ // Called right after allocating a new object.
+ // Offset is the starting position in the stream
+ // of the object.
+ public void addObject(int offset, Object value) {
+ offsetToObjectMap.put(new Integer(offset), value);
+ }
+
+ // If the given starting position doesn't refer
+ // to the beginning of an object currently being
+ // deserialized, this throws an IOException.
+ // Otherwise, it returns a reference to the
+ // object.
+ public Object getObject(int offset) throws IOException {
+ Integer position = new Integer(offset);
+
+ if (!offsetToObjectMap.containsKey(position))
+ // XXX I18N, logging needed.
+ throw new IOException("Invalid indirection to offset "
+ + offset);
+
+ 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
+ // further indirections.
+ public void removeObject(int offset) {
+ offsetToObjectMap.remove(new Integer(offset));
+ }
+
+ // If the given offset doesn't map to an Object,
+ // then it isn't an indirection to an object
+ // currently being deserialized.
+ public boolean containsObject(int offset) {
+ return offsetToObjectMap.containsKey(new Integer(offset));
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java
new file mode 100644
index 0000000..e5f7709
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/IIOPOutputStream.java
@@ -0,0 +1,801 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.io;
+
+import org.omg.CORBA.portable.OutputStream;
+
+import java.security.AccessController ;
+import java.security.PrivilegedAction ;
+
+import java.io.IOException;
+import java.io.InvalidClassException;
+import java.io.Externalizable;
+import java.io.NotSerializableException;
+import java.io.NotActiveException;
+
+import java.lang.reflect.InvocationTargetException;
+
+import javax.rmi.CORBA.Util;
+
+import sun.corba.Bridge ;
+
+import com.sun.corba.se.impl.util.Utility;
+import com.sun.corba.se.impl.util.RepositoryId;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.UtilSystemException ;
+
+/**
+ * IIOPOutputStream is ...
+ *
+ * @author Stephen Lewallen
+ * @since JDK1.1.6
+ */
+
+public class IIOPOutputStream
+ extends com.sun.corba.se.impl.io.OutputStreamHook
+{
+ private UtilSystemException wrapper = UtilSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ private static Bridge bridge =
+ (Bridge)AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ return Bridge.get() ;
+ }
+ }
+ ) ;
+
+ private org.omg.CORBA_2_3.portable.OutputStream orbStream;
+
+ private Object currentObject = null;
+
+ private ObjectStreamClass currentClassDesc = null;
+
+ private int recursionDepth = 0;
+
+ private int simpleWriteDepth = 0;
+
+ private IOException abortIOException = null;
+
+ private java.util.Stack classDescStack = new java.util.Stack();
+
+ // Used when calling an object's writeObject method
+ private Object[] writeObjectArgList = {this};
+
+ public IIOPOutputStream()
+ throws java.io.IOException
+ {
+ super();
+ }
+
+ // If using RMI-IIOP stream format version 2, this tells
+ // the ORB stream (which must be a ValueOutputStream) to
+ // begin a new valuetype to contain the optional data
+ // of the writeObject method.
+ protected void beginOptionalCustomData() {
+
+ if (streamFormatVersion == 2) {
+
+ org.omg.CORBA.portable.ValueOutputStream vout
+ = (org.omg.CORBA.portable.ValueOutputStream)orbStream;
+
+ vout.start_value(currentClassDesc.getRMIIIOPOptionalDataRepId());
+ }
+ }
+
+ final void setOrbStream(org.omg.CORBA_2_3.portable.OutputStream os) {
+ orbStream = os;
+ }
+
+ final org.omg.CORBA_2_3.portable.OutputStream getOrbStream() {
+ return orbStream;
+ }
+
+ final void increaseRecursionDepth(){
+ recursionDepth++;
+ }
+
+ final int decreaseRecursionDepth(){
+ return --recursionDepth;
+ }
+
+ /**
+ * Override the actions of the final method "writeObject()"
+ * in ObjectOutputStream.
+ * @since JDK1.1.6
+ */
+ public final void writeObjectOverride(Object obj)
+ throws IOException
+ {
+ writeObjectState.writeData(this);
+
+ Util.writeAbstractObject((OutputStream)orbStream, obj);
+ }
+
+ /**
+ * Override the actions of the final method "writeObject()"
+ * in ObjectOutputStream.
+ * @since JDK1.1.6
+ */
+ public final void simpleWriteObject(Object obj, byte formatVersion)
+ /* throws IOException */
+ {
+ byte oldStreamFormatVersion = streamFormatVersion;
+
+ streamFormatVersion = formatVersion;
+
+ Object prevObject = currentObject;
+ ObjectStreamClass prevClassDesc = currentClassDesc;
+ simpleWriteDepth++;
+
+ try {
+ // if (!checkSpecialClasses(obj) && !checkSubstitutableSpecialClasses(obj))
+ outputObject(obj);
+
+ } catch (IOException ee) {
+ if (abortIOException == null)
+ abortIOException = ee;
+ } finally {
+ /* Restore state of previous call incase this is a nested call */
+ streamFormatVersion = oldStreamFormatVersion;
+ simpleWriteDepth--;
+ currentObject = prevObject;
+ currentClassDesc = prevClassDesc;
+ }
+
+ /* 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)
+ abortIOException = null;
+ if (pending != null) {
+ bridge.throwException( pending ) ;
+ }
+ }
+
+ // Required by the superclass.
+ ObjectStreamField[] getFieldsNoCopy() {
+ return currentClassDesc.getFieldsNoCopy();
+ }
+
+ /**
+ * Override the actions of the final method "defaultWriteObject()"
+ * in ObjectOutputStream.
+ * @since JDK1.1.6
+ */
+ public final void defaultWriteObjectDelegate()
+ /* throws IOException */
+ {
+ try {
+ if (currentObject == null || currentClassDesc == null)
+ // XXX I18N, Logging needed.
+ throw new NotActiveException("defaultWriteObjectDelegate");
+
+ ObjectStreamField[] fields =
+ currentClassDesc.getFieldsNoCopy();
+ if (fields.length > 0) {
+ outputClassFields(currentObject, currentClassDesc.forClass(),
+ fields);
+ }
+ } catch(IOException ioe) {
+ bridge.throwException(ioe);
+ }
+ }
+
+ /**
+ * Override the actions of the final method "enableReplaceObject()"
+ * in ObjectOutputStream.
+ * @since JDK1.1.6
+ */
+ public final boolean enableReplaceObjectDelegate(boolean enable)
+ /* throws SecurityException */
+ {
+ return false;
+
+ }
+
+
+ protected final void annotateClass(Class<?> cl) throws IOException{
+ // XXX I18N, Logging needed.
+ throw new IOException("Method annotateClass not supported");
+ }
+
+ public final void close() throws IOException{
+ // no op
+ }
+
+ protected final void drain() throws IOException{
+ // no op
+ }
+
+ public final void flush() throws IOException{
+ try{
+ orbStream.flush();
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ protected final Object replaceObject(Object obj) throws IOException{
+ // XXX I18N, Logging needed.
+ throw new IOException("Method replaceObject not supported");
+ }
+
+ /**
+ * 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
+ */
+ public final void reset() throws IOException{
+ try{
+ //orbStream.reset();
+
+ if (currentObject != null || currentClassDesc != null)
+ // XXX I18N, Logging needed.
+ throw new IOException("Illegal call to reset");
+
+ abortIOException = null;
+
+ if (classDescStack == null)
+ classDescStack = new java.util.Stack();
+ else
+ classDescStack.setSize(0);
+
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ public final void write(byte b[]) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ orbStream.write_octet_array(b, 0, b.length);
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ 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) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ public final void write(int data) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ orbStream.write_octet((byte)(data & 0xFF));
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ public final void writeBoolean(boolean data) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ orbStream.write_boolean(data);
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ public final void writeByte(int data) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ orbStream.write_octet((byte)data);
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ 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) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ public final void writeChar(int data) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ orbStream.write_wchar((char)data);
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ 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) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ public final void writeDouble(double data) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ orbStream.write_double(data);
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ public final void writeFloat(float data) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ orbStream.write_float(data);
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ public final void writeInt(int data) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ orbStream.write_long(data);
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ public final void writeLong(long data) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ orbStream.write_longlong(data);
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ public final void writeShort(int data) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ orbStream.write_short((short)data);
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ 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 is preserved
+ * in orbutil.IIOPInputStream_1_3 in order to interoperate with
+ * our legacy ORBs.
+ */
+ protected void internalWriteUTF(org.omg.CORBA.portable.OutputStream stream,
+ String data)
+ {
+ stream.write_wstring(data);
+ }
+
+ public final void writeUTF(String data) throws IOException{
+ try{
+ writeObjectState.writeData(this);
+
+ internalWriteUTF(orbStream, data);
+ } catch(Error e) {
+ IOException ioexc = new IOException(e.getMessage());
+ ioexc.initCause(e) ;
+ throw ioexc ;
+ }
+ }
+
+ // INTERNAL UTILITY METHODS
+ /*
+ * 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 ObjectStreamClass) {
+ // XXX I18N, Logging needed.
+ throw new IOException("Serialization of ObjectStreamClass not supported");
+ }
+
+ return false;
+ }
+
+ /*
+ * Check for special cases of substitutable serializing objects.
+ * These classes are replaceable.
+ */
+ private boolean checkSubstitutableSpecialClasses(Object obj)
+ throws IOException
+ {
+ if (obj instanceof String) {
+ orbStream.write_value((java.io.Serializable)obj);
+ return true;
+ }
+
+ //if (obj.getClass().isArray()) {
+ // outputArray(obj);
+ // return true;
+ //}
+
+ return false;
+ }
+
+ /*
+ * Write out the object
+ */
+ 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.
+ */
+ currentClassDesc = ObjectStreamClass.lookup(currclass);
+ if (currentClassDesc == null) {
+ // XXX I18N, Logging needed.
+ throw new NotSerializableException(currclass.getName());
+ }
+
+ /* If the object is externalizable,
+ * call writeExternal.
+ * else do Serializable processing.
+ */
+ if (currentClassDesc.isExternalizable()) {
+ // Write format version
+ orbStream.write_octet(streamFormatVersion);
+
+ Externalizable ext = (Externalizable)obj;
+ ext.writeExternal(this);
+
+ } 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.
+ */
+ if (currentClassDesc.forClass().getName().equals("java.lang.String")) {
+ this.writeUTF((String)obj);
+ return;
+ }
+ int stackMark = classDescStack.size();
+ try {
+ ObjectStreamClass next;
+ while ((next = currentClassDesc.getSuperclass()) != null) {
+ classDescStack.push(currentClassDesc);
+ currentClassDesc = next;
+ }
+
+ /*
+ * For currentClassDesc and all the pushed class descriptors
+ * If the class is writing its own data
+ * set blockData = true; call the class writeObject method
+ * If not
+ * invoke either the defaultWriteObject method.
+ */
+ do {
+
+ WriteObjectState oldState = writeObjectState;
+
+ try {
+
+ setState(NOT_IN_WRITE_OBJECT);
+
+ if (currentClassDesc.hasWriteObject()) {
+ invokeObjectWriter(currentClassDesc, obj );
+ } else {
+ defaultWriteObjectDelegate();
+ }
+ } finally {
+ setState(oldState);
+ }
+
+ } while (classDescStack.size() > stackMark &&
+ (currentClassDesc = (ObjectStreamClass)classDescStack.pop()) != null);
+ } finally {
+ classDescStack.setSize(stackMark);
+ }
+ }
+ }
+
+ /*
+ * Invoke writer.
+ * _REVISIT_ invokeObjectWriter and invokeObjectReader behave inconsistently with each other since
+ * the reader returns a boolean...fix later
+ */
+ private void invokeObjectWriter(ObjectStreamClass osc, Object obj)
+ throws IOException
+ {
+ Class c = osc.forClass() ;
+
+ try {
+
+ // Write format version
+ orbStream.write_octet(streamFormatVersion);
+
+ writeObjectState.enterWriteObject(this);
+
+ // writeObject(obj, c, this);
+ osc.invokeWriteObject( obj, this ) ;
+
+ writeObjectState.exitWriteObject(this);
+
+ } catch (InvocationTargetException e) {
+ Throwable t = e.getTargetException();
+ if (t instanceof IOException)
+ throw (IOException)t;
+ else if (t instanceof RuntimeException)
+ throw (RuntimeException) t;
+ else if (t instanceof Error)
+ throw (Error) t;
+ else
+ // XXX I18N, Logging needed.
+ throw new Error("invokeObjectWriter internal error",e);
+ }
+ }
+
+ 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((int)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:
+ // XXX I18N, Logging needed.
+ throw new InvalidClassException(currentClassDesc.getName());
+ }
+ }
+
+ private void writeObjectField(ObjectStreamField field,
+ Object objectValue) throws IOException {
+
+ if (ObjectStreamClassCorbaExt.isAny(field.getTypeString())) {
+ javax.rmi.CORBA.Util.writeAny(orbStream, objectValue);
+ }
+ else {
+ Class type = field.getType();
+ int callType = ValueHandlerImpl.kValueType;
+
+ if (type.isInterface()) {
+ String className = type.getName();
+
+ if (java.rmi.Remote.class.isAssignableFrom(type)) {
+
+ // RMI Object reference...
+
+ callType = ValueHandlerImpl.kRemoteType;
+
+
+ } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)){
+
+ // IDL Object reference...
+ callType = ValueHandlerImpl.kRemoteType;
+
+ } else if (RepositoryId.isAbstractBase(type)) {
+ // IDL Abstract Object reference...
+ callType = ValueHandlerImpl.kAbstractType;
+ } else if (ObjectStreamClassCorbaExt.isAbstractInterface(type)) {
+ callType = ValueHandlerImpl.kAbstractType;
+ }
+ }
+
+ switch (callType) {
+ case ValueHandlerImpl.kRemoteType:
+ Util.writeRemoteObject(orbStream, objectValue);
+ break;
+ case ValueHandlerImpl.kAbstractType:
+ Util.writeAbstractObject(orbStream, objectValue);
+ break;
+ case ValueHandlerImpl.kValueType:
+ 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());
+ }
+ }
+ }
+ }
+
+ /* Write the fields of the specified class by invoking the appropriate
+ * write* method on this class.
+ */
+ private void outputClassFields(Object o, Class cl,
+ ObjectStreamField[] fields)
+ throws IOException {
+
+ for (int i = 0; i < fields.length; i++) {
+ if (fields[i].getField() == null)
+ throw new InvalidClassException(cl.getName(),
+ "Nonexistent field " + fields[i].getName());
+ switch (fields[i].getTypeCode()) {
+ case 'B':
+ byte byteValue = bridge.getByte(o, fields[i].getFieldID()) ;
+ orbStream.write_octet(byteValue);
+ break;
+ case 'C':
+ char charValue = bridge.getChar(o, fields[i].getFieldID()) ;
+ orbStream.write_wchar(charValue);
+ break;
+ case 'F':
+ float floatValue = bridge.getFloat(o, fields[i].getFieldID()) ;
+ orbStream.write_float(floatValue);
+ break;
+ case 'D' :
+ double doubleValue = bridge.getDouble(o, fields[i].getFieldID()) ;
+ orbStream.write_double(doubleValue);
+ break;
+ case 'I':
+ int intValue = bridge.getInt(o, fields[i].getFieldID()) ;
+ orbStream.write_long(intValue);
+ break;
+ case 'J':
+ long longValue = bridge.getLong(o, fields[i].getFieldID()) ;
+ orbStream.write_longlong(longValue);
+ break;
+ case 'S':
+ short shortValue = bridge.getShort(o, fields[i].getFieldID()) ;
+ orbStream.write_short(shortValue);
+ break;
+ case 'Z':
+ boolean booleanValue = bridge.getBoolean(o, fields[i].getFieldID()) ;
+ orbStream.write_boolean(booleanValue);
+ break;
+ case '[':
+ case 'L':
+ Object objectValue = bridge.getObject(o, fields[i].getFieldID()) ;
+ writeObjectField(fields[i], objectValue);
+ break;
+ default:
+ throw new InvalidClassException(cl.getName());
+ }
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java
new file mode 100644
index 0000000..f4198e3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/InputStreamHook.java
@@ -0,0 +1,469 @@
+/*
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.io;
+
+import java.io.IOException;
+import java.io.StreamCorruptedException;
+import java.io.NotActiveException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.util.*;
+import java.lang.reflect.Array;
+import java.lang.reflect.Constructor;
+
+import org.omg.CORBA.portable.ValueInputStream;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersion;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.impl.logging.UtilSystemException;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+
+public abstract class InputStreamHook extends ObjectInputStream
+{
+ // These should be visible in all the nested classes
+ static final OMGSystemException omgWrapper =
+ OMGSystemException.get( CORBALogDomains.RPC_ENCODING ) ;
+
+ static final UtilSystemException utilWrapper =
+ UtilSystemException.get( CORBALogDomains.RPC_ENCODING ) ;
+
+ private class HookGetFields extends ObjectInputStream.GetField {
+ private Map fields = null;
+
+ 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.
+ */
+ public java.io.ObjectStreamClass getObjectStreamClass() {
+ return null;
+ }
+
+ /**
+ * Return true if the named field is defaulted and has no value
+ * in this stream.
+ */
+ 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 {
+ 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 {
+ if (defaulted(name))
+ return defvalue;
+ else return ((Character)fields.get(name)).charValue();
+
+ }
+
+ /**
+ * Get the value of the named byte field from the persistent fields.
+ */
+ public byte get(String name, byte defvalue)
+ throws IOException, IllegalArgumentException {
+ if (defaulted(name))
+ return defvalue;
+ else return ((Byte)fields.get(name)).byteValue();
+
+ }
+
+ /**
+ * Get the value of the named short field from the persistent fields.
+ */
+ public short get(String name, short defvalue)
+ throws IOException, IllegalArgumentException {
+ if (defaulted(name))
+ return defvalue;
+ else return ((Short)fields.get(name)).shortValue();
+
+ }
+
+ /**
+ * Get the value of the named int field from the persistent fields.
+ */
+ 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 {
+ 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 {
+ 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 {
+ 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 {
+ if (defaulted(name))
+ return defvalue;
+ else return fields.get(name);
+
+ }
+
+ public String toString(){
+ return fields.toString();
+ }
+ }
+
+ public InputStreamHook()
+ throws IOException {
+ super();
+ }
+
+ public void defaultReadObject()
+ throws IOException, ClassNotFoundException, NotActiveException
+ {
+ readObjectState.beginDefaultReadObject(this);
+
+ defaultReadObjectDelegate();
+
+ readObjectState.endDefaultReadObject(this);
+ }
+
+ abstract void defaultReadObjectDelegate();
+
+ 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
+ public ObjectInputStream.GetField readFields()
+ throws IOException, ClassNotFoundException, NotActiveException {
+
+ HashMap 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
+ // writeObject user may do one of the following
+ // 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);
+
+ readFields(fieldValueMap);
+
+ readObjectState.endDefaultReadObject(this);
+
+ return new HookGetFields(fieldValueMap);
+ }
+
+ // 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.
+ //
+ // On the reader's side, the main factors are whether or not
+ // we have a readObject method and whether or not the
+ // sender wrote default data
+
+ protected void setState(ReadObjectState newState) {
+ readObjectState = newState;
+ }
+
+ protected abstract byte getStreamFormatVersion();
+ abstract org.omg.CORBA_2_3.portable.InputStream getOrbStream();
+
+ // Description of possible actions
+ protected static class ReadObjectState {
+ public void beginUnmarshalCustomValue(InputStreamHook stream,
+ boolean calledDefaultWriteObject,
+ boolean hasReadObject) throws IOException {}
+
+ public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException {}
+ public void beginDefaultReadObject(InputStreamHook stream) throws IOException {}
+ public void endDefaultReadObject(InputStreamHook stream) throws IOException {}
+ public void readData(InputStreamHook stream) throws IOException {}
+ }
+
+ 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 class DefaultState extends ReadObjectState {
+
+ public void beginUnmarshalCustomValue(InputStreamHook stream,
+ boolean calledDefaultWriteObject,
+ boolean hasReadObject)
+ throws IOException {
+
+ if (hasReadObject) {
+ if (calledDefaultWriteObject)
+ stream.setState(IN_READ_OBJECT_DEFAULTS_SENT);
+ else {
+ try {
+ if (stream.getStreamFormatVersion() == 2)
+ ((ValueInputStream)stream.getOrbStream()).start_value();
+ } 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
+ // while reading the optional data.
+
+ }
+ stream.setState(IN_READ_OBJECT_OPT_DATA);
+ }
+ } else {
+ if (calledDefaultWriteObject)
+ stream.setState(NO_READ_OBJECT_DEFAULTS_SENT);
+ else
+ // XXX I18N and logging needed.
+ throw new StreamCorruptedException("No default data sent");
+ }
+ }
+ }
+
+ // 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 {
+
+ public void beginUnmarshalCustomValue(InputStreamHook stream,
+ boolean calledDefaultWriteObject,
+ boolean hasReadObject)
+ {
+ throw utilWrapper.badBeginUnmarshalCustomValue() ;
+ }
+
+ public void endDefaultReadObject(InputStreamHook stream) {
+ stream.setState(IN_READ_OBJECT_PAST_DEFAULTS_REMOTE_NOT_CUSTOM);
+ }
+
+ public void readData(InputStreamHook stream) {
+ stream.throwOptionalDataIncompatibleException();
+ }
+ }
+
+ protected static class InReadObjectPastDefaultsRemoteDidNotUseWOState extends ReadObjectState {
+
+ public void beginUnmarshalCustomValue(InputStreamHook stream,
+ boolean calledDefaultWriteObject,
+ boolean hasReadObject)
+ {
+ throw utilWrapper.badBeginUnmarshalCustomValue() ;
+ }
+
+ public void beginDefaultReadObject(InputStreamHook stream) throws IOException
+ {
+ // XXX I18N and logging needed.
+ throw new StreamCorruptedException("Default data already read");
+ }
+
+
+ public void readData(InputStreamHook stream) {
+ stream.throwOptionalDataIncompatibleException();
+ }
+ }
+
+ protected void throwOptionalDataIncompatibleException()
+ {
+ throw omgWrapper.rmiiiopOptionalDataIncompatible2() ;
+ }
+
+
+ protected static class InReadObjectDefaultsSentState extends ReadObjectState {
+
+ public void beginUnmarshalCustomValue(InputStreamHook stream,
+ boolean calledDefaultWriteObject,
+ boolean hasReadObject) {
+ // This should never happen.
+ throw utilWrapper.badBeginUnmarshalCustomValue() ;
+ }
+
+ public void endUnmarshalCustomValue(InputStreamHook stream) {
+
+ // In stream format version 2, we can skip over
+ // 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();
+ }
+
+ stream.setState(DEFAULT_STATE);
+ }
+
+ public void endDefaultReadObject(InputStreamHook stream) throws IOException {
+
+ // Read the fake valuetype header in stream format version 2
+ if (stream.getStreamFormatVersion() == 2)
+ ((ValueInputStream)stream.getOrbStream()).start_value();
+
+ stream.setState(IN_READ_OBJECT_OPT_DATA);
+ }
+
+ public void readData(InputStreamHook stream) throws IOException {
+ org.omg.CORBA.ORB orb = stream.getOrbStream().orb();
+ if ((orb == null) ||
+ !(orb instanceof com.sun.corba.se.spi.orb.ORB)) {
+ throw new StreamCorruptedException(
+ "Default data must be read first");
+ }
+ ORBVersion clientOrbVersion =
+ ((com.sun.corba.se.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
+ // StreamCorruptedException for older versions of the ORB where
+ // calledDefaultWriteObject always returns true.
+ if ((ORBVersionFactory.getPEORB().compareTo(clientOrbVersion) <= 0) ||
+ (clientOrbVersion.equals(ORBVersionFactory.getFOREIGN()))) {
+ // XXX I18N and logging needed.
+ throw new StreamCorruptedException("Default data must be read first");
+ }
+ }
+ }
+
+ protected static class InReadObjectOptionalDataState extends ReadObjectState {
+
+ public void beginUnmarshalCustomValue(InputStreamHook stream,
+ boolean calledDefaultWriteObject,
+ boolean hasReadObject)
+ {
+ // This should never happen.
+ throw utilWrapper.badBeginUnmarshalCustomValue() ;
+ }
+
+ public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException
+ {
+ if (stream.getStreamFormatVersion() == 2) {
+ ((ValueInputStream)stream.getOrbStream()).end_value();
+ }
+ stream.setState(DEFAULT_STATE);
+ }
+
+ public void beginDefaultReadObject(InputStreamHook stream) throws IOException
+ {
+ // XXX I18N and logging needed.
+ throw new StreamCorruptedException("Default data not sent or already read/passed");
+ }
+
+
+ }
+
+ protected static class InReadObjectNoMoreOptionalDataState
+ extends InReadObjectOptionalDataState {
+
+ public void readData(InputStreamHook stream) throws IOException {
+ stream.throwOptionalDataIncompatibleException();
+ }
+ }
+
+ protected static class NoReadObjectDefaultsSentState extends ReadObjectState {
+ public void endUnmarshalCustomValue(InputStreamHook stream) throws IOException {
+ // Code should read default fields before calling this
+
+ if (stream.getStreamFormatVersion() == 2) {
+ ((ValueInputStream)stream.getOrbStream()).start_value();
+ ((ValueInputStream)stream.getOrbStream()).end_value();
+ }
+
+ stream.setState(DEFAULT_STATE);
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
new file mode 100644
index 0000000..b875d25
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClass.java
@@ -0,0 +1,1726 @@
+/*
+ * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 2012 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.io;
+
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.lang.invoke.MethodHandle;
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.DigestOutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.InvocationTargetException;
+
+import java.io.IOException;
+import java.io.DataOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InvalidClassException;
+import java.io.Externalizable;
+import java.io.Serializable;
+
+import java.util.Arrays;
+import java.util.Comparator;
+
+import com.sun.corba.se.impl.util.RepositoryId;
+
+import org.omg.CORBA.ValueMember;
+
+import sun.corba.Bridge;
+
+/**
+ * An 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.
+ * <br>
+ * The ObjectStreamClass for a specific class loaded in this Java VM can
+ * be found using the lookup method.
+ *
+ * @author Roger Riggs
+ * @since JDK1.1
+ */
+public class ObjectStreamClass implements java.io.Serializable {
+ private static final boolean DEBUG_SVUID = false ;
+
+ public static final long kDefaultUID = -1;
+
+ /** true if represents enum type */
+ private boolean isEnum;
+
+ private static final Bridge bridge =
+ AccessController.doPrivileged(
+ new PrivilegedAction<Bridge>() {
+ 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
+ * java.io.Serializable or java.io.Externalizable.
+ */
+ static final ObjectStreamClass lookup(Class<?> cl)
+ {
+ ObjectStreamClass desc = lookupInternal(cl);
+ if (desc.isSerializable() || desc.isExternalizable())
+ return desc;
+ return null;
+ }
+
+ /*
+ * 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.
+ */
+ ObjectStreamClass desc = null;
+ synchronized (descriptorFor) {
+ /* Find the matching descriptor if it already known */
+ desc = findDescriptorFor(cl);
+ if (desc == null) {
+ /* Check if it's serializable */
+ boolean serializable = Serializable.class.isAssignableFrom(cl);
+
+ /* If the class is only Serializable,
+ * lookup the descriptor for the superclass.
+ */
+ ObjectStreamClass superdesc = null;
+ if (serializable) {
+ Class<?> superclass = cl.getSuperclass();
+ if (superclass != null)
+ 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.
+ */
+ boolean externalizable = false;
+ if (serializable) {
+ externalizable =
+ ((superdesc != null) && superdesc.isExternalizable()) ||
+ Externalizable.class.isAssignableFrom(cl);
+ if (externalizable) {
+ serializable = false;
+ }
+ }
+
+ /* Create a new version descriptor,
+ * it put itself in the known table.
+ */
+ desc = new ObjectStreamClass(cl, superdesc,
+ serializable, externalizable);
+ }
+ // 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
+ // unintialized instances.
+ //
+ // History: Note, the following init() call was originally within
+ // the synchronization block, as it currently is now. Later, the
+ // init() call was moved outside the synchronization block, and
+ // the init() method used a private member variable lock, to
+ // avoid performance problems. See bug 4165204. But that lead to
+ // a deadlock situation, see bug 5104239. Hence, the init() method
+ // has now been moved back into the synchronization block. The
+ // right approach to solving these problems would be to rewrite
+ // this class, based on the latest java.io.ObjectStreamClass.
+ desc.init();
+ }
+ return desc;
+ }
+
+ /**
+ * The name of the class described by this descriptor.
+ */
+ public final String getName() {
+ return name;
+ }
+
+ /**
+ * 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.
+ */
+ public static final long getSerialVersionUID( java.lang.Class<?> clazz) {
+ ObjectStreamClass theosc = ObjectStreamClass.lookup( clazz );
+ if( theosc != null )
+ {
+ 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.
+ */
+ public final long getSerialVersionUID() {
+ return suid;
+ }
+
+ /**
+ * 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.
+ */
+ public final String getSerialVersionUIDStr() {
+ if (suidStr == null)
+ suidStr = Long.toHexString(suid).toUpperCase();
+ return suidStr;
+ }
+
+ /**
+ * Return the actual (computed) serialVersionUID for this class.
+ */
+ 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.
+ */
+ public final long getActualSerialVersionUID() {
+ return actualSuid;
+ }
+
+ /**
+ * Return the actual (computed) serialVersionUID for this class.
+ */
+ public final String getActualSerialVersionUIDStr() {
+ if (actualSuidStr == null)
+ actualSuidStr = Long.toHexString(actualSuid).toUpperCase();
+ return actualSuidStr;
+ }
+
+ /**
+ * Return the class in the local VM that this version is mapped to.
+ * Null is returned if there is no corresponding local class.
+ */
+ public final Class<?> forClass() {
+ return ofClass;
+ }
+
+ /**
+ * 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
+ * there are no fields.
+ * @since JDK1.2
+ */
+ public ObjectStreamField[] getFields() {
+ // Return a copy so the caller can't change the fields.
+ if (fields.length > 0) {
+ ObjectStreamField[] dup = new ObjectStreamField[fields.length];
+ System.arraycopy(fields, 0, dup, 0, fields.length);
+ return dup;
+ } else {
+ return fields;
+ }
+ }
+
+ 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)))
+ return true;
+ }
+ }
+ } catch (Exception exc) {
+ // Ignore this; all we want to do is return false
+ // Note that ValueUtility.getSignature can throw checked exceptions.
+ }
+
+ return false;
+ }
+
+ /* Avoid unnecessary allocations. */
+ final ObjectStreamField[] getFieldsNoCopy() {
+ return fields;
+ }
+
+ /**
+ * Get the field of this class by name.
+ * @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.
+ */
+ for (int i = fields.length-1; i >= 0; i--) {
+ if (name.equals(fields[i].getName())) {
+ return fields[i];
+ }
+ }
+ return null;
+ }
+
+ public final boolean invokeWriteObject(Object obj, ObjectOutputStream ois) throws InvocationTargetException {
+ if (!hasWriteObject()) {
+ return false;
+ }
+ try {
+ writeObjectMethod.invoke(obj, ois);
+ } catch (Throwable t) {
+ throw new InvocationTargetException(t, "writeObject");
+ }
+ return true;
+ }
+
+ public final boolean invokeReadObject(Object obj, ObjectInputStream ois) throws InvocationTargetException {
+ if (hasReadObject()) {
+ try {
+ readObjectMethod.invoke(obj, ois);
+ return true;
+ } catch (Throwable t) {
+ throw new InvocationTargetException(t, "readObject");
+ }
+ } else {
+ return false;
+ }
+ }
+
+ public Serializable writeReplace(Serializable value) {
+ if (writeReplaceObjectMethod != null) {
+ try {
+ return (Serializable) writeReplaceObjectMethod.invoke(value);
+ } catch (Throwable t) {
+ throw new InternalError("unexpected error", t);
+ }
+ }
+ else return value;
+ }
+
+ public Object readResolve(Object value) {
+ if (readResolveObjectMethod != null) {
+ try {
+ return readResolveObjectMethod.invoke(value);
+ } catch (Throwable t) {
+ throw new InternalError("unexpected error", t);
+ }
+ }
+ else return value;
+ }
+
+ /**
+ * Return a string describing this ObjectStreamClass.
+ */
+ public final String toString() {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append(name);
+ sb.append(": static final long serialVersionUID = ");
+ sb.append(Long.toString(suid));
+ sb.append("L;");
+ return sb.toString();
+ }
+
+ /*
+ * 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 */
+
+ if (Proxy.isProxyClass(cl)) {
+ forProxyClass = true;
+ }
+
+ name = cl.getName();
+ isEnum = Enum.class.isAssignableFrom(cl);
+ superclass = superdesc;
+ serializable = serial;
+ if (!forProxyClass) {
+ // proxy classes are never externalizable
+ externalizable = extern;
+ }
+
+ /*
+ * 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.
+ */
+ insertDescriptorFor(this);
+
+ /*
+ * The remainder of initialization occurs in init(), which is called
+ * after the lock on the global class descriptor table has been
+ * released.
+ */
+ }
+
+ static final class PersistentFieldsValue
+ extends ClassValue<ObjectStreamField[]> {
+ PersistentFieldsValue() { }
+
+ protected ObjectStreamField[] computeValue(Class<?> type) {
+ try {
+ bridge.ensureClassInitialized(type);
+ Field pf = type.getDeclaredField("serialPersistentFields");
+ int mods = pf.getModifiers();
+ if (Modifier.isPrivate(mods) && Modifier.isStatic(mods) &&
+ Modifier.isFinal(mods)) {
+ long offset = bridge.staticFieldOffset(pf);
+ java.io.ObjectStreamField[] fields =
+ (java.io.ObjectStreamField[])bridge.getObject(type, offset);
+ return translateFields(fields);
+ }
+ } catch (NoSuchFieldException |
+ IllegalArgumentException | ClassCastException e) {
+ }
+ return null;
+ }
+
+ private static ObjectStreamField[] translateFields(java.io.ObjectStreamField[] fields) {
+ if (fields == null) {
+ return null;
+ }
+ ObjectStreamField[] translation =
+ new ObjectStreamField[fields.length];
+ for (int i = 0; i < fields.length; i++) {
+ translation[i] = new ObjectStreamField(fields[i].getName(),
+ fields[i].getType());
+ }
+ return translation;
+ }
+ }
+
+ 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 is 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).
+ */
+
+
+ private void init() {
+ synchronized (lock) {
+
+ // See description at definition of initialized.
+ if (initialized)
+ return;
+
+ final Class<?> cl = ofClass;
+
+ if (!serializable ||
+ externalizable ||
+ forProxyClass ||
+ name.equals("java.lang.String")){
+ fields = NO_FIELDS;
+ } else if (serializable) {
+ /* 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.
+ */
+ fields = persistentFieldsValue.get(cl);
+
+ if (fields == null) {
+ /* Get all of the declared fields for this Class.
+ * 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];
+ for (int i = 0; i < actualfields.length; i++) {
+ Field fld = actualfields[i] ;
+ int modifiers = fld.getModifiers();
+ if (!Modifier.isStatic(modifiers) &&
+ !Modifier.isTransient(modifiers)) {
+ tempFields[numFields++] = new ObjectStreamField(fld);
+ }
+ }
+
+ fields = new ObjectStreamField[numFields];
+ System.arraycopy(tempFields, 0, fields, 0, numFields);
+
+ } else {
+ // 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--) {
+ try {
+ Field reflField = cl.getDeclaredField(fields[j].getName());
+ if (fields[j].getType() == reflField.getType()) {
+ fields[j].setField(reflField);
+ }
+ } catch (NoSuchFieldException e) {
+ // Nothing to do
+ }
+ }
+ }
+ return null;
+ }
+ });
+
+ if (fields.length > 1)
+ Arrays.sort(fields);
+
+ /* Set up field data for use while writing using the API api. */
+ computeFieldInfo();
+ }
+
+ /* 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.
+ */
+ 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
+ suid = 0L;
+ } else {
+ 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) ) {
+ long offset = bridge.staticFieldOffset(f);
+ suid = bridge.getLong(cl, offset);
+ // SerialBug 2: should be computed after writeObject
+ // actualSuid = computeStructuralUID(cl);
+ } else {
+ suid = _computeSerialVersionUID(cl);
+ // SerialBug 2: should be computed after writeObject
+ // actualSuid = computeStructuralUID(cl);
+ }
+ } catch (NoSuchFieldException ex) {
+ suid = _computeSerialVersionUID(cl);
+ // SerialBug 2: should be computed after writeObject
+ // actualSuid = computeStructuralUID(cl);
+ }
+ }
+
+ writeReplaceObjectMethod = bridge.writeReplaceForSerialization(cl);
+
+ readResolveObjectMethod = bridge.readResolveForSerialization(cl);
+
+ if (externalizable)
+ cons = getExternalizableConstructor(cl) ;
+ else
+ cons = getSerializableConstructor(cl) ;
+
+ if (serializable && !forProxyClass) {
+ writeObjectMethod = bridge.writeObjectForSerialization(cl) ;
+ readObjectMethod = bridge.readObjectForSerialization(cl);
+ }
+ return null;
+ }
+ });
+ }
+
+ // This call depends on a lot of information computed above!
+ actualSuid = ObjectStreamClass.computeStructuralUID(this, cl);
+
+ // If we have a write object method, precompute the
+ // RMI-IIOP stream format version 2 optional data
+ // repository ID.
+ if (hasWriteObject())
+ rmiiiopOptionalDataRepId = computeRMIIIOPOptionalDataRepId();
+
+ // This must be done last.
+ initialized = true;
+ }
+ }
+
+ // Specific to RMI-IIOP
+ /**
+ * 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."
+ */
+ private String computeRMIIIOPOptionalDataRepId() {
+
+ StringBuffer sbuf = new StringBuffer("RMI:org.omg.custom.");
+ sbuf.append(RepositoryId.convertToISOLatin1(this.getName()));
+ sbuf.append(':');
+ sbuf.append(this.getActualSerialVersionUIDStr());
+ sbuf.append(':');
+ sbuf.append(this.getSerialVersionUIDStr());
+
+ return sbuf.toString();
+ }
+
+ /**
+ * This will return null if there is no writeObject method.
+ */
+ public final String getRMIIIOPOptionalDataRepId() {
+ return rmiiiopOptionalDataRepId;
+ }
+
+ /*
+ * 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;
+ suid = s;
+ superclass = null;
+ }
+
+
+ /*
+ * Set the class this version descriptor matches.
+ * The base class name and serializable hash must match.
+ * Fill in the reflected Fields that will be used
+ * for reading.
+ */
+ final void setClass(Class<?> cl) throws InvalidClassException {
+
+ if (cl == null) {
+ localClassDesc = null;
+ ofClass = null;
+ computeFieldInfo();
+ return;
+ }
+
+ localClassDesc = lookupInternal(cl);
+ if (localClassDesc == null)
+ // XXX I18N, logging needed
+ throw new InvalidClassException(cl.getName(),
+ "Local class not compatible");
+ if (suid != localClassDesc.suid) {
+
+ /* Check for exceptional cases that allow mismatched suid. */
+
+ /* Allow adding Serializable or Externalizable
+ * to a later release of the class.
+ */
+ boolean addedSerialOrExtern =
+ isNonSerializable() || localClassDesc.isNonSerializable();
+
+ /* Disregard the serialVersionUID of an array
+ * when name and cl.Name differ. If resolveClass() returns
+ * an array with a different package name,
+ * the serialVersionUIDs will not match since the fully
+ * qualified array class is used in the
+ * computation of the array's serialVersionUID. There is
+ * no way to set a permanent serialVersionUID for an array type.
+ */
+
+ boolean arraySUID = (cl.isArray() && ! cl.getName().equals(name));
+
+ if (! arraySUID && ! addedSerialOrExtern ) {
+ // XXX I18N, logging needed
+ throw new InvalidClassException(cl.getName(),
+ "Local class not compatible:" +
+ " stream classdesc serialVersionUID=" + suid +
+ " local class serialVersionUID=" + localClassDesc.suid);
+ }
+ }
+
+ /* compare the class names, stripping off package names. */
+ if (! compareClassNames(name, cl.getName(), '.'))
+ // XXX I18N, logging needed
+ throw new InvalidClassException(cl.getName(),
+ "Incompatible local class name. " +
+ "Expected class name compatible with " +
+ name);
+
+ /*
+ * Test that both implement either serializable or externalizable.
+ */
+
+ // The next check is more generic, since it covers the
+ // Proxy case, the JDK 1.3 serialization code has
+ // both checks
+ //if ((serializable && localClassDesc.externalizable) ||
+ // (externalizable && localClassDesc.serializable))
+ // throw new InvalidClassException(localCl.getName(),
+ // "Serializable is incompatible with Externalizable");
+
+ if ((serializable != localClassDesc.serializable) ||
+ (externalizable != localClassDesc.externalizable) ||
+ (!serializable && !externalizable))
+
+ // XXX I18N, logging needed
+ throw new InvalidClassException(cl.getName(),
+ "Serialization incompatible with Externalization");
+
+ /* Set up the reflected Fields in the class where the value of each
+ * field in this descriptor should be stored.
+ * Each field in this ObjectStreamClass (the source) is located (by
+ * name) in the ObjectStreamClass of the class(the destination).
+ * In the usual (non-versioned case) the field is in both
+ * descriptors and the types match, so the reflected Field is copied.
+ * If the type does not match, a InvalidClass exception is thrown.
+ * If the field is not present in the class, the reflected Field
+ * remains null so the field will be read but discarded.
+ * If extra fields are present in the class they are ignored. Their
+ * values will be set to the default value by the object allocator.
+ * Both the src and dest field list are sorted by type and name.
+ */
+
+ ObjectStreamField[] destfield =
+ (ObjectStreamField[])localClassDesc.fields;
+ ObjectStreamField[] srcfield =
+ (ObjectStreamField[])fields;
+
+ int j = 0;
+ nextsrc:
+ for (int i = 0; i < srcfield.length; i++ ) {
+ /* Find this field in the dest*/
+ for (int k = j; k < destfield.length; k++) {
+ if (srcfield[i].getName().equals(destfield[k].getName())) {
+ /* found match */
+ if (srcfield[i].isPrimitive() &&
+ !srcfield[i].typeEquals(destfield[k])) {
+ // XXX I18N, logging needed
+ throw new InvalidClassException(cl.getName(),
+ "The type of field " +
+ srcfield[i].getName() +
+ " of class " + name +
+ " is incompatible.");
+ }
+
+ /* Skip over any fields in the dest that are not in the src */
+ j = k;
+
+ srcfield[i].setField(destfield[j].getField());
+ // go on to the next source field
+ continue nextsrc;
+ }
+ }
+ }
+
+ /* Set up field data for use while reading from the input stream. */
+ computeFieldInfo();
+
+ /* Remember the class this represents */
+ ofClass = cl;
+
+ /* get the cache of these methods from the local class
+ * implementation.
+ */
+ readObjectMethod = localClassDesc.readObjectMethod;
+ readResolveObjectMethod = localClassDesc.readResolveObjectMethod;
+ }
+
+ /* Compare the base class names of streamName and localName.
+ *
+ * @return Return true iff the base class name compare.
+ * @param streamName Fully qualified class name.
+ * @param localName Fully qualified class name.
+ * @param pkgSeparator class names use either '.' or '/'.
+ *
+ * Only compare base class name to allow package renaming.
+ */
+ 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)
+ streamNameIndex = 0;
+
+ int localNameIndex = localName.lastIndexOf(pkgSeparator);
+ if (localNameIndex < 0)
+ localNameIndex = 0;
+
+ 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
+ */
+ final boolean typeEquals(ObjectStreamClass other) {
+ return (suid == other.suid) &&
+ compareClassNames(name, other.name, '.');
+ }
+
+ /*
+ * Return the superclass descriptor of this descriptor.
+ */
+ final void setSuperclass(ObjectStreamClass s) {
+ superclass = s;
+ }
+
+ /*
+ * Return the superclass descriptor of this descriptor.
+ */
+ final ObjectStreamClass getSuperclass() {
+ return superclass;
+ }
+
+ /**
+ * Return whether the class has a readObject method
+ */
+ final boolean hasReadObject() {
+ return readObjectMethod != null;
+ }
+
+ /*
+ * Return whether the class has a writeObject method
+ */
+ final boolean hasWriteObject() {
+ return writeObjectMethod != null ;
+ }
+
+ /**
+ * Returns true if represented class is serializable or externalizable and
+ * defines a conformant writeReplace method. Otherwise, returns false.
+ */
+ boolean hasWriteReplaceMethod() {
+ return (writeReplaceObjectMethod != null);
+ }
+
+ /**
+ * Returns true if represented class is serializable or externalizable and
+ * defines a conformant readResolve method. Otherwise, returns false.
+ */
+ boolean hasReadResolveMethod() {
+ return (readResolveObjectMethod != 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,
+ */
+ final boolean 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. <p>
+ *
+ * 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.
+ *
+ * @see ObjectOutputStream#useProtocolVersion
+ * @see ObjectStreamConstants#PROTOCOL_VERSION_1
+ * @see ObjectStreamConstants#PROTOCOL_VERSION_2
+ *
+ * @since JDK 1.2
+ */
+ boolean hasExternalizableBlockDataMode() {
+ return hasExternalizableBlockData;
+ }
+
+ /**
+ * 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
+ {
+ if (cons != null) {
+ try {
+ return cons.newInstance();
+ } catch (IllegalAccessException ex) {
+ // should not occur, as access checks have been suppressed
+ InternalError ie = new InternalError();
+ ie.initCause( ex ) ;
+ throw ie ;
+ }
+ } else {
+ throw new UnsupportedOperationException("no constructor for " + ofClass);
+ }
+ }
+
+ /**
+ * 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 static Constructor<?> getExternalizableConstructor(Class<?> cl) {
+ return bridge.newConstructorForExternalization(cl);
+ }
+
+ /**
+ * 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 static Constructor<?> getSerializableConstructor(Class<?> cl) {
+ return bridge.newConstructorForSerialization(cl);
+ }
+
+ /*
+ * Return the ObjectStreamClass of the local class this one is based on.
+ */
+ final ObjectStreamClass localClassDescriptor() {
+ return localClassDesc;
+ }
+
+ /*
+ * Get the Serializability of the class.
+ */
+ boolean isSerializable() {
+ return serializable;
+ }
+
+ /*
+ * Get the externalizability of the class.
+ */
+ boolean isExternalizable() {
+ return externalizable;
+ }
+
+ boolean isNonSerializable() {
+ 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.
+ */
+ private void computeFieldInfo() {
+ primBytes = 0;
+ objFields = 0;
+
+ for (int i = 0; i < fields.length; i++ ) {
+ switch (fields[i].getTypeCode()) {
+ case 'B':
+ case 'Z':
+ primBytes += 1;
+ break;
+ case 'C':
+ case 'S':
+ primBytes += 2;
+ break;
+
+ case 'I':
+ case 'F':
+ primBytes += 4;
+ break;
+ case 'J':
+ case 'D' :
+ primBytes += 8;
+ break;
+
+ case 'L':
+ case '[':
+ objFields += 1;
+ break;
+ }
+ }
+ }
+
+ 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).
+ */
+
+ 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.
+ */
+ private static long _computeSerialVersionUID(Class<?> cl) {
+ if (DEBUG_SVUID)
+ msg( "Computing SerialVersionUID for " + cl ) ;
+ ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
+
+ long h = 0;
+ try {
+ MessageDigest md = MessageDigest.getInstance("SHA");
+ DigestOutputStream mdo = new DigestOutputStream(devnull, md);
+ DataOutputStream data = new DataOutputStream(mdo);
+
+ if (DEBUG_SVUID)
+ 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.
+ * Previously this hack was previously present in the VM.
+ */
+ Method[] method = cl.getDeclaredMethods();
+ if ((classaccess & Modifier.INTERFACE) != 0) {
+ classaccess &= (~Modifier.ABSTRACT);
+ if (method.length > 0) {
+ classaccess |= Modifier.ABSTRACT;
+ }
+ }
+
+ // Mask out any post-1.4 attributes
+ classaccess &= CLASS_MASK ;
+
+ if (DEBUG_SVUID)
+ 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
+ */
+ if (!cl.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.
+ */
+
+ Class<?> interfaces[] = cl.getInterfaces();
+ Arrays.sort(interfaces, compareClassByName);
+
+ for (int i = 0; i < interfaces.length; i++) {
+ if (DEBUG_SVUID)
+ msg( "\twriteUTF( \"" + interfaces[i].getName() + "\" ) " ) ;
+ data.writeUTF(interfaces[i].getName());
+ }
+ }
+
+ /* Sort the field names to get a deterministic order */
+ Field[] field = cl.getDeclaredFields();
+ Arrays.sort(field, compareMemberByName);
+
+ 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.
+ */
+ int m = f.getModifiers();
+ if (Modifier.isPrivate(m) &&
+ (Modifier.isTransient(m) || Modifier.isStatic(m)))
+ continue;
+
+ if (DEBUG_SVUID)
+ msg( "\twriteUTF( \"" + f.getName() + "\" ) " ) ;
+ data.writeUTF(f.getName());
+
+ // Mask out any post-1.4 bits
+ m &= FIELD_MASK ;
+
+ if (DEBUG_SVUID)
+ msg( "\twriteInt( " + m + " ) " ) ;
+ data.writeInt(m);
+
+ if (DEBUG_SVUID)
+ msg( "\twriteUTF( \"" + getSignature(f.getType()) + "\" ) " ) ;
+ data.writeUTF(getSignature(f.getType()));
+ }
+
+ if (hasStaticInitializer(cl)) {
+ if (DEBUG_SVUID)
+ msg( "\twriteUTF( \"<clinit>\" ) " ) ;
+ data.writeUTF("<clinit>");
+
+ if (DEBUG_SVUID)
+ msg( "\twriteInt( " + Modifier.STATIC + " )" ) ;
+ data.writeInt(Modifier.STATIC); // TBD: what modifiers does it have
+
+ if (DEBUG_SVUID)
+ 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
+ */
+
+ MethodSignature[] constructors =
+ MethodSignature.removePrivateAndSort(cl.getDeclaredConstructors());
+ for (int i = 0; i < constructors.length; i++) {
+ MethodSignature c = constructors[i];
+ String mname = "<init>";
+ String desc = c.signature;
+ desc = desc.replace('/', '.');
+ if (DEBUG_SVUID)
+ msg( "\twriteUTF( \"" + mname + "\" )" ) ;
+ data.writeUTF(mname);
+
+ // mask out post-1.4 modifiers
+ int modifier = c.member.getModifiers() & METHOD_MASK ;
+
+ if (DEBUG_SVUID)
+ msg( "\twriteInt( " + modifier + " ) " ) ;
+ data.writeInt( modifier ) ;
+
+ if (DEBUG_SVUID)
+ msg( "\twriteUTF( \"" + desc+ "\" )" ) ;
+ data.writeUTF(desc);
+ }
+
+ /* 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 m = methods[i];
+ String desc = m.signature;
+ desc = desc.replace('/', '.');
+
+ if (DEBUG_SVUID)
+ msg( "\twriteUTF( \"" + m.member.getName()+ "\" )" ) ;
+ data.writeUTF(m.member.getName());
+
+ // mask out post-1.4 modifiers
+ int modifier = m.member.getModifiers() & METHOD_MASK ;
+
+ if (DEBUG_SVUID)
+ msg( "\twriteInt( " + modifier + " ) " ) ;
+ data.writeInt( modifier ) ;
+
+ if (DEBUG_SVUID)
+ msg( "\twriteUTF( \"" + desc + "\" )" ) ;
+ data.writeUTF(desc);
+ }
+
+ /* 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);
+ }
+ } catch (IOException ignore) {
+ /* can't happen, but be deterministic anyway. */
+ h = -1;
+ } catch (NoSuchAlgorithmException complain) {
+ SecurityException se = new SecurityException() ;
+ se.initCause( complain ) ;
+ throw se ;
+ }
+
+ return h;
+ }
+
+ private static long computeStructuralUID(com.sun.corba.se.impl.io.ObjectStreamClass osc, Class<?> cl) {
+ ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
+
+ long h = 0;
+ try {
+
+ if ((!java.io.Serializable.class.isAssignableFrom(cl)) ||
+ (cl.isInterface())){
+ return 0;
+ }
+
+ if (java.io.Externalizable.class.isAssignableFrom(cl)) {
+ return 1;
+ }
+
+ MessageDigest md = MessageDigest.getInstance("SHA");
+ DigestOutputStream mdo = new DigestOutputStream(devnull, md);
+ DataOutputStream data = new DataOutputStream(mdo);
+
+ // Get SUID of parent
+ Class<?> parent = cl.getSuperclass();
+ if ((parent != null))
+ // SerialBug 1; acc. to spec the one for
+ // java.lang.object
+ // should be computed and put
+ // && (parent != java.lang.Object.class))
+ {
+ //data.writeLong(computeSerialVersionUID(null,parent));
+ data.writeLong(computeStructuralUID(lookup(parent), parent));
+ }
+
+ if (osc.hasWriteObject())
+ data.writeInt(2);
+ else
+ data.writeInt(1);
+
+ // 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();
+ if (field.length > 1) {
+ Arrays.sort(field, compareObjStrFieldsByName);
+ }
+
+ // ...Java field name in UTF encoding, field
+ // descriptor, as defined by the JVM spec...
+ for (int i = 0; i < field.length; i++) {
+ 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.
+ */
+ 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 = 0; i < Math.min(8, hasharray.length); i++) {
+ 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 ;
+ }
+ return h;
+ }
+
+ /**
+ * Compute the JVM signature for the class.
+ */
+ static String getSignature(Class<?> clazz) {
+ String type = null;
+ if (clazz.isArray()) {
+ Class<?> cl = clazz;
+ int dimensions = 0;
+ while (cl.isArray()) {
+ dimensions++;
+ cl = cl.getComponentType();
+ }
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < dimensions; i++) {
+ sb.append("[");
+ }
+ sb.append(getSignature(cl));
+ type = sb.toString();
+ } else if (clazz.isPrimitive()) {
+ if (clazz == Integer.TYPE) {
+ type = "I";
+ } else if (clazz == Byte.TYPE) {
+ type = "B";
+ } else if (clazz == Long.TYPE) {
+ type = "J";
+ } else if (clazz == Float.TYPE) {
+ type = "F";
+ } else if (clazz == Double.TYPE) {
+ type = "D";
+ } else if (clazz == Short.TYPE) {
+ type = "S";
+ } else if (clazz == Character.TYPE) {
+ type = "C";
+ } else if (clazz == Boolean.TYPE) {
+ type = "Z";
+ } else if (clazz == Void.TYPE) {
+ type = "V";
+ }
+ } else {
+ type = "L" + clazz.getName().replace('.', '/') + ";";
+ }
+ return type;
+ }
+
+ /*
+ * Compute the JVM method descriptor for the method.
+ */
+ static String getSignature(Method meth) {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("(");
+
+ Class<?>[] params = meth.getParameterTypes(); // avoid clone
+ for (int j = 0; j < params.length; j++) {
+ sb.append(getSignature(params[j]));
+ }
+ sb.append(")");
+ sb.append(getSignature(meth.getReturnType()));
+ return sb.toString();
+ }
+
+ /*
+ * Compute the JVM constructor descriptor for the constructor.
+ */
+ static String getSignature(Constructor cons) {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("(");
+
+ Class<?>[] params = cons.getParameterTypes(); // avoid clone
+ for (int j = 0; j < params.length; j++) {
+ sb.append(getSignature(params[j]));
+ }
+ sb.append(")V");
+ return sb.toString();
+ }
+
+ /*
+ * Cache of Class -> ClassDescriptor Mappings.
+ */
+ static private ObjectStreamClassEntry[] descriptorFor = new ObjectStreamClassEntry[61];
+
+ /*
+ * findDescriptorFor a Class. This looks in the cache for a
+ * mapping from Class -> ObjectStreamClass mappings. The hashCode
+ * of the Class is used for the lookup since the Class is the key.
+ * The entries are extended from java.lang.ref.SoftReference so the
+ * gc will be able to free them if needed.
+ */
+ private static ObjectStreamClass findDescriptorFor(Class<?> cl) {
+
+ int hash = cl.hashCode();
+ int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
+ ObjectStreamClassEntry e;
+ ObjectStreamClassEntry prev;
+
+ /* Free any initial entries whose refs have been cleared */
+ while ((e = descriptorFor[index]) != null && e.get() == null) {
+ descriptorFor[index] = e.next;
+ }
+
+ /* Traverse the chain looking for a descriptor with ofClass == cl.
+ * unlink entries that are unresolved.
+ */
+ prev = e;
+ while (e != null ) {
+ ObjectStreamClass desc = (ObjectStreamClass)(e.get());
+ if (desc == null) {
+ // This entry has been cleared, unlink it
+ prev.next = e.next;
+ } else {
+ if (desc.ofClass == cl)
+ return desc;
+ prev = e;
+ }
+ e = e.next;
+ }
+ return null;
+ }
+
+ /*
+ * insertDescriptorFor a Class -> ObjectStreamClass mapping.
+ */
+ private static void insertDescriptorFor(ObjectStreamClass desc) {
+ // Make sure not already present
+ if (findDescriptorFor(desc.ofClass) != null) {
+ return;
+ }
+
+ int hash = desc.ofClass.hashCode();
+ int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
+ ObjectStreamClassEntry e = new ObjectStreamClassEntry(desc);
+ e.next = descriptorFor[index];
+ descriptorFor[index] = e;
+ }
+
+ private static Field[] getDeclaredFields(final Class<?> clz) {
+ return (Field[]) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return clz.getDeclaredFields();
+ }
+ });
+ }
+
+
+ /*
+ * The name of this descriptor
+ */
+ private String name;
+
+ /*
+ * The descriptor of the supertype.
+ */
+ private ObjectStreamClass superclass;
+
+ /*
+ * Flags for Serializable and Externalizable.
+ */
+ private boolean serializable;
+ private boolean externalizable;
+
+ /*
+ * Array of persistent fields of this class, sorted by
+ * type and name.
+ */
+ private ObjectStreamField[] fields;
+
+ /*
+ * Class that is a descriptor for in this virtual machine.
+ */
+ private Class<?> ofClass;
+
+ /*
+ * True if descriptor for a proxy class.
+ */
+ boolean forProxyClass;
+
+
+ /*
+ * SerialVersionUID for this class.
+ */
+ private long suid = kDefaultUID;
+ private String suidStr = null;
+
+ /*
+ * Actual (computed) SerialVersionUID for this class.
+ */
+ private long actualSuid = kDefaultUID;
+ private String actualSuidStr = null;
+
+ /*
+ * 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.
+ */
+ private boolean initialized = false;
+
+ /* Internal lock object. */
+ private 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.
+ *
+ * @since JDK 1.2
+ */
+ private boolean hasExternalizableBlockData;
+ private transient MethodHandle writeObjectMethod;
+ private transient MethodHandle readObjectMethod;
+ private transient MethodHandle writeReplaceObjectMethod;
+ private transient MethodHandle readResolveObjectMethod;
+ private transient 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.
+ */
+ private String rmiiiopOptionalDataRepId = null;
+
+ /*
+ * ObjectStreamClass that this one was built from.
+ */
+ private ObjectStreamClass localClassDesc;
+
+ /**
+ * Returns true if the given class defines a static initializer method,
+ * false otherwise.
+ */
+ private static boolean hasStaticInitializer(Class<?> cl) {
+ return bridge.hasStaticInitializerForSerialization(cl);
+ }
+
+
+ /** use serialVersionUID from JDK 1.1. for interoperability */
+ private static final long serialVersionUID = -6120832682080437368L;
+
+ /**
+ * 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];
+
+ /*
+ * Entries held in the Cache of known ObjectStreamClass objects.
+ * Entries are chained together with the same hash value (modulo array size).
+ */
+ private static class ObjectStreamClassEntry // extends java.lang.ref.SoftReference
+ {
+ ObjectStreamClassEntry(ObjectStreamClass c) {
+ //super(c);
+ this.c = c;
+ }
+ ObjectStreamClassEntry next;
+
+ public Object get()
+ {
+ return c;
+ }
+ private ObjectStreamClass c;
+ }
+
+ /*
+ * Comparator object for Classes and Interfaces
+ */
+ private static Comparator compareClassByName =
+ new CompareClassByName();
+
+ private static class CompareClassByName implements Comparator {
+ public int compare(Object o1, Object o2) {
+ Class<?> c1 = (Class)o1;
+ Class<?> c2 = (Class)o2;
+ return (c1.getName()).compareTo(c2.getName());
+ }
+ }
+
+ /**
+ * Comparator for ObjectStreamFields by name
+ */
+ private final static Comparator compareObjStrFieldsByName
+ = new CompareObjStrFieldsByName();
+
+ private static class CompareObjStrFieldsByName implements Comparator {
+ public int compare(Object o1, Object o2) {
+ ObjectStreamField osf1 = (ObjectStreamField)o1;
+ ObjectStreamField osf2 = (ObjectStreamField)o2;
+
+ return osf1.getName().compareTo(osf2.getName());
+ }
+ }
+
+ /*
+ * Comparator object for Members, Fields, and Methods
+ */
+ private static Comparator compareMemberByName =
+ new CompareMemberByName();
+
+ private static class CompareMemberByName implements Comparator {
+ public int compare(Object o1, Object o2) {
+ String s1 = ((Member)o1).getName();
+ String s2 = ((Member)o2).getName();
+
+ if (o1 instanceof Method) {
+ s1 += getSignature((Method)o1);
+ s2 += getSignature((Method)o2);
+ } else if (o1 instanceof Constructor) {
+ 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 {
+ Member member;
+ 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.*/
+ static MethodSignature[] removePrivateAndSort(Member[] m) {
+ int numNonPrivate = 0;
+ for (int i = 0; i < m.length; i++) {
+ 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())) {
+ cm[cmi] = new MethodSignature(m[i]);
+ cmi++;
+ }
+ }
+ if (cmi > 0)
+ Arrays.sort(cm, cm[0]);
+ return cm;
+ }
+
+ /* Assumes that o1 and o2 are either both methods
+ or both constructors.*/
+ public int compare(Object o1, Object o2) {
+ /* Arrays.sort calls compare when o1 and o2 are equal.*/
+ if (o1 == o2)
+ return 0;
+
+ MethodSignature c1 = (MethodSignature)o1;
+ MethodSignature c2 = (MethodSignature)o2;
+
+ int result;
+ if (isConstructor()) {
+ result = c1.signature.compareTo(c2.signature);
+ } else { // is a Method.
+ result = c1.member.getName().compareTo(c2.member.getName());
+ if (result == 0)
+ result = c1.signature.compareTo(c2.signature);
+ }
+ return result;
+ }
+
+ final private boolean isConstructor() {
+ return member instanceof Constructor;
+ }
+ private MethodSignature(Member m) {
+ member = m;
+ if (isConstructor()) {
+ signature = ObjectStreamClass.getSignature((Constructor)m);
+ } else {
+ signature = ObjectStreamClass.getSignature((Method)m);
+ }
+ }
+ }
+
+ /**
+ * Returns non-static, non-abstract method with given signature provided it
+ * is defined by or accessible (via inheritance) by the given class, or
+ * null if no match found. Access checks are disabled on the returned
+ * method (if any).
+ *
+ * Copied from the Merlin java.io.ObjectStreamClass.
+ */
+ private static Method getInheritableMethod(Class<?> cl, String name,
+ Class<?>[] argTypes,
+ Class<?> returnType)
+ {
+ Method meth = null;
+ Class<?> defCl = cl;
+ while (defCl != null) {
+ try {
+ meth = defCl.getDeclaredMethod(name, argTypes);
+ break;
+ } catch (NoSuchMethodException ex) {
+ defCl = defCl.getSuperclass();
+ }
+ }
+
+ if ((meth == null) || (meth.getReturnType() != returnType)) {
+ return null;
+ }
+ int mods = meth.getModifiers();
+ if ((mods & (Modifier.STATIC | Modifier.ABSTRACT)) != 0) {
+ return null;
+ } else if ((mods & (Modifier.PUBLIC | Modifier.PROTECTED)) != 0) {
+ return meth;
+ } else if ((mods & Modifier.PRIVATE) != 0) {
+ return (cl == defCl) ? meth : null;
+ } else {
+ return packageEquals(cl, defCl) ? meth : null;
+ }
+ }
+
+ /**
+ * Returns true if classes are defined in the same package, false
+ * otherwise.
+ *
+ * Copied from the Merlin java.io.ObjectStreamClass.
+ */
+ private static boolean packageEquals(Class<?> cl1, Class<?> cl2) {
+ Package pkg1 = cl1.getPackage(), pkg2 = cl2.getPackage();
+ return ((pkg1 == pkg2) || ((pkg1 != null) && (pkg1.equals(pkg2))));
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClassCorbaExt.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClassCorbaExt.java
new file mode 100644
index 0000000..8f54e25
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamClassCorbaExt.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.io;
+
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedAction;
+
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+
+
+// This file contains some utility methods that
+// originally were in the OSC in the RMI-IIOP
+// code delivered by IBM. They don't make
+// sense there, and hence have been put
+// here so that they can be factored out in
+// an attempt to eliminate redundant code from
+// ObjectStreamClass. Eventually the goal is
+// to move to java.io.ObjectStreamClass, and
+// java.io.ObjectStreamField.
+
+// class is package private for security reasons
+
+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.
+ */
+ static final boolean isAbstractInterface(Class cl) {
+ if (!cl.isInterface() || // #1
+ java.rmi.Remote.class.isAssignableFrom(cl)) { // #2
+ return false;
+ }
+ Method[] methods = cl.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ 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])) {
+ exceptionMatch = true;
+ }
+ }
+ if (!exceptionMatch) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * Returns TRUE if type is 'any'.
+ */
+ static final boolean isAny(String typeString) {
+
+ int isAny = 0;
+
+ if ( (typeString != null) &&
+ (typeString.equals("Ljava/lang/Object;") ||
+ typeString.equals("Ljava/io/Serializable;") ||
+ typeString.equals("Ljava/io/Externalizable;")) )
+ isAny = 1;
+
+ return (isAny==1);
+ }
+
+ private static final Method[] getDeclaredMethods(final Class clz) {
+ return (Method[]) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return clz.getDeclaredMethods();
+ }
+ });
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamField.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamField.java
new file mode 100644
index 0000000..0fa0f99
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/ObjectStreamField.java
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.io;
+
+import java.lang.reflect.Field;
+import java.lang.Comparable;
+import java.util.Hashtable;
+
+import sun.corba.Bridge ;
+import java.security.AccessController ;
+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.
+ *
+ */
+public class ObjectStreamField implements Comparable
+{
+ private static final Bridge bridge =
+ (Bridge)AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ return Bridge.get() ;
+ }
+ }
+ ) ;
+
+ /**
+ * Create a named field with the specified type.
+ */
+ ObjectStreamField(String n, Class clazz) {
+ name = n;
+ this.clazz = clazz;
+
+ // Compute the typecode for easy switching
+ if (clazz.isPrimitive()) {
+ if (clazz == Integer.TYPE) {
+ type = 'I';
+ } else if (clazz == Byte.TYPE) {
+ type = 'B';
+ } else if (clazz == Long.TYPE) {
+ type = 'J';
+ } else if (clazz == Float.TYPE) {
+ type = 'F';
+ } else if (clazz == Double.TYPE) {
+ type = 'D';
+ } else if (clazz == Short.TYPE) {
+ type = 'S';
+ } else if (clazz == Character.TYPE) {
+ type = 'C';
+ } else if (clazz == Boolean.TYPE) {
+ type = 'Z';
+ }
+ } else if (clazz.isArray()) {
+ type = '[';
+ typeString = ObjectStreamClass.getSignature(clazz);
+ } else {
+ type = 'L';
+ typeString = ObjectStreamClass.getSignature(clazz);
+ }
+
+ if (typeString != null)
+ signature = typeString;
+ else
+ signature = String.valueOf(type);
+
+ }
+
+ ObjectStreamField(Field field) {
+ this(field.getName(), field.getType());
+ setField( field ) ;
+ }
+
+ /**
+ * Create an ObjectStreamField containing a reflected Field.
+ */
+ ObjectStreamField(String n, char t, Field f, String ts)
+ {
+ name = n;
+ type = t;
+ setField( f ) ;
+ typeString = ts;
+
+ if (typeString != null)
+ signature = typeString;
+ else
+ signature = String.valueOf(type);
+
+ }
+
+ /**
+ * Get the name of this field.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get the type of the field.
+ */
+ public Class getType() {
+ if (clazz != null)
+ return clazz;
+ switch (type) {
+ case 'B': clazz = Byte.TYPE;
+ break;
+ case 'C': clazz = Character.TYPE;
+ break;
+ case 'S': clazz = Short.TYPE;
+ break;
+ case 'I': clazz = Integer.TYPE;
+ break;
+ case 'J': clazz = Long.TYPE;
+ break;
+ case 'F': clazz = Float.TYPE;
+ break;
+ case 'D': clazz = Double.TYPE;
+ break;
+ case 'Z': clazz = Boolean.TYPE;
+ break;
+ case '[':
+ case 'L':
+ clazz = Object.class;
+ break;
+ }
+
+ return clazz;
+ }
+
+ public char getTypeCode() {
+ return type;
+ }
+
+ public String getTypeString() {
+ return typeString;
+ }
+
+ Field getField() {
+ return field;
+ }
+
+ void setField(Field field) {
+ this.field = field;
+ this.fieldID = bridge.objectFieldOffset( field ) ;
+ }
+
+ /*
+ * Default constructor creates an empty field.
+ * Usually used just to get to the sort functions.
+ */
+ ObjectStreamField() {
+ }
+
+ /**
+ * test if this field is a primitive or not.
+ */
+ public boolean isPrimitive() {
+ return (type != '[' && type != 'L');
+ }
+
+ /**
+ * 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.
+ */
+ public int compareTo(Object o) {
+ ObjectStreamField f2 = (ObjectStreamField)o;
+ boolean thisprim = (this.typeString == null);
+ boolean otherprim = (f2.typeString == null);
+
+ if (thisprim != otherprim) {
+ return (thisprim ? -1 : 1);
+ }
+ return this.name.compareTo(f2.name);
+ }
+
+ /**
+ * 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.
+ */
+ public boolean typeEquals(ObjectStreamField other) {
+ if (other == null || type != other.type)
+ return false;
+
+ /* Return true if the primitive types matched */
+ if (typeString == null && other.typeString == null)
+ return true;
+
+ return ObjectStreamClass.compareClassNames(typeString,
+ other.typeString,
+ '/');
+ }
+
+ /* Returns the signature of the Field.
+ *
+ */
+ public String getSignature() {
+
+ return signature;
+
+ }
+
+ /**
+ * Return a string describing this field.
+ */
+ public String toString() {
+ if (typeString != null)
+ return typeString + " " + name;
+ else
+ return type + " " + name;
+ }
+
+ public Class getClazz() {
+ return clazz;
+ }
+
+ /* Returns the Field ID
+ *
+ */
+ public long getFieldID() {
+ 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
+
+ // 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
+ // 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 ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/OptionalDataException.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/OptionalDataException.java
new file mode 100644
index 0000000..89228fd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/OptionalDataException.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.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.
+ *
+ * @author unascribed
+ * @since JDK1.1
+ */
+public class OptionalDataException extends java.io.IOException {
+ /*
+ * Create an <code>OptionalDataException</code> with a length.
+ */
+ OptionalDataException(int len) {
+ eof = false;
+ length = len;
+ }
+
+ /*
+ * Create an <code>OptionalDataException</code> signifing no
+ * more primitive data is available.
+ */
+ OptionalDataException(boolean end) {
+ length = 0;
+ eof = end;
+ }
+
+ /**
+ * The number of bytes of primitive data available to be read
+ * in the current buffer.
+ */
+ public int length;
+
+ /**
+ * True if there is no more data in the buffered part of the stream.
+ */
+ public boolean eof;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
new file mode 100644
index 0000000..79ef01e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/OutputStreamHook.java
@@ -0,0 +1,318 @@
+/*
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.io;
+
+import java.io.IOException;
+import java.io.NotActiveException;
+import java.io.OutputStream;
+import java.io.ObjectOutputStream;
+import java.io.ObjectOutput;
+import java.util.Map;
+import java.util.HashMap;
+
+import org.omg.CORBA.INTERNAL;
+
+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.
+ */
+ private class HookPutFields extends ObjectOutputStream.PutField
+ {
+ private Map<String,Object> fields = new HashMap<>();
+
+ /**
+ * Put the value of the named boolean field into the persistent field.
+ */
+ public void put(String name, boolean value){
+ fields.put(name, new Boolean(value));
+ }
+
+ /**
+ * Put the value of the named char field into the persistent fields.
+ */
+ public void put(String name, char value){
+ fields.put(name, new Character(value));
+ }
+
+ /**
+ * Put the value of the named byte field into the persistent fields.
+ */
+ public void put(String name, byte value){
+ fields.put(name, new Byte(value));
+ }
+
+ /**
+ * Put the value of the named short field into the persistent fields.
+ */
+ public void put(String name, short value){
+ fields.put(name, new Short(value));
+ }
+
+ /**
+ * Put the value of the named int field into the persistent fields.
+ */
+ public void put(String name, int value){
+ fields.put(name, new Integer(value));
+ }
+
+ /**
+ * Put the value of the named long field into the persistent fields.
+ */
+ public void put(String name, long value){
+ fields.put(name, new Long(value));
+ }
+
+ /**
+ * Put the value of the named float field into the persistent fields.
+ *
+ */
+ public void put(String name, float value){
+ fields.put(name, new Float(value));
+ }
+
+ /**
+ * Put the value of the named double field into the persistent field.
+ */
+ public void put(String name, double value){
+ fields.put(name, new Double(value));
+ }
+
+ /**
+ * Put the value of the named Object field into the persistent field.
+ */
+ 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;
+
+ ObjectStreamField[] osfields = hook.getFieldsNoCopy();
+
+ // Write the fields to the stream in the order
+ // provided by the ObjectStreamClass. (They should
+ // be sorted appropriately already.)
+ for (int i = 0; i < osfields.length; i++) {
+
+ Object value = fields.get(osfields[i].getName());
+
+ hook.writeField(osfields[i], value);
+ }
+ }
+ }
+
+ abstract void writeField(ObjectStreamField field, Object value) throws IOException;
+
+ public OutputStreamHook()
+ throws java.io.IOException {
+ super();
+ }
+
+ public void defaultWriteObject() throws IOException {
+
+ writeObjectState.defaultWriteObject(this);
+
+ defaultWriteObjectDelegate();
+ }
+
+ public abstract void defaultWriteObjectDelegate();
+
+ public ObjectOutputStream.PutField putFields()
+ throws IOException {
+ if (putFields == null) {
+ putFields = new HookPutFields();
+ }
+ return putFields;
+ }
+
+ // Stream format version, saved/restored during recursive calls
+ protected byte streamFormatVersion = 1;
+
+ // Return the stream format version currently being used
+ // to serialize an object
+ public byte getStreamFormatVersion() {
+ return streamFormatVersion;
+ }
+
+ abstract ObjectStreamField[] getFieldsNoCopy();
+
+ // User uses PutFields to simulate default data.
+ // See java.io.ObjectOutputStream.PutFields
+ public void writeFields()
+ throws IOException {
+
+ writeObjectState.defaultWriteObject(this);
+ if (putFields != null) {
+ putFields.write(this);
+ } else {
+ throw new NotActiveException("no current PutField object");
+ }
+ }
+
+ abstract org.omg.CORBA_2_3.portable.OutputStream getOrbStream();
+
+ 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
+ // state diagrams in the docs directory of the workspace.
+
+ protected WriteObjectState writeObjectState = NOT_IN_WRITE_OBJECT;
+
+ protected void setState(WriteObjectState newState) {
+ writeObjectState = newState;
+ }
+
+ // Description of possible actions
+ protected static class WriteObjectState {
+ public void enterWriteObject(OutputStreamHook stream) throws IOException {}
+ public void exitWriteObject(OutputStreamHook stream) throws IOException {}
+ public void defaultWriteObject(OutputStreamHook stream) throws IOException {}
+ public void writeData(OutputStreamHook stream) throws IOException {}
+ }
+
+ protected static class DefaultState extends WriteObjectState {
+ public void enterWriteObject(OutputStreamHook stream) throws IOException {
+ stream.setState(IN_WRITE_OBJECT);
+ }
+ }
+
+ protected static final WriteObjectState NOT_IN_WRITE_OBJECT = new DefaultState();
+ protected static final WriteObjectState IN_WRITE_OBJECT = new InWriteObjectState();
+ protected static final WriteObjectState WROTE_DEFAULT_DATA = new WroteDefaultDataState();
+ protected static final WriteObjectState WROTE_CUSTOM_DATA = new WroteCustomDataState();
+
+ protected static class InWriteObjectState extends WriteObjectState {
+
+ public void enterWriteObject(OutputStreamHook stream) throws IOException {
+ // XXX I18N, logging needed.
+ throw new IOException("Internal state failure: Entered writeObject twice");
+ }
+
+ public void exitWriteObject(OutputStreamHook stream) throws IOException {
+
+ // We didn't write any data, so write the
+ // called defaultWriteObject indicator as false
+ stream.getOrbStream().write_boolean(false);
+
+ // If we're in stream format verison 2, we must
+ // put the "null" marker to say that there isn't
+ // any optional data
+ if (stream.getStreamFormatVersion() == 2)
+ stream.getOrbStream().write_long(0);
+
+ stream.setState(NOT_IN_WRITE_OBJECT);
+ }
+
+ public void defaultWriteObject(OutputStreamHook stream) throws IOException {
+
+ // The writeObject method called defaultWriteObject
+ // or writeFields, so put the called defaultWriteObject
+ // indicator as true
+ stream.getOrbStream().write_boolean(true);
+
+ stream.setState(WROTE_DEFAULT_DATA);
+ }
+
+ public void writeData(OutputStreamHook stream) throws IOException {
+
+ // The writeObject method first called a direct
+ // 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
+ stream.getOrbStream().write_boolean(false);
+ stream.beginOptionalCustomData();
+ stream.setState(WROTE_CUSTOM_DATA);
+ }
+ }
+
+ protected static class WroteDefaultDataState extends InWriteObjectState {
+
+ public void exitWriteObject(OutputStreamHook stream) throws IOException {
+
+ // We only wrote default data, so if in stream format
+ // version 2, put the null indicator to say that there
+ // is no optional data
+ if (stream.getStreamFormatVersion() == 2)
+ stream.getOrbStream().write_long(0);
+
+ stream.setState(NOT_IN_WRITE_OBJECT);
+ }
+
+ public void defaultWriteObject(OutputStreamHook stream) throws IOException {
+ // XXX I18N, logging needed.
+ throw new IOException("Called defaultWriteObject/writeFields twice");
+ }
+
+ public void writeData(OutputStreamHook stream) throws IOException {
+
+ // The writeObject method called a direct write operation.
+ // If in stream format version 2, put the fake valuetype
+ // header.
+ stream.beginOptionalCustomData();
+
+ stream.setState(WROTE_CUSTOM_DATA);
+ }
+ }
+
+ protected static class WroteCustomDataState extends InWriteObjectState {
+
+ public void exitWriteObject(OutputStreamHook stream) throws IOException {
+ // In stream format version 2, we must tell the ORB
+ // stream to close the fake custom valuetype.
+ if (stream.getStreamFormatVersion() == 2)
+ ((org.omg.CORBA.portable.ValueOutputStream)stream.getOrbStream()).end_value();
+
+ stream.setState(NOT_IN_WRITE_OBJECT);
+ }
+
+ public void defaultWriteObject(OutputStreamHook stream) throws IOException {
+ // XXX I18N, logging needed.
+ throw new IOException("Cannot call defaultWriteObject/writeFields after writing custom data in RMI-IIOP");
+ }
+
+ // We don't have to do anything special here, just let
+ // the stream write the data.
+ public void writeData(OutputStreamHook stream) throws IOException {}
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/TypeMismatchException.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/TypeMismatchException.java
new file mode 100644
index 0000000..7561f88
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/TypeMismatchException.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.io;
+
+public class TypeMismatchException extends Error
+{
+ public TypeMismatchException()
+ {
+ super();
+ }
+
+ public TypeMismatchException(String mssg)
+ {
+ super(mssg);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java
new file mode 100644
index 0000000..9a46afd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueHandlerImpl.java
@@ -0,0 +1,926 @@
+/*
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.io;
+
+import javax.rmi.CORBA.Util;
+
+import java.util.Hashtable;
+import java.io.IOException;
+
+import com.sun.corba.se.impl.util.RepositoryId;
+import com.sun.corba.se.impl.util.Utility;
+
+import org.omg.CORBA.TCKind;
+
+import org.omg.CORBA.portable.IndirectionException;
+import com.sun.org.omg.SendingContext.CodeBase;
+import com.sun.org.omg.SendingContext.CodeBaseHelper;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedExceptionAction;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+import com.sun.corba.se.impl.logging.UtilSystemException;
+
+public final class ValueHandlerImpl implements javax.rmi.CORBA.ValueHandlerMultiFormat {
+
+ // Property to override our maximum stream format version
+ public static final String FORMAT_VERSION_PROPERTY
+ = "com.sun.CORBA.MaxStreamFormatVersion";
+
+ 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.
+ private static final byte MAX_STREAM_FORMAT_VERSION;
+
+ static {
+ MAX_STREAM_FORMAT_VERSION = getMaxStreamFormatVersion();
+ }
+
+ // 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
+ // a supported version (1 through MAX_STREAM_FORMAT_VERSION).
+ private static byte getMaxStreamFormatVersion() {
+
+ try {
+
+ String propValue = (String) AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public java.lang.Object run() {
+ return System.getProperty(ValueHandlerImpl.FORMAT_VERSION_PROPERTY);
+ }
+ });
+
+ // The property wasn't set
+ if (propValue == null)
+ return MAX_SUPPORTED_FORMAT_VERSION;
+
+ byte result = Byte.parseByte(propValue);
+
+ // 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)
+ // XXX I18N, logging needed.
+ throw new ExceptionInInitializerError("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
+ // the system shutdown with this Error?
+
+ Error err = new ExceptionInInitializerError(ex);
+ err.initCause( ex ) ;
+ throw err ;
+ }
+ }
+
+ public static final short kRemoteType = 0;
+ public static final short kAbstractType = 1;
+ public static final short kValueType = 2;
+
+ private Hashtable inputStreamPairs = null;
+ private Hashtable outputStreamPairs = null;
+ private CodeBase codeBase = null;
+ private boolean useHashtables = true;
+ private boolean isInputStream = true;
+ private IIOPOutputStream outputStreamBridge = null;
+ private IIOPInputStream inputStreamBridge = null;
+ private OMGSystemException omgWrapper = OMGSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+ private UtilSystemException utilWrapper = UtilSystemException.get(
+ CORBALogDomains.RPC_ENCODING ) ;
+
+ // See javax.rmi.CORBA.ValueHandlerMultiFormat
+ public byte getMaximumStreamFormatVersion() {
+ return MAX_STREAM_FORMAT_VERSION;
+ }
+
+ // See javax.rmi.CORBA.ValueHandlerMultiFormat
+ 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() ;
+ }
+ } else if (streamFormatVersion != 1) {
+ throw omgWrapper.invalidStreamFormatVersion(
+ new Integer(streamFormatVersion) ) ;
+ }
+
+ writeValueWithVersion(out, value, streamFormatVersion);
+ }
+
+ private ValueHandlerImpl(){}
+
+ private ValueHandlerImpl(boolean isInputStream) {
+ this();
+ useHashtables = false;
+ this.isInputStream = isInputStream;
+ }
+
+ static ValueHandlerImpl getInstance() {
+ return new ValueHandlerImpl();
+ }
+
+ static ValueHandlerImpl getInstance(boolean isInputStream) {
+ return new ValueHandlerImpl(isInputStream);
+ }
+
+ /**
+ * 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
+ **/
+ public void writeValue(org.omg.CORBA.portable.OutputStream out,
+ java.io.Serializable value) {
+ writeValueWithVersion(out, value, STREAM_FORMAT_VERSION_1);
+ }
+
+ 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;
+
+ if (!useHashtables) {
+ if (outputStreamBridge == null) {
+ outputStreamBridge = createOutputStream();
+ outputStreamBridge.setOrbStream(out);
+ }
+
+ try {
+ outputStreamBridge.increaseRecursionDepth();
+ writeValueInternal(outputStreamBridge, out, value, streamFormatVersion);
+ } finally {
+ outputStreamBridge.decreaseRecursionDepth();
+ }
+
+ return;
+ }
+
+ IIOPOutputStream jdkToOrbOutputStreamBridge = null;
+
+ if (outputStreamPairs == null)
+ outputStreamPairs = new Hashtable();
+
+ jdkToOrbOutputStreamBridge = (IIOPOutputStream)outputStreamPairs.get(_out);
+
+ if (jdkToOrbOutputStreamBridge == null) {
+ jdkToOrbOutputStreamBridge = createOutputStream();
+ jdkToOrbOutputStreamBridge.setOrbStream(out);
+ outputStreamPairs.put(_out, jdkToOrbOutputStreamBridge);
+ }
+
+ try {
+
+ jdkToOrbOutputStreamBridge.increaseRecursionDepth();
+ writeValueInternal(jdkToOrbOutputStreamBridge, out, value, streamFormatVersion);
+ } finally {
+ if (jdkToOrbOutputStreamBridge.decreaseRecursionDepth() == 0) {
+ outputStreamPairs.remove(_out);
+ }
+ }
+ }
+
+ private void writeValueInternal(IIOPOutputStream bridge,
+ org.omg.CORBA_2_3.portable.OutputStream out,
+ java.io.Serializable value,
+ byte streamFormatVersion)
+ {
+ Class clazz = value.getClass();
+
+ if (clazz.isArray())
+ write_Array(out, value, clazz.getComponentType());
+ else
+ bridge.simpleWriteObject(value, streamFormatVersion);
+ }
+
+ /**
+ * Reads a value from the stream using java semantics.
+ * @param in The stream to read the value from
+ * @param clazz The type of the value to be read in
+ * @param rt The sending context runtime
+ **/
+ public java.io.Serializable readValue(org.omg.CORBA.portable.InputStream in,
+ int offset,
+ java.lang.Class clazz,
+ String repositoryID,
+ org.omg.SendingContext.RunTime rt)
+ {
+ // Must use narrow rather than a direct cast to a com.sun
+ // class. Fix for bug 4379539.
+ CodeBase sender = CodeBaseHelper.narrow(rt);
+
+ org.omg.CORBA_2_3.portable.InputStream inStream =
+ (org.omg.CORBA_2_3.portable.InputStream) in;
+
+ if (!useHashtables) {
+ if (inputStreamBridge == null) {
+ inputStreamBridge = createInputStream();
+ inputStreamBridge.setOrbStream(inStream);
+ inputStreamBridge.setSender(sender); //d11638
+ // backward compatability 4365188
+ inputStreamBridge.setValueHandler(this);
+ }
+
+ java.io.Serializable result = null;
+
+ try {
+
+ inputStreamBridge.increaseRecursionDepth();
+ result = (java.io.Serializable) readValueInternal(inputStreamBridge, inStream, offset, clazz, repositoryID, sender);
+
+ } finally {
+
+ if (inputStreamBridge.decreaseRecursionDepth() == 0) {
+ // Indirections are resolved immediately since
+ // the change to the active recursion manager,
+ // so this will never happen.
+ }
+ }
+
+ return result;
+ }
+
+ IIOPInputStream jdkToOrbInputStreamBridge = null;
+ if (inputStreamPairs == null)
+ inputStreamPairs = new Hashtable();
+
+ jdkToOrbInputStreamBridge = (IIOPInputStream)inputStreamPairs.get(in);
+
+ if (jdkToOrbInputStreamBridge == null) {
+
+ jdkToOrbInputStreamBridge = createInputStream();
+ jdkToOrbInputStreamBridge.setOrbStream(inStream);
+ jdkToOrbInputStreamBridge.setSender(sender); //d11638
+ // backward compatability 4365188
+ jdkToOrbInputStreamBridge.setValueHandler(this);
+ inputStreamPairs.put(in, jdkToOrbInputStreamBridge);
+ }
+
+ java.io.Serializable result = null;
+
+ try {
+
+ jdkToOrbInputStreamBridge.increaseRecursionDepth();
+ result = (java.io.Serializable) readValueInternal(jdkToOrbInputStreamBridge, inStream, offset, clazz, repositoryID, sender);
+
+ } finally {
+
+ if (jdkToOrbInputStreamBridge.decreaseRecursionDepth() == 0) {
+ inputStreamPairs.remove(in);
+ }
+ }
+
+ return result;
+ }
+
+ 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);
+ } else {
+ bridge.simpleSkipObject(repositoryID, sender);
+ }
+ return result;
+ }
+
+ if (clazz.isArray()) {
+ result = (java.io.Serializable)read_Array(bridge, in, clazz, sender, offset);
+ } else {
+ result = (java.io.Serializable)bridge.simpleReadObject(clazz, repositoryID, sender, offset);
+ }
+
+ return result;
+ }
+
+ /**
+ * 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.
+ **/
+ public java.lang.String getRMIRepositoryID(java.lang.Class clz) {
+ return RepositoryId.createForJavaType(clz);
+ }
+
+ /**
+ * 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.
+ **/
+ 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.
+ * @return the SendingContext.CodeBase of this ValueHandler.
+ **/
+ public org.omg.SendingContext.RunTime getRunTimeCodeBase() {
+ if (codeBase != null)
+ return codeBase;
+ else {
+ codeBase = new FVDCodeBaseImpl();
+
+ // backward compatability 4365188
+ // set the valueHandler so that correct/incorrect RepositoryID
+ // calculations can be done based on the ORB version
+ FVDCodeBaseImpl fvdImpl = (FVDCodeBaseImpl) codeBase;
+ fvdImpl.setValueHandler(this);
+ 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
+ */
+
+ public boolean useFullValueDescription(Class clazz, String repositoryID)
+ throws IOException
+ {
+ return RepositoryId.useFullValueDescription(clazz, repositoryID);
+ }
+
+ public String getClassName(String id)
+ {
+ RepositoryId repID = RepositoryId.cache.getId(id);
+ return repID.getClassName();
+ }
+
+ public Class getClassFromType(String id)
+ throws ClassNotFoundException
+ {
+ RepositoryId repId = RepositoryId.cache.getId(id);
+ return repId.getClassFromType();
+ }
+
+ public Class getAnyClassFromType(String id)
+ throws ClassNotFoundException
+ {
+ RepositoryId repId = RepositoryId.cache.getId(id);
+ return repId.getAnyClassFromType();
+ }
+
+ public String createForAnyType(Class cl)
+ {
+ return RepositoryId.createForAnyType(cl);
+ }
+
+ public String getDefinedInId(String id)
+ {
+ RepositoryId repId = RepositoryId.cache.getId(id);
+ return repId.getDefinedInId();
+ }
+
+ public String getUnqualifiedName(String id)
+ {
+ RepositoryId repId = RepositoryId.cache.getId(id);
+ return repId.getUnqualifiedName();
+ }
+
+ public String getSerialVersionUID(String id)
+ {
+ RepositoryId repId = RepositoryId.cache.getId(id);
+ return repId.getSerialVersionUID();
+ }
+
+
+ public boolean isAbstractBase(Class clazz)
+ {
+ return RepositoryId.isAbstractBase(clazz);
+ }
+
+ 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.
+ * @return the true value to marshal on the wire.
+ **/
+ public java.io.Serializable writeReplace(java.io.Serializable value) {
+ return ObjectStreamClass.lookup(value.getClass()).writeReplace(value);
+ }
+
+ private void writeCharArray(org.omg.CORBA_2_3.portable.OutputStream out,
+ char[] array,
+ int offset,
+ int length)
+ {
+ out.write_wchar_array(array, offset, length);
+ }
+
+ private void write_Array(org.omg.CORBA_2_3.portable.OutputStream out, java.io.Serializable obj, Class type) {
+
+ int i, length;
+
+ if (type.isPrimitive()) {
+ if (type == Integer.TYPE) {
+ 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);
+ length = array.length;
+ out.write_ulong(length);
+ out.write_octet_array(array, 0, length);
+ } else if (type == Long.TYPE) {
+ 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);
+ length = array.length;
+ out.write_ulong(length);
+ out.write_float_array(array, 0, length);
+ } else if (type == Double.TYPE) {
+ 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);
+ length = array.length;
+ out.write_ulong(length);
+ out.write_short_array(array, 0, length);
+ } else if (type == Character.TYPE) {
+ 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);
+ length = array.length;
+ out.write_ulong(length);
+ out.write_boolean_array(array, 0, length);
+ } else {
+ // XXX I18N, logging needed.
+ throw new Error("Invalid primitive type : " +
+ obj.getClass().getName());
+ }
+ } else if (type == java.lang.Object.class) {
+ Object[] array = (Object[])((Object)obj);
+ length = array.length;
+ out.write_ulong(length);
+ for (i = 0; i < length; i++) {
+ Util.writeAny(out, array[i]);
+ }
+ } else {
+ Object[] array = (Object[])((Object)obj);
+ length = array.length;
+ out.write_ulong(length);
+ int callType = kValueType;
+
+ if (type.isInterface()) {
+ String className = type.getName();
+
+ if (java.rmi.Remote.class.isAssignableFrom(type)) {
+ // RMI Object reference...
+ callType = kRemoteType;
+ } else if (org.omg.CORBA.Object.class.isAssignableFrom(type)){
+ // IDL Object reference...
+ callType = kRemoteType;
+ } else if (RepositoryId.isAbstractBase(type)) {
+ // IDL Abstract Object reference...
+ callType = kAbstractType;
+ } else if (ObjectStreamClassCorbaExt.isAbstractInterface(type)) {
+ callType = kAbstractType;
+ }
+ }
+
+ for (i = 0; i < length; i++) {
+ switch (callType) {
+ case kRemoteType:
+ Util.writeRemoteObject(out, array[i]);
+ break;
+ case kAbstractType:
+ Util.writeAbstractObject(out,array[i]);
+ break;
+ case kValueType:
+ 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());
+ }
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private void readCharArray(org.omg.CORBA_2_3.portable.InputStream in,
+ char[] array,
+ int offset,
+ int length)
+ {
+ in.read_wchar_array(array, offset, length);
+ }
+
+ 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();
+ int i;
+
+ if (sequence == null) {
+ for (i = 0; i < length; i++)
+ in.read_value();
+
+ return null;
+ }
+
+ Class componentType = sequence.getComponentType();
+ Class actualType = 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));
+ } else if (componentType == Byte.TYPE) {
+ byte[] array = new byte[length];
+ in.read_octet_array(array, 0, length);
+ 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));
+ } else if (componentType == Float.TYPE) {
+ float[] array = new float[length];
+ in.read_float_array(array, 0, length);
+ 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));
+ } else if (componentType == Short.TYPE) {
+ short[] array = new short[length];
+ in.read_short_array(array, 0, length);
+ 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));
+ } else if (componentType == Boolean.TYPE) {
+ boolean[] array = new boolean[length];
+ in.read_boolean_array(array, 0, length);
+ return ((java.io.Serializable)((Object)array));
+ } else {
+ // XXX I18N, logging needed.
+ throw new Error("Invalid primitive componentType : " + sequence.getName());
+ }
+ } else if (componentType == java.lang.Object.class) {
+ 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.
+ bridge.activeRecursionMgr.addObject(offset, array);
+
+ for (i = 0; i < length; i++) {
+ Object objectValue = null;
+ try {
+ objectValue = Util.readAny(in);
+ } 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
+ // reference, either).
+ 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,
+ new Integer( cdrie.offset ) ) ;
+ }
+ }
+
+ array[i] = objectValue;
+ }
+ return ((java.io.Serializable)((Object)array));
+ } else {
+ 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.
+ 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 (componentType.isInterface()) {
+ boolean loadStubClass = false;
+ // String className = componentType.getName();
+
+ if (java.rmi.Remote.class.isAssignableFrom(componentType)) {
+
+ // RMI Object reference...
+ callType = kRemoteType;
+
+ // for better performance, load the stub class once
+ // instead of for each element of the array
+ loadStubClass = true;
+ } else if (org.omg.CORBA.Object.class.isAssignableFrom(componentType)){
+ // IDL Object reference...
+ callType = kRemoteType;
+ loadStubClass = true;
+ } else if (RepositoryId.isAbstractBase(componentType)) {
+ // IDL Abstract Object reference...
+ callType = kAbstractType;
+ loadStubClass = true;
+ } else if (ObjectStreamClassCorbaExt.isAbstractInterface(componentType)) {
+
+ // RMI Abstract Object reference...
+
+ // componentType = null;
+ callType = kAbstractType;
+ }
+
+ if (loadStubClass) {
+ try {
+ String codebase = Util.getCodebase(componentType);
+ String repID = RepositoryId.createForAnyType(componentType);
+ Class stubType =
+ Utility.loadStubClass(repID, codebase, componentType);
+ actualType = stubType;
+ } catch (ClassNotFoundException e) {
+ narrow = true;
+ }
+ } else {
+ narrow = true;
+ }
+ }
+
+ for (i = 0; i < length; i++) {
+
+ try {
+ switch (callType) {
+ case kRemoteType:
+ if (!narrow)
+ array[i] = (Object)in.read_Object(actualType);
+ else {
+ array[i] = Utility.readObjectAndNarrow(in, actualType);
+
+ }
+ break;
+ case kAbstractType:
+ if (!narrow)
+ array[i] = (Object)in.read_abstract_interface(actualType);
+ else {
+ array[i] = Utility.readAbstractAndNarrow(in, actualType);
+ }
+ break;
+ case kValueType:
+ array[i] = (Object)in.read_value(actualType);
+ break;
+ }
+ } 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);
+ } catch (IOException ioe) {
+ // Translate to a MARSHAL exception since
+ // ValueHandlers aren't allowed to throw
+ // IOExceptions
+ throw utilWrapper.invalidIndirection( ioe,
+ new Integer( cdrie.offset ) ) ;
+ }
+ }
+
+ }
+
+ return ((java.io.Serializable)((Object)array));
+ }
+ } finally {
+ // We've completed deserializing this object. Any
+ // future indirections will be handled correctly at the
+ // CDR level. The ActiveRecursionManager only deals with
+ // objects currently being deserialized.
+ bridge.activeRecursionMgr.removeObject(offset);
+ }
+ }
+
+ private boolean isArray(String repId){
+ return RepositoryId.cache.getId(repId).isSequence();
+ }
+
+ private String getOutputStreamClassName() {
+ return "com.sun.corba.se.impl.io.IIOPOutputStream";
+ }
+
+ private IIOPOutputStream createOutputStream() {
+ final String name = getOutputStreamClassName();
+ try {
+ IIOPOutputStream stream = createOutputStreamBuiltIn(name);
+ if (stream != null) {
+ return stream;
+ }
+ return createCustom(IIOPOutputStream.class, name);
+ } catch (Throwable t) {
+ // Throw exception under the carpet.
+ InternalError ie = new InternalError(
+ "Error loading " + name
+ );
+ ie.initCause(t);
+ throw ie;
+ }
+ }
+
+ /**
+ * Construct a built in implementation with priveleges.
+ * Returning null indicates a non-built is specified.
+ */
+ private IIOPOutputStream createOutputStreamBuiltIn(
+ final String name
+ ) throws Throwable {
+ try {
+ return AccessController.doPrivileged(
+ new PrivilegedExceptionAction<IIOPOutputStream>() {
+ public IIOPOutputStream run() throws IOException {
+ return createOutputStreamBuiltInNoPriv(name);
+ }
+ }
+ );
+ } catch (java.security.PrivilegedActionException exc) {
+ throw exc.getCause();
+ }
+ }
+
+ /**
+ * Returning null indicates a non-built is specified.
+ */
+ private IIOPOutputStream createOutputStreamBuiltInNoPriv(
+ final String name
+ ) throws IOException {
+ return name.equals(IIOPOutputStream.class.getName()) ?
+ new IIOPOutputStream() : null;
+ }
+
+ private String getInputStreamClassName() {
+ return "com.sun.corba.se.impl.io.IIOPInputStream";
+ }
+
+ private IIOPInputStream createInputStream() {
+ final String name = getInputStreamClassName();
+ try {
+ IIOPInputStream stream = createInputStreamBuiltIn(name);
+ if (stream != null) {
+ return stream;
+ }
+ return createCustom(IIOPInputStream.class, name);
+ } catch (Throwable t) {
+ // Throw exception under the carpet.
+ InternalError ie = new InternalError(
+ "Error loading " + name
+ );
+ ie.initCause(t);
+ throw ie;
+ }
+ }
+
+ /**
+ * Construct a built in implementation with priveleges.
+ * Returning null indicates a non-built is specified.
+ */
+ private IIOPInputStream createInputStreamBuiltIn(
+ final String name
+ ) throws Throwable {
+ try {
+ return AccessController.doPrivileged(
+ new PrivilegedExceptionAction<IIOPInputStream>() {
+ public IIOPInputStream run() throws IOException {
+ return createInputStreamBuiltInNoPriv(name);
+ }
+ }
+ );
+ } catch (java.security.PrivilegedActionException exc) {
+ throw exc.getCause();
+ }
+ }
+
+ /**
+ * Returning null indicates a non-built is specified.
+ */
+ private IIOPInputStream createInputStreamBuiltInNoPriv(
+ final String name
+ ) throws IOException {
+ return name.equals(IIOPInputStream.class.getName()) ?
+ new IIOPInputStream() : null;
+ }
+
+ /**
+ * Create a custom implementation without privileges.
+ */
+ private <T> T createCustom(
+ final Class<T> type, final String className
+ ) throws Throwable {
+ // Note: We use the thread context or system ClassLoader here
+ // since we want to load classes outside of the
+ // core JDK when running J2EE Pure ORB and
+ // talking to Kestrel.
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null)
+ cl = ClassLoader.getSystemClassLoader();
+
+ Class<?> clazz = cl.loadClass(className);
+ Class<? extends T> streamClass = clazz.asSubclass(type);
+
+ // Since the ClassLoader should cache the class, this isn't
+ // as expensive as it looks.
+ return streamClass.newInstance();
+
+ }
+
+ TCKind getJavaCharTCKind() {
+ return TCKind.tk_wchar;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueUtility.java b/src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueUtility.java
new file mode 100644
index 0000000..20cec8d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/io/ValueUtility.java
@@ -0,0 +1,483 @@
+/*
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.io;
+
+import com.sun.org.omg.CORBA.ValueDefPackage.FullValueDescription;
+import com.sun.org.omg.CORBA.OperationDescription;
+import com.sun.org.omg.CORBA.AttributeDescription;
+import org.omg.CORBA.ValueMember;
+import com.sun.org.omg.CORBA.Initializer;
+import org.omg.CORBA.IDLType;
+import com.sun.org.omg.CORBA._IDLTypeStub;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.TypeCodePackage.*;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.TCKind;
+import java.lang.reflect.*;
+import com.sun.corba.se.impl.util.RepositoryId;
+import java.util.*;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+
+/**
+ * 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
+ };
+
+ static {
+ sun.corba.SharedSecrets.setJavaCorbaAccess(new sun.corba.JavaCorbaAccess() {
+ public ValueHandlerImpl newValueHandlerImpl() {
+ return ValueHandlerImpl.getInstance();
+ }
+ public Class<?> loadClass(String className) throws ClassNotFoundException {
+ if (Thread.currentThread().getContextClassLoader() != null) {
+ return Thread.currentThread().getContextClassLoader().
+ loadClass(className);
+ } else {
+ return ClassLoader.getSystemClassLoader().loadClass(className);
+ }
+ }
+ });
+ }
+
+ public static String getSignature(ValueMember member)
+ throws ClassNotFoundException {
+
+ // 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) {
+ Class c = RepositoryId.cache.getId(member.id).getClassFromType();
+ return ObjectStreamClass.getSignature(c);
+
+ } else {
+
+ return primitiveConstants[member.type.kind().value()];
+ }
+
+ }
+
+ public static FullValueDescription translate(ORB orb, ObjectStreamClass osc, ValueHandler vh){
+
+ // Create FullValueDescription
+ FullValueDescription result = new FullValueDescription();
+ Class className = osc.forClass();
+
+ ValueHandlerImpl vhandler = (com.sun.corba.se.impl.io.ValueHandlerImpl) vh;
+ String repId = vhandler.createForAnyType(className);
+
+ // Set FVD name
+ result.name = vhandler.getUnqualifiedName(repId);
+ if (result.name == null)
+ result.name = "";
+
+ // Set FVD id _REVISIT_ : Manglings
+ result.id = vhandler.getRMIRepositoryID(className);
+ if (result.id == null)
+ result.id = "";
+
+ // Set FVD is_abstract
+ result.is_abstract = ObjectStreamClassCorbaExt.isAbstractInterface(className);
+
+ // Set FVD is_custom
+ result.is_custom = osc.hasWriteObject() || osc.isExternalizable();
+
+ // Set FVD defined_in _REVISIT_ : Manglings
+ result.defined_in = vhandler.getDefinedInId(repId);
+ if (result.defined_in == null)
+ result.defined_in = "";
+
+ // Set FVD version
+ result.version = vhandler.getSerialVersionUID(repId);
+ if (result.version == null)
+ result.version = "";
+
+ // Skip FVD operations - N/A
+ result.operations = new OperationDescription[0];
+
+ // Skip FVD attributed - N/A
+ result.attributes = new AttributeDescription[0];
+
+ // Set FVD members
+ // 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.
+ 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]);
+
+ if ((!(java.rmi.Remote.class.isAssignableFrom(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++) {
+ if ((!(java.rmi.Remote.class.isAssignableFrom(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 (java.io.Serializable.class.isAssignableFrom(superClass))
+ result.base_value = vhandler.getRMIRepositoryID(superClass);
+ else
+ result.base_value = "";
+
+ // Set FVD type
+ //result.type = createTypeCodeForClass(orb, osc.forClass());
+ result.type = orb.get_primitive_tc(TCKind.tk_value); //11638
+
+ return result;
+
+ }
+
+ private static ValueMember[] translateMembers (ORB orb,
+ ObjectStreamClass osc,
+ ValueHandler vh,
+ IdentityKeyValueStack createdIDs)
+ {
+ ValueHandlerImpl vhandler = (com.sun.corba.se.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.
+ for (int i = 0; i < fieldsLength; i++) {
+ String valRepId = vhandler.getRMIRepositoryID(fields[i].getClazz());
+ members[i] = new ValueMember();
+ members[i].name = fields[i].getName();
+ members[i].id = valRepId; // _REVISIT_ : Manglings
+ members[i].defined_in = vhandler.getDefinedInId(valRepId);// _REVISIT_ : Manglings
+ members[i].version = "1.0";
+ members[i].type_def = new _IDLTypeStub(); // _REVISIT_ : IDLType implementation missing
+
+ 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
+ // ptc-00-01-06 1.3.5.6 says that the IDL field
+ // should be private in this case.
+ members[i].access = PRIVATE_MEMBER;
+ } else {
+ int m = fields[i].getField().getModifiers();
+ if (Modifier.isPublic(m))
+ members[i].access = PUBLIC_MEMBER;
+ else
+ members[i].access = PRIVATE_MEMBER;
+ }
+
+ switch (fields[i].getTypeCode()) {
+ case 'B':
+ members[i].type = orb.get_primitive_tc(TCKind.tk_octet); //11638
+ break;
+ case 'C':
+ members[i].type
+ = orb.get_primitive_tc(vhandler.getJavaCharTCKind()); // 11638
+ break;
+ case 'F':
+ members[i].type = orb.get_primitive_tc(TCKind.tk_float); //11638
+ break;
+ case 'D' :
+ members[i].type = orb.get_primitive_tc(TCKind.tk_double); //11638
+ break;
+ case 'I':
+ members[i].type = orb.get_primitive_tc(TCKind.tk_long); //11638
+ break;
+ case 'J':
+ members[i].type = orb.get_primitive_tc(TCKind.tk_longlong); //11638
+ break;
+ case 'S':
+ members[i].type = orb.get_primitive_tc(TCKind.tk_short); //11638
+ break;
+ case 'Z':
+ members[i].type = orb.get_primitive_tc(TCKind.tk_boolean); //11638
+ break;
+ // case '[':
+ // members[i].type = orb.get_primitive_tc(TCKind.tk_value_box); //11638
+ // members[i].id = RepositoryId.createForAnyType(fields[i].getType());
+ // break;
+ default:
+ members[i].type = createTypeCodeForClassInternal(orb, fields[i].getClazz(), vhandler,
+ createdIDs);
+ members[i].id = vhandler.createForAnyType(fields[i].getType());
+ break;
+ } // end switch
+
+ } // end for loop
+
+ return members;
+ }
+
+ 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){
+
+ if (exists(clzRepositoryId, type.supported_interfaces))
+ return true;
+
+ if (clzRepositoryId.equals(type.id))
+ return true;
+
+ 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. This is used to detect recursive types.
+ IdentityKeyValueStack createdIDs = new IdentityKeyValueStack();
+ // 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)
+ {
+ // This wrapper method is the protection against infinite recursion.
+ TypeCode tc = null;
+ String id = (String)createdIDs.get(c);
+ if (id != null) {
+ return orb.create_recursive_tc(id);
+ } else {
+ id = vh.getRMIRepositoryID(c);
+ 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);
+ tc = createTypeCodeInternal(orb, c, vh, id, createdIDs);
+ createdIDs.pop();
+ return tc;
+ }
+ }
+
+ // Maintains a stack of key-value pairs. Compares elements using == operator.
+ private static class IdentityKeyValueStack {
+ private static class KeyValuePair {
+ Object key;
+ Object value;
+ KeyValuePair(Object key, Object value) {
+ this.key = key;
+ this.value = value;
+ }
+ boolean equals(KeyValuePair pair) {
+ return pair.key == this.key;
+ }
+ }
+
+ Stack pairs = null;
+
+ Object get(Object key) {
+ if (pairs == null) {
+ return null;
+ }
+ for (Iterator i = pairs.iterator(); i.hasNext();) {
+ KeyValuePair pair = (KeyValuePair)i.next();
+ if (pair.key == key) {
+ return pair.value;
+ }
+ }
+ return null;
+ }
+
+ void push(Object key, Object value) {
+ if (pairs == null) {
+ pairs = new Stack();
+ }
+ pairs.push(new KeyValuePair(key, value));
+ }
+
+ void pop() {
+ pairs.pop();
+ }
+ }
+
+ private static TypeCode createTypeCodeInternal (ORB orb,
+ java.lang.Class c,
+ ValueHandler vh,
+ String id,
+ IdentityKeyValueStack createdIDs)
+ {
+ if ( c.isArray() ) {
+ // Arrays - may recurse for multi-dimensional arrays
+ Class componentClass = c.getComponentType();
+ TypeCode embeddedType;
+ if ( componentClass.isPrimitive() ){
+ embeddedType
+ = ValueUtility.getPrimitiveTypeCodeForClass(orb,
+ componentClass,
+ vh);
+ } else {
+ 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 ) {
+ // Strings
+ TypeCode t = orb.create_string_tc (0);
+ return orb.create_value_box_tc (id, "StringValue", t);
+ } else if (java.rmi.Remote.class.isAssignableFrom(c)) {
+ return orb.get_primitive_tc(TCKind.tk_objref);
+ } else if (org.omg.CORBA.Object.class.isAssignableFrom(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));
+ }
+
+ // type modifier
+ // REVISIT truncatable and abstract?
+ 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 && java.io.Serializable.class.isAssignableFrom(superClass)) {
+ base = createTypeCodeForClassInternal(orb, superClass, vh, createdIDs);
+ }
+
+ // members
+ 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) {
+
+ if (c == Integer.TYPE) {
+ return orb.get_primitive_tc (TCKind.tk_long);
+ } else if (c == Byte.TYPE) {
+ return orb.get_primitive_tc (TCKind.tk_octet);
+ } else if (c == Long.TYPE) {
+ return orb.get_primitive_tc (TCKind.tk_longlong);
+ } else if (c == Float.TYPE) {
+ return orb.get_primitive_tc (TCKind.tk_float);
+ } 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);
+ } else if (c == Character.TYPE) {
+ return orb.get_primitive_tc (((ValueHandlerImpl)vh).getJavaCharTCKind());
+ } else if (c == Boolean.TYPE) {
+ return orb.get_primitive_tc (TCKind.tk_boolean);
+ } else {
+ // _REVISIT_ Not sure if this is right.
+ return orb.get_primitive_tc (TCKind.tk_any);
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java
new file mode 100644
index 0000000..39affb1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ByteBuffer.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.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.<p>
+ *
+ * Any array elements following the last element in the ByteBuffer are 0.
+ */
+ protected byte elementData[];
+
+ /**
+ * The number of valid components in this {@code ByteBuffer} object.
+ * Components {@code elementData[0]} through
+ * {@code elementData[elementCount-1]} are the actual items.
+ *
+ * @serial
+ */
+ 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.
+ *
+ * @serial
+ */
+ protected int capacityIncrement;
+
+ /**
+ * 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
+ */
+ public ByteBuffer(int initialCapacity, int capacityIncrement) {
+ super();
+ if (initialCapacity < 0)
+ 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.
+ *
+ * @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 {@code 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 {@code 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;
+ if (elementCount < oldCapacity) {
+ byte oldData[] = elementData;
+ elementData = new byte[elementCount];
+ System.arraycopy(oldData, 0, elementData, 0, elementCount);
+ }
+ }
+
+ /**
+ * 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);
+ if (newCapacity < minCapacity) {
+ newCapacity = minCapacity;
+ }
+ elementData = new byte[newCapacity];
+ System.arraycopy(oldData, 0, elementData, 0, elementCount);
+ }
+ }
+
+ /**
+ * Returns the current capacity of this ByteBuffer.
+ *
+ * @return the current capacity (the length of its internal
+ * data arary, kept in the field {@code elementData}
+ * of this ByteBuffer.
+ */
+ public int capacity() {
+ return elementData.length;
+ }
+
+ /**
+ * Returns the number of components in this ByteBuffer.
+ *
+ * @return the number of components in this ByteBuffer.
+ */
+ public int size() {
+ return elementCount;
+ }
+
+ /**
+ * Tests if this ByteBuffer has no components.
+ *
+ * @return {@code true} if and only if this ByteBuffer has
+ * no components, that is, its size is zero;
+ * {@code false} otherwise.
+ */
+ public boolean isEmpty() {
+ return elementCount == 0;
+ }
+
+ public void append(byte value)
+ {
+ ensureCapacityHelper(elementCount + 1);
+ elementData[elementCount++] = value;
+ }
+
+ public void append( int value )
+ {
+ ensureCapacityHelper(elementCount + 4);
+ 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 ;
+ }
+ 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 ;
+ }
+
+ /**
+ * Returns an array containing all of the elements in this ByteBuffer
+ * in the correct order.
+ *
+ * @since 1.2
+ */
+ public byte[] toArray() {
+ return elementData ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java
new file mode 100644
index 0000000..63cdcae
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/EncapsulationUtility.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.util.List;
+import java.util.LinkedList;
+import java.util.Iterator;
+
+import org.omg.IOP.TAG_INTERNET_IOP ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+import com.sun.corba.se.spi.ior.Identifiable ;
+import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
+import com.sun.corba.se.spi.ior.WriteContents ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.ior.FreezableList ;
+
+import com.sun.corba.se.impl.encoding.CDROutputStream ;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
+import com.sun.corba.se.impl.encoding.EncapsInputStream ;
+
+import sun.corba.EncapsInputStreamFactory;
+
+/**
+ * This static utility class contains various utility methods for reading and
+ * writing CDR encapsulations.
+ *
+ * @author Ken Cavanaugh
+ */
+public class EncapsulationUtility
+{
+ private EncapsulationUtility()
+ {
+ }
+
+ /** Read the count from is, then read count Identifiables from
+ * is using the factory. Add each constructed Identifiable to container.
+ */
+ public static 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() ;
+ Identifiable 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.
+ */
+ public static void writeIdentifiableSequence( List container, OutputStream os)
+ {
+ os.write_long( container.size() ) ;
+ Iterator iter = container.iterator() ;
+ while (iter.hasNext()) {
+ Identifiable obj = (Identifiable)( iter.next() ) ;
+ 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.
+ */
+ static public void writeOutputStream( OutputStream dataStream,
+ OutputStream os )
+ {
+ byte[] data = ((CDROutputStream)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.
+ */
+ static public InputStream getEncapsulationStream( InputStream is )
+ {
+ byte[] data = readOctets( is ) ;
+ EncapsInputStream result = EncapsInputStreamFactory.newEncapsInputStream( is.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.
+ */
+ static public byte[] readOctets( InputStream is )
+ {
+ int len = is.read_ulong() ;
+ byte[] data = new byte[len] ;
+ is.read_octet_array( data, 0, len ) ;
+ return data ;
+ }
+
+ static public void writeEncapsulation( WriteContents obj,
+ OutputStream os )
+ {
+ EncapsOutputStream out =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)os.orb());
+
+ out.putEndian() ;
+
+ obj.writeContents( out ) ;
+
+ writeOutputStream( out, os ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/FreezableList.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/FreezableList.java
new file mode 100644
index 0000000..8eb0511
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/FreezableList.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior ;
+
+import java.util.Collection ;
+import java.util.List ;
+import java.util.AbstractList ;
+import java.util.ListIterator ;
+import java.util.Iterator ;
+
+import com.sun.corba.se.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.
+*/
+public class FreezableList extends AbstractList {
+ private List delegate = null ;
+ private boolean immutable = false ;
+
+ public boolean equals( Object obj )
+ {
+ if (obj == null)
+ return false ;
+
+ if (!(obj instanceof FreezableList))
+ return false ;
+
+ FreezableList other = (FreezableList)obj ;
+
+ return delegate.equals( other.delegate ) &&
+ (immutable == other.immutable) ;
+ }
+
+ public int hashCode()
+ {
+ return delegate.hashCode() ;
+ }
+
+ public FreezableList( List delegate, boolean immutable )
+ {
+ this.delegate = delegate ;
+ this.immutable = immutable ;
+ }
+
+ public FreezableList( List delegate )
+ {
+ this( delegate, false ) ;
+ }
+
+ public void makeImmutable()
+ {
+ immutable = true ;
+ }
+
+ public boolean isImmutable()
+ {
+ return immutable ;
+ }
+
+ public void makeElementsImmutable()
+ {
+ Iterator iter = iterator() ;
+ while (iter.hasNext()) {
+ Object obj = iter.next() ;
+ if (obj instanceof MakeImmutable) {
+ MakeImmutable element = (MakeImmutable)obj ;
+ element.makeImmutable() ;
+ }
+ }
+ }
+
+ // Methods overridden from AbstractList
+
+ public int size()
+ {
+ return delegate.size() ;
+ }
+
+ public Object get(int index)
+ {
+ return delegate.get(index) ;
+ }
+
+ public Object set(int index, Object element)
+ {
+ if (immutable)
+ throw new UnsupportedOperationException() ;
+
+ return delegate.set(index, element) ;
+ }
+
+ public void add(int index, Object element)
+ {
+ if (immutable)
+ throw new UnsupportedOperationException() ;
+
+ delegate.add(index, element) ;
+ }
+
+ public Object remove(int index)
+ {
+ if (immutable)
+ throw new UnsupportedOperationException() ;
+
+ return delegate.remove(index) ;
+ }
+
+ // We also override subList so that the result is a FreezableList.
+ public List subList(int fromIndex, int toIndex)
+ {
+ List list = delegate.subList(fromIndex, toIndex) ;
+ List result = new FreezableList( list, immutable ) ;
+ return result ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericIdentifiable.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericIdentifiable.java
new file mode 100644
index 0000000..1226d92
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericIdentifiable.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.util.Arrays ;
+
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import com.sun.corba.se.spi.ior.Identifiable ;
+
+/**
+ * This is used for unknown components and profiles. A TAG_MULTICOMPONENT_PROFILE will be represented this way.
+ */
+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 int getId()
+ {
+ return id ;
+ }
+
+ 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 boolean equals(Object obj)
+ {
+ if (obj == null)
+ return false ;
+
+ if (!(obj instanceof GenericIdentifiable))
+ return false ;
+
+ GenericIdentifiable encaps = (GenericIdentifiable)obj ;
+
+ return (getId() == encaps.getId()) &&
+ Arrays.equals( getData(), encaps.getData() ) ;
+ }
+
+ public int hashCode()
+ {
+ int result = 17 ;
+ for (int ctr=0; ctr<data.length; ctr++ )
+ result = 37*result + data[ctr] ;
+ return result ;
+ }
+
+ public GenericIdentifiable(int id, byte[] data)
+ {
+ this.id = id ;
+ this.data = (byte[])(data.clone()) ;
+ }
+
+ public byte[] getData()
+ {
+ return data ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedComponent.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedComponent.java
new file mode 100644
index 0000000..b6d946b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedComponent.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import org.omg.CORBA.ORB ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+
+public class GenericTaggedComponent extends GenericIdentifiable
+ implements TaggedComponent
+{
+ public GenericTaggedComponent( int id, InputStream is )
+ {
+ super( id, is ) ;
+ }
+
+ public GenericTaggedComponent( int id, byte[] data )
+ {
+ super( id, data ) ;
+ }
+
+ /**
+ * @return org.omg.IOP.TaggedComponent
+ */
+ public org.omg.IOP.TaggedComponent getIOPComponent( ORB orb )
+ {
+ return new org.omg.IOP.TaggedComponent( getId(),
+ getData() ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java
new file mode 100644
index 0000000..20269e9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/GenericTaggedProfile.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import com.sun.corba.se.spi.ior.TaggedProfile ;
+import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.ObjectKey ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+
+import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
+
+public class GenericTaggedProfile extends GenericIdentifiable implements TaggedProfile
+{
+ private ORB orb ;
+
+ public GenericTaggedProfile( int id, InputStream is )
+ {
+ super( id, is ) ;
+ this.orb = (ORB)(is.orb()) ;
+ }
+
+ public GenericTaggedProfile( ORB orb, int id, byte[] data )
+ {
+ super( id, data ) ;
+ this.orb = orb ;
+ }
+
+ public TaggedProfileTemplate getTaggedProfileTemplate()
+ {
+ return null ;
+ }
+
+ public ObjectId getObjectId()
+ {
+ return null ;
+ }
+
+ public ObjectKeyTemplate getObjectKeyTemplate()
+ {
+ return null ;
+ }
+
+ public ObjectKey getObjectKey()
+ {
+ return null ;
+ }
+
+ public boolean isEquivalent( TaggedProfile prof )
+ {
+ return equals( prof ) ;
+ }
+
+ public void makeImmutable()
+ {
+ // NO-OP
+ }
+
+ public boolean isLocal()
+ {
+ return false ;
+ }
+
+ public org.omg.IOP.TaggedProfile getIOPProfile()
+ {
+ EncapsOutputStream os =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream(orb);
+ write( os ) ;
+ InputStream is = (InputStream)(os.create_input_stream()) ;
+ return org.omg.IOP.TaggedProfileHelper.read( is ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORImpl.java
new file mode 100644
index 0000000..8c531d0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORImpl.java
@@ -0,0 +1,338 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.util.ListIterator ;
+import java.util.Iterator ;
+import java.util.Map ;
+import java.util.HashMap ;
+
+import java.io.StringWriter;
+import java.io.IOException;
+
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import org.omg.IOP.TAG_INTERNET_IOP ;
+
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
+import com.sun.corba.se.spi.ior.TaggedProfile ;
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.IORTemplate ;
+import com.sun.corba.se.spi.ior.IORTemplateList ;
+import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
+import com.sun.corba.se.spi.ior.IdentifiableContainerBase ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.IORFactories ;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.encoding.MarshalOutputStream;
+
+import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+
+import com.sun.corba.se.impl.orbutil.HexOutputStream;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+import com.sun.corba.se.impl.logging.IORSystemException ;
+
+// XXX remove this once getProfile is gone
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
+
+/** 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 addXXX 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 ;
+ private boolean isCachedHashValue = false;
+ private int cachedHashValue;
+ IORSystemException wrapper ;
+
+ 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.
+ */
+ private IORTemplateList iortemps = null ;
+
+ public boolean equals( Object obj )
+ {
+ if (obj == null)
+ return false ;
+
+ if (!(obj instanceof IOR))
+ return false ;
+
+ IOR other = (IOR)obj ;
+
+ return super.equals( obj ) && typeId.equals( other.getTypeId() ) ;
+ }
+
+ public synchronized int hashCode()
+ {
+ if (! isCachedHashValue) {
+ cachedHashValue = (super.hashCode() ^ typeId.hashCode());
+ isCachedHashValue = true;
+ }
+ return cachedHashValue;
+ }
+
+ /** Construct an empty IOR. This is needed for null object references.
+ */
+ public IORImpl( ORB orb )
+ {
+ this( orb, "" ) ;
+ }
+
+ public IORImpl( ORB orb, String typeid )
+ {
+ factory = orb ;
+ wrapper = IORSystemException.get( orb,
+ CORBALogDomains.OA_IOR ) ;
+ this.typeId = typeid ;
+ }
+
+ /** Construct an IOR from an IORTemplate by applying the same
+ * object id to each TaggedProfileTemplate in the IORTemplate.
+ */
+ 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() ;
+ Iterator templateIterator = iortemp.iterator() ;
+
+ while (templateIterator.hasNext()) {
+ TaggedProfileTemplate ptemp =
+ (TaggedProfileTemplate)(templateIterator.next()) ;
+
+ TaggedProfile profile = ptemp.create( oktemp, id ) ;
+
+ add( profile ) ;
+ }
+ }
+
+ /** Construct an IOR from an IORTemplate by applying the same
+ * object id to each TaggedProfileTemplate in the IORTemplate.
+ */
+ public IORImpl( ORB orb, String typeId, IORTemplateList iortemps, ObjectId id)
+ {
+ this( orb, typeId ) ;
+
+ this.iortemps = iortemps ;
+
+ Iterator iter = iortemps.iterator() ;
+ while (iter.hasNext()) {
+ IORTemplate iortemp = (IORTemplate)(iter.next()) ;
+ addTaggedProfiles( iortemp, id ) ;
+ }
+
+ makeImmutable() ;
+ }
+
+ public IORImpl(InputStream is)
+ {
+ this( (ORB)(is.orb()), is.read_string() ) ;
+
+ IdentifiableFactoryFinder finder =
+ factory.getTaggedProfileFactoryFinder() ;
+
+ EncapsulationUtility.readIdentifiableSequence( this, finder, is ) ;
+
+ makeImmutable() ;
+ }
+
+ public String getTypeId()
+ {
+ return typeId ;
+ }
+
+ public void write(OutputStream os)
+ {
+ os.write_string( typeId ) ;
+ EncapsulationUtility.writeIdentifiableSequence( this, os ) ;
+ }
+
+ public String stringify()
+ {
+ StringWriter bs;
+
+ MarshalOutputStream s =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
+ s.putEndian();
+ write( (OutputStream)s );
+ bs = new StringWriter();
+ try {
+ s.writeTo(new HexOutputStream(bs));
+ } catch (IOException ex) {
+ throw wrapper.stringifyWriteError( ex ) ;
+ }
+
+ return ORBConstants.STRINGIFY_PREFIX + bs;
+ }
+
+ public synchronized void makeImmutable()
+ {
+ makeElementsImmutable() ;
+
+ if (iortemps != null)
+ iortemps.makeImmutable() ;
+
+ super.makeImmutable() ;
+ }
+
+ public org.omg.IOP.IOR getIOPIOR() {
+ EncapsOutputStream os =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream(factory);
+ write(os);
+ InputStream is = (InputStream) (os.create_input_stream());
+ return org.omg.IOP.IORHelper.read(is);
+ }
+
+ 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
+ // null objref with a non-empty typeId string.
+ //
+ return ((size() == 0) /* && (typeId.length() == 0) */);
+ }
+
+ public boolean isEquivalent(IOR ior)
+ {
+ Iterator myIterator = iterator() ;
+ Iterator otherIterator = ior.iterator() ;
+ while (myIterator.hasNext() && otherIterator.hasNext()) {
+ TaggedProfile myProfile = (TaggedProfile)(myIterator.next()) ;
+ TaggedProfile otherProfile = (TaggedProfile)(otherIterator.next()) ;
+ if (!myProfile.isEquivalent( otherProfile ))
+ return false ;
+ }
+
+ return myIterator.hasNext() == otherIterator.hasNext() ;
+ }
+
+ private void initializeIORTemplateList()
+ {
+ // Maps ObjectKeyTemplate to IORTemplate
+ Map oktempToIORTemplate = new HashMap() ;
+
+ iortemps = IORFactories.makeIORTemplateList() ;
+ Iterator iter = iterator() ;
+ ObjectId oid = null ; // used to check that all profiles have the same oid.
+ while (iter.hasNext()) {
+ TaggedProfile prof = (TaggedProfile)(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() ))
+ throw wrapper.badOidInIorTemplateList() ;
+
+ // Find or create the IORTemplate for oktemp.
+ IORTemplate iortemp = (IORTemplate)(oktempToIORTemplate.get( oktemp )) ;
+ if (iortemp == null) {
+ iortemp = IORFactories.makeIORTemplate( oktemp ) ;
+ oktempToIORTemplate.put( oktemp, iortemp ) ;
+ iortemps.add( iortemp ) ;
+ }
+
+ iortemp.add( ptemp ) ;
+ }
+
+ 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.
+ */
+ public synchronized IORTemplateList getIORTemplates()
+ {
+ if (iortemps == null)
+ initializeIORTemplateList() ;
+
+ return iortemps ;
+ }
+
+ /** Return the first IIOPProfile in this IOR.
+ * XXX THIS IS TEMPORARY FOR BACKWARDS COMPATIBILITY AND WILL BE REMOVED
+ * SOON!
+ */
+ public IIOPProfile getProfile()
+ {
+ IIOPProfile iop = null ;
+ Iterator iter = iteratorById( TAG_INTERNET_IOP.value ) ;
+ if (iter.hasNext())
+ iop = (IIOPProfile)(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() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORTemplateImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORTemplateImpl.java
new file mode 100644
index 0000000..2b99c88
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORTemplateImpl.java
@@ -0,0 +1,137 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.util.Iterator ;
+
+import org.omg.CORBA.INTERNAL ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import org.omg.IOP.TAG_INTERNET_IOP ;
+
+import com.sun.corba.se.spi.ior.IdentifiableContainerBase ;
+import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
+import com.sun.corba.se.spi.ior.IORTemplate ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.IORFactory ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+/**
+ * This class is a container of TaggedProfileTemplates.
+ */
+public class IORTemplateImpl extends IdentifiableContainerBase implements IORTemplate
+{
+ private ObjectKeyTemplate oktemp ;
+
+ public boolean equals( Object obj )
+ {
+ if (obj == null)
+ return false ;
+
+ if (!(obj instanceof IORTemplateImpl))
+ return false ;
+
+ IORTemplateImpl other = (IORTemplateImpl)obj ;
+
+ return super.equals( obj ) && oktemp.equals( other.getObjectKeyTemplate() ) ;
+ }
+
+ public int hashCode()
+ {
+ return super.hashCode() ^ oktemp.hashCode() ;
+ }
+
+ public ObjectKeyTemplate getObjectKeyTemplate()
+ {
+ return 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 boolean isEquivalent( IORFactory other )
+ {
+ if (!(other instanceof IORTemplate))
+ return false ;
+
+ IORTemplate list = (IORTemplate)other ;
+
+ Iterator thisIterator = iterator() ;
+ Iterator listIterator = list.iterator() ;
+ while (thisIterator.hasNext() && listIterator.hasNext()) {
+ TaggedProfileTemplate thisTemplate =
+ (TaggedProfileTemplate)thisIterator.next() ;
+ TaggedProfileTemplate listTemplate =
+ (TaggedProfileTemplate)listIterator.next() ;
+ if (!thisTemplate.isEquivalent( listTemplate ))
+ return false ;
+ }
+
+ 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.
+ */
+ public void makeImmutable()
+ {
+ makeElementsImmutable() ;
+ super.makeImmutable() ;
+ }
+
+ 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() ;
+
+ oktemp = orb.getObjectKeyFactory().createTemplate( is ) ;
+ EncapsulationUtility.readIdentifiableSequence( this, finder, is ) ;
+
+ makeImmutable() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORTemplateListImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORTemplateListImpl.java
new file mode 100644
index 0000000..ec1d821
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IORTemplateListImpl.java
@@ -0,0 +1,129 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+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 com.sun.corba.se.spi.ior.IORTemplate ;
+import com.sun.corba.se.spi.ior.IORTemplateList ;
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.IORTemplate ;
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.IORFactory ;
+import com.sun.corba.se.spi.ior.IORFactories ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+public class IORTemplateListImpl extends FreezableList implements IORTemplateList
+{
+ /* This class must override add( int, Object ) and set( int, Object )
+ * so that adding an IORTemplateList to an IORTemplateList just results
+ * in a list of TaggedProfileTemplates.
+ */
+ public Object set( int index, Object element )
+ {
+ if (element instanceof IORTemplate) {
+ return super.set( index, element ) ;
+ } else if (element instanceof IORTemplateList) {
+ Object result = remove( index ) ;
+ add( index, element ) ;
+ return result ;
+ } else
+ throw new IllegalArgumentException() ;
+ }
+
+ public void add( int index, Object element )
+ {
+ if (element instanceof IORTemplate) {
+ super.add( index, element ) ;
+ } else if (element instanceof IORTemplateList) {
+ IORTemplateList tl = (IORTemplateList)element ;
+ addAll( index, tl ) ;
+ } else
+ throw new IllegalArgumentException() ;
+ }
+
+ public IORTemplateListImpl()
+ {
+ super( new ArrayList() ) ;
+ }
+
+ public IORTemplateListImpl( InputStream is )
+ {
+ this() ;
+ int size = is.read_long() ;
+ for (int ctr=0; ctr<size; ctr++) {
+ IORTemplate iortemp = IORFactories.makeIORTemplate( is ) ;
+ add( iortemp ) ;
+ }
+
+ makeImmutable() ;
+ }
+
+ public void makeImmutable()
+ {
+ makeElementsImmutable() ;
+ super.makeImmutable() ;
+ }
+
+ public void write( OutputStream os )
+ {
+ os.write_long( size() ) ;
+ Iterator iter = iterator() ;
+ while (iter.hasNext()) {
+ IORTemplate iortemp = (IORTemplate)(iter.next()) ;
+ iortemp.write( os ) ;
+ }
+ }
+
+ public IOR makeIOR( ORB orb, String typeid, ObjectId oid )
+ {
+ return new IORImpl( orb, typeid, this, oid ) ;
+ }
+
+ public boolean isEquivalent( IORFactory other )
+ {
+ if (!(other instanceof IORTemplateList))
+ return false ;
+
+ IORTemplateList list = (IORTemplateList)other ;
+
+ Iterator thisIterator = iterator() ;
+ Iterator listIterator = list.iterator() ;
+ while (thisIterator.hasNext() && listIterator.hasNext()) {
+ IORTemplate thisTemplate = (IORTemplate)thisIterator.next() ;
+ IORTemplate listTemplate = (IORTemplate)listIterator.next() ;
+ if (!thisTemplate.isEquivalent( listTemplate ))
+ return false ;
+ }
+
+ return thisIterator.hasNext() == listIterator.hasNext() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IdentifiableFactoryFinderBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IdentifiableFactoryFinderBase.java
new file mode 100644
index 0000000..89cc94c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/IdentifiableFactoryFinderBase.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import java.util.Map ;
+import java.util.HashMap ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.ior.Identifiable ;
+import com.sun.corba.se.spi.ior.IdentifiableFactory ;
+import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.IORSystemException ;
+
+public abstract class IdentifiableFactoryFinderBase implements
+ IdentifiableFactoryFinder
+{
+ private ORB orb ;
+ private Map map ;
+ protected IORSystemException wrapper ;
+
+ protected IdentifiableFactoryFinderBase( ORB orb )
+ {
+ map = new HashMap() ;
+ this.orb = orb ;
+ wrapper = IORSystemException.get( orb,
+ CORBALogDomains.OA_IOR ) ;
+ }
+
+ protected IdentifiableFactory getFactory(int id)
+ {
+ Integer ident = new Integer( id ) ;
+ IdentifiableFactory factory = (IdentifiableFactory)(map.get(
+ ident ) ) ;
+ return factory ;
+ }
+
+ public abstract Identifiable handleMissingFactory( int id, InputStream is ) ;
+
+ public Identifiable create(int id, InputStream is)
+ {
+ IdentifiableFactory factory = getFactory( id ) ;
+
+ if (factory != null)
+ return factory.create( is ) ;
+ else
+ return handleMissingFactory( id, is ) ;
+ }
+
+ public void registerFactory(IdentifiableFactory factory)
+ {
+ Integer ident = new Integer( factory.getId() ) ;
+ map.put( ident, factory ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/JIDLObjectKeyTemplate.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/JIDLObjectKeyTemplate.java
new file mode 100644
index 0000000..3e7b9c2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/JIDLObjectKeyTemplate.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+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.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.spi.orb.ORBVersionFactory ;
+
+import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public final class JIDLObjectKeyTemplate extends NewObjectKeyTemplateBase
+{
+ /** This constructor reads the template ONLY from the stream.
+ */
+ public JIDLObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
+ {
+ super( orb, magic, scid, is.read_long(), JIDL_ORB_ID, JIDL_OAID );
+
+ setORBVersion( is ) ;
+ }
+
+ /** This constructor reads a complete ObjectKey (template and Id)
+ * from the stream.
+ */
+ 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 ) ;
+
+ 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() ) ;
+ }
+
+ protected void writeTemplate( OutputStream os )
+ {
+ os.write_long( getMagic() ) ;
+ os.write_long( getSubcontractId() ) ;
+ os.write_long( getServerId() ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/NewObjectKeyTemplateBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/NewObjectKeyTemplateBase.java
new file mode 100644
index 0000000..691927a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/NewObjectKeyTemplateBase.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.io.IOException ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.spi.orb.ORBVersionFactory ;
+
+import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
+
+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( new Integer( magic ) ) ;
+ }
+
+ public void write(ObjectId objectId, OutputStream os)
+ {
+ super.write( objectId, 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 ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdArray.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdArray.java
new file mode 100644
index 0000000..bb98e46
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdArray.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior ;
+
+import java.util.Iterator ;
+import java.util.Arrays ;
+
+public class ObjectAdapterIdArray extends ObjectAdapterIdBase {
+ private final String[] objectAdapterId ;
+
+ public ObjectAdapterIdArray( String[] objectAdapterId )
+ {
+ this.objectAdapterId = objectAdapterId ;
+ }
+
+ /** Special constructor used for OA IDs of length 2.
+ */
+ public ObjectAdapterIdArray( String name1, String name2 )
+ {
+ objectAdapterId = new String[2] ;
+ objectAdapterId[0] = name1 ;
+ objectAdapterId[1] = name2 ;
+ }
+
+ public int getNumLevels()
+ {
+ return objectAdapterId.length ;
+ }
+
+ public Iterator iterator()
+ {
+ return Arrays.asList( objectAdapterId ).iterator() ;
+ }
+
+ public String[] getAdapterName()
+ {
+ return (String[])(objectAdapterId.clone()) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdBase.java
new file mode 100644
index 0000000..febce61
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdBase.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior ;
+
+import java.util.Iterator ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+
+abstract class ObjectAdapterIdBase implements ObjectAdapterId {
+ public boolean equals( Object other )
+ {
+ if (!(other instanceof ObjectAdapterId))
+ return false ;
+
+ ObjectAdapterId theOther = (ObjectAdapterId)other ;
+
+ Iterator iter1 = iterator() ;
+ Iterator iter2 = theOther.iterator() ;
+
+ while (iter1.hasNext() && iter2.hasNext()) {
+ String str1 = (String)(iter1.next()) ;
+ String str2 = (String)(iter2.next()) ;
+
+ if (!str1.equals( str2 ))
+ return false ;
+ }
+
+ return iter1.hasNext() == iter2.hasNext() ;
+ }
+
+ public int hashCode()
+ {
+ int result = 17 ;
+ Iterator iter = iterator() ;
+ while (iter.hasNext()) {
+ String str = (String)(iter.next()) ;
+ result = 37*result + str.hashCode() ;
+ }
+ return result ;
+ }
+
+ public String toString()
+ {
+ StringBuffer buff = new StringBuffer() ;
+ buff.append( "ObjectAdapterID[" ) ;
+ Iterator iter = iterator() ;
+ boolean first = true ;
+ while (iter.hasNext()) {
+ String str = (String)(iter.next()) ;
+
+ if (first)
+ first = false ;
+ else
+ buff.append( "/" ) ;
+
+ buff.append( str ) ;
+ }
+
+ buff.append( "]" ) ;
+
+ return buff.toString() ;
+ }
+
+ public void write( OutputStream os )
+ {
+ os.write_long( getNumLevels() ) ;
+ Iterator iter = iterator() ;
+ while (iter.hasNext()) {
+ String str = (String)(iter.next()) ;
+ os.write_string( str ) ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java
new file mode 100644
index 0000000..4fc9852
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectAdapterIdNumber.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior ;
+
+import java.util.Iterator ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+/** 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 {@code { "OldRootPOA", "<number>" }},
+ * and provide an extra method to get the number back.
+ */
+public class ObjectAdapterIdNumber extends ObjectAdapterIdArray {
+ private int poaid ;
+
+ public ObjectAdapterIdNumber( int poaid )
+ {
+ super( "OldRootPOA", Integer.toString( poaid ) ) ;
+ this.poaid = poaid ;
+ }
+
+ public int getOldPOAId()
+ {
+ return poaid ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectIdImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectIdImpl.java
new file mode 100644
index 0000000..200f045
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectIdImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.util.Arrays ;
+import com.sun.corba.se.spi.ior.ObjectId ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+public final class ObjectIdImpl implements ObjectId
+{
+ private byte[] id;
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof ObjectIdImpl))
+ return false ;
+
+ ObjectIdImpl other = (ObjectIdImpl)obj ;
+
+ return Arrays.equals( this.id, other.id ) ;
+ }
+
+ public int hashCode()
+ {
+ int result = 17 ;
+ for (int ctr=0; ctr<id.length; ctr++)
+ result = 37*result + id[ctr] ;
+ return result ;
+ }
+
+ public ObjectIdImpl( byte[] id )
+ {
+ this.id = id ;
+ }
+
+ public byte[] getId()
+ {
+ return id ;
+ }
+
+ public void write( OutputStream os )
+ {
+ os.write_long( id.length ) ;
+ os.write_octet_array( id, 0, id.length ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java
new file mode 100644
index 0000000..d774994
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyFactoryImpl.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.io.IOException ;
+
+import org.omg.CORBA.MARSHAL ;
+import org.omg.CORBA.OctetSeqHolder ;
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectKey ;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+import com.sun.corba.se.impl.ior.JIDLObjectKeyTemplate ;
+import com.sun.corba.se.impl.ior.POAObjectKeyTemplate ;
+import com.sun.corba.se.impl.ior.WireObjectKeyTemplate ;
+import com.sun.corba.se.impl.ior.ObjectIdImpl ;
+import com.sun.corba.se.impl.ior.ObjectKeyImpl ;
+import com.sun.corba.se.impl.logging.IORSystemException ;
+
+import com.sun.corba.se.impl.encoding.EncapsInputStream ;
+import sun.corba.EncapsInputStreamFactory;
+
+
+/** Based on the magic and scid, return the appropriate
+* ObjectKeyTemplate. Expects to be called with a valid
+* magic. If scid is not valid, null should be returned.
+*/
+interface Handler {
+ ObjectKeyTemplate handle( int magic, int scid,
+ InputStream is, OctetSeqHolder osh ) ;
+}
+
+/** Singleton used to manufacture ObjectKey and ObjectKeyTemplate
+ * instances.
+ * @author Ken Cavanaugh
+ */
+public class ObjectKeyFactoryImpl implements ObjectKeyFactory
+{
+ public static final int MAGIC_BASE = 0xAFABCAFE ;
+
+ // Magic used in our object keys for JDK 1.2, 1.3, RMI-IIOP OP,
+ // J2EE 1.0-1.2.1.
+ public static final int JAVAMAGIC_OLD = MAGIC_BASE ;
+
+ // Magic used only in JDK 1.3.1. No format changes in object keys.
+ public static final int JAVAMAGIC_NEW = MAGIC_BASE + 1 ;
+
+ // New magic used in our object keys for JDK 1.4, J2EE 1.3 and later.
+ // Format changes: all object keys have version string; POA key format
+ // is changed.
+ public static final int JAVAMAGIC_NEWER = MAGIC_BASE + 2 ;
+
+ public static final int MAX_MAGIC = JAVAMAGIC_NEWER ;
+
+ // Beginning in JDK 1.3.1_01, we introduced changes which required
+ // the ability to distinguish between JDK 1.3.1 FCS and the patch
+ // versions. See OldJIDLObjectKeyTemplate.
+ public static final byte JDK1_3_1_01_PATCH_LEVEL = 1;
+
+ private final ORB orb ;
+ private IORSystemException wrapper ;
+
+ public ObjectKeyFactoryImpl( ORB orb )
+ {
+ this.orb = orb ;
+ wrapper = IORSystemException.get( orb,
+ CORBALogDomains.OA_IOR ) ;
+ }
+
+ // XXX The handlers still need to be made pluggable.
+ //
+ // I think this can be done as follows:
+ // 1. Move the Handler interface into the SPI as ObjectKeyHandler.
+ // 2. Add two methods to ObjectAdapterFactory:
+ // ObjectKeyHandler getHandlerForObjectKey( ) ;
+ // ObjectKeyHandler getHandlerForObjectKeyTemplate( ) ;
+ // 3. Move the implementation of the fullKey handler and the
+ // oktempOnly handler into TOAFactory and POAFactory.
+ // 4. Move the ObjectKey impl classes into the impl/oa packages.
+ // 5. Create an internal interface
+ // interface HandlerFinder {
+ // ObjectKeyHandler get( int scid ) ;
+ // }
+ // and modify create(InputStream,Handler,OctetSeqHolder)
+ // to take a HandlerFinder instead of a Handler.
+ // 6. Modify create( byte[] ) and createTemplate( InputStream )
+ // to create an instance of HandlerFinder: something like:
+ // new HandlerFinder() {
+ // ObjectKeyHandler get( int scid )
+ // {
+ // return orb.getRequestDispatcherRegistry().
+ // getObjectAdapterFactory( scid ).getHandlerForObjectKey() ;
+ // }
+ // and similarly for getHandlerForObjectKeyTemplate.
+
+ /** This handler reads the full object key, both the oktemp
+ * and the ID.
+ */
+ private Handler fullKey = 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, 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.
+ */
+ 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 ) ;
+ }
+
+ 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 ;
+
+ try {
+ is.mark(0) ;
+ int magic = is.read_long() ;
+
+ if (validMagic( magic )) {
+ int scid = is.read_long() ;
+ oktemp = handler.handle( magic, scid, is, osh ) ;
+ }
+ } catch (MARSHAL mexc) {
+ // XXX log this error
+ // ignore this: error handled below because oktemp == null
+ }
+
+ if (oktemp == null)
+ // If we did not successfully construct a oktemp, reset the
+ // stream so that WireObjectKeyTemplate can correctly construct the
+ // object key.
+ try {
+ is.reset() ;
+ } catch (IOException exc) {
+ // XXX log this error
+ // ignore this
+ }
+
+ return oktemp ;
+ }
+
+ public ObjectKey create( byte[] key )
+ {
+ OctetSeqHolder osh = new OctetSeqHolder() ;
+ EncapsInputStream is = EncapsInputStreamFactory.newEncapsInputStream( orb, key, key.length );
+
+ ObjectKeyTemplate oktemp = create( is, fullKey, osh ) ;
+ if (oktemp == null)
+ oktemp = new WireObjectKeyTemplate( is, osh ) ;
+
+ ObjectId oid = new ObjectIdImpl( osh.value ) ;
+ return new ObjectKeyImpl( oktemp, oid ) ;
+ }
+
+ public ObjectKeyTemplate createTemplate( InputStream is )
+ {
+ ObjectKeyTemplate oktemp = create( is, oktempOnly, null ) ;
+ if (oktemp == null)
+ oktemp = new WireObjectKeyTemplate( orb ) ;
+
+ return oktemp ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java
new file mode 100644
index 0000000..ddf84a3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyImpl.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectKey ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+
+import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
+
+public class ObjectKeyImpl implements ObjectKey
+{
+ private ObjectKeyTemplate oktemp;
+ private ObjectId id;
+
+ public boolean equals( Object obj )
+ {
+ if (obj == null)
+ return false ;
+
+ if (!(obj instanceof ObjectKeyImpl))
+ return false ;
+
+ ObjectKeyImpl other = (ObjectKeyImpl)obj ;
+
+ return oktemp.equals( other.oktemp ) &&
+ id.equals( other.id ) ;
+ }
+
+ public int hashCode()
+ {
+ return oktemp.hashCode() ^ id.hashCode() ;
+ }
+
+ public ObjectKeyTemplate getTemplate()
+ {
+ return oktemp ;
+ }
+
+ public ObjectId getId()
+ {
+ return id ;
+ }
+
+ public ObjectKeyImpl( ObjectKeyTemplate oktemp, ObjectId id )
+ {
+ this.oktemp = oktemp ;
+ this.id = id ;
+ }
+
+ public void write( OutputStream os )
+ {
+ oktemp.write( id, os ) ;
+ }
+
+ public byte[] getBytes( org.omg.CORBA.ORB orb )
+ {
+ EncapsOutputStream os =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
+ write( os ) ;
+ return os.toByteArray() ;
+ }
+
+ public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb )
+ {
+ return oktemp.getServerRequestDispatcher( orb, id ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyTemplateBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyTemplateBase.java
new file mode 100644
index 0000000..6f0cfbe
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectKeyTemplateBase.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.util.Iterator ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+
+import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
+
+import com.sun.corba.se.impl.logging.IORSystemException ;
+
+
+public abstract class ObjectKeyTemplateBase implements ObjectKeyTemplate
+{
+ // 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 ) ;
+
+ private ORB orb ;
+ protected IORSystemException wrapper ;
+ private ORBVersion version ;
+ private int magic ;
+ private int scid ;
+ private int serverid ;
+ private String orbid ;
+ private ObjectAdapterId oaid ;
+
+ private byte[] adapterId ;
+
+ public byte[] getAdapterId()
+ {
+ return (byte[])(adapterId.clone()) ;
+ }
+
+ private byte[] computeAdapterId()
+ {
+ // write out serverid, orbid, oaid
+ ByteBuffer buff = new ByteBuffer() ;
+
+ buff.append( getServerId() ) ;
+ buff.append( orbid ) ;
+
+ buff.append( oaid.getNumLevels() ) ;
+ Iterator iter = oaid.iterator() ;
+ while (iter.hasNext()) {
+ String comp = (String)(iter.next()) ;
+ buff.append( comp ) ;
+ }
+
+ buff.trimToSize() ;
+
+ return buff.toArray() ;
+ }
+
+ public ObjectKeyTemplateBase( ORB orb, int magic, int scid, int serverid,
+ String orbid, ObjectAdapterId oaid )
+ {
+ this.orb = orb ;
+ this.wrapper = IORSystemException.get( orb,
+ CORBALogDomains.OA_IOR ) ;
+ this.magic = magic ;
+ this.scid = scid ;
+ this.serverid = serverid ;
+ this.orbid = orbid ;
+ this.oaid = oaid ;
+
+ adapterId = computeAdapterId() ;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof ObjectKeyTemplateBase))
+ return false ;
+
+ 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 )) ;
+ }
+
+ 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 ;
+ }
+
+ public int getSubcontractId()
+ {
+ return scid ;
+ }
+
+ public int getServerId()
+ {
+ return serverid ;
+ }
+
+ public String getORBId()
+ {
+ return orbid ;
+ }
+
+ public ObjectAdapterId getObjectAdapterId()
+ {
+ return oaid ;
+ }
+
+ public void write(ObjectId objectId, OutputStream os)
+ {
+ writeTemplate( os ) ;
+ objectId.write( os ) ;
+ }
+
+ public void write( OutputStream os )
+ {
+ writeTemplate( os ) ;
+ }
+
+ abstract protected void writeTemplate( OutputStream os ) ;
+
+ protected int getMagic()
+ {
+ 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 ORBVersion getORBVersion()
+ {
+ 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 ;
+ }
+
+ public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id )
+ {
+ return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( scid ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl.java
new file mode 100644
index 0000000..cb5424c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior ;
+
+import java.util.Iterator ;
+
+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 com.sun.corba.se.spi.oa.ObjectAdapter ;
+
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactory;
+import com.sun.corba.se.spi.ior.IORTemplateList;
+import com.sun.corba.se.spi.ior.IORFactories;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+import com.sun.corba.se.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
+{
+ transient private IORTemplateList iorTemplates ;
+
+ public ObjectReferenceFactoryImpl( InputStream is )
+ {
+ super( (ORB)(is.orb()) ) ;
+ _read( is ) ;
+ }
+
+ public ObjectReferenceFactoryImpl( ORB orb, IORTemplateList iortemps )
+ {
+ super( orb ) ;
+ iorTemplates = iortemps ;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof ObjectReferenceFactoryImpl))
+ return false ;
+
+ ObjectReferenceFactoryImpl other = (ObjectReferenceFactoryImpl)obj ;
+
+ return (iorTemplates != null) &&
+ iorTemplates.equals( other.iorTemplates ) ;
+ }
+
+ 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
+ // of the abstract valuetype, should that become necessary.
+ public static final String repositoryId =
+ "IDL:com/sun/corba/se/impl/ior/ObjectReferenceFactoryImpl:1.0" ;
+
+ public String[] _truncatable_ids()
+ {
+ return new String[] { repositoryId } ;
+ }
+
+ 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 ;
+
+ iorTemplates = IORFactories.makeIORTemplateList( istr ) ;
+ }
+
+ /** 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 ;
+
+ iorTemplates.write( ostr ) ;
+ }
+
+ public IORFactory getIORFactory()
+ {
+ return iorTemplates ;
+ }
+
+ public IORTemplateList getIORTemplateList()
+ {
+ return iorTemplates ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceProducerBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceProducerBase.java
new file mode 100644
index 0000000..f4a3a60
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceProducerBase.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.ior.IORFactory ;
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.IORFactories ;
+import com.sun.corba.se.spi.ior.IORTemplateList ;
+import com.sun.corba.se.spi.ior.ObjectId ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+import com.sun.corba.se.impl.logging.IORSystemException ;
+
+public abstract class ObjectReferenceProducerBase {
+ transient protected ORB orb ;
+
+ public abstract IORFactory getIORFactory() ;
+
+ public abstract IORTemplateList getIORTemplateList() ;
+
+ 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 ) ;
+
+ return ORBUtility.makeObjectReference( ior ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl.java
new file mode 100644
index 0000000..267f2db
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior ;
+
+import java.util.Iterator ;
+
+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.ObjectReferenceTemplate ;
+import org.omg.PortableInterceptor.ObjectReferenceTemplateHelper ;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter ;
+
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactory;
+import com.sun.corba.se.spi.ior.IORTemplate;
+import com.sun.corba.se.spi.ior.IORTemplateList;
+import com.sun.corba.se.spi.ior.IORFactories;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+import com.sun.corba.se.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
+{
+ transient private IORTemplate iorTemplate ;
+
+ public ObjectReferenceTemplateImpl( InputStream is )
+ {
+ super( (ORB)(is.orb()) ) ;
+ _read( is ) ;
+ }
+
+ public ObjectReferenceTemplateImpl( ORB orb, IORTemplate iortemp )
+ {
+ super( orb ) ;
+ iorTemplate = iortemp ;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof ObjectReferenceTemplateImpl))
+ return false ;
+
+ ObjectReferenceTemplateImpl other = (ObjectReferenceTemplateImpl)obj ;
+
+ return (iorTemplate != null) &&
+ iorTemplate.equals( other.iorTemplate ) ;
+ }
+
+ 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
+ // of the abstract valuetype, should that become necessary.
+ public static final String repositoryId =
+ "IDL:com/sun/corba/se/impl/ior/ObjectReferenceTemplateImpl:1.0" ;
+
+ public String[] _truncatable_ids()
+ {
+ return new String[] { repositoryId } ;
+ }
+
+ public TypeCode _type()
+ {
+ return ObjectReferenceTemplateHelper.type() ;
+ }
+
+ /** 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()) ;
+ }
+
+ /** 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 ;
+
+ iorTemplate.write( ostr ) ;
+ }
+
+ public String server_id ()
+ {
+ int val = iorTemplate.getObjectKeyTemplate().getServerId() ;
+ return Integer.toString( val ) ;
+ }
+
+ public String orb_id ()
+ {
+ return iorTemplate.getObjectKeyTemplate().getORBId() ;
+ }
+
+ public String[] adapter_name()
+ {
+ ObjectAdapterId poaid =
+ iorTemplate.getObjectKeyTemplate().getObjectAdapterId() ;
+
+ return poaid.getAdapterName() ;
+ }
+
+ public IORFactory getIORFactory()
+ {
+ return iorTemplate ;
+ }
+
+ public IORTemplateList getIORTemplateList()
+ {
+ IORTemplateList tl = IORFactories.makeIORTemplateList() ;
+ tl.add( iorTemplate ) ;
+ tl.makeImmutable() ;
+ return tl ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldJIDLObjectKeyTemplate.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldJIDLObjectKeyTemplate.java
new file mode 100644
index 0000000..e5b854c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldJIDLObjectKeyTemplate.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+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.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.spi.orb.ORBVersionFactory ;
+
+import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream ;
+
+/**
+ * Handles object keys created by JDK ORBs from before JDK 1.4.0.
+ */
+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.
+ */
+ 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 );
+
+ 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.
+ *
+ * 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.
+ */
+ if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW &&
+ osh.value.length > ((CDRInputStream)is).getPosition()) {
+
+ patchVersion = is.read_octet();
+
+ if (patchVersion == ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL)
+ setORBVersion(ORBVersionFactory.getJDK1_3_1_01());
+ else if (patchVersion > ObjectKeyFactoryImpl.JDK1_3_1_01_PATCH_LEVEL)
+ setORBVersion(ORBVersionFactory.getORBVersion());
+ else
+ throw wrapper.invalidJdk131PatchLevel( new Integer( patchVersion ) ) ;
+ }
+ }
+
+
+ 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() ) ;
+ }
+
+ protected void writeTemplate( OutputStream os )
+ {
+ os.write_long( getMagic() ) ;
+ os.write_long( getSubcontractId() ) ;
+ os.write_long( getServerId() ) ;
+ }
+
+ public void write(ObjectId objectId, OutputStream os)
+ {
+ super.write(objectId, os);
+
+ if (patchVersion != OldJIDLObjectKeyTemplate.NULL_PATCH_VERSION)
+ os.write_octet( patchVersion ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldObjectKeyTemplateBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldObjectKeyTemplateBase.java
new file mode 100644
index 0000000..e68d6f6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldObjectKeyTemplateBase.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.spi.orb.ORBVersionFactory ;
+
+import com.sun.corba.se.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 ) ;
+
+ // set version based on magic
+ if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_OLD)
+ setORBVersion( ORBVersionFactory.getOLD() ) ;
+ else if (magic == ObjectKeyFactoryImpl.JAVAMAGIC_NEW)
+ setORBVersion( ORBVersionFactory.getNEW() ) ;
+ else // any other magic should not be here
+ throw wrapper.badMagic( new Integer( magic ) ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldPOAObjectKeyTemplate.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldPOAObjectKeyTemplate.java
new file mode 100644
index 0000000..626310c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/OldPOAObjectKeyTemplate.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+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.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.spi.orb.ORBVersionFactory ;
+
+import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public final class OldPOAObjectKeyTemplate extends OldObjectKeyTemplateBase
+{
+ /** This constructor reads the template ONLY from the stream
+ */
+ 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.
+ */
+ 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 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 ) ;
+
+ ObjectAdapterIdNumber oaid = (ObjectAdapterIdNumber)(getObjectAdapterId()) ;
+ int poaid = oaid.getOldPOAId() ;
+ os.write_long( poaid ) ;
+ }
+
+ public ORBVersion getORBVersion()
+ {
+ if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_OLD)
+ return ORBVersionFactory.getOLD() ;
+ else if (getMagic() == ObjectKeyFactoryImpl.JAVAMAGIC_NEW)
+ return ORBVersionFactory.getNEW() ;
+ else
+ throw new INTERNAL() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/POAObjectKeyTemplate.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/POAObjectKeyTemplate.java
new file mode 100644
index 0000000..3a8eac0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/POAObjectKeyTemplate.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.util.Iterator ;
+
+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.se.spi.activation.POANameHelper ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.spi.orb.ORBVersionFactory ;
+
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+
+import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
+
+public final class POAObjectKeyTemplate extends NewObjectKeyTemplateBase
+{
+ /** This constructor reads the template ONLY from the stream.
+ */
+ public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is )
+ {
+ super( orb, magic, scid, is.read_long(), is.read_string(),
+ new ObjectAdapterIdArray( POANameHelper.read( is ) ) ) ;
+
+ setORBVersion( is ) ;
+ }
+
+ /** This constructor reads a complete ObjectKey (template and Id)
+ * from the stream.
+ */
+ public POAObjectKeyTemplate( ORB orb, int magic, int scid, InputStream is,
+ OctetSeqHolder osh )
+ {
+ super( orb, magic, scid, is.read_long(), is.read_string(),
+ new ObjectAdapterIdArray( POANameHelper.read( is ) ) ) ;
+
+ osh.value = readObjectKey( 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 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/src/java.corba/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java
new file mode 100644
index 0000000..3c455e3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/StubIORImpl.java
@@ -0,0 +1,267 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.io.ObjectInputStream ;
+import java.io.ObjectOutputStream ;
+import java.io.IOException ;
+import java.io.StringWriter ;
+
+import org.omg.CORBA.ORB ;
+
+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.se.spi.presentation.rmi.StubAdapter ;
+import com.sun.corba.se.impl.orbutil.HexOutputStream ;
+
+/**
+ * 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
+{
+ // cached hash code
+ private int hashCode;
+
+ // IOR components
+ private byte[] typeData;
+ private int[] profileTags;
+ private byte[][] profileData;
+
+ public StubIORImpl()
+ {
+ hashCode = 0 ;
+ typeData = null ;
+ profileTags = null ;
+ profileData = null ;
+ }
+
+ public String getRepositoryId()
+ {
+ if (typeData == null)
+ return null ;
+
+ return new String( typeData ) ;
+ }
+
+ public StubIORImpl( org.omg.CORBA.Object obj )
+ {
+ // 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();
+
+ // read the IOR components back from the stream
+ int typeLength = istr.read_long();
+ typeData = new byte[typeLength];
+ istr.read_octet_array(typeData, 0, typeLength);
+ int numProfiles = istr.read_long();
+ profileTags = new int[numProfiles];
+ profileData = new byte[numProfiles][];
+ 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);
+ }
+ }
+
+ public Delegate getDelegate( ORB orb )
+ {
+ // write the 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);
+ ostr.write_long(profileTags.length);
+ 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);
+ }
+
+ InputStream istr = ostr.create_input_stream() ;
+
+ // read the IOR back from the stream
+ org.omg.CORBA.Object obj = (org.omg.CORBA.Object)istr.read_Object();
+ return StubAdapter.getDelegate( obj ) ;
+ }
+
+ public void doRead( java.io.ObjectInputStream stream )
+ throws IOException, ClassNotFoundException
+ {
+ // read the IOR from the ObjectInputStream
+ int typeLength = stream.readInt();
+ typeData = new byte[typeLength];
+ stream.readFully(typeData);
+ int numProfiles = stream.readInt();
+ profileTags = new int[numProfiles];
+ profileData = new byte[numProfiles][];
+ for (int i = 0; i < numProfiles; i++) {
+ profileTags[i] = stream.readInt();
+ profileData[i] = new byte[stream.readInt()];
+ stream.readFully(profileData[i]);
+ }
+ }
+
+ public void doWrite( ObjectOutputStream stream )
+ throws IOException
+ {
+ // write the IOR to the ObjectOutputStream
+ stream.writeInt(typeData.length);
+ stream.write(typeData);
+ stream.writeInt(profileTags.length);
+ for (int i = 0; i < profileTags.length; i++) {
+ stream.writeInt(profileTags[i]);
+ stream.writeInt(profileData[i].length);
+ stream.write(profileData[i]);
+ }
+ }
+
+ /**
+ * 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()
+ {
+ if (hashCode == 0) {
+
+ // compute the hash code
+ for (int i = 0; i < typeData.length; i++) {
+ hashCode = hashCode * 37 + typeData[i];
+ }
+
+ for (int i = 0; i < profileTags.length; i++) {
+ hashCode = hashCode * 37 + profileTags[i];
+ for (int j = 0; j < profileData[i].length; j++) {
+ hashCode = hashCode * 37 + profileData[i][j];
+ }
+ }
+ }
+
+ return hashCode;
+ }
+
+ private boolean equalArrays( int[] data1, int[] data2 )
+ {
+ if (data1.length != data2.length)
+ return false ;
+
+ for (int ctr=0; ctr<data1.length; ctr++) {
+ if (data1[ctr] != data2[ctr])
+ return false ;
+ }
+
+ return true ;
+ }
+
+ private boolean equalArrays( byte[] data1, byte[] data2 )
+ {
+ if (data1.length != data2.length)
+ return false ;
+
+ for (int ctr=0; ctr<data1.length; ctr++) {
+ if (data1[ctr] != data2[ctr])
+ return false ;
+ }
+
+ return true ;
+ }
+
+ private boolean equalArrays( byte[][] data1, byte[][] data2 )
+ {
+ if (data1.length != data2.length)
+ return false ;
+
+ for (int ctr=0; ctr<data1.length; ctr++) {
+ if (!equalArrays( data1[ctr], data2[ctr] ))
+ return false ;
+ }
+
+ return true ;
+ }
+
+ public boolean equals(java.lang.Object obj)
+ {
+ if (this == obj) {
+ return true;
+ }
+
+ if (!(obj instanceof StubIORImpl)) {
+ return false;
+ }
+
+ StubIORImpl other = (StubIORImpl) obj;
+ if (other.hashCode() != this.hashCode()) {
+ return false;
+ }
+
+ return equalArrays( typeData, other.typeData ) &&
+ equalArrays( profileTags, other.profileTags ) &&
+ equalArrays( profileData, other.profileData ) ;
+ }
+
+ private void appendByteArray( StringBuffer result, byte[] data )
+ {
+ for ( int ctr=0; ctr<data.length; ctr++ ) {
+ result.append( Integer.toHexString( data[ctr] ) ) ;
+ }
+ }
+
+ /**
+ * Returns a string representation of this stub. Returns the same string
+ * for all stubs that represent the same remote object.
+ * {@code "SimpleIORImpl[<typeName>,[<profileID>]data, ...]"}
+ * @return a string representation of this stub.
+ */
+ public String toString()
+ {
+ StringBuffer result = new StringBuffer() ;
+ result.append( "SimpleIORImpl[" ) ;
+ String repositoryId = new String( typeData ) ;
+ result.append( repositoryId ) ;
+ for (int ctr=0; ctr<profileTags.length; ctr++) {
+ result.append( ",(" ) ;
+ result.append( profileTags[ctr] ) ;
+ result.append( ")" ) ;
+ appendByteArray( result, profileData[ctr] ) ;
+ }
+
+ result.append( "]" ) ;
+ return result.toString() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java
new file mode 100644
index 0000000..db334e7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedComponentFactoryFinderImpl.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.sun.corba.se.spi.ior.Identifiable ;
+import com.sun.corba.se.spi.ior.IdentifiableFactory ;
+import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder ;
+
+import com.sun.corba.se.impl.ior.GenericTaggedComponent ;
+import com.sun.corba.se.impl.ior.IdentifiableFactoryFinderBase ;
+
+import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public class TaggedComponentFactoryFinderImpl extends
+ IdentifiableFactoryFinderBase implements TaggedComponentFactoryFinder
+{
+ public TaggedComponentFactoryFinderImpl( ORB orb )
+ {
+ super( orb ) ;
+ }
+
+ public Identifiable 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 =
+ sun.corba.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() ;
+
+ return (TaggedComponent)create( comp.tag, is ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedProfileFactoryFinderImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedProfileFactoryFinderImpl.java
new file mode 100644
index 0000000..da5b1cb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedProfileFactoryFinderImpl.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import com.sun.corba.se.spi.ior.Identifiable ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.ior.IdentifiableFactoryFinderBase ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+public class TaggedProfileFactoryFinderImpl extends
+ IdentifiableFactoryFinderBase
+{
+ public TaggedProfileFactoryFinderImpl( ORB orb )
+ {
+ super( orb ) ;
+ }
+
+ public Identifiable handleMissingFactory( int id, InputStream is)
+ {
+ return new GenericTaggedProfile( id, is ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java
new file mode 100644
index 0000000..ed09d58
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TaggedProfileTemplateFactoryFinderImpl.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import com.sun.corba.se.spi.ior.Identifiable ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.ior.IdentifiableFactoryFinderBase ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import org.omg.CORBA.INTERNAL ;
+
+public class TaggedProfileTemplateFactoryFinderImpl extends
+ IdentifiableFactoryFinderBase
+{
+ public TaggedProfileTemplateFactoryFinderImpl( ORB orb )
+ {
+ super( orb ) ;
+ }
+
+ public Identifiable handleMissingFactory( int id, InputStream is)
+ {
+ throw wrapper.taggedProfileTemplateFactoryNotFound( new Integer(id) ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TestAssertions b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TestAssertions
new file mode 100644
index 0000000..b74041a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/TestAssertions
@@ -0,0 +1,136 @@
+Remaining work
+- Look at the relation between TaggedComponents and Codecs.
+- Add TaggedComponentFactories to ORB init
+- look at PI and codecs
+- Implement PoliciesComponent
+
+=====================
+Testing:
+Tagged Components: (DONE)
+ General:
+ - Constructed data can be retrieved
+ - read and written correctly as part of IOR
+ (test this first in IdEncapsulationContainerBase test)
+ AlternateIIOPAddressComponent:
+ - can correctly write out TCP port >32K
+ CodeSetsComponent
+ - none additional
+ JavaCodebaseComponent
+ - none additional
+ ORBTypeComponent
+ - none additional
+ PoliciesComponent
+ - none additional
+
+IdentifiableContainerBase (DONE)
+ - Test iteratorById on Identifiables (DONE)
+ - Iterator on id not present is empty (hasNext() == false)
+ - Iterator on id present returns all ids in sequence
+IdEncapsulationContainerBase (DONE)
+ - Test read sequence of TaggedComponents
+ - Test writing sequence of TaggedComponents
+GenericIdEncapsulation (DONE)
+ - Test by using for tagged profile and tagged component
+ - write out and read back test
+IIOPAddress (DONE)
+ - Constructed object returns correct values
+ - equals:
+ - false for non-IIOPAddress value
+ - true iff ports and hosts match
+IIOPProfile (DONE)
+ - construct from id, template; check that correct values are returned
+ - write out and read back
+ - no components for 1.0
+ - components for >1.0
+ - getObjectKey returns value constructed correctly
+ - isEquivalent iff ids equal and templates equivalent
+IIOPProfileTemplate (DONE)
+ - Constructed object contains correct values
+ - isEquivalent iff address and template are equal
+ - cannot have new components added after makeImmutable call
+IOR (DONE)
+ - Constructed object contains correct values
+ - IOR() has null typeid and no profiles (DONE)
+ - IOR( String ) has given typeid and no profiles (DONE)
+ - IOR( String, IIOPProfileTemplate, ObjectId ) has given typeid and
+ one IIOPProfile corresponding to template and objectid
+ - IOR( String, IORTemplate, ObjectId ) has profiles corresponding to
+ IORTemplate and ObjectIds. (DONE)
+ - IORTemplate( String, IORTemplate, ObjectIds ) has profiles
+ corresponding to IORTemplate and ObjectIds (DONE)
+ - IOR( IORTemplate, ObjectIds ) usual test (DONE)
+ - write out/read back test (DONE)
+ - Construct IOR with 2 IIOPProfiles, each with several components,
+ and 2 GenericIdEncapsulation profiles, write out, read back,
+ check for equals directly and by calling equals
+ - cannot have new profiles added after makeImmutable call (DONE)
+ - contained IIOPProfiles cannot have added components after
+ makeImmutable call. (DONE)
+IORTemplate (DONE)
+ - Constructed object contains correct value
+JIDLObjectKeyTemplate (DONE)
+ - test that IDs match expected values when created from
+ byte[] in ObjectKeyFactory.create
+ - Constructed object contains correct values
+ - write out and read back test
+ - getId correctly extract id from key
+FreezableList (DONE)
+ - ASSUME that it acts like a linked list: don't test entire interface
+ - all modification operations throw UnsupportedOperationException
+ after makeImmutable call
+ - all iterators (whether created before or after makeImmutable call)
+ throw U.O.E. after makeImmutable
+ObjectId (DONE)
+ - constructed object returns same id
+ - test cases in equals
+ObjectKey (DONE)
+ - constructed object returns same id, template
+ - write/read test
+ - getBytes returns correct value (test by using factory and
+ comparing)
+ObjectKeyFactory (DONE)
+ - test create with hand created keys
+ - key length < 4
+ - key length >= 4
+ - magic is JAVAMAGIC
+ - scid is POA scid
+ - scid is JIDL scid
+ - other scid
+ - magic is not JAVAMAGIC
+ - test with error cases on length
+POAObjectKeyTemplate (DONE)
+ - test that IDs match expected values when created from
+ byte[] in ObjectKeyFactory.create
+ - test that IDs match when created with explicit values
+ - write out and read back test
+ - getId correctly extracts id from key
+TaggedComponentFactories (DONE)
+ - only tested inditectly by reading and writing IIOPProfileTemplate
+ that contains all components
+TaggedComponentFactoryFinder (DONE)
+ - registered factory can be looked up
+ - lookup of unregistered factory returns null
+ - reads tagged component from stream as correct type if registered
+ - reads tagged component from stream as generic if not registered
+TaggedProfileFactoryFinder (DONE)
+ - reads IIOP profile as IIOPProfile
+ - reads others as Generic
+WireObjectTemplate (DONE)
+ - getId returns entire key as id
+ - serverId is -1
+ - write out and read back test
+
+Interfaces (no tests):
+ IdEncapsulation
+ IdEncapsulationFactory
+ IdEncapsulationFactoryFinder
+ Identifiable
+ ObjectKeyTemplateo
+ ObjectKeyTemplate
+ TaggedComponent
+ TaggedProfile
+ TaggedProfileTemplate
+ Writeable
+
+Trivial classes:
+ ObjectIds
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/WireObjectKeyTemplate.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/WireObjectKeyTemplate.java
new file mode 100644
index 0000000..b80e00e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/WireObjectKeyTemplate.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior;
+
+import org.omg.CORBA.OctetSeqHolder ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.spi.orb.ORBVersionFactory ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream ;
+
+import com.sun.corba.se.impl.logging.IORSystemException ;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public class WireObjectKeyTemplate implements ObjectKeyTemplate
+{
+ private ORB orb ;
+ private IORSystemException wrapper ;
+
+ public boolean equals( Object obj )
+ {
+ if (obj == null)
+ return false ;
+
+ return obj instanceof WireObjectKeyTemplate ;
+ }
+
+ public int hashCode()
+ {
+ return 53 ; // All WireObjectKeyTemplates are the same, so they should
+ // have the same hashCode.
+ }
+
+ private byte[] getId( InputStream is )
+ {
+ CDRInputStream cis = (CDRInputStream)is ;
+ int len = cis.getBufferLength() ;
+ byte[] result = new byte[ len ] ;
+ cis.read_octet_array( result, 0, len ) ;
+ return result ;
+ }
+
+ public WireObjectKeyTemplate( ORB orb )
+ {
+ initORB( orb ) ;
+ }
+
+ public WireObjectKeyTemplate( InputStream is, OctetSeqHolder osh )
+ {
+ osh.value = getId( is ) ;
+ initORB( (ORB)(is.orb())) ;
+ }
+
+ private void initORB( ORB orb )
+ {
+ this.orb = orb ;
+ wrapper = IORSystemException.get( orb,
+ CORBALogDomains.OA_IOR ) ;
+ }
+
+ public void write( ObjectId id, OutputStream os )
+ {
+ byte[] key = id.getId() ;
+ os.write_octet_array( key, 0, key.length ) ;
+ }
+
+ public void write( OutputStream os )
+ {
+ // Does nothing
+ }
+
+ 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
+ * to return an invalid server id.
+ */
+ public int getServerId()
+ {
+ return -1 ;
+ }
+
+ public String getORBId()
+ {
+ throw wrapper.orbIdNotAvailable() ;
+ }
+
+ public ObjectAdapterId getObjectAdapterId()
+ {
+ 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 ORBVersion getORBVersion()
+ {
+ return ORBVersionFactory.getFOREIGN() ;
+ }
+
+ public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id )
+ {
+ byte[] bid = id.getId() ;
+ String str = new String( bid ) ;
+ return orb.getRequestDispatcherRegistry().getServerRequestDispatcher( str ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java
new file mode 100644
index 0000000..231dac6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/AlternateIIOPAddressComponentImpl.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior.iiop;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.TaggedComponentBase ;
+
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent ;
+
+import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public class AlternateIIOPAddressComponentImpl extends TaggedComponentBase
+ implements AlternateIIOPAddressComponent
+{
+ private IIOPAddress addr ;
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof AlternateIIOPAddressComponentImpl))
+ return false ;
+
+ AlternateIIOPAddressComponentImpl other =
+ (AlternateIIOPAddressComponentImpl)obj ;
+
+ return addr.equals( other.addr ) ;
+ }
+
+ public int hashCode()
+ {
+ return addr.hashCode() ;
+ }
+
+ public String toString()
+ {
+ return "AlternateIIOPAddressComponentImpl[addr=" + addr + "]" ;
+ }
+
+ public AlternateIIOPAddressComponentImpl( IIOPAddress addr )
+ {
+ this.addr = addr ;
+ }
+
+ public IIOPAddress getAddress()
+ {
+ return addr ;
+ }
+
+ 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
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/CodeSetsComponentImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/CodeSetsComponentImpl.java
new file mode 100644
index 0000000..1bc03c6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/CodeSetsComponentImpl.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior.iiop;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.TaggedComponentBase ;
+
+import com.sun.corba.se.spi.ior.iiop.CodeSetsComponent ;
+
+import org.omg.IOP.TAG_CODE_SETS ;
+
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
+import com.sun.corba.se.impl.encoding.MarshalOutputStream ;
+import com.sun.corba.se.impl.encoding.MarshalInputStream ;
+
+public class CodeSetsComponentImpl extends TaggedComponentBase
+ implements CodeSetsComponent
+{
+ CodeSetComponentInfo csci ;
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof CodeSetsComponentImpl))
+ return false ;
+
+ CodeSetsComponentImpl other = (CodeSetsComponentImpl)obj ;
+
+ return csci.equals( other.csci ) ;
+ }
+
+ public int hashCode()
+ {
+ return csci.hashCode() ;
+ }
+
+ public String toString()
+ {
+ return "CodeSetsComponentImpl[csci=" + csci + "]" ;
+ }
+
+ public CodeSetsComponentImpl()
+ {
+ // Uses our default code sets (see CodeSetComponentInfo)
+ csci = new CodeSetComponentInfo() ;
+ }
+
+ public CodeSetsComponentImpl( InputStream is )
+ {
+ csci = new CodeSetComponentInfo() ;
+ csci.read( (MarshalInputStream)is ) ;
+ }
+
+ public CodeSetsComponentImpl(com.sun.corba.se.spi.orb.ORB orb)
+ {
+ if (orb == null)
+ csci = new CodeSetComponentInfo();
+ else
+ csci = orb.getORBData().getCodeSetComponentInfo();
+ }
+
+ public CodeSetComponentInfo getCodeSetComponentInfo()
+ {
+ return csci ;
+ }
+
+ 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
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressBase.java
new file mode 100644
index 0000000..cc91839
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressBase.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior.iiop ;
+
+import org.omg.CORBA.BAD_PARAM ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+
+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
+ // ints throught this code, except that marshalling requires a
+ // scaling conversion. intToShort and shortToInt are provided
+ // for this purpose.
+ protected short intToShort( int value )
+ {
+ if (value > 32767)
+ return (short)(value - 65536) ;
+ return (short)value ;
+ }
+
+ protected int shortToInt( short value )
+ {
+ if (value < 0)
+ return value + 65536 ;
+ return value ;
+ }
+
+ public void write( OutputStream os )
+ {
+ os.write_string( getHost() ) ;
+ int port = getPort() ;
+ os.write_short( intToShort( port ) ) ;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof IIOPAddress))
+ return false ;
+
+ IIOPAddress other = (IIOPAddress)obj ;
+
+ return getHost().equals(other.getHost()) &&
+ (getPort() == other.getPort()) ;
+ }
+
+ public int hashCode()
+ {
+ return getHost().hashCode() ^ getPort() ;
+ }
+
+ public String toString()
+ {
+ return "IIOPAddress[" + getHost() + "," + getPort() + "]" ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressClosureImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressClosureImpl.java
new file mode 100644
index 0000000..80ecfac
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressClosureImpl.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior.iiop;
+
+import org.omg.CORBA.BAD_PARAM ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.orbutil.closure.Closure ;
+
+public final class IIOPAddressClosureImpl extends IIOPAddressBase
+{
+ private Closure host;
+ private Closure port;
+
+ public IIOPAddressClosureImpl( Closure host, Closure port )
+ {
+ this.host = host ;
+ this.port = port ;
+ }
+
+ public String getHost()
+ {
+ return (String)(host.evaluate()) ;
+ }
+
+ public int getPort()
+ {
+ Integer value = (Integer)(port.evaluate()) ;
+ return value.intValue() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressImpl.java
new file mode 100644
index 0000000..255f20a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPAddressImpl.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior.iiop;
+
+import org.omg.CORBA.BAD_PARAM ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.IORSystemException ;
+
+public final class IIOPAddressImpl extends IIOPAddressBase
+{
+ private ORB orb ;
+ private IORSystemException wrapper ;
+ private String host;
+ private int port;
+
+ public IIOPAddressImpl( ORB orb, String host, int port )
+ {
+ this.orb = orb ;
+ wrapper = IORSystemException.get( orb,
+ CORBALogDomains.OA_IOR ) ;
+
+ if ((port < 0) || (port > 65535))
+ throw wrapper.badIiopAddressPort( new Integer(port)) ;
+
+ this.host = host ;
+ this.port = port ;
+ }
+
+ public IIOPAddressImpl( InputStream is )
+ {
+ host = is.read_string() ;
+ short thePort = is.read_short() ;
+ port = shortToInt( thePort ) ;
+ }
+
+ public String getHost()
+ {
+ return host ;
+ }
+
+ public int getPort()
+ {
+ return port ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java
new file mode 100644
index 0000000..bb30cc8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileImpl.java
@@ -0,0 +1,348 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior.iiop;
+
+import java.util.List ;
+import java.util.Iterator ;
+
+import org.omg.CORBA.SystemException ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ;
+import org.omg.IOP.TAG_INTERNET_IOP;
+import org.omg.IOP.TAG_JAVA_CODEBASE;
+
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter ;
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
+
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+import com.sun.corba.se.spi.ior.TaggedProfile ;
+import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
+import com.sun.corba.se.spi.ior.ObjectKey ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+import com.sun.corba.se.spi.ior.IdentifiableBase ;
+import com.sun.corba.se.spi.ior.IORFactories ;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
+
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+import com.sun.corba.se.spi.ior.iiop.JavaCodebaseComponent ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.ior.EncapsulationUtility ;
+
+import com.sun.corba.se.impl.encoding.EncapsInputStream ;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
+
+import sun.corba.EncapsInputStreamFactory;
+
+import com.sun.corba.se.impl.util.JDKBridge;
+
+import com.sun.corba.se.impl.logging.IORSystemException;
+
+public class IIOPProfileImpl extends IdentifiableBase implements IIOPProfile
+{
+ private ORB orb ;
+ private IORSystemException wrapper ;
+ private ObjectId oid;
+ private IIOPProfileTemplate proftemp;
+ private ObjectKeyTemplate oktemp ;
+
+ // Cached lookups
+ protected String codebase = null ;
+ protected boolean cachedCodebase = false;
+
+ private boolean checkedIsLocal = false ;
+ private boolean cachedIsLocal = false ;
+
+ // initialize-on-demand holder
+ private static class LocalCodeBaseSingletonHolder {
+ public static JavaCodebaseComponent comp ;
+
+ static {
+ String localCodebase = JDKBridge.getLocalCodebase() ;
+ if (localCodebase == null)
+ comp = null ;
+ else
+ comp = IIOPFactories.makeJavaCodebaseComponent(
+ localCodebase ) ;
+ }
+ }
+
+ private GIOPVersion giopVersion = null;
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof IIOPProfileImpl))
+ return false ;
+
+ IIOPProfileImpl other = (IIOPProfileImpl)obj ;
+
+ return oid.equals( other.oid ) && proftemp.equals( other.proftemp ) &&
+ oktemp.equals( other.oktemp ) ;
+ }
+
+ public int hashCode()
+ {
+ return oid.hashCode() ^ proftemp.hashCode() ^ oktemp.hashCode() ;
+ }
+
+ public ObjectId getObjectId()
+ {
+ return oid ;
+ }
+
+ public TaggedProfileTemplate getTaggedProfileTemplate()
+ {
+ return proftemp ;
+ }
+
+ public ObjectKeyTemplate getObjectKeyTemplate()
+ {
+ return oktemp ;
+ }
+
+ private IIOPProfileImpl( ORB orb )
+ {
+ this.orb = orb ;
+ wrapper = IORSystemException.get( orb,
+ CORBALogDomains.OA_IOR ) ;
+ }
+
+ 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( 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() ;
+ }
+
+ EncapsInputStream istr = EncapsInputStreamFactory.newEncapsInputStream((ORB)orb, profile.profile_data,
+ profile.profile_data.length);
+ istr.consumeEndian();
+ init( 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 ) ;
+
+ ObjectKey okey = orb.getObjectKeyFactory().create( key ) ;
+ oktemp = okey.getTemplate() ;
+ oid = okey.getId() ;
+
+ proftemp = IIOPFactories.makeIIOPProfileTemplate( orb,
+ version, primary ) ;
+
+ // Handle any tagged components (if applicable)
+ if (version.getMinor() > 0)
+ 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
+ // 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 ;
+
+ if (jcc != null) {
+ if (version.getMinor() > 0)
+ proftemp.add( jcc ) ;
+
+ 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 int getId()
+ {
+ return proftemp.getId() ;
+ }
+
+ public boolean isEquivalent( TaggedProfile prof )
+ {
+ if (!(prof instanceof IIOPProfile))
+ return false ;
+
+ IIOPProfile other = (IIOPProfile)prof ;
+
+ return oid.equals( other.getObjectId() ) &&
+ proftemp.isEquivalent( other.getTaggedProfileTemplate() ) &&
+ oktemp.equals( other.getObjectKeyTemplate() ) ;
+ }
+
+ public ObjectKey getObjectKey()
+ {
+ ObjectKey result = IORFactories.makeObjectKey( oktemp, oid ) ;
+ return result ;
+ }
+
+ public org.omg.IOP.TaggedProfile getIOPProfile()
+ {
+ EncapsOutputStream os =
+ sun.corba.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 ) ;
+
+ if (iter.hasNext()) {
+ JavaCodebaseComponent jcbc = (JavaCodebaseComponent)(iter.next()) ;
+ return jcbc.getURLs() ;
+ }
+
+ return null ;
+ }
+
+ public synchronized String getCodebase() {
+ if (!cachedCodebase) {
+ cachedCodebase = true ;
+ codebase = uncachedGetCodeBase() ;
+ }
+
+ return codebase ;
+ }
+
+ /**
+ * @return the ORBVersion associated with the object key in the IOR.
+ */
+ public ORBVersion getORBVersion() {
+ return oktemp.getORBVersion();
+ }
+
+ public synchronized boolean isLocal()
+ {
+ if (!checkedIsLocal) {
+ checkedIsLocal = true ;
+ String host = proftemp.getPrimaryAddress().getHost() ;
+
+ cachedIsLocal = orb.isLocalHost(host) &&
+ orb.isLocalServerId(oktemp.getSubcontractId(),
+ oktemp.getServerId()) &&
+ orb.getLegacyServerSocketManager()
+ .legacyIsLocalServerPort(
+ proftemp.getPrimaryAddress().getPort());
+ }
+
+ return cachedIsLocal ;
+ }
+
+ /** 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.
+ * XXX revisit: do we want this at all? If we do, it might move to the
+ * ObjectKeyTemplate instead.
+ */
+ public java.lang.Object getServant()
+ {
+ if (!isLocal())
+ return null ;
+
+ RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ;
+ ObjectAdapterFactory oaf = scr.getObjectAdapterFactory(
+ oktemp.getSubcontractId() ) ;
+
+ ObjectAdapterId oaid = oktemp.getObjectAdapterId() ;
+ ObjectAdapter oa = null ;
+
+ try {
+ 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.toString() ) ;
+ return null ;
+ }
+
+ 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.
+ */
+ public synchronized GIOPVersion getGIOPVersion()
+ {
+ return proftemp.getGIOPVersion() ;
+ }
+
+ public void makeImmutable()
+ {
+ proftemp.makeImmutable() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java
new file mode 100644
index 0000000..4d3dbe5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/IIOPProfileTemplateImpl.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior.iiop;
+
+import java.util.Iterator ;
+
+import org.omg.IOP.TAG_INTERNET_IOP ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+import com.sun.corba.se.spi.ior.TaggedProfile ;
+import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
+import com.sun.corba.se.spi.ior.TaggedProfileTemplateBase ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.IdentifiableContainerBase ;
+import com.sun.corba.se.spi.ior.IdentifiableBase ;
+
+import com.sun.corba.se.impl.ior.EncapsulationUtility ;
+
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
+
+import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
+
+import com.sun.corba.se.impl.encoding.CDROutputStream ;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+import com.sun.corba.se.spi.orb.ORB ;
+
+/**
+ * If getMinorVersion==0, this does not contain any tagged components
+ */
+public class IIOPProfileTemplateImpl extends TaggedProfileTemplateBase
+ implements IIOPProfileTemplate
+{
+ private ORB orb ;
+ private GIOPVersion giopVersion ;
+ private IIOPAddress primary ;
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof IIOPProfileTemplateImpl))
+ return false ;
+
+ IIOPProfileTemplateImpl other = (IIOPProfileTemplateImpl)obj ;
+
+ return super.equals( obj ) && giopVersion.equals( other.giopVersion ) &&
+ primary.equals( other.primary ) ;
+ }
+
+ 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 GIOPVersion getGIOPVersion()
+ {
+ return giopVersion ;
+ }
+
+ public IIOPAddress getPrimaryAddress()
+ {
+ return 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() ;
+ }
+
+ 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 ) ;
+
+ makeImmutable() ;
+ }
+
+ 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.
+ // Note that this cannot be accomplished with a codec!
+
+ // Use the byte order of the given stream
+ OutputStream encapsulatedOS =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream(
+ (ORB)os.orb(), ((CDROutputStream)os).isLittleEndian() ) ;
+
+ okeyTemplate.write( id, encapsulatedOS ) ;
+ EncapsulationUtility.writeOutputStream( encapsulatedOS, 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 boolean isEquivalent( TaggedProfileTemplate temp )
+ {
+ if (!(temp instanceof IIOPProfileTemplateImpl))
+ return false ;
+
+ IIOPProfileTemplateImpl tempimp = (IIOPProfileTemplateImpl)temp ;
+
+ return primary.equals( tempimp.primary ) ;
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java
new file mode 100644
index 0000000..f7b17e0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaCodebaseComponentImpl.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior.iiop;
+
+import org.omg.IOP.TAG_JAVA_CODEBASE ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.TaggedComponentBase ;
+
+import com.sun.corba.se.spi.ior.iiop.JavaCodebaseComponent ;
+
+public class JavaCodebaseComponentImpl extends TaggedComponentBase
+ implements JavaCodebaseComponent
+{
+ private String URLs ;
+
+ public boolean equals( Object obj )
+ {
+ if (obj == null)
+ return false ;
+
+ if (!(obj instanceof JavaCodebaseComponentImpl))
+ return false ;
+
+ JavaCodebaseComponentImpl other = (JavaCodebaseComponentImpl)obj ;
+
+ return URLs.equals( other.getURLs() ) ;
+ }
+
+ public int hashCode()
+ {
+ return URLs.hashCode() ;
+ }
+
+ public String toString()
+ {
+ return "JavaCodebaseComponentImpl[URLs=" + URLs + "]" ;
+ }
+
+ public String getURLs()
+ {
+ return URLs ;
+ }
+
+ public JavaCodebaseComponentImpl( String URLs )
+ {
+ this.URLs = 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
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java
new file mode 100644
index 0000000..a89ea21
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/JavaSerializationComponent.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.ior.iiop;
+
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.TaggedComponentBase;
+
+/**
+ * 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.
+ */
+public class JavaSerializationComponent extends TaggedComponentBase {
+
+ private byte version;
+
+ private static JavaSerializationComponent singleton;
+
+ public static JavaSerializationComponent singleton() {
+ if (singleton == null) {
+ synchronized (JavaSerializationComponent.class) {
+ singleton =
+ new JavaSerializationComponent(Message.JAVA_ENC_VERSION);
+ }
+ }
+ return singleton;
+ }
+
+ public JavaSerializationComponent(byte version) {
+ this.version = version;
+ }
+
+ public byte javaSerializationVersion() {
+ return this.version;
+ }
+
+ public void writeContents(OutputStream os) {
+ os.write_octet(version);
+ }
+
+ public int getId() {
+ return ORBConstants.TAG_JAVA_SERIALIZATION_ID;
+ }
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof JavaSerializationComponent)) {
+ return false;
+ }
+ JavaSerializationComponent other = (JavaSerializationComponent) obj;
+ return this.version == other.version;
+ }
+
+ public int hashCode() {
+ return this.version;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java
new file mode 100644
index 0000000..dcf5b2e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/MaxStreamFormatVersionComponentImpl.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ */
+package com.sun.corba.se.impl.ior.iiop;
+
+import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT;
+
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+import javax.rmi.CORBA.ValueHandlerMultiFormat;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+import com.sun.corba.se.spi.ior.TaggedComponentBase;
+
+import com.sun.corba.se.spi.ior.iiop.MaxStreamFormatVersionComponent;
+
+// Java to IDL ptc 02-01-12 1.4.11
+// TAG_RMI_CUSTOM_MAX_STREAM_FORMAT
+public class MaxStreamFormatVersionComponentImpl extends TaggedComponentBase
+ implements MaxStreamFormatVersionComponent
+{
+ private byte version;
+
+ public static final MaxStreamFormatVersionComponentImpl singleton
+ = new MaxStreamFormatVersionComponentImpl();
+
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof MaxStreamFormatVersionComponentImpl))
+ return false ;
+
+ MaxStreamFormatVersionComponentImpl other =
+ (MaxStreamFormatVersionComponentImpl)obj ;
+
+ return version == other.version ;
+ }
+
+ public int hashCode()
+ {
+ return version ;
+ }
+
+ public String toString()
+ {
+ return "MaxStreamFormatVersionComponentImpl[version=" + version + "]" ;
+ }
+
+ public MaxStreamFormatVersionComponentImpl()
+ {
+ version = ORBUtility.getMaxStreamFormatVersion();
+ }
+
+ public MaxStreamFormatVersionComponentImpl(byte streamFormatVersion) {
+ version = streamFormatVersion;
+ }
+
+ public byte getMaxStreamFormatVersion()
+ {
+ return version;
+ }
+
+ public void writeContents(OutputStream os)
+ {
+ os.write_octet(version);
+ }
+
+ public int getId()
+ {
+ return TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java
new file mode 100644
index 0000000..68a4f9b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/ORBTypeComponentImpl.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.ior.iiop;
+
+import org.omg.IOP.TAG_ORB_TYPE ;
+
+import com.sun.corba.se.spi.ior.TaggedComponentBase ;
+
+import com.sun.corba.se.spi.ior.iiop.ORBTypeComponent ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public class ORBTypeComponentImpl extends TaggedComponentBase
+ implements ORBTypeComponent
+{
+ private int ORBType;
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof ORBTypeComponentImpl))
+ return false ;
+
+ ORBTypeComponentImpl other = (ORBTypeComponentImpl)obj ;
+
+ return ORBType == other.ORBType ;
+ }
+
+ public int hashCode()
+ {
+ return ORBType ;
+ }
+
+ public String toString()
+ {
+ return "ORBTypeComponentImpl[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 getORBType()
+ {
+ return ORBType ;
+ }
+
+ public void writeContents(OutputStream os)
+ {
+ os.write_ulong( ORBType ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java
new file mode 100644
index 0000000..84b3703
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/iiop/RequestPartitioningComponentImpl.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ */
+package com.sun.corba.se.impl.ior.iiop;
+
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import com.sun.corba.se.spi.ior.TaggedComponentBase;
+import com.sun.corba.se.spi.ior.iiop.RequestPartitioningComponent;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+
+public class RequestPartitioningComponentImpl extends TaggedComponentBase
+ implements RequestPartitioningComponent
+{
+ private static ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get( CORBALogDomains.OA_IOR ) ;
+
+ private int partitionToUse;
+
+ public boolean equals(Object obj)
+ {
+ if (!(obj instanceof RequestPartitioningComponentImpl))
+ return false ;
+
+ RequestPartitioningComponentImpl other =
+ (RequestPartitioningComponentImpl)obj ;
+
+ return partitionToUse == other.partitionToUse ;
+ }
+
+ public int hashCode()
+ {
+ return partitionToUse;
+ }
+
+ public String toString()
+ {
+ return "RequestPartitioningComponentImpl[partitionToUse=" + partitionToUse + "]" ;
+ }
+
+ 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(
+ new Integer(thePartitionToUse),
+ new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
+ new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
+ }
+ partitionToUse = thePartitionToUse;
+ }
+
+ public int getRequestPartitioningId()
+ {
+ return partitionToUse;
+ }
+
+ public void writeContents(OutputStream os)
+ {
+ os.write_ulong(partitionToUse);
+ }
+
+ public int getId()
+ {
+ return ORBConstants.TAG_REQUEST_PARTITIONING_ID;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/ior/notes b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/notes
new file mode 100644
index 0000000..7f66ce5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/ior/notes
@@ -0,0 +1,317 @@
+Notes on IOR implementation
+
+1. Writeable is an interface that can write itself to an OutputStream.
+
+2. IdEncapsulation is a particular kind of Writeable that has an Id and
+ an Encapsulation (a sequence of bytes) representing some other structure
+ in a CDR encapsulation.
+
+3. ContainerBase is a base class for containers of IdEncapsulations.
+
+4. An IOR is a ContainerBase.
+
+5. A TaggedComponent is not a ContainerBase.
+
+6. Some (not all) Profiles are ContainerBases.
+
+7. IIOPAddress contains (host, port)
+ IIOPServerLocation contains:
+ - A primary IIOPAddress
+ - 0 or more secondary IIOPAddresses (these get placed in
+ TAG_ALTERNATE_IIOP_ADDRESS components)
+
+8. IIOPProfileTemplate:
+ - major, minor version
+ - 0 or more TaggedComponents
+ - ObjectKeyTemplate
+
+9. ObjectKeyTemplate:
+ - contains only wire data, not internal structures
+
+ write( object id, output stream ): write the object key out
+ to the output stream with the given object id
+
+10. Significant problem: must of the dispatch path code is written in terms of
+ IORs when it should be based on profiles. Only a single profile is used in
+ a request, and that is what should be passed around. This needs fixing soon
+ to accommodate the eventual implementation of CORBA FT, and also to work
+ properly with the new IOR.
+
+11. Another question: since profile contains key which contains scid, what if
+ we have multiple profiles with different scids?
+ One answer: create a cluster subcontract that invokes the individual
+ profiles for FT. This may not mesh well with the FT spec.
+
+12. Uses of IORs in the ORB:
+
+Activation/ServerManagerImpl.java
+ - Construct IOR for bad ID handler location forward
+corba/ClientDelegate.java
+ - marshal, getIOR, unmarshal are all questionable and make
+ poor use of IOR.
+ - gets forwarded IOR from response
+ - IORs handled in some service contexts
+ - createRequest needs to parse IOR
+ - gets the (one) IIOP profile that we care about
+ - gets the object key
+corba/InitialNamingClient.java
+ - constructs IOR from address info, object key
+ - current implementation should use AlternateIIOPAddress components
+ - constructs IOR with key "INIT" for old bootstrap
+corba/ORB.java
+ - stringify and destringify IOR
+corba/ServerDelegate.java
+ - access IOR from sending context service context
+ - destroyObjref directly access transient key from a known offset.
+ - creation sets up key inline with known offsets
+core/IOR.java
+ - IOR sometimes stores a servant
+ - IOR contains the following
+ - Object servant
+ - Endpoint ep
+ - String codebase
+ - boolean cachedCodebase
+ - TaggedComponent localCodeBaseTC
+ - InternetIOPTag
+ - The two constructors that take full args also
+ construct tagged components
+ - will need alternate address components for INS
+core/SendingContextServiceContext.java
+ - reads IOR from input stream
+iiop/CDRInputStream.java
+ - needs type id, code base from IOR
+iiop/IIOPOutputStream.java
+ - needs to access objkey as a sequence of bytes to realing requests.
+POA/GenericPOAClientSC.java
+ - needs to pull POA ID out of object key
+ - needs to created a new IOR that has an updated scid
+POA/GenericPOAServerSC.java
+ - creates IORs
+TransactionalPOA/TransactionalServerSC.java
+ - inline access to known offset in object key to
+ determine whether transactional
+
+Guide to the files:
+
+Basic Interfaces:
+ Identifiable.java (Object has an Id)
+ Writeable.java (Object can write to OutputStream)
+ IdEncapsulation.java (Writeable, Identifiable interface)
+ IdEncapsulationFactory.java (Factory interface for IdEncapsulation)
+ IdEncapsulationFactoryFinder.java (Finder interface for IdEncapsulationFactoryFinder)
+
+ IIOPAddress.java (class containing host and port for IIOP)
+
+Basic support for IdEncapsulations (shared for components and profiles):
+ GenericIdEncapsulation.java (Has id, octet sequence: used for generic
+ TaggedComponent and TaggedProfile objects)
+ FreezableList.java (Delegated implementation of List that can be made
+ immutable after construction)
+ IdentifiableContainerBase.java (extends FreezableList: container of Identifiable:
+ supports iteratorById.)
+ IdEncapsulationContainerBase.java (extends IdenitifableContainerBase:
+ container of IdEncapsulation: supports read/write IdEncapsulationSequence)
+
+Object Keys:
+ ObjectKeyFactory.java
+ ObjectKeyTemplate.java (interface for the following:)
+ JIDLObjectKeyTemplate.java (object key used in *Delegate)
+ POAObjectKeyTemplate.java (object key used in GenericPOA*SC)
+ WireObjectKeyTemplate.java (used for non-Sun ORB IORs)
+ ObjectId.java (a simple wrapper for byte[])
+ ObjectKey.java (contains ObjectId and ObjectKeyTemplate)
+
+Components:
+ TaggedComponentFactories.java (contains method for registering factories)
+ TaggedComponentFactoryFinder.java (contains registered factories)
+ TaggedComponent.java (interface of all tagged components)
+ AlternateIIOPAddressComponent.java
+ CodeSetsComponent.java
+ JavaCodebaseComponent.java
+ ORBTypeComponent.java
+ PoliciesComponent.java
+
+Profiles:
+ IIOPProfile.java (IIOPProfileTemplate and ObjectId)
+ IIOPProfileTemplate.java (contains version, address, ObjectKeyTemplate,
+ list of TaggedComponent)
+ TaggedProfile.java (interface for all TaggedProfiles)
+ TaggedProfileFactoryFinder.java
+ TaggedProfileTemplate.java
+
+IOR:
+ IOR.java
+ IORTemplate.java (List of IIOPProfileTemplate
+ ObjectIds.java (List of ObjectId: needed for an IOR constructor)
+
+Notes from integration code review:
+
+General:
+ - Look at making IOR API public, or
+ move everything into com.sun.corba.se.impl.ior
+ (don't hold up putback for this)
+ Making public:
+ - Writeable needs getBytes() as well as write()
+ methods.
+ - codec can be used with an Any to convert between
+ IDL data type and sequence of bytes.
+ - write() needs to use getBytes, then write id, length,
+ octets to output stream.
+ - getBytes() method needs to get typecode from IDL
+ then create Any.
+ - IdEncapsulations need to have constructor that takes
+ byte[] (encapsulation of value).
+ Why not?
+ - Unencapsulated object keys can't be made portable
+ - Lots of dependencies on ORB code in ObjectKey support
+ Conclusion:
+ - move to internal (DONE)
+ - JAVA_MAGIC should move to ObjectKeyTemplates (DONE)
+ - check for intToBytes/bytesToInt related to object key
+ corba/ServerDelegate (DONE)
+ POA/GenericPOAServerSC (DONE)
+ POA/SubcontractResponseHandler (DONE)
+ TransactionalPOA/TransactionalClientSC.java (DONE)
+ TransactionalPOA/TransactionalServerSC.java (DONE)
+
+./com/sun/corba/se/impl/cosnaming/BootstrapServer.java
+ - remove sc_init_key_* (DONE)
+
+./com/sun/corba/se/impl/poa/POAImpl.java
+ - remove line 130: comment on other endpoints, e.g. SSL (DONE)
+ - add revisit comment on line 133: use multiple server port API (DONE)
+
+./com/sun/corba/se/impl/corba/ORB.java
+ - object_to_string: add comment that connect only takes place in
+ non-POA cases. (DONE)
+
+./com/sun/corba/se/impl/corba/ServerDelegate.java
+ - chase down the object key offsets (DONE)
+ (search for bytesToInt and intToBytes)
+
+./com/sun/corba/se/impl/core/SubcontractRegistry.java
+ - getServerSubcontract: add b-e l-e comment and history on INIT, TINI (DONE)
+ - getServerSubcontract: reference to constants (May not do this?)
+ - getServerSubcontract: return null at end IS reachable, in the
+ case where we have essentially a name in the key that isn't
+ one of the ones we support. Throw an exception? (DONE)
+ - add minor code for INTERNAL (and string) (DONE)
+ - remove setId calls in callers to getClientSubcontract (DONE)
+ - throw INTERNAL exception for temp.size() != 1 case (DONE)
+ Think about INST corbaloc problems (multi-profile IORs)
+ both return nulls should throw exceptions (DONE)
+
+./com/sun/corba/se/impl/core/IOR.java
+ - Add some comments to getIORfromString about 4/2 constants (DONE)
+ - fix name: should be getIORFromString (DONE)
+ - IOR( InputStream ) has a problem with cachedCodeBase:
+ is should not call getCodeBase: must refactor to
+ an internal implementation method. (DONE)
+ - isEquivalent and isLocal should assert failure
+ if multiple profiles (through exception in getProfile) (DONE)
+ (add comments about multi case)
+
+./com/sun/corba/se/impl/iiop/CDRInputStream_1_0.java
+ - read_Object: add assert in case servant is not Tie or objref (DONE)
+
+./com/sun/corba/se/internal/TransactionalPOA/TransactionalPOAImpl.java
+ - add comment about transactionalIortemplate: goes away after
+ we get to OTS 1.2 transactional policy. (DONE)
+ - change transactionalClone( ObjectKeyTemplate ) so that
+ we get an error (INTERNAL) if NOT POAObjectKeyTemplate (DONE)
+ - line 138: get string constant from
+ org.omg.CosTransactions.TransactionalObject (DONE)
+ - remove Delegate d decl. (DONE)
+
+We need to assign minor codes for all exceptions!
+
+We need to clean up the minor code base usage! (DONE)
+
+Add equals/toString to:
+ Do not try to develop a reflective universal equals: too slow!
+ Do we really want equals on lists?
+ If we do, define collectionEqual on FreezableList
+
+CodeSetsComponent: toString
+FreezableList: basic toString, equals methods
+IIOPProfile: toString
+IIOPProfileTemplate: toString
+IOR: toString
+IORTemplate.java: toString, equals (inherit?)
+IdEncapsulationContainerBase.java: make abstract, but provide base toString/equals
+IdentifiableContainerBase.java: make abstract (no other changes)
+ (ContainerBase classes need some explanation)
+ObjectIds.java needs toString, equals (use FreezableList?)
+ObjectKey: toString
+ObjectKeyFactory.java: singleton: don't add toString or equals
+PoliciesComponent.java: should finish this sometime (after we figure out
+ exactly what to do with it)
+TaggedComponentBase.java: should be abstract
+TaggedComponentFactories.java: a singelton
+TaggedComponentFactoryFinder.java: a singleton
+TaggedProfileFactoryFinder.java: a singleton
+JIDLObjectKeyTemplate: toString
+POAObjectKeyTemplate: toString
+WireObjectKeyTemplate: toString uninteresting: no data, equals not useful
+
+use util/Utility.objectToString to implement toString methods.
+
+Other changes:
+
+ IIOPAddress.toString should include class name (DONE)
+
+ New tests needed:
+ IIOPProfile.getIOPComponents
+ IIOPProfile.getIOPProfile
+ GenericTaggedProfile.getIOPComponents
+ GenericTaggedProfile.getIOPProfile
+ GenericTaggedComponent.getIOPComponent
+ ObjectKeyTemplate.getAdapterId
+
+ Plus, do a read/write test for IOP stuff:
+ construct profile
+ convert to IOP.TaggedProfile
+ write to stream
+ get input stream
+ construct profile
+ check for equal
+
+ do some tests on IOR.toString() just to see what gets printed.
+
+ Add getAdapterId to *ObjectKeyTemplate.java (DONE)
+ Add some tests for this:
+ - WireObjectKeyTemplate throws an exception
+ - Identically constructed ObjectKeyTemplates produce identical Adapter Ids.
+ - Different OKTs produce different adapter IDs.
+
+New tests for versioning support:
+
+ORBVersionFactory:
+ - for create array methods (DONE)
+ - returns expected values for version encodings
+ - throws INTERNAL for negative version
+ - test one case for create stream method (DONE)
+ - getORBVersion returns correct version (DONE)
+ORBVersionImpl:
+ - check equals on some ORBVersions (DONE)
+ - check that each ORBVersion returns correct orbtype (DONE)
+JIDLObjectKeyTemplate:
+ - non-key constructor gives NEWER version (DONE)
+POAObjectKeyTemplate:
+ - non-key constructor gives NEWER version (DONE)
+OldJIDLObjectKeyTemplate: (DONE)
+ - non-key constructor with OLD, NEW MAGIC and check version
+ - other values throw exception
+OldPOAObjectKeyTemplate: (DONE)
+ - non-key constructor with OLD, NEW MAGIC and check version (DONE)
+ - other values throw exception (DONE)
+WireObjectKeyTemplate (DONE)
+ - version is FOREIGN
+ObjectKeyFactory (DONE)
+ create the following keys and check results:
+ JIDL OLD OldJIDL with correct magic, version
+ JIDL NEW OldJIDL
+ JIDL NEWER JIDL
+ POA OLD OldPOA
+ POA NEW OldPOA
+ POA NEWER POA
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java
new file mode 100644
index 0000000..5ac8283
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/StubDelegateImpl.java
@@ -0,0 +1,214 @@
+/*
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.javax.rmi.CORBA;
+
+import java.io.IOException;
+
+import java.rmi.RemoteException;
+
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_INV_ORDER;
+
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.InputStream;
+
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.util.Utility;
+
+import com.sun.corba.se.impl.ior.StubIORImpl ;
+import com.sun.corba.se.impl.presentation.rmi.StubConnectImpl ;
+
+import com.sun.corba.se.impl.logging.UtilSystemException ;
+
+/**
+ * Base class from which all static RMI-IIOP stubs must inherit.
+ */
+public class StubDelegateImpl implements javax.rmi.CORBA.StubDelegate
+{
+ static UtilSystemException wrapper = UtilSystemException.get(
+ CORBALogDomains.RMIIIOP ) ;
+
+ private StubIORImpl ior ;
+
+ public StubIORImpl getIOR()
+ {
+ return ior ;
+ }
+
+ public StubDelegateImpl()
+ {
+ ior = null ;
+ }
+
+ /**
+ * Sets the IOR components if not already set.
+ */
+ private 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.
+ * @return the hash code value.
+ */
+ public int hashCode(javax.rmi.CORBA.Stub self)
+ {
+ init(self);
+ return ior.hashCode() ;
+ }
+
+ /**
+ * Compares two stubs for equality. Returns <code>true</code> when used to compare stubs
+ * that represent the same remote object, and <code>false</code> otherwise.
+ * @param obj the reference object with which to compare.
+ * @return <code>true</code> if this object is the same as the <code>obj</code>
+ * argument; <code>false</code> otherwise.
+ */
+ public boolean equals(javax.rmi.CORBA.Stub self, java.lang.Object obj)
+ {
+ if (self == obj) {
+ return true;
+ }
+
+ if (!(obj instanceof javax.rmi.CORBA.Stub)) {
+ return false;
+ }
+
+ // no need to call init() because of calls to hashCode() below
+
+ javax.rmi.CORBA.Stub other = (javax.rmi.CORBA.Stub) obj;
+ if (other.hashCode() != self.hashCode()) {
+ return false;
+ }
+
+ // 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
+ // reflection) toString, because it is not possible to directly
+ // access the StubDelegateImpl from the Stub.
+ return self.toString().equals( other.toString() ) ;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if (this == obj)
+ return true ;
+
+ if (!(obj instanceof StubDelegateImpl))
+ return false ;
+
+ StubDelegateImpl other = (StubDelegateImpl)obj ;
+
+ if (ior == null)
+ return ior == other.ior ;
+ else
+ return ior.equals( other.ior ) ;
+ }
+
+ public int hashCode() {
+ if (ior == null) {
+ return 0;
+ } else {
+ return ior.hashCode();
+ }
+ }
+
+ /**
+ * 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 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
+ * {@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.
+ */
+ public 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 void readObject(javax.rmi.CORBA.Stub self,
+ java.io.ObjectInputStream stream) throws IOException, ClassNotFoundException
+ {
+ if (ior == null)
+ ior = new StubIORImpl() ;
+
+ 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).
+ */
+ public void writeObject(javax.rmi.CORBA.Stub self,
+ java.io.ObjectOutputStream stream) throws IOException
+ {
+ init(self);
+ ior.doWrite( stream ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java b/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
new file mode 100644
index 0000000..a9ae337
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/CORBA/Util.java
@@ -0,0 +1,778 @@
+/*
+ * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.javax.rmi.CORBA; // Util (sed marker, don't remove!)
+
+import java.rmi.RemoteException;
+import java.rmi.UnexpectedException;
+import java.rmi.MarshalException;
+
+import java.rmi.server.RMIClassLoader;
+
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.Map;
+import java.util.WeakHashMap;
+
+import java.io.Serializable;
+import java.io.NotSerializableException;
+
+import java.lang.reflect.Constructor;
+
+import javax.rmi.CORBA.ValueHandler;
+import javax.rmi.CORBA.Tie;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import java.rmi.MarshalException;
+import java.rmi.NoSuchObjectException;
+import java.rmi.AccessException;
+import java.rmi.Remote;
+import java.rmi.ServerError;
+import java.rmi.ServerException;
+import java.rmi.ServerRuntimeException;
+
+import javax.transaction.TransactionRequiredException;
+import javax.transaction.TransactionRolledbackException;
+import javax.transaction.InvalidTransactionException;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.INV_OBJREF;
+import org.omg.CORBA.NO_PERMISSION;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.TRANSACTION_REQUIRED;
+import org.omg.CORBA.TRANSACTION_ROLLEDBACK;
+import org.omg.CORBA.INVALID_TRANSACTION;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.ACTIVITY_REQUIRED;
+import org.omg.CORBA.ACTIVITY_COMPLETED;
+import org.omg.CORBA.INVALID_ACTIVITY;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+// This class must be able to function with non-Sun ORBs.
+// This means that any of the following com.sun.corba classes
+// must only occur in contexts that also handle the non-Sun case.
+
+import com.sun.corba.se.pept.transport.ContactInfoList ;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.protocol.CorbaClientDelegate;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
+import com.sun.corba.se.spi.copyobject.ReflectiveCopyException ;
+import com.sun.corba.se.spi.copyobject.CopierManager ;
+import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
+import com.sun.corba.se.spi.copyobject.ObjectCopier ;
+import com.sun.corba.se.impl.io.ValueHandlerImpl;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+import com.sun.corba.se.impl.util.Utility;
+import com.sun.corba.se.impl.util.IdentityHashtable;
+import com.sun.corba.se.impl.util.JDKBridge;
+import com.sun.corba.se.impl.logging.UtilSystemException;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import sun.corba.SharedSecrets;
+
+
+/**
+ * Provides utility methods that can be used by stubs and ties to
+ * perform common operations.
+ */
+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 IdentityHashtable exportedServants = new IdentityHashtable();
+
+ private static final ValueHandlerImpl valueHandlerSingleton =
+ SharedSecrets.getJavaCorbaAccess().newValueHandlerImpl();
+
+ private UtilSystemException utilWrapper = UtilSystemException.get(
+ CORBALogDomains.RPC_ENCODING);
+
+ private static Util instance = null;
+
+ public Util() {
+ setInstance(this);
+ }
+
+ private static void setInstance( Util util ) {
+ assert instance == null : "Instance already defined";
+ instance = util;
+ }
+
+ public static Util getInstance() {
+ return instance;
+ }
+
+ public static boolean isInstanceDefined() {
+ return instance != null;
+ }
+
+ // 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)
+ {
+ for (Enumeration e = exportedServants.keys(); e.hasMoreElements(); )
+ {
+ java.lang.Object key = e.nextElement();
+ Remote target = (Remote)(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.
+ try {
+ if (orb == getTie(target).orb()) {
+ try {
+ unexportObject(target);
+ } catch( java.rmi.NoSuchObjectException ex ) {
+ // We neglect this exception if at all if it is
+ // raised. It is not harmful.
+ }
+ }
+ } catch (BAD_OPERATION bad) {
+ /* Ignore */
+ }
+ }
+ }
+
+ /**
+ * Maps a SystemException to a RemoteException.
+ * @param ex the SystemException to map.
+ * @return the mapped exception.
+ */
+ public RemoteException mapSystemException(SystemException ex)
+ {
+ if (ex instanceof UnknownException) {
+ Throwable orig = ((UnknownException)ex).originalEx;
+ if (orig instanceof Error) {
+ 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);
+ } else if (orig instanceof RuntimeException) {
+ throw (RuntimeException) orig;
+ }
+ }
+
+ // Build the message string...
+ String name = ex.getClass().getName();
+ 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;
+ }
+
+ String message = "CORBA " + corbaName + " " + ex.minor + " " + status;
+
+ // Now map to the correct RemoteException type...
+ if (ex instanceof COMM_FAILURE) {
+ return new MarshalException(message, ex);
+ } else if (ex instanceof INV_OBJREF) {
+ RemoteException newEx = new NoSuchObjectException(message);
+ newEx.detail = ex;
+ return newEx;
+ } else if (ex instanceof NO_PERMISSION) {
+ return new AccessException(message, ex);
+ } else if (ex instanceof MARSHAL) {
+ return new MarshalException(message, ex);
+ } else if (ex instanceof OBJECT_NOT_EXIST) {
+ RemoteException newEx = new NoSuchObjectException(message);
+ newEx.detail = ex;
+ return newEx;
+ } else if (ex instanceof TRANSACTION_REQUIRED) {
+ RemoteException newEx = new TransactionRequiredException(message);
+ newEx.detail = ex;
+ return newEx;
+ } else if (ex instanceof TRANSACTION_ROLLEDBACK) {
+ RemoteException newEx = new TransactionRolledbackException(message);
+ newEx.detail = ex;
+ return newEx;
+ } else if (ex instanceof INVALID_TRANSACTION) {
+ RemoteException newEx = new InvalidTransactionException(message);
+ newEx.detail = ex;
+ return newEx;
+ } else if (ex instanceof BAD_PARAM) {
+ 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) {
+
+ if (ex.getMessage() != null)
+ inner = new NotSerializableException(ex.getMessage());
+ else
+ inner = new NotSerializableException();
+
+ inner.initCause( ex ) ;
+ }
+
+ return new MarshalException(message,inner);
+ } else if (ex instanceof ACTIVITY_REQUIRED) {
+ try {
+ Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
+ "javax.activity.ActivityRequiredException");
+ Class[] params = new Class[2];
+ params[0] = java.lang.String.class;
+ params[1] = java.lang.Throwable.class;
+ Constructor cr = cl.getConstructor(params);
+ Object[] args = new Object[2];
+ args[0] = message;
+ args[1] = ex;
+ return (RemoteException) cr.newInstance(args);
+ } catch (Throwable e) {
+ utilWrapper.classNotFound(
+ e, "javax.activity.ActivityRequiredException");
+ }
+ } else if (ex instanceof ACTIVITY_COMPLETED) {
+ try {
+ Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
+ "javax.activity.ActivityCompletedException");
+ Class[] params = new Class[2];
+ params[0] = java.lang.String.class;
+ params[1] = java.lang.Throwable.class;
+ Constructor cr = cl.getConstructor(params);
+ Object[] args = new Object[2];
+ args[0] = message;
+ args[1] = ex;
+ return (RemoteException) cr.newInstance(args);
+ } catch (Throwable e) {
+ utilWrapper.classNotFound(
+ e, "javax.activity.ActivityCompletedException");
+ }
+ } else if (ex instanceof INVALID_ACTIVITY) {
+ try {
+ Class<?> cl = SharedSecrets.getJavaCorbaAccess().loadClass(
+ "javax.activity.InvalidActivityException");
+ Class[] params = new Class[2];
+ params[0] = java.lang.String.class;
+ params[1] = java.lang.Throwable.class;
+ Constructor cr = cl.getConstructor(params);
+ Object[] args = new Object[2];
+ args[0] = message;
+ args[1] = ex;
+ return (RemoteException) cr.newInstance(args);
+ } catch (Throwable e) {
+ utilWrapper.classNotFound(
+ e, "javax.activity.InvalidActivityException");
+ }
+ }
+
+ // Just map to a generic RemoteException...
+ return new RemoteException(message, 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)
+ {
+ org.omg.CORBA.ORB orb = out.orb();
+
+ // Create Any
+ Any any = orb.create_any();
+
+ // Make sure we have a connected object...
+ java.lang.Object newObj = Utility.autoConnect(obj,orb,false);
+
+ if (newObj instanceof org.omg.CORBA.Object) {
+ any.insert_Object((org.omg.CORBA.Object)newObj);
+ } else {
+ if (newObj == null) {
+ // Handle the null case, including backwards
+ // compatibility issues
+ any.insert_Value(null, createTypeCodeForNull(orb));
+ } else {
+ 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);
+ if (tc == null)
+ any.insert_Value((Serializable)newObj);
+ else
+ any.insert_Value((Serializable)newObj, tc);
+ } else if (newObj instanceof Remote) {
+ ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName());
+ } else {
+ ORBUtility.throwNotSerializableForCorba(newObj.getClass().getName());
+ }
+ }
+ }
+
+ out.write_any(any);
+ }
+
+ /**
+ * 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.
+ *
+ * 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) {
+
+ if (any instanceof com.sun.corba.se.impl.corba.AnyImpl &&
+ orb instanceof ORB) {
+
+ com.sun.corba.se.impl.corba.AnyImpl anyImpl
+ = (com.sun.corba.se.impl.corba.AnyImpl)any;
+
+ ORB ourORB = (ORB)orb;
+
+ return anyImpl.createTypeCodeForClass(obj.getClass(), ourORB);
+
+ } else
+ return null;
+ }
+
+
+ /**
+ * 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)
+ {
+ if (orb instanceof 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) {
+
+ return orb.get_primitive_tc(TCKind.tk_value);
+ }
+ }
+
+ // Use tk_abstract_interface as detailed in the resolution
+
+ // REVISIT: Define this in IDL and get the ID in generated code
+ String abstractBaseID = "IDL:omg.org/CORBA/AbstractBase:1.0";
+
+ return orb.create_abstract_interface_tc(abstractBaseID, "");
+ }
+
+ /**
+ * 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)
+ {
+ Any any = in.read_any();
+ if ( any.type().kind().value() == TCKind._tk_objref )
+ return any.extract_Object ();
+ else
+ return any.extract_Value();
+ }
+
+ /**
+ * Writes a java.lang.Object as a CORBA Object. If {@code obj} is
+ * an exported RMI-IIOP server object, the tie is found
+ * and wired to {@code obj}, then written to {@code out.write_Object(org.omg.CORBA.Object)}.
+ * If {@code obj} is a CORBA Object, it is written to
+ * {@code 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)
+ {
+ // 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);
+ }
+
+ /**
+ * Writes a java.lang.Object as either a value or a CORBA Object.
+ * If {@code obj} is a value object or a stub object, it is written to
+ * {@code out.write_abstract_interface(java.lang.Object)}. If {@code obj} is an exported
+ * RMI-IIOP server object, the tie is found and wired to {@code obj},
+ * then written to {@code 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 )
+ {
+ // 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);
+ }
+
+ /**
+ * 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.
+ */
+ 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);
+ 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.start();
+ }
+ }
+ }
+ }
+
+ /**
+ * 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
+ {
+ synchronized (exportedServants) {
+ Tie cachedTie = lookupTie(target);
+ if (cachedTie != null) {
+ exportedServants.remove(target);
+ Utility.purgeStubForTie(cachedTie);
+ Utility.purgeTieAndServant(cachedTie);
+ try {
+ cleanUpTie(cachedTie);
+ } catch (BAD_OPERATION e) {
+ // ignore
+ } catch (org.omg.CORBA.OBJ_ADAPTER e) {
+ // 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" );
+ }
+ }
+ }
+
+ 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)
+ {
+ synchronized (exportedServants) {
+ return lookupTie(target);
+ }
+ }
+
+ /**
+ * An unsynchronized version of getTie() for internal use.
+ */
+ private static Tie lookupTie (Remote target)
+ {
+ Tie result = (Tie)exportedServants.get(target);
+ if (result == null && target instanceof Tie) {
+ if (exportedServants.contains(target)) {
+ result = (Tie)target;
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Returns a singleton instance of a class that implements the
+ * {@link ValueHandler} interface.
+ * @return a class which implements the ValueHandler interface.
+ */
+ public ValueHandler createValueHandler()
+ {
+ return valueHandlerSingleton;
+ }
+
+ /**
+ * 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) {
+ return RMIClassLoader.getClassAnnotation(clz);
+ }
+
+ /**
+ * 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 class whose ClassLoader may be used to
+ * load the class if all other methods fail.
+ * @return the {@code 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);
+ }
+
+ /**
+ * The {@code 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 {@code _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 {@code _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 {@code _is_local()}
+ * method returns false otherwise. The default behavior of {@code _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.
+ */
+ public boolean isLocal(javax.rmi.CORBA.Stub stub) throws RemoteException
+ {
+ boolean result = false ;
+
+ try {
+ org.omg.CORBA.portable.Delegate delegate = stub._get_delegate() ;
+ if (delegate instanceof CorbaClientDelegate) {
+ // For the Sun ORB
+ CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
+ ContactInfoList cil = cdel.getContactInfoList() ;
+ if (cil instanceof CorbaContactInfoList) {
+ CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
+ LocalClientRequestDispatcher lcs = ccil.getLocalClientRequestDispatcher() ;
+ result = lcs.useLocalInvocation( null ) ;
+ }
+ } else {
+ // For a non-Sun ORB
+ result = delegate.is_local( stub ) ;
+ }
+ } catch (SystemException e) {
+ throw javax.rmi.CORBA.Util.mapSystemException(e);
+ }
+
+ return result ;
+ }
+
+ /**
+ * 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)
+ {
+ if (orig instanceof SystemException) {
+ return mapSystemException((SystemException)orig);
+ }
+
+ if (orig instanceof Error) {
+ 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);
+ } else if (orig instanceof RuntimeException) {
+ throw (RuntimeException) orig;
+ }
+
+ if (orig instanceof Exception)
+ 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.
+ * @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
+ {
+ if (obj == null)
+ // Bug fix for 5018613: JCK test expects copyObjects to throw
+ // NPE when obj==null. This is actually not in the spec, since
+ // obj is not really an RMI-IDL data type, but we follow our
+ // test here, and force this error to be thrown.
+ throw new NullPointerException() ;
+
+ Class compType = obj.getClass().getComponentType() ;
+ if (Remote.class.isAssignableFrom( compType ) && !compType.isInterface()) {
+ // 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 ) ;
+ } else
+ return (Object[])copyObject( obj, orb ) ;
+ }
+
+ /**
+ * 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
+ {
+ if (orb instanceof 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 ) ;
+ } catch (java.util.EmptyStackException exc) {
+ // copyObject was invoked outside of an invocation, probably by
+ // a test. Get the default copier from the ORB.
+ // XXX should we just make the default copier available directly
+ // and avoid constructing one on each call?
+ 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 ;
+ }
+ } else {
+ 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();
+ }
+ }
+}
+
+class KeepAlive extends Thread
+{
+ boolean quit = false;
+
+ public KeepAlive ()
+ {
+ super(null, null, "Servant-KeepAlive-Thread", 0, false);
+ setDaemon(false);
+ }
+
+ public synchronized void run ()
+ {
+ while (!quit) {
+ try {
+ wait();
+ } catch (InterruptedException e) {}
+ }
+ }
+
+ public synchronized void quit ()
+ {
+ quit = true;
+ notifyAll();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/PortableRemoteObject.java b/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/PortableRemoteObject.java
new file mode 100644
index 0000000..822de35
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/javax/rmi/PortableRemoteObject.java
@@ -0,0 +1,362 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.javax.rmi;
+
+import java.lang.reflect.Method ;
+
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+
+import java.rmi.RemoteException;
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+
+import java.util.Properties;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.SystemException;
+
+import java.rmi.server.UnicastRemoteObject;
+import java.rmi.server.RemoteStub;
+import java.rmi.server.ExportException;
+
+import java.net.URL;
+
+import com.sun.corba.se.impl.util.JDKBridge;
+import com.sun.corba.se.impl.util.Utility;
+import com.sun.corba.se.impl.util.RepositoryId;
+
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+
+import java.security.AccessController;
+import com.sun.corba.se.impl.orbutil.GetPropertyAction;
+
+/**
+ * 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 {
+
+ /**
+ * 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 {
+
+ if (obj == null) {
+ throw new NullPointerException("invalid argument");
+ }
+
+ // Has this object already been exported to IIOP?
+
+ if (Util.getTie(obj) != null) {
+
+ // Yes, so this is an error...
+
+ 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.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}.
+ * @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
+ {
+ 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 )) {
+ 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.getTie(obj);
+
+ if (theTie != null) {
+ 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.
+ * @param obj the object to unexport.
+ * @exception NoSuchObjectException if the remote object is not
+ * currently exported.
+ */
+ 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.");
+ }
+
+ Tie theTie = Util.getTie(obj);
+ if (theTie != null) {
+ Util.unexportObject(obj);
+ } else {
+ if (Utility.loadTie(obj) == null) {
+ UnicastRemoteObject.unexportObject(obj,true);
+ } else {
+ throw new NoSuchObjectException("Object not exported.");
+ }
+ }
+ }
+
+ /**
+ * 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
+ {
+ java.lang.Object result = null;
+
+ if (narrowFrom == null)
+ return null;
+
+ if (narrowTo == null)
+ throw new NullPointerException("invalid argument");
+
+ try {
+ if (narrowTo.isAssignableFrom(narrowFrom.getClass()))
+ return narrowFrom;
+
+ // Is narrowTo an interface that might be
+ // implemented by a servant running on iiop?
+ if (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);
+ } else {
+ throw new ClassCastException( "Object is not of remote type " +
+ narrowTo.getName() ) ;
+ }
+ } else {
+ throw new ClassCastException( "Class " + narrowTo.getName() +
+ " is not a valid remote interface" ) ;
+ }
+ } 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 Stub#connect} method for more information.
+ * @param target the object to connect.
+ * @param source a previously connected object.
+ * @throws RemoteException if <code>source</code> is not connected
+ * or if <code>target</code> is already connected to a different ORB than
+ * <code>source</code>.
+ */
+ 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 ) ;
+ } else {
+ // Is this a servant that was exported to iiop?
+ Tie tie = Util.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");
+ }
+ */
+ } else {
+ orb = tie.orb();
+ }
+ }
+ } catch (SystemException e) {
+ throw new RemoteException("'source' object not connected", e );
+ }
+
+ boolean targetIsIIOP = false ;
+ Tie targetTie = null;
+ if (StubAdapter.isStub(target)) {
+ targetIsIIOP = true;
+ } else {
+ targetTie = Util.getTie(target);
+ 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");
+ }
+ */
+ }
+ }
+
+ if (!targetIsIIOP) {
+ // 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");
+ }
+ } 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");
+ }
+
+ // 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?
+ if (existingOrb == orb) {
+
+ // Yes, so nothing to do...
+ return;
+ } else {
+ // No, so this is an error...
+ throw new RemoteException(
+ "'target' object was already connected");
+ }
+ } catch (SystemException e) {}
+
+ // No, so do it...
+ targetTie.orb(orb);
+ } else {
+ StubAdapter.connect( target, orb ) ;
+ }
+ } catch (SystemException e) {
+
+ // The stub or tie was already connected...
+ throw new RemoteException(
+ "'target' object was already connected", e );
+ }
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/DefaultSocketFactory.java b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/DefaultSocketFactory.java
new file mode 100644
index 0000000..93f6e3f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/DefaultSocketFactory.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.legacy.connection;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
+import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.transport.SocketInfo;
+
+import com.sun.corba.se.impl.legacy.connection.EndPointInfoImpl;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+public class DefaultSocketFactory
+ implements
+ ORBSocketFactory
+{
+ private com.sun.corba.se.spi.orb.ORB orb;
+ private static ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_TRANSPORT ) ;
+
+ public DefaultSocketFactory()
+ {
+ }
+
+ public void setORB(com.sun.corba.se.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 ) ;
+ }
+
+ ServerSocket serverSocket;
+
+ if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) {
+ ServerSocketChannel serverSocketChannel =
+ ServerSocketChannel.open();
+ serverSocket = serverSocketChannel.socket();
+ } else {
+ serverSocket = new ServerSocket();
+ }
+ serverSocket.bind(new InetSocketAddress(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 Socket createSocket(SocketInfo socketInfo)
+ throws
+ IOException,
+ GetEndPointInfoAgainException
+ {
+ Socket socket;
+
+ if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) {
+ InetSocketAddress address =
+ new InetSocketAddress(socketInfo.getHost(),
+ socketInfo.getPort());
+ SocketChannel socketChannel = SocketChannel.open(address);
+ socket = socketChannel.socket();
+ } else {
+ socket = new Socket(socketInfo.getHost(),
+ socketInfo.getPort());
+ }
+
+ // REVISIT - this is done in SocketOrChannelConnectionImpl
+ try {
+ socket.setTcpNoDelay(true);
+ } catch (Exception e) {
+ ;
+ }
+ return socket;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/EndPointInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/EndPointInfoImpl.java
new file mode 100644
index 0000000..76711e1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/EndPointInfoImpl.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.legacy.connection;
+
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
+import com.sun.corba.se.spi.transport.SocketInfo;
+
+public class EndPointInfoImpl
+ implements
+ SocketInfo,
+ LegacyServerSocketEndPointInfo
+{
+
+ protected String type;
+ protected String hostname;
+ protected int port;
+ protected int locatorPort;
+ protected String name;
+
+ public EndPointInfoImpl(String type, int port, String hostname) {
+ this.type = type;
+ this.port = port;
+ this.hostname = hostname;
+ this.locatorPort = -1;
+ this.name = LegacyServerSocketEndPointInfo.NO_NAME;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getHost() {
+ return hostname;
+ }
+
+ public String getHostName() {
+ return hostname;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ public int getLocatorPort ()
+ {
+ return locatorPort;
+ }
+
+ public void setLocatorPort (int port)
+ {
+ locatorPort = port;
+ }
+
+ public String getName()
+ {
+ return name;
+ }
+
+ public int hashCode() {
+ return type.hashCode() ^ hostname.hashCode() ^ port;
+ }
+
+ public boolean equals(Object obj) {
+ if (!(obj instanceof EndPointInfoImpl)) {
+ return false;
+ }
+ EndPointInfoImpl other = (EndPointInfoImpl)obj;
+ if (type == null) {
+ if (other.type != null) {
+ return false;
+ }
+ } else if (!type.equals(other.type)) {
+ return false;
+ }
+ if (port != other.port) {
+ return false;
+ }
+ if (!hostname.equals(other.hostname)) {
+ return false;
+ }
+ return true;
+ }
+
+ public String toString ()
+ {
+ return
+ type + " " +
+ name + " " +
+ hostname + " " +
+ port;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/LegacyServerSocketManagerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/LegacyServerSocketManagerImpl.java
new file mode 100644
index 0000000..3a5ca90
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/LegacyServerSocketManagerImpl.java
@@ -0,0 +1,186 @@
+/*
+ * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.legacy.connection;
+
+import java.net.ServerSocket;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+
+import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.Selector;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaTransportManager;
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
+import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl;
+import com.sun.corba.se.impl.legacy.connection.USLPort;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+public class LegacyServerSocketManagerImpl
+ implements
+ LegacyServerSocketManager
+{
+ protected ORB orb;
+ private ORBUtilSystemException wrapper ;
+
+ public LegacyServerSocketManagerImpl(ORB orb)
+ {
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_TRANSPORT ) ;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // LegacyServerSocketManager
+ //
+
+ // Only used in ServerManagerImpl.
+ public int legacyGetTransientServerPort(String type)
+ {
+ return legacyGetServerPort(type, false);
+ }
+
+ // Only used by POAPolicyMediatorBase.
+ public synchronized int legacyGetPersistentServerPort(String socketType)
+ {
+ if (orb.getORBData().getServerIsORBActivated()) {
+ // this server is activated by orbd
+ return legacyGetServerPort(socketType, true);
+ } else if (orb.getORBData().getPersistentPortInitialized()) {
+ // this is a user-activated server
+ return orb.getORBData().getPersistentServerPort();
+ } else {
+ throw wrapper.persistentServerportNotSet(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ // Only used by PI IORInfoImpl.
+ 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)
+ {
+ Iterator iterator = getAcceptorIterator();
+ while (iterator.hasNext()) {
+ LegacyServerSocketEndPointInfo endPoint = cast(iterator.next());
+ if (endPoint != null && name.equals(endPoint.getName())) {
+ return endPoint;
+ }
+ }
+ throw new INTERNAL("No acceptor for: " + name);
+ }
+
+ // Check to see if the given port is equal to any of the ORB Server Ports.
+ // XXX Does this need to change for the multi-homed case?
+ // Used in IIOPProfileImpl, ORBImpl.
+ public boolean legacyIsLocalServerPort(int port)
+ {
+ Iterator iterator = getAcceptorIterator();
+ while (iterator.hasNext()) {
+ LegacyServerSocketEndPointInfo endPoint = cast(iterator.next());
+ if (endPoint != null && endPoint.getPort() == port) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation.
+ //
+
+ private int legacyGetServerPort (String socketType, boolean isPersistent)
+ {
+ Iterator endpoints = getAcceptorIterator();
+ while (endpoints.hasNext()) {
+ LegacyServerSocketEndPointInfo ep = cast(endpoints.next());
+ if (ep != null && ep.getType().equals(socketType)) {
+ if (isPersistent) {
+ return ep.getLocatorPort();
+ } else {
+ return ep.getPort();
+ }
+ }
+ }
+ return -1;
+ }
+
+ private Iterator getAcceptorIterator()
+ {
+ Collection acceptors =
+ orb.getCorbaTransportManager().getAcceptors(null, null);
+ if (acceptors != null) {
+ return acceptors.iterator();
+ }
+
+ throw wrapper.getServerPortCalledBeforeEndpointsInitialized() ;
+ }
+
+ private LegacyServerSocketEndPointInfo cast(Object o)
+ {
+ if (o instanceof LegacyServerSocketEndPointInfo) {
+ return (LegacyServerSocketEndPointInfo) o;
+ }
+ return null;
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("LegacyServerSocketManagerImpl", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryAcceptorImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryAcceptorImpl.java
new file mode 100644
index 0000000..f62d7f6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryAcceptorImpl.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.legacy.connection;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INTERNAL;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl;
+import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
+
+/**
+ * @author Harold Carr
+ */
+public class SocketFactoryAcceptorImpl
+ extends
+ SocketOrChannelAcceptorImpl
+{
+ public SocketFactoryAcceptorImpl(ORB orb, int port,
+ String name, String type)
+ {
+ super(orb, port, name, type);
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept Acceptor
+ //
+
+ public boolean initialize()
+ {
+ if (initialized) {
+ return false;
+ }
+ if (orb.transportDebugFlag) {
+ dprint("initialize: " + this);
+ }
+ try {
+ serverSocket = orb.getORBData()
+ .getLegacySocketFactory().createServerSocket(type, port);
+ internalInitialize();
+ } catch (Throwable t) {
+ throw wrapper.createListenerFailed( t, Integer.toString(port) ) ;
+ }
+ initialized = true;
+ return true;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation.
+ //
+
+ protected String toStringName()
+ {
+ return "SocketFactoryAcceptorImpl";
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint(toStringName(), msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryConnectionImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryConnectionImpl.java
new file mode 100644
index 0000000..af96c92
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryConnectionImpl.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.legacy.connection;
+
+import java.net.Socket;
+import java.nio.channels.SocketChannel;
+import java.util.Collections;
+
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.ContactInfo;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.transport.CorbaContactInfo;
+import com.sun.corba.se.spi.transport.SocketInfo;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl;
+import com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl;
+
+/**
+ * @author Harold Carr
+ */
+public class SocketFactoryConnectionImpl
+ extends
+ SocketOrChannelConnectionImpl
+{
+ // Socket-factory client constructor.
+ public SocketFactoryConnectionImpl(ORB orb,
+ CorbaContactInfo contactInfo,
+ boolean useSelectThreadToWait,
+ boolean useWorkerThread)
+ {
+ super(orb, useSelectThreadToWait, useWorkerThread);
+
+ // REVISIT - probably need a contact info for both
+ // client and server for removing connections from cache?
+ this.contactInfo = contactInfo;
+
+ boolean isBlocking = !useSelectThreadToWait;
+ SocketInfo socketInfo =
+ // REVISIT - case - needs interface method
+ ((SocketFactoryContactInfoImpl)contactInfo).socketInfo;
+ try {
+ socket =
+ orb.getORBData().getLegacySocketFactory().createSocket(socketInfo);
+ socketChannel = socket.getChannel();
+ if (socketChannel != null) {
+ socketChannel.configureBlocking(isBlocking);
+ } else {
+ // IMPORTANT: non-channel-backed sockets must use
+ // dedicated reader threads.
+ setUseSelectThreadToWait(false);
+ }
+ if (orb.transportDebugFlag) {
+ dprint(".initialize: connection created: " + socket);
+ }
+ } catch (GetEndPointInfoAgainException ex) {
+ 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())) ;
+ }
+ state = OPENING;
+ }
+
+ public String toString()
+ {
+ synchronized ( stateEvent ){
+ return
+ "SocketFactoryConnectionImpl[" + " "
+ + (socketChannel == null ?
+ socket.toString() : socketChannel.toString()) + " "
+ + getStateString( state ) + " "
+ + shouldUseSelectThreadToWait() + " "
+ + shouldUseWorkerThreadForEvent()
+ + "]" ;
+ }
+ }
+
+ // Note: public to override parent.
+ public void dprint(String msg)
+ {
+ ORBUtility.dprint("SocketFactoryConnectionImpl", msg);
+ }
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoImpl.java
new file mode 100644
index 0000000..52d287e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoImpl.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.legacy.connection;
+
+import com.sun.corba.se.pept.transport.Connection;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList;
+import com.sun.corba.se.spi.transport.SocketInfo;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl;
+
+
+/**
+ * @author Harold Carr
+ */
+public class SocketFactoryContactInfoImpl
+ extends
+ SocketOrChannelContactInfoImpl
+{
+ protected ORBUtilSystemException wrapper;
+ protected SocketInfo socketInfo;
+
+ // XREVISIT
+ // See SocketOrChannelAcceptorImpl.createMessageMediator
+ // See SocketFactoryContactInfoImpl.constructor()
+ // See SocketOrChannelContactInfoImpl.constructor()
+ public SocketFactoryContactInfoImpl()
+ {
+ }
+
+ public SocketFactoryContactInfoImpl(
+ ORB orb,
+ CorbaContactInfoList contactInfoList,
+ IOR effectiveTargetIOR,
+ short addressingDisposition,
+ SocketInfo cookie)
+ {
+ super(orb, contactInfoList);
+ this.effectiveTargetIOR = effectiveTargetIOR;
+ this.addressingDisposition = addressingDisposition;
+
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_TRANSPORT ) ;
+
+ socketInfo =
+ orb.getORBData().getLegacySocketFactory()
+ .getEndPointInfo(orb, effectiveTargetIOR, cookie);
+
+ socketType = socketInfo.getType();
+ hostname = socketInfo.getHost();
+ port = socketInfo.getPort();
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.ContactInfo
+ //
+
+ public Connection createConnection()
+ {
+ Connection connection =
+ new SocketFactoryConnectionImpl(
+ orb, this,
+ orb.getORBData().connectionSocketUseSelectThreadToWait(),
+ orb.getORBData().connectionSocketUseWorkerThreadForEvent());
+ return connection;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // java.lang.Object
+ //
+
+ public String toString()
+ {
+ return
+ "SocketFactoryContactInfoImpl["
+ + socketType + " "
+ + hostname + " "
+ + port
+ + "]";
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListImpl.java
new file mode 100644
index 0000000..4f209d0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListImpl.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.legacy.connection;
+
+import java.util.Iterator;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.impl.transport.CorbaContactInfoListImpl;
+import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
+
+/**
+ * @author Harold Carr
+ */
+public class SocketFactoryContactInfoListImpl
+ extends
+ CorbaContactInfoListImpl
+{
+ // XREVISIT - is this used?
+ public SocketFactoryContactInfoListImpl(ORB orb)
+ {
+ super(orb);
+ }
+
+ public SocketFactoryContactInfoListImpl(ORB orb, IOR targetIOR)
+ {
+ super(orb, targetIOR);
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.ContactInfoList
+ //
+
+ public Iterator iterator()
+ {
+ return new SocketFactoryContactInfoListIteratorImpl(orb, this);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java
new file mode 100644
index 0000000..63081b1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/SocketFactoryContactInfoListIteratorImpl.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.legacy.connection;
+
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.SystemException;
+
+import com.sun.corba.se.pept.transport.ContactInfo;
+
+import com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaContactInfo;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList;
+import com.sun.corba.se.spi.transport.SocketInfo;
+
+import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
+import com.sun.corba.se.impl.transport.SharedCDRContactInfoImpl;
+
+public class SocketFactoryContactInfoListIteratorImpl
+ extends CorbaContactInfoListIteratorImpl
+{
+ private SocketInfo socketInfoCookie;
+
+ public SocketFactoryContactInfoListIteratorImpl(
+ ORB orb,
+ CorbaContactInfoList corbaContactInfoList)
+ {
+ super(orb, corbaContactInfoList, null, null);
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // java.util.Iterator
+ //
+
+ public boolean hasNext()
+ {
+ return true;
+ }
+
+ public Object 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);
+ }
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.ContactInfoListIterator
+ //
+
+ public boolean reportException(ContactInfo contactInfo,
+ RuntimeException ex)
+ {
+ this.failureContactInfo = (CorbaContactInfo)contactInfo;
+ this.failureException = ex;
+ if (ex instanceof org.omg.CORBA.COMM_FAILURE) {
+
+ if (ex.getCause() instanceof GetEndPointInfoAgainException) {
+ socketInfoCookie =
+ ((GetEndPointInfoAgainException) ex.getCause())
+ .getEndPointInfo();
+ return true;
+ }
+
+ SystemException se = (SystemException) ex;
+ if (se.completed == CompletionStatus.COMPLETED_NO) {
+ if (contactInfoList.getEffectiveTargetIOR() !=
+ contactInfoList.getTargetIOR())
+ {
+ // retry from root ior
+ contactInfoList.setEffectiveTargetIOR(
+ contactInfoList.getTargetIOR());
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/USLPort.java b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/USLPort.java
new file mode 100644
index 0000000..fb50957
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/legacy/connection/USLPort.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.legacy.connection;
+
+public class USLPort
+{
+ private String type;
+ private int port;
+
+ public USLPort (String type, int port)
+ {
+ this.type = type;
+ this.port = port;
+ }
+
+ public String getType () { return type; }
+ public int getPort () { return port; }
+ public String toString () { return type + ":" + port; }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoFactoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoFactoryImpl.java
new file mode 100644
index 0000000..087fc1f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoFactoryImpl.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.monitoring;
+
+import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfoFactory;
+import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo;
+
+public class MonitoredAttributeInfoFactoryImpl
+ implements MonitoredAttributeInfoFactory
+{
+ public MonitoredAttributeInfo createMonitoredAttributeInfo(
+ String description, Class type, boolean isWritable,
+ boolean isStatistic )
+ {
+ return new MonitoredAttributeInfoImpl( description, type,
+ isWritable, isStatistic );
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoImpl.java
new file mode 100644
index 0000000..3b7539e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredAttributeInfoImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.monitoring;
+
+import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo;
+
+public class MonitoredAttributeInfoImpl implements MonitoredAttributeInfo {
+ private final String description;
+ private final Class type;
+ private final boolean writableFlag, statisticFlag;
+
+ MonitoredAttributeInfoImpl( String description, Class type,
+ boolean isWritable, boolean isStatistic )
+ {
+ this.description = description;
+ this.type = type;
+ this.writableFlag = isWritable;
+ this.statisticFlag = isStatistic;
+ }
+
+ public String getDescription( ) {
+ return this.description;
+ }
+
+ public Class type( ) {
+ return this.type;
+ }
+
+ public boolean isWritable( ) {
+ return this.writableFlag;
+ }
+
+ public boolean isStatistic( ) {
+ return this.statisticFlag;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectFactoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectFactoryImpl.java
new file mode 100644
index 0000000..3e99aff
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectFactoryImpl.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.monitoring;
+
+import com.sun.corba.se.spi.monitoring.MonitoredObjectFactory;
+import com.sun.corba.se.spi.monitoring.MonitoredObject;
+
+public class MonitoredObjectFactoryImpl implements MonitoredObjectFactory {
+
+ public MonitoredObject createMonitoredObject( String name,
+ String description )
+ {
+ return new MonitoredObjectImpl( name, description );
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectImpl.java
new file mode 100644
index 0000000..edec5b7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoredObjectImpl.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.monitoring;
+
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collection;
+import java.util.Iterator;
+
+import com.sun.corba.se.spi.monitoring.MonitoredObject;
+import com.sun.corba.se.spi.monitoring.MonitoredAttribute;
+
+public class MonitoredObjectImpl implements MonitoredObject {
+ private final String name;
+ private final String description;
+
+ // List of all child Monitored Objects
+ private Map children = new HashMap();
+
+ // All the Attributes of this Monitored Object instance
+ private Map monitoredAttributes = new HashMap();
+
+ private MonitoredObject parent = null;
+
+
+ // Constructor
+ MonitoredObjectImpl( String name, String description ) {
+ this.name = name;
+ this.description = description;
+ }
+
+ public MonitoredObject getChild( String name ) {
+ synchronized( this ) {
+ return (MonitoredObject) children.get( name );
+ }
+ }
+
+ public Collection getChildren( ) {
+ synchronized( this ) {
+ return children.values();
+ }
+ }
+
+ public void addChild( MonitoredObject m ) {
+ if (m != null){
+ synchronized( this ) {
+ children.put( m.getName(), m);
+ m.setParent( this );
+ }
+ }
+ }
+
+ public void removeChild( String name ) {
+ if (name != null){
+ synchronized( this ) {
+ children.remove( name );
+ }
+ }
+ }
+
+ public synchronized MonitoredObject getParent( ) {
+ return parent;
+ }
+
+ public synchronized void setParent( MonitoredObject p ) {
+ parent = p;
+ }
+
+ public MonitoredAttribute getAttribute( String name ) {
+ synchronized( this ) {
+ return (MonitoredAttribute) monitoredAttributes.get( name );
+ }
+ }
+
+ public Collection getAttributes( ) {
+ synchronized( this ) {
+ return monitoredAttributes.values();
+ }
+ }
+
+ public void addAttribute( MonitoredAttribute value ) {
+ if (value != null) {
+ synchronized( this ) {
+ monitoredAttributes.put( value.getName(), value );
+ }
+ }
+ }
+
+ public void removeAttribute( String name ) {
+ if (name != null) {
+ synchronized( this ) {
+ monitoredAttributes.remove( name );
+ }
+ }
+ }
+
+ /**
+ * calls clearState() on all the registered children MonitoredObjects and
+ * MonitoredAttributes.
+ */
+ public void clearState( ) {
+ synchronized( this ) {
+ Iterator i = monitoredAttributes.values().iterator();
+ // First call clearState on all the local attributes
+ while( i.hasNext( ) ) {
+ ((MonitoredAttribute)i.next()).clearState();
+ }
+ i = children.values().iterator();
+ // next call clearState on all the children MonitoredObjects
+ while( i.hasNext() ) {
+ ((MonitoredObject)i.next()).clearState();
+ }
+ }
+ }
+
+ public String getName( ) {
+ return name;
+ }
+
+ public String getDescription( ) {
+ return description;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java
new file mode 100644
index 0000000..a88d2f2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerFactoryImpl.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.monitoring;
+
+import java.util.HashMap;
+import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;
+import com.sun.corba.se.spi.monitoring.MonitoringManager;
+
+public class MonitoringManagerFactoryImpl implements MonitoringManagerFactory {
+
+ private HashMap monitoringManagerTable = new HashMap();
+
+ public synchronized MonitoringManager createMonitoringManager(
+ String nameOfTheRoot, String description)
+ {
+ MonitoringManagerImpl m = null;
+ m = (MonitoringManagerImpl)monitoringManagerTable.get(nameOfTheRoot);
+ if (m == null) {
+ m = new MonitoringManagerImpl(nameOfTheRoot, description);
+ monitoringManagerTable.put(nameOfTheRoot, m);
+ }
+ return m;
+ }
+
+ public synchronized void remove(String nameOfTheRoot) {
+ monitoringManagerTable.remove(nameOfTheRoot);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java
new file mode 100644
index 0000000..b7e676e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/monitoring/MonitoringManagerImpl.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.monitoring;
+
+import com.sun.corba.se.spi.monitoring.MonitoringManager;
+import com.sun.corba.se.spi.monitoring.MonitoringManagerFactory;
+import com.sun.corba.se.spi.monitoring.MonitoredObject;
+import com.sun.corba.se.spi.monitoring.MonitoredObjectFactory;
+import com.sun.corba.se.spi.monitoring.MonitoringFactories;
+
+public class MonitoringManagerImpl implements MonitoringManager {
+ private final MonitoredObject rootMonitoredObject;
+
+ MonitoringManagerImpl(String nameOfTheRoot, String description) {
+ MonitoredObjectFactory f =
+ MonitoringFactories.getMonitoredObjectFactory();
+ rootMonitoredObject =
+ f.createMonitoredObject(nameOfTheRoot, description);
+ }
+
+ public void clearState() {
+ rootMonitoredObject.clearState();
+ }
+
+ public MonitoredObject getRootMonitoredObject() {
+ return rootMonitoredObject;
+ }
+
+ public void close() {
+ MonitoringManagerFactory f =
+ MonitoringFactories.getMonitoringManagerFactory();
+ f.remove(rootMonitoredObject.getName());
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/BindingIteratorImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/BindingIteratorImpl.java
new file mode 100644
index 0000000..df8faeb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/BindingIteratorImpl.java
@@ -0,0 +1,185 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+// Import general CORBA classes
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Object;
+
+// Import org.omg.CosNaming classes
+import org.omg.CosNaming.Binding;
+import org.omg.CosNaming.BindingType;
+import org.omg.CosNaming.BindingHolder;
+import org.omg.CosNaming.BindingListHolder;
+import org.omg.CosNaming.BindingIteratorHolder;
+import org.omg.CosNaming.BindingIteratorPOA;
+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.
+ * <p>
+ * 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.
+ * <p>
+ * 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 ;
+
+ /**
+ * Create a binding iterator servant.
+ * runs the super constructor.
+ * @param orb an ORB object.
+ * @exception java.lang.Exception a Java exception.
+ */
+ public BindingIteratorImpl(ORB orb)
+ throws java.lang.Exception
+ {
+ super();
+ this.orb = orb ;
+ }
+
+ /**
+ * 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.
+ * @see NextOne
+ */
+ public synchronized boolean next_one(org.omg.CosNaming.BindingHolder b)
+ {
+ // NextOne actually returns the next one
+ return NextOne(b);
+ }
+
+ /**
+ * 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.
+ * @see NextOne
+ */
+ 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().
+ * @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)
+ {
+ // Take the smallest of what's left and what's being asked for
+ int numberToGet = Math.min(RemainingElements(),how_many);
+
+ // Create a resulting BindingList
+ Binding[] bl = new Binding[numberToGet];
+ BindingHolder bh = new BindingHolder();
+ int i = 0;
+ // Keep iterating as long as there are entries
+ while (i < numberToGet && this.NextOne(bh) == true) {
+ bl[i] = bh.value;
+ i++;
+ }
+ // Found any at all?
+ if (i == 0) {
+ // No
+ blh.value = new Binding[0];
+ return false;
+ }
+
+ // 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.
+ * @see Destroy
+ */
+ public synchronized void destroy()
+ {
+ // Destroy actually destroys
+ this.Destroy();
+ }
+
+ /**
+ * 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.
+ */
+ protected abstract boolean NextOne(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.
+ */
+ protected abstract void Destroy();
+
+ /**
+ * Abstract method for returning the remaining number of elements.
+ * @return the remaining number of elements in the iterator.
+ */
+ protected abstract int RemainingElements();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InterOperableNamingImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InterOperableNamingImpl.java
new file mode 100644
index 0000000..74a44a9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InterOperableNamingImpl.java
@@ -0,0 +1,413 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+import org.omg.CosNaming.NamingContextExtPackage.*;
+import java.io.StringWriter;
+
+// Import general CORBA classes
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.Object;
+
+// Import org.omg.CosNaming types
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+
+
+/**
+ * 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.
+ *
+ * @param n Array of Name Components (Simple or Compound Names)
+ * @return string which is the stringified reference.
+ */
+ public String convertToString( org.omg.CosNaming.NameComponent[]
+ theNameComponents )
+ {
+ String theConvertedString =
+ convertNameComponentToString( theNameComponents[0] );
+ String temp;
+ for( int i = 1; i < theNameComponents.length; i++ ) {
+ temp = convertNameComponentToString( theNameComponents[i] );
+ if( temp != null ) {
+ theConvertedString =
+ theConvertedString + "/" + convertNameComponentToString(
+ theNameComponents[i] );
+ }
+ }
+ return theConvertedString;
+ }
+
+ /** This method converts a single Namecomponent to String, By adding Escapes
+ * If neccessary.
+ */
+ private String convertNameComponentToString(
+ org.omg.CosNaming.NameComponent theNameComponent )
+ {
+ if( ( ( theNameComponent.id == null )
+ ||( theNameComponent.id.length() == 0 ) )
+ &&( ( theNameComponent.kind == null )
+ ||( theNameComponent.kind.length() == 0 ) ) )
+ {
+ return ".";
+ }
+ else if( ( theNameComponent.id == null )
+ ||( theNameComponent.id.length() == 0 ) )
+ {
+ String kind = addEscape( theNameComponent.kind );
+ return "." + kind;
+ }
+ else if( ( theNameComponent.kind == null )
+ ||( theNameComponent.kind.length() == 0 ) )
+ {
+ String id = addEscape( theNameComponent.id );
+ return id;
+ }
+ else {
+ String id = addEscape( theNameComponent.id );
+ String kind = addEscape( theNameComponent.kind );
+ return (id + "." + kind);
+ }
+ }
+
+
+ /** This method adds escape '\' for the Namecomponent if neccessary
+ */
+ private String addEscape( String value )
+ {
+ StringBuffer theNewValue;
+ if( (value != null) && ( (value.indexOf('.') != -1 ) ||
+ (value.indexOf('/') != -1)))
+ {
+ char c;
+ theNewValue = new StringBuffer( );
+ for( int i = 0; i < value.length( ); i++ ) {
+ c = value.charAt( i );
+ if( ( c != '.' ) && (c != '/' ) )
+ {
+ theNewValue.append( c );
+ }
+ else {
+ // Adding escape for the "."
+ theNewValue.append( '\\' );
+ theNewValue.append( c );
+ }
+ }
+ }
+ else {
+ return value;
+ }
+ return new String( theNewValue );
+ }
+
+ /**
+ * Method which converts the Stringified name into Array of Name Components.
+ *
+ * @param string which is the stringified name.
+ * @return Array of Name Components (Simple or Compound Names)
+ */
+ public org.omg.CosNaming.NameComponent[] convertToNameComponent(
+ String theStringifiedName )
+ throws org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ String[] theStringifiedNameComponents =
+ breakStringToNameComponents( theStringifiedName );
+ if( ( theStringifiedNameComponents == null )
+ || (theStringifiedNameComponents.length == 0 ) )
+ {
+ return null;
+ }
+ NameComponent[] theNameComponents =
+ new NameComponent[theStringifiedNameComponents.length];
+ for( int i = 0; i < theStringifiedNameComponents.length; i++ ) {
+ theNameComponents[i] = createNameComponentFromString(
+ theStringifiedNameComponents[i] );
+ }
+ return theNameComponents;
+ }
+
+ /** Step1 in converting Stringified name into array of Name Component
+ * is breaking the String into multiple name components
+ */
+ private String[] breakStringToNameComponents( String theStringifiedName ) {
+ int[] theIndices = new int[100];
+ int theIndicesIndex = 0;
+
+ for(int index = 0; index <= theStringifiedName.length(); ) {
+ theIndices[theIndicesIndex] = theStringifiedName.indexOf( '/',
+ index );
+ if( theIndices[theIndicesIndex] == -1 ) {
+ // This is the end of all the occurence of '/' and hence come
+ // out of the loop
+ index = theStringifiedName.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 )
+ && (theStringifiedName.charAt(
+ theIndices[theIndicesIndex]-1) == '\\') )
+ {
+ index = theIndices[theIndicesIndex] + 1;
+ theIndices[theIndicesIndex] = -1;
+ }
+ else {
+ index = theIndices[theIndicesIndex] + 1;
+ theIndicesIndex++;
+ }
+ }
+ }
+ if( theIndicesIndex == 0 ) {
+ String[] tempString = new String[1];
+ tempString[0] = theStringifiedName;
+ return tempString;
+ }
+ if( theIndicesIndex != 0 ) {
+ theIndicesIndex++;
+ }
+ return StringComponentsFromIndices( theIndices, theIndicesIndex,
+ theStringifiedName );
+ }
+
+ /** 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
+
+ {
+ String id = null;
+ String kind = null;
+ 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( );
+ }
+
+ int index = theStringifiedNameComponent.indexOf( '.', 0 );
+ // The format could be XYZ (Without kind)
+ 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
+ // and Kinds are null
+ 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 {
+ boolean kindfound = false;
+ while( (index < theStringifiedNameComponent.length() )
+ &&( kindfound != true ) )
+ {
+ index = theStringifiedNameComponent.indexOf( '.',index + 1);
+ if( index > 0 ) {
+ if( theStringifiedNameComponent.charAt(
+ index - 1 ) != '\\' )
+ {
+ kindfound = true;
+ }
+ }
+ 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 {
+ id = theStringifiedNameComponent;
+ }
+ }
+ }
+ id = cleanEscapeCharacter( id );
+ kind = cleanEscapeCharacter( kind );
+ if( id == null ) {
+ id = "";
+ }
+ if( kind == null ) {
+ kind = "";
+ }
+ return new NameComponent( id, kind );
+ }
+
+
+ /** 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 ) {
+ return theString;
+ }
+ else {
+ StringBuffer src = new StringBuffer( theString );
+ StringBuffer dest = new StringBuffer( );
+ char 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 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 );
+ }
+ }
+ }
+ }
+ return new String(dest);
+ }
+ }
+
+ /**
+ * 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.
+ */
+ public String createURLBasedAddress( String address, String name )
+ throws InvalidAddress
+ {
+ String theurl = null;
+ if( ( address == null )
+ ||( address.length() == 0 ) ) {
+ throw new InvalidAddress();
+ }
+ else {
+ theurl = "corbaname:" + address + "#" + encode( name );
+ }
+ return theurl;
+ }
+
+ /** Encodes the string according to RFC 2396 IETF spec required by INS.
+ */
+ 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 );
+ }
+ // 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 {
+ // Add escape
+ theStringAfterEscape.write( '%' );
+ String hexString = Integer.toHexString( (int) c );
+ theStringAfterEscape.write( hexString );
+ }
+ }
+ return theStringAfterEscape.toString();
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingKey.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingKey.java
new file mode 100644
index 0000000..8385c6c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingKey.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+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.
+ */
+public class InternalBindingKey
+{
+ // A key contains a name
+ public NameComponent name;
+ private int idLen;
+ private int kindLen;
+ private int hashVal;
+
+ // Default Constructor
+ public InternalBindingKey() {}
+
+ // Normal constructor
+ public InternalBindingKey(NameComponent n)
+ {
+ idLen = 0;
+ kindLen = 0;
+ setup(n);
+ }
+
+ // Setup the object
+ protected void setup(NameComponent n) {
+ this.name = n;
+ // Precompute lengths and values since they will not change
+ if( this.name.id != null ) {
+ idLen = this.name.id.length();
+ }
+ if( this.name.kind != null ) {
+ kindLen = this.name.kind.length();
+ }
+ hashVal = 0;
+ if (idLen > 0)
+ hashVal += this.name.id.hashCode();
+ if (kindLen > 0)
+ hashVal += this.name.kind.hashCode();
+ }
+
+ // Compare the keys by comparing name's id and kind
+ public boolean equals(java.lang.Object o) {
+ if (o == null)
+ return false;
+ if (o instanceof InternalBindingKey) {
+ InternalBindingKey that = (InternalBindingKey)o;
+ // Both lengths must match
+ if (this.idLen != that.idLen || this.kindLen != that.kindLen) {
+ return false;
+ }
+ // If id is set is must be equal
+ if (this.idLen > 0 && this.name.id.equals(that.name.id) == false) {
+ return false;
+ }
+ // If kind is set it must be equal
+ if (this.kindLen > 0 && this.name.kind.equals(that.name.kind) == false) {
+ return false;
+ }
+ // Must be the same
+ return true;
+ } else {
+ return false;
+ }
+ }
+ // Return precomputed value
+ public int hashCode() {
+ return this.hashVal;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingValue.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingValue.java
new file mode 100644
index 0000000..cf6322b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/InternalBindingValue.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+import org.omg.CORBA.Object;
+import org.omg.CosNaming.Binding;
+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.
+ */
+public class InternalBindingValue
+{
+ public Binding theBinding;
+ public String strObjectRef;
+ public org.omg.CORBA.Object theObjectRef;
+
+ // Default constructor
+ public InternalBindingValue() {}
+
+ // Normal constructor
+ public InternalBindingValue(Binding b, String o) {
+ theBinding = b;
+ strObjectRef = o;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextDataStore.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextDataStore.java
new file mode 100644
index 0000000..042f3a9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextDataStore.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+// Import general CORBA classes
+import org.omg.CORBA.Object;
+
+// Import org.omg.CosNaming classes
+import org.omg.CosNaming.BindingType;
+import org.omg.CosNaming.BindingTypeHolder;
+import org.omg.CosNaming.BindingListHolder;
+import org.omg.CosNaming.BindingIteratorHolder;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+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.
+ */
+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.
+ * @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 Bind(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.
+ * @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 Resolve(NameComponent n,BindingTypeHolder bth)
+ throws org.omg.CORBA.SystemException;
+
+ /**
+ * Method which implements unbinding a name.
+ * @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 Unbind(NameComponent n)
+ throws org.omg.CORBA.SystemException;
+
+ /**
+ * 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 List(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.
+ * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
+ */
+ NamingContext NewContext()
+ 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 Destroy()
+ throws org.omg.CORBA.SystemException;
+
+ /**
+ * Method which returns whether this NamingContext is empty
+ * or not.
+ * @return true if this NamingContext contains no bindings.
+ */
+ boolean IsEmpty();
+
+ POA getNSPOA( );
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java
new file mode 100644
index 0000000..3b2c19f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java
@@ -0,0 +1,1025 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+// Imports for Logging
+import java.util.logging.Logger;
+import java.util.logging.Level;
+import com.sun.corba.se.impl.orbutil.LogKeywords;
+
+// Import general CORBA classes
+import org.omg.CORBA.Object;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
+
+// Import org.omg.CosNaming classes
+import org.omg.CosNaming.BindingType;
+import org.omg.CosNaming.BindingTypeHolder;
+import org.omg.CosNaming.BindingListHolder;
+import org.omg.CosNaming.BindingIteratorHolder;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContextHelper;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextPackage.*;
+import org.omg.CosNaming._NamingContextImplBase;
+import org.omg.CosNaming.NamingContextExtHelper;
+import org.omg.CosNaming.NamingContextExt;
+import org.omg.CosNaming.NamingContextExtPOA;
+import org.omg.CosNaming.NamingContextExtPackage.*;
+import org.omg.CosNaming.NamingContextPackage.NotFound;
+
+import com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore;
+
+import com.sun.corba.se.impl.naming.namingutil.INSURLHandler;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.impl.logging.NamingSystemException ;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+/**
+ * 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.
+ * <p>
+ * 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.
+ * <p>
+ * 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.
+ */
+public abstract class NamingContextImpl
+ extends NamingContextExtPOA
+ implements NamingContextDataStore
+{
+
+ protected POA nsPOA;
+ private Logger readLogger, updateLogger, lifecycleLogger;
+ private NamingSystemException wrapper ;
+ private static NamingSystemException staticWrapper =
+ NamingSystemException.get( CORBALogDomains.NAMING_UPDATE ) ;
+
+ // The grammer for Parsing and Building Interoperable Stringified Names
+ // are implemented in this class
+ private InterOperableNamingImpl insImpl;
+ /**
+ * Create a naming context servant.
+ * Runs the super constructor.
+ * @param orb an ORB object.
+ * @exception java.lang.Exception a Java exception.
+ */
+ public NamingContextImpl(ORB orb, POA poa) throws java.lang.Exception {
+ super();
+ this.orb = orb;
+ wrapper = NamingSystemException.get( orb,
+ CORBALogDomains.NAMING_UPDATE ) ;
+
+ insImpl = new InterOperableNamingImpl( );
+ this.nsPOA = poa;
+ readLogger = orb.getLogger( CORBALogDomains.NAMING_READ);
+ updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE);
+ lifecycleLogger = orb.getLogger(
+ CORBALogDomains.NAMING_LIFECYCLE);
+ }
+
+ 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.
+ * @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.
+ * @see doBind
+ */
+ 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 )
+ {
+ updateLogger.warning( LogKeywords.NAMING_BIND +
+ " unsuccessful because NULL Object cannot be Bound " );
+ throw wrapper.objectIsNull() ;
+ }
+ // doBind implements all four flavors of binding
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ doBind(impl,n,obj,false,BindingType.nobject);
+ if( updateLogger.isLoggable( Level.FINE ) ) {
+ // isLoggable call to make sure that we save some precious
+ // processor cycles, if there is no need to log.
+ updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + " Name = " +
+ NamingUtils.getDirectoryStructuredName( n ) );
+ }
+ }
+
+
+ /**
+ * 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 NamingContext 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.
+ * @see doBind
+ */
+ 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 ) {
+ updateLogger.warning( LogKeywords.NAMING_BIND_FAILURE +
+ " NULL Context cannot be Bound " );
+ throw new BAD_PARAM( "Naming Context should not be null " );
+ }
+ // doBind implements all four flavors of binding
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ doBind(impl,n,nc,false,BindingType.ncontext);
+ if( updateLogger.isLoggable( Level.FINE ) ) {
+ // isLoggable call to make sure that we save some precious
+ // processor cycles, if there is no need to log.
+ updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + " Name = " +
+ NamingUtils.getDirectoryStructuredName( n ) );
+ }
+ }
+
+ /**
+ * 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.
+ * @see doBind
+ */
+ 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 )
+ {
+ updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
+ " NULL Object cannot be Bound " );
+ throw wrapper.objectIsNull() ;
+ }
+ try {
+ // doBind implements all four flavors of binding
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ doBind(impl,n,obj,true,BindingType.nobject);
+ } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
+ updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
+ NamingUtils.getDirectoryStructuredName( n ) +
+ " is already bound to a Naming Context" );
+ // This should not happen
+ throw wrapper.namingCtxRebindAlreadyBound( ex ) ;
+ }
+ if( updateLogger.isLoggable( Level.FINE ) ) {
+ // isLoggable call to make sure that we save some precious
+ // processor cycles, if there is no need to log.
+ updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
+ NamingUtils.getDirectoryStructuredName( n ) );
+ }
+ }
+
+ /**
+ * 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.
+ * @see doBind
+ */
+ 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 )
+ {
+ updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
+ " NULL Context cannot be Bound " );
+ throw wrapper.objectIsNull() ;
+ }
+ try {
+ // doBind implements all four flavors of binding
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ doBind(impl,n,nc,true,BindingType.ncontext);
+ } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
+ // This should not happen
+ updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
+ NamingUtils.getDirectoryStructuredName( n ) +
+ " is already bound to a CORBA Object" );
+ throw wrapper.namingCtxRebindctxAlreadyBound( ex ) ;
+ }
+ if( updateLogger.isLoggable( Level.FINE ) ) {
+ // isLoggable call to make sure that we save some precious
+ // processor cycles, if there is no need to log.
+ updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
+ NamingUtils.getDirectoryStructuredName( n ) );
+ }
+ }
+
+ /**
+ * 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.
+ * @see doResolve
+ */
+ 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 = (NamingContextDataStore)this;
+ org.omg.CORBA.Object obj = doResolve(impl,n);
+ if( obj != null ) {
+ if( readLogger.isLoggable( Level.FINE ) ) {
+ readLogger.fine( LogKeywords.NAMING_RESOLVE_SUCCESS +
+ " Name: " + NamingUtils.getDirectoryStructuredName( n ) );
+ }
+ } else {
+ readLogger.warning( LogKeywords.NAMING_RESOLVE_FAILURE +
+ " Name: " + NamingUtils.getDirectoryStructuredName( n ) );
+ }
+ return obj;
+ }
+
+
+ /**
+ * 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.
+ * @see doUnbind
+ */
+ 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 = (NamingContextDataStore)this;
+ doUnbind(impl,n);
+ if( updateLogger.isLoggable( Level.FINE ) ) {
+ // isLoggable call to make sure that we save some precious
+ // processor cycles, if there is no need to log.
+ updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
+ " Name: " + NamingUtils.getDirectoryStructuredName( 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.
+ * @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.
+ * @see BindingListHolder
+ * @see BindingIteratorImpl
+ */
+ public void list(int how_many, BindingListHolder bl,
+ BindingIteratorHolder bi)
+ {
+ // List actually generates the list
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ synchronized (impl) {
+ impl.List(how_many,bl,bi);
+ }
+ if( readLogger.isLoggable( Level.FINE ) && (bl.value != null )) {
+ // isLoggable call to make sure that we save some precious
+ // processor cycles, if there is no need to log.
+ readLogger.fine ( LogKeywords.NAMING_LIST_SUCCESS +
+ "list(" + how_many + ") -> bindings[" + bl.value.length +
+ "] + iterator: " + bi.value);
+ }
+ }
+
+ /**
+ * 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.
+ */
+ public synchronized NamingContext new_context()
+ {
+ // Create actually creates a new naming context
+ lifecycleLogger.fine( "Creating New Naming Context " );
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ synchronized (impl) {
+ NamingContext nctx = impl.NewContext();
+ if( nctx != null ) {
+ lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
+ } else {
+ // If naming context is null, then that must be a serious
+ // error.
+ lifecycleLogger.severe ( LogKeywords.LIFECYCLE_CREATE_FAILURE );
+ }
+ return nctx;
+ }
+ }
+
+ /**
+ * 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.
+ * @see new_context
+ * @see bind_context
+ */
+ 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 {
+ if (debug)
+ dprint("bind_new_context " + nameToString(n));
+ // The obvious solution:
+ nc = this.new_context();
+ this.bind_context(n,nc);
+ rnc = nc;
+ nc = null;
+ } finally {
+ try {
+ if(nc != null)
+ nc.destroy();
+ } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
+ }
+ }
+ if( updateLogger.isLoggable( Level.FINE ) ) {
+ // isLoggable call to make sure that we save some precious
+ // processor cycles, if there is no need to log.
+ updateLogger.fine ( LogKeywords.NAMING_BIND +
+ "New Context Bound To " +
+ NamingUtils.getDirectoryStructuredName( n ) );
+ }
+ return rnc;
+ }
+
+ /**
+ * 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.
+ */
+ public void destroy()
+ throws org.omg.CosNaming.NamingContextPackage.NotEmpty
+ {
+ lifecycleLogger.fine( "Destroying Naming Context " );
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ synchronized (impl) {
+ if (impl.IsEmpty() == true) {
+ // The context is empty so it can be destroyed
+ impl.Destroy();
+ lifecycleLogger.fine ( LogKeywords.LIFECYCLE_DESTROY_SUCCESS );
+ }
+ else {
+ // This context is not empty!
+ // Not a fatal error, warning should do.
+ lifecycleLogger.warning( LogKeywords.LIFECYCLE_DESTROY_FAILURE +
+ " NamingContext children are not destroyed still.." );
+ throw new NotEmpty();
+ }
+ }
+ }
+
+ /**
+ * 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 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.
+ * @see resolve
+ * @see unbind
+ * @see bind
+ * @see bind_context
+ * @see rebind
+ * @see rebind_context
+ */
+ 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
+ {
+ // Valid name?
+ if (n.length < 1)
+ throw new InvalidName();
+
+ // At bottom level?
+ if (n.length == 1) {
+ // The identifier must be set
+ if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) {
+ throw new InvalidName();
+ }
+
+ // Ensure synchronization of backend
+ synchronized (impl) {
+ // Yes: bind object in this context under the name
+ BindingTypeHolder bth = new BindingTypeHolder();
+ if (rebind) {
+ org.omg.CORBA.Object objRef = impl.Resolve( 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
+ // 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);
+ }
+ } 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);
+ }
+ }
+ impl.Unbind(n[0]);
+ }
+
+ } else {
+ if (impl.Resolve(n[0],bth) != null)
+ // "Resistence is futile." [Borg pickup line]
+ throw new AlreadyBound();
+ }
+
+ // Now there are no other bindings under this name
+ impl.Bind(n[0],obj,bt);
+ }
+ } else {
+ // No: bind in a different context
+ NamingContext context = resolveFirstAsContext(impl,n);
+
+ // Compute tail
+ NameComponent[] tail = new NameComponent[n.length - 1];
+ System.arraycopy(n,1,tail,0,n.length-1);
+
+ // How should we propagate the bind
+ switch (bt.value()) {
+ case BindingType._nobject:
+ {
+ // Bind as object
+ if (rebind)
+ context.rebind(tail,obj);
+ else
+ context.bind(tail,obj);
+ }
+ break;
+ case BindingType._ncontext:
+ {
+ // Narrow to a naming context using Java casts. It must
+ // work.
+ NamingContext objContext = (NamingContext)obj;
+ // Bind as context
+ if (rebind)
+ context.rebind_context(tail,objContext);
+ else
+ context.bind_context(tail,objContext);
+ }
+ break;
+ default:
+ // This should not happen
+ throw staticWrapper.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
+ */
+ 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 = null;
+ BindingTypeHolder bth = new BindingTypeHolder();
+
+
+ // Length must be greater than 0
+ if (n.length < 1)
+ throw new InvalidName();
+
+ // The identifier must be set
+ if (n.length == 1) {
+ synchronized (impl) {
+ // Resolve first level in this context
+ obj = impl.Resolve(n[0],bth);
+ }
+ if (obj == null) {
+ // Object was not found
+ throw new NotFound(NotFoundReason.missing_node,n);
+ }
+ return obj;
+ } else {
+ // n.length > 1
+ if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0) ) {
+ throw new InvalidName();
+ }
+
+ NamingContext context = resolveFirstAsContext(impl,n);
+
+ // Compute restOfName = name[1..length]
+ NameComponent[] tail = new NameComponent[n.length -1];
+ System.arraycopy(n,1,tail,0,n.length-1);
+
+ // Resolve rest of name in context
+ 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 ) {
+ 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
+ */
+ public static void doUnbind(NamingContextDataStore impl,
+ NameComponent[] n)
+ throws org.omg.CosNaming.NamingContextPackage.NotFound,
+ org.omg.CosNaming.NamingContextPackage.CannotProceed,
+ org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ // Name valid?
+ if (n.length < 1)
+ throw new InvalidName();
+
+ // Unbind here?
+ if (n.length == 1) {
+ // The identifier must be set
+ if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) ) {
+ throw new InvalidName();
+ }
+
+ org.omg.CORBA.Object objRef = null;
+ synchronized (impl) {
+ // Yes: unbind in this context
+ objRef = impl.Unbind(n[0]);
+ }
+
+ if (objRef == null)
+ // It was not bound
+ throw new NotFound(NotFoundReason.missing_node,n);
+ // Done
+ return;
+ } else {
+ // No: unbind in a different context
+
+ // Resolve first - must be resolveable
+ NamingContext context = resolveFirstAsContext(impl,n);
+
+ // Compute tail
+ NameComponent[] tail = new NameComponent[n.length - 1];
+ System.arraycopy(n,1,tail,0,n.length-1);
+
+ // Propagate unbind to this context
+ 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.CosNaming.NamingContextPackage.CannotProceed Could not proceed
+ * in resolving the first component of the supplied name.
+ * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
+ * @see resolve
+ */
+ protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
+ NameComponent[] n)
+ throws org.omg.CosNaming.NamingContextPackage.NotFound {
+ org.omg.CORBA.Object topRef = null;
+ BindingTypeHolder bth = new BindingTypeHolder();
+ NamingContext context = null;
+
+ synchronized (impl) {
+ // Resolve first - must be resolveable
+ topRef = impl.Resolve(n[0],bth);
+ if (topRef == null) {
+ // It was not bound
+ throw new NotFound(NotFoundReason.missing_node,n);
+ }
+ }
+
+ // Was it bound as a context?
+ if (bth.value != BindingType.ncontext) {
+ // It was not a context
+ throw new NotFound(NotFoundReason.not_context,n);
+ }
+
+ // Narrow to a naming context
+ try {
+ context = NamingContextHelper.narrow(topRef);
+ } catch (org.omg.CORBA.BAD_PARAM ex) {
+ // It was not a context
+ throw new NotFound(NotFoundReason.not_context,n);
+ }
+
+ // Hmm. must be ok
+ return context;
+ }
+
+
+ /**
+ * This operation creates a stringified name from the array of Name
+ * components.
+ * @param n Name of the object
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ */
+ public String to_string(org.omg.CosNaming.NameComponent[] n)
+ throws org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ // Name valid?
+ if ( (n == null ) || (n.length == 0) )
+ {
+ throw new InvalidName();
+ }
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+
+ 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
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ */
+ public org.omg.CosNaming.NameComponent[] to_name(String sn)
+ throws org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ // Name valid?
+ if ( (sn == null ) || (sn.length() == 0) )
+ {
+ throw new InvalidName();
+ }
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ org.omg.CosNaming.NameComponent[] theNameComponents =
+ insImpl.convertToNameComponent( sn );
+ if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
+ {
+ throw new InvalidName();
+ }
+ for( int i = 0; i < theNameComponents.length; i++ ) {
+ // If there is a name component whose id and kind null or
+ // zero length string, then an invalid name exception needs to be
+ // raised.
+ if ( ( ( theNameComponents[i].id == null )
+ ||( theNameComponents[i].id.length() == 0 ) )
+ &&( ( theNameComponents[i].kind == null )
+ ||( theNameComponents[i].kind.length() == 0 ) ) ) {
+ throw new InvalidName();
+ }
+ }
+ 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
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
+ * Indicates the internet based address of the host machine is
+ * incorrect
+ */
+
+ public String to_url(String addr, String sn)
+ throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
+ org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ // Name valid?
+ if ( (sn == null ) || (sn.length() == 0) )
+ {
+ throw new InvalidName();
+ }
+ if( addr == null )
+ {
+ throw new
+ org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
+ }
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ String urlBasedAddress = null;
+ urlBasedAddress = insImpl.createURLBasedAddress( addr, sn );
+ // Extra check to see that corba name url created is valid as per
+ // INS spec grammer.
+ try {
+ INSURLHandler.getINSURLHandler( ).parseURL( urlBasedAddress );
+ } catch( BAD_PARAM e ) {
+ throw new
+ org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
+ }
+ return urlBasedAddress;
+ }
+
+ /**
+ * This operation resolves the Stringified name into the object
+ * reference.
+ * @param sn Stringified Name of the 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
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
+ * Indicates the name is already bound.
+ *
+ */
+ 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 = null;
+ // Name valid?
+ if ( (sn == null ) || (sn.length() == 0) )
+ {
+ throw new InvalidName();
+ }
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ org.omg.CosNaming.NameComponent[] theNameComponents =
+ insImpl.convertToNameComponent( sn );
+
+ if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
+ {
+ throw new InvalidName();
+ }
+ theObject = resolve( theNameComponents );
+ return theObject;
+ }
+
+
+ transient protected ORB orb;
+
+ public static String nameToString(NameComponent[] name)
+ {
+ StringBuffer s = new StringBuffer("{");
+ if (name != null || name.length > 0) {
+ for (int i=0;i<name.length;i++) {
+ if (i>0)
+ s.append(",");
+ s.append("[").
+ append(name[i].id).
+ append(",").
+ append(name[i].kind).
+ append("]");
+ }
+ }
+ s.append("}");
+ return s.toString();
+ }
+
+ // Debugging aids.
+ public static final boolean debug = false;
+
+ private static void dprint(String msg) {
+ NamingUtils.dprint("NamingContextImpl(" +
+ Thread.currentThread().getName() + " at " +
+ System.currentTimeMillis() +
+ " ems): " + msg);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingUtils.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingUtils.java
new file mode 100644
index 0000000..d141d4d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingUtils.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+import java.io.*;
+import org.omg.CosNaming.NameComponent;
+
+
+public class NamingUtils {
+ // Do not instantiate this class
+ private NamingUtils() {};
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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);
+ else
+ System.err.println(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) {
+ if (errStream != null)
+ e.printStackTrace(errStream);
+ else
+ e.printStackTrace();
+ }
+
+ /**
+ * 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 {
+ // Create an outputstream for debugging
+ 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 {
+ 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);
+ 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.
+ */
+ static String getDirectoryStructuredName( NameComponent[] name ) {
+ StringBuffer directoryStructuredName = new StringBuffer("/");
+ for( int i = 0; i < name.length; i++ ) {
+ directoryStructuredName.append( name[i].id + "." + name[i].kind );
+ }
+ return directoryStructuredName.toString( );
+ }
+
+ /**
+ * The debug printstream.
+ */
+ public static java.io.PrintStream debugStream;
+
+ /**
+ * The error printstream.
+ */
+ public static java.io.PrintStream errStream;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientBindingIterator.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientBindingIterator.java
new file mode 100644
index 0000000..468a533
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientBindingIterator.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+// Import general CORBA classes
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.ORB;
+import org.omg.PortableServer.POA;
+
+// Get org.omg.CosNaming Types
+import org.omg.CosNaming.Binding;
+import org.omg.CosNaming.BindingType;
+import org.omg.CosNaming.BindingTypeHolder;
+import org.omg.CosNaming.NameComponent;
+
+// Get base implementation
+import com.sun.corba.se.impl.naming.cosnaming.NamingContextImpl;
+import com.sun.corba.se.impl.naming.cosnaming.InternalBindingValue;
+
+// Get a hash table
+import java.util.Hashtable;
+import java.util.Enumeration;
+
+/**
+ * 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
+{
+ // 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.
+ * @exception Exception a Java exception thrown of the base class cannot
+ * initialize.
+ */
+ public TransientBindingIterator(ORB orb, Hashtable aTable,
+ POA thePOA )
+ throws java.lang.Exception
+ {
+ super(orb);
+ theHashtable = aTable;
+ theEnumeration = this.theHashtable.elements();
+ currentSize = this.theHashtable.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 NextOne(org.omg.CosNaming.BindingHolder b)
+ {
+ // If there are more elements get the next element
+ boolean hasMore = theEnumeration.hasMoreElements();
+ if (hasMore) {
+ b.value =
+ ((InternalBindingValue)theEnumeration.nextElement()).theBinding;
+ currentSize--;
+ } else {
+ // Return empty but marshalable binding
+ 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.
+ */
+ final public void Destroy()
+ {
+ // Remove the object from the Active Object Map.
+ try {
+ byte[] objectId = nsPOA.servant_to_id( this );
+ if( objectId != null ) {
+ nsPOA.deactivate_object( objectId );
+ }
+ }
+ catch( Exception e ) {
+ NamingUtils.errprint("BindingIterator.Destroy():caught exception:");
+ NamingUtils.printException(e);
+ }
+ }
+
+ /**
+ * Returns the remaining number of elements in the iterator.
+ * @return the remaining number of elements in the iterator.
+ */
+ public final int RemainingElements() {
+ return currentSize;
+ }
+
+ private int currentSize;
+ private Hashtable theHashtable;
+ private Enumeration theEnumeration;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameServer.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameServer.java
new file mode 100644
index 0000000..c9e250f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameServer.java
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+import java.util.Properties;
+import java.net.InetAddress;
+
+import org.omg.CORBA.ORB;
+
+import org.omg.CosNaming.NamingContext;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.naming.cosnaming.TransientNameService;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
+import com.sun.corba.se.impl.logging.NamingSystemException;
+
+/**
+ * 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.
+ * <p>
+ * 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 TransientNameService
+ * @see BootstrapServer
+ */
+public class TransientNameServer
+{
+ static private boolean debug = false ;
+ static NamingSystemException wrapper = NamingSystemException.get(
+ CORBALogDomains.NAMING ) ;
+
+ static public void trace( String msg ) {
+ if (debug)
+ System.out.println( msg ) ;
+ }
+
+ static public void initDebug( String[] args ) {
+ // If debug was compiled to be true for testing purposes,
+ // don't change it.
+ if (debug)
+ return ;
+
+ for (int ctr=0; ctr<args.length; ctr++)
+ if (args[ctr].equalsIgnoreCase( "-debug" )) {
+ debug = true ;
+ return ;
+ }
+ debug = false ;
+ }
+
+ private static org.omg.CORBA.Object initializeRootNamingContext( ORB orb ) {
+ org.omg.CORBA.Object rootContext = null;
+ try {
+ com.sun.corba.se.spi.orb.ORB coreORB =
+ (com.sun.corba.se.spi.orb.ORB)orb ;
+
+ TransientNameService tns = new TransientNameService(coreORB );
+ return tns.initialNamingContext();
+ } catch (org.omg.CORBA.SystemException e) {
+ throw wrapper.transNsCannotCreateInitialNcSys( e ) ;
+ } catch (Exception e) {
+ throw wrapper.transNsCannotCreateInitialNc( e ) ;
+ }
+ }
+
+ /**
+ * 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.
+ */
+ public static void main(String args[]) {
+ initDebug( args ) ;
+
+ boolean invalidHostOption = false;
+ boolean orbInitialPort0 = false;
+
+ // Determine the initial bootstrap port to use
+ int initialPort = 0;
+ try {
+ trace( "Transient name server started with args " + args ) ;
+
+ // Create an ORB object
+ Properties props = System.getProperties() ;
+
+ props.put( ORBConstants.SERVER_ID_PROPERTY, ORBConstants.NAME_SERVICE_SERVER_ID ) ;
+ props.put( "org.omg.CORBA.ORBClass",
+ "com.sun.corba.se.impl.orb.ORBImpl" );
+
+ try {
+ // Try environment
+ String ips = System.getProperty( ORBConstants.INITIAL_PORT_PROPERTY ) ;
+ if (ips != null && ips.length() > 0 ) {
+ initialPort = java.lang.Integer.parseInt(ips);
+ // -Dorg.omg.CORBA.ORBInitialPort=0 is invalid
+ if( initialPort == 0 ) {
+ orbInitialPort0 = true;
+ throw wrapper.transientNameServerBadPort() ;
+ }
+ }
+ String hostName =
+ System.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ;
+ if( hostName != null ) {
+ invalidHostOption = true;
+ throw wrapper.transientNameServerBadHost() ;
+ }
+ } catch (java.lang.NumberFormatException e) {
+ // do nothing
+ }
+
+ // Let arguments override
+ for (int i=0;i<args.length;i++) {
+ // Was the initial port specified?
+ if (args[i].equals("-ORBInitialPort") &&
+ i < args.length-1) {
+ initialPort = java.lang.Integer.parseInt(args[i+1]);
+ // -ORBInitialPort 0 is invalid
+ if( initialPort == 0 ) {
+ orbInitialPort0 = true;
+ throw wrapper.transientNameServerBadPort() ;
+ }
+ }
+ if (args[i].equals("-ORBInitialHost" ) ) {
+ invalidHostOption = true;
+ throw wrapper.transientNameServerBadHost() ;
+ }
+ }
+
+ // If initialPort is not set, then we need to set the Default
+ // Initial Port Property for the ORB
+ if( initialPort == 0 ) {
+ initialPort = ORBConstants.DEFAULT_INITIAL_PORT;
+ props.put( ORBConstants.INITIAL_PORT_PROPERTY,
+ java.lang.Integer.toString(initialPort) );
+ }
+
+ // Set -ORBInitialPort = Persistent Server Port so that ORBImpl
+ // will start Boot Strap.
+ props.put( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
+ java.lang.Integer.toString(initialPort) );
+
+ org.omg.CORBA.ORB corb = ORB.init( args, props ) ;
+ trace( "ORB object returned from init: " + corb ) ;
+
+ org.omg.CORBA.Object ns = initializeRootNamingContext( corb ) ;
+ ((com.sun.corba.se.org.omg.CORBA.ORB)corb).register_initial_reference(
+ "NamingService", ns ) ;
+
+ String stringifiedIOR = null;
+
+ if( ns != null ) {
+ stringifiedIOR = corb.object_to_string(ns) ;
+ } else {
+ NamingUtils.errprint(CorbaResourceUtil.getText(
+ "tnameserv.exception", initialPort));
+ NamingUtils.errprint(CorbaResourceUtil.getText(
+ "tnameserv.usage"));
+ System.exit( 1 );
+ }
+
+ trace( "name service created" ) ;
+
+ // This is used for handshaking by the IBM test framework!
+ // Do not modify, unless another synchronization protocol is
+ // used to replace this hack!
+
+ System.out.println(CorbaResourceUtil.getText(
+ "tnameserv.hs1", stringifiedIOR));
+ System.out.println(CorbaResourceUtil.getText(
+ "tnameserv.hs2", initialPort));
+ System.out.println(CorbaResourceUtil.getText("tnameserv.hs3"));
+
+ // Serve objects.
+ java.lang.Object sync = new java.lang.Object();
+ synchronized (sync) {sync.wait();}
+ } catch (Exception e) {
+ if( invalidHostOption ) {
+ // Let the User Know that -ORBInitialHost is not valid for
+ // tnameserver
+ NamingUtils.errprint( CorbaResourceUtil.getText(
+ "tnameserv.invalidhostoption" ) );
+ } else if( orbInitialPort0 ) {
+ // Let the User Know that -ORBInitialPort 0 is not valid for
+ // tnameserver
+ NamingUtils.errprint( CorbaResourceUtil.getText(
+ "tnameserv.orbinitialport0" ));
+ } else {
+ NamingUtils.errprint(CorbaResourceUtil.getText(
+ "tnameserv.exception", initialPort));
+ NamingUtils.errprint(CorbaResourceUtil.getText(
+ "tnameserv.usage"));
+ }
+
+ e.printStackTrace() ;
+ }
+ }
+
+ /**
+ * Private constructor since no object of this type should be instantiated.
+ */
+ private TransientNameServer() {}
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameService.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameService.java
new file mode 100644
index 0000000..7842dd1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNameService.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+// Get CORBA type
+import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.CompletionStatus;
+
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.INTERNAL;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.LifespanPolicyValue;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+
+// Get org.omg.CosNaming types
+import org.omg.CosNaming.NamingContext;
+
+// Import transient naming context
+import com.sun.corba.se.impl.naming.cosnaming.TransientNamingContext;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.logging.NamingSystemException;
+
+/**
+ * Class TransientNameService implements a transient name service
+ * using TransientNamingContexts and TransientBindingIterators, which
+ * implement the org.omg.CosNaming::NamingContext and org.omg.CosNaming::BindingIterator
+ * interfaces specfied by the OMG Common Object Services Specification.
+ * <p>
+ * The TransientNameService creates the initial NamingContext object.
+ * @see NamingContextImpl
+ * @see BindingIteratorImpl
+ * @see TransientNamingContext
+ * @see TransientBindingIterator
+ */
+public class TransientNameService
+{
+ /**
+ * 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.
+ */
+ public TransientNameService(com.sun.corba.se.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" );
+ }
+
+ /**
+ * 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.
+ */
+ public TransientNameService(com.sun.corba.se.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 );
+ }
+
+
+ /**
+ * This method initializes Transient Name Service by associating Root
+ * context with POA and registering the root context with INS Object Keymap.
+ */
+ private void initialize( com.sun.corba.se.spi.orb.ORB orb,
+ String nameServiceName )
+ throws org.omg.CORBA.INITIALIZE
+ {
+ NamingSystemException wrapper = NamingSystemException.get( orb,
+ CORBALogDomains.NAMING ) ;
+
+ try {
+ 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);
+
+ POA nsPOA = rootPOA.create_POA( "TNameService", null, poaPolicy );
+ 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 );
+ theInitialNamingContext = initialContext.localRoot;
+ orb.register_initial_reference( nameServiceName,
+ theInitialNamingContext );
+ } catch (org.omg.CORBA.SystemException e) {
+ throw wrapper.transNsCannotCreateInitialNcSys( e ) ;
+ } catch (Exception e) {
+ throw wrapper.transNsCannotCreateInitialNc( e ) ;
+ }
+ }
+
+
+ /**
+ * Return the initial NamingContext.
+ * @return the object reference for the initial NamingContext.
+ */
+ 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/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNamingContext.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNamingContext.java
new file mode 100644
index 0000000..cef11cb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/TransientNamingContext.java
@@ -0,0 +1,357 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.cosnaming;
+
+// Import general CORBA classes
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.ORB;
+import org.omg.PortableServer.POA;
+
+// Import org.omg.CosNaming types
+import org.omg.CosNaming.Binding;
+import org.omg.CosNaming.BindingType;
+import org.omg.CosNaming.BindingTypeHolder;
+import org.omg.CosNaming.BindingListHolder;
+import org.omg.CosNaming.BindingIteratorHolder;
+import org.omg.CosNaming.NameComponent;
+import org.omg.CosNaming.NamingContext;
+
+import java.util.logging.Logger;
+import java.util.logging.Level;
+
+import java.util.Hashtable;
+import com.sun.corba.se.impl.orbutil.LogKeywords;
+import com.sun.corba.se.impl.logging.NamingSystemException;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+/**
+ * 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.
+ * <p>
+ * 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.
+ * <p>
+ * To create and destroy object references, the TransientNamingContext
+ * uses the orb.connect() and orb.disconnect() methods.
+ *
+ * @see NamingContextImpl
+ * @see NamingContextDataStore
+ * @see TransientBindingIterator
+ * @see TransientNameService
+ */
+public class TransientNamingContext extends NamingContextImpl implements NamingContextDataStore
+{
+ private Logger readLogger, updateLogger, lifecycleLogger;
+
+ // XXX: the wrapper calls are all preceded by logger updates.
+ // These can be combined, and then we simply use 3 NamingSystemException wrappers,
+ // for read, update, and lifecycl.
+ private NamingSystemException wrapper ;
+
+ /**
+ * Constructs a new TransientNamingContext object.
+ * @param orb an orb object.
+ * @param initial the initial naming context.
+ * @exception Exception a Java exception thrown of the base class cannot
+ * initialize.
+ */
+ public TransientNamingContext(com.sun.corba.se.spi.orb.ORB orb,
+ org.omg.CORBA.Object initial,
+ POA nsPOA )
+ throws java.lang.Exception
+ {
+ super(orb, nsPOA );
+ wrapper = NamingSystemException.get( orb, CORBALogDomains.NAMING ) ;
+
+ this.localRoot = initial;
+ readLogger = orb.getLogger( CORBALogDomains.NAMING_READ);
+ updateLogger = orb.getLogger( CORBALogDomains.NAMING_UPDATE);
+ lifecycleLogger = orb.getLogger(
+ CORBALogDomains.NAMING_LIFECYCLE);
+ lifecycleLogger.fine( "Root TransientNamingContext LIFECYCLE.CREATED" );
+ }
+
+ /**
+ * 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.
+ */
+ public final void Bind(NameComponent n, org.omg.CORBA.Object obj,
+ BindingType bt)
+ throws org.omg.CORBA.SystemException
+ {
+ // Create a key and a value
+ 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);
+ value.theObjectRef = obj;
+ // insert it
+ InternalBindingValue oldValue =
+ (InternalBindingValue)this.theHashtable.put(key,value);
+
+ if (oldValue != null) {
+ updateLogger.warning( LogKeywords.NAMING_BIND + "Name " +
+ getName( n ) + " Was Already Bound" );
+ throw wrapper.transNcBindAlreadyBound() ;
+ }
+ if( updateLogger.isLoggable( Level.FINE ) ) {
+ updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS +
+ "Name Component: " + n.id + "." + n.kind );
+ }
+ }
+
+ /**
+ * 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.
+ */
+ public final org.omg.CORBA.Object Resolve(NameComponent n,
+ BindingTypeHolder bth)
+ throws org.omg.CORBA.SystemException
+ {
+ // Is the initial naming context requested?
+ 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 =
+ (InternalBindingValue) this.theHashtable.get(key);
+ if (value == null) return null;
+ if( readLogger.isLoggable( Level.FINE ) ) {
+ readLogger.fine( LogKeywords.NAMING_RESOLVE_SUCCESS
+ + "Namecomponent :" + getName( n ) );
+ }
+
+ // 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.
+ * @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.
+ */
+ public final org.omg.CORBA.Object Unbind(NameComponent n)
+ throws org.omg.CORBA.SystemException
+ {
+ // Create a key and remove it from the hashtable
+ InternalBindingKey key = new InternalBindingKey(n);
+ InternalBindingValue value =
+ (InternalBindingValue)this.theHashtable.remove(key);
+
+ // Return what was found
+ if (value == null) {
+ if( updateLogger.isLoggable( Level.FINE ) ) {
+ updateLogger.fine( LogKeywords.NAMING_UNBIND_FAILURE +
+ " There was no binding with the name " + getName( n ) +
+ " to Unbind " );
+ }
+ return null;
+ } else {
+ if( updateLogger.isLoggable( Level.FINE ) ) {
+ updateLogger.fine( LogKeywords.NAMING_UNBIND_SUCCESS +
+ " NameComponent: " + getName( n ) );
+ }
+ 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.
+ * @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.
+ */
+ public final void List(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
+ // Binding Iterator.destroy is called.
+ TransientBindingIterator bindingIterator =
+ new TransientBindingIterator(this.orb,
+ (Hashtable)this.theHashtable.clone(), 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 );
+
+ // Get the object reference for the binding iterator servant
+ org.omg.CosNaming.BindingIterator bindingRef =
+ org.omg.CosNaming.BindingIteratorHelper.narrow( obj );
+
+ bi.value = bindingRef;
+ } catch (org.omg.CORBA.SystemException e) {
+ readLogger.warning( LogKeywords.NAMING_LIST_FAILURE + e );
+ throw e;
+ } catch (Exception e) {
+ // Convert to a CORBA system exception
+ readLogger.severe( LogKeywords.NAMING_LIST_FAILURE + 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.
+ */
+ public final org.omg.CosNaming.NamingContext NewContext()
+ throws org.omg.CORBA.SystemException
+ {
+ try {
+ // Create a new servant
+ TransientNamingContext transContext =
+ new TransientNamingContext(
+ (com.sun.corba.se.spi.orb.ORB) orb,localRoot, nsPOA);
+
+ byte[] objectId = nsPOA.activate_object( transContext );
+ org.omg.CORBA.Object obj = nsPOA.id_to_reference( objectId );
+ lifecycleLogger.fine( "TransientNamingContext " +
+ "LIFECYCLE.CREATE SUCCESSFUL" );
+ return org.omg.CosNaming.NamingContextHelper.narrow( obj );
+
+ } catch (org.omg.CORBA.SystemException e) {
+ lifecycleLogger.log(
+ Level.WARNING, LogKeywords.LIFECYCLE_CREATE_FAILURE, e );
+ throw e;
+ } catch (Exception e) {
+ lifecycleLogger.log(
+ Level.WARNING, LogKeywords.LIFECYCLE_CREATE_FAILURE, 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.
+ */
+ public final void Destroy()
+ 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 );
+ }
+ if( lifecycleLogger.isLoggable( Level.FINE ) ) {
+ lifecycleLogger.fine(
+ LogKeywords.LIFECYCLE_DESTROY_SUCCESS );
+ }
+ } catch (org.omg.CORBA.SystemException e) {
+ lifecycleLogger.log( Level.WARNING,
+ LogKeywords.LIFECYCLE_DESTROY_FAILURE, e );
+ throw e;
+ } catch (Exception e) {
+ lifecycleLogger.log( Level.WARNING,
+ LogKeywords.LIFECYCLE_DESTROY_FAILURE, e );
+ throw wrapper.transNcDestroyGotExc( e ) ;
+ }
+ }
+
+ /**
+ * A Utility Method For Logging..
+ */
+ 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 true if this NamingContext contains no bindings.
+ */
+ public final boolean IsEmpty()
+ {
+ return this.theHashtable.isEmpty();
+ }
+
+ // A hashtable to store the bindings
+ private final Hashtable theHashtable = new Hashtable();
+
+ /**
+ * The local root naming context.
+ */
+ public org.omg.CORBA.Object localRoot;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbalocURL.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbalocURL.java
new file mode 100644
index 0000000..eb911cd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbalocURL.java
@@ -0,0 +1,288 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.namingutil;
+
+import java.util.*;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.NamingSystemException ;
+
+/**
+ * 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
+{
+ static NamingSystemException wrapper = NamingSystemException.get(
+ CORBALogDomains.NAMING_READ ) ;
+
+ /**
+ * 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.
+ */
+ public CorbalocURL( String aURL ) {
+ String url = aURL;
+
+ if( url != null ) {
+ try {
+ // First Clean the URL Escapes if there are any
+ url = Utility.cleanEscapes( url );
+ } catch( Exception e ) {
+ // There is something wrong with the URL escapes used
+ // so throw an exception
+ badAddress( e );
+ }
+ 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 ) {
+ // The url starts with a '/', it's an error
+ badAddress( null );
+ }
+ // 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 ), "," );
+ // NOTE:
+ // There should be atleast one token, because there are checks
+ // 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( ) ) {
+ String endpointInfo = endpoints.nextToken();
+ IIOPEndpointInfo iiopEndpointInfo = null;
+ if( endpointInfo.startsWith( "iiop:" ) ) {
+ iiopEndpointInfo = handleIIOPColon( endpointInfo );
+ } else if( endpointInfo.startsWith( "rir:" ) ) {
+ handleRIRColon( endpointInfo );
+ rirFlag = true;
+ } 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( null );
+ }
+ 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( );
+ }
+ 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 );
+ }
+ }
+ }
+
+
+ /**
+ * A Utility method to throw BAD_PARAM exception to signal malformed
+ * INS URL.
+ */
+ private void badAddress( java.lang.Throwable e )
+ {
+ throw wrapper.insBadAddress( e ) ;
+ }
+
+ /**
+ * 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 );
+ }
+
+
+ /**
+ * 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@<host>:<port>
+ 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( null );
+ }
+ if( tokenCount == 2 ) {
+ // There is VersionInformation after iiop:
+ String version = tokenizer.nextToken( );
+ int dot = version.indexOf('.');
+ // There is a version without ., which means
+ // Malformed list
+ if (dot == -1) {
+ badAddress( null );
+ }
+ try {
+ iiopEndpointInfo.setVersion(
+ Integer.parseInt( version.substring( 0, dot )),
+ Integer.parseInt( version.substring(dot+1)) );
+ hostandport = tokenizer.nextToken( );
+ } catch( Throwable e ) {
+ badAddress( e );
+ }
+ }
+ 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 );
+ }
+ Utility.validateGIOPVersion( iiopEndpointInfo );
+ return iiopEndpointInfo;
+ }
+
+ /**
+ * Validate 'rir:' case.
+ */
+ private void handleRIRColon( String rirInfo )
+ {
+ if( rirInfo.length() != NamingConstants.RIRCOLON_LENGTH ) {
+ badAddress( null );
+ }
+ }
+
+ /**
+ * Returns an IPV6 Port that is after [<ipv6>]:. 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;
+ }
+
+ /**
+ * Will be true only in CorbanameURL class.
+ */
+ public boolean isCorbanameURL( ) {
+ return false;
+ }
+
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbanameURL.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbanameURL.java
new file mode 100644
index 0000000..1ebae71
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/CorbanameURL.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.namingutil;
+
+import com.sun.corba.se.impl.logging.NamingSystemException;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+/**
+ * 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
+ */
+public class CorbanameURL extends INSURLBase
+{
+ private static NamingSystemException wrapper =
+ NamingSystemException.get( CORBALogDomains.NAMING ) ;
+
+ /**
+ * 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.
+ */
+ 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 );
+ }
+
+ int delimiterIndex = url.indexOf( '#' );
+ String corbalocString = null;
+ if( delimiterIndex != -1 ) {
+ // Append corbaloc: for Grammar check, Get the string between
+ // corbaname: and # which forms the corbaloc string
+ corbalocString = "corbaloc:" +
+ url.substring( 0, delimiterIndex ) + "/";
+ } else {
+ // Build a corbaloc string to check the grammar.
+ // 10 is the length of corbaname:
+ corbalocString = "corbaloc:" + url.substring( 0, url.length() );
+ // If the string doesnot end with a / then add one to end the
+ // URL correctly
+ if( corbalocString.endsWith( "/" ) != true ) {
+ corbalocString = corbalocString + "/";
+ }
+ }
+ try {
+ // Check the corbaloc grammar and set the returned corbaloc
+ // object to the CorbaName Object
+ 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 );
+ }
+ }
+
+ /**
+ * A Utility method to throw BAD_PARAM exception.
+ */
+ private void badAddress( java.lang.Throwable e )
+ throws org.omg.CORBA.BAD_PARAM
+ {
+ throw wrapper.insBadAddress( e ) ;
+ }
+
+ /**
+ * 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( );
+ }
+
+ public boolean isCorbanameURL( ) {
+ return true;
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/IIOPEndpointInfo.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/IIOPEndpointInfo.java
new file mode 100644
index 0000000..3cee5e8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/IIOPEndpointInfo.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.namingutil;
+
+import com.sun.corba.se.impl.orbutil.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.
+ *
+ * @author Hemanth
+ */
+public class IIOPEndpointInfo
+{
+ // Version information
+ private int major, minor;
+
+ // Host Name and Port Number
+ private String host;
+ private int port;
+
+ IIOPEndpointInfo( ) {
+ // Default IIOP Version
+ major = ORBConstants.DEFAULT_INS_GIOP_MAJOR_VERSION;
+ minor = ORBConstants.DEFAULT_INS_GIOP_MINOR_VERSION;
+ // Default host is localhost
+ host = ORBConstants.DEFAULT_INS_HOST;
+ // Default INS Port
+ port = ORBConstants.DEFAULT_INS_PORT;
+ }
+
+ public void setHost( String theHost ) {
+ host = theHost;
+ }
+
+ public String getHost( ) {
+ return host;
+ }
+
+ public void setPort( int thePort ) {
+ port = thePort;
+ }
+
+ public int getPort( ) {
+ return port;
+ }
+
+ public void setVersion( int theMajor, int theMinor ) {
+ major = theMajor;
+ minor = theMinor;
+ }
+
+ public int getMajor( ) {
+ return major;
+ }
+
+ public int getMinor( ) {
+ return minor;
+ }
+
+ /** Internal Debug Method.
+ */
+ public void dump( ) {
+ System.out.println( " Major -> " + major + " Minor -> " + minor );
+ System.out.println( "host -> " + host );
+ System.out.println( "port -> " + port );
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURL.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURL.java
new file mode 100644
index 0000000..a8f54f1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURL.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.namingutil;
+
+/**
+ * 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( );
+
+ // There can be one or more Endpoint's in the URL, so the return value is
+ // a List
+ public java.util.List getEndpointInfo( );
+
+ public String getKeyString( );
+
+ public String getStringifiedName( );
+
+ // This method will return true only in CorbanameURL, It is provided because
+ // corbaname: URL needs special handling.
+ public boolean isCorbanameURL( );
+
+ // A debug method, which is not required for normal operation
+ public void dPrint( );
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLBase.java
new file mode 100644
index 0000000..72471cf
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLBase.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.namingutil;
+
+/** 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
+ */
+public abstract class INSURLBase implements INSURL {
+
+ // 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 ;
+
+ public boolean getRIRFlag( ) {
+ return rirFlag;
+ }
+
+ public java.util.List getEndpointInfo( ) {
+ return theEndpointInfo;
+ }
+
+ public String getKeyString( ) {
+ return theKeyString;
+ }
+
+ public String getStringifiedName( ) {
+ return theStringifiedName;
+ }
+
+ 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( );
+ }
+ if( isCorbanameURL( ) ) {
+ System.out.println( "Stringified Name = " + getStringifiedName() );
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLHandler.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLHandler.java
new file mode 100644
index 0000000..45b45fa
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/INSURLHandler.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.naming.namingutil;
+
+import org.omg.CORBA.CompletionStatus;
+import java.util.StringTokenizer;
+
+/**
+ * This class is the entry point to parse different types of INS URL's.
+ *
+ * @author Hemanth
+ */
+
+public class INSURLHandler {
+
+ private static INSURLHandler insURLHandler = null;
+
+ // Length of corbaloc:
+ private static final int CORBALOC_PREFIX_LENGTH = 9;
+
+ // Length of corbaname:
+ private static final int CORBANAME_PREFIX_LENGTH = 10;
+
+ private INSURLHandler( ) {
+ }
+
+ public synchronized static INSURLHandler getINSURLHandler( ) {
+ if( insURLHandler == null ) {
+ insURLHandler = new INSURLHandler( );
+ }
+ return insURLHandler;
+ }
+
+ 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 ) );
+ }
+ return null;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/NamingConstants.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/NamingConstants.java
new file mode 100644
index 0000000..5465ae9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/NamingConstants.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.naming.namingutil;
+
+/**
+ * Constants specific to INS parsing and validation.
+ */
+public class NamingConstants {
+
+ // iiop length
+ public static final int IIOP_LENGTH = 4;
+
+ // rir: length
+ public static final int RIRCOLON_LENGTH = 4;
+
+ public static final int MAJORNUMBER_SUPPORTED = 1;
+
+ public static final int MINORNUMBERMAX = 2;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/Utility.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/Utility.java
new file mode 100644
index 0000000..8d69260
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/namingutil/Utility.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.namingutil;
+
+import java.io.StringWriter;
+
+import org.omg.CORBA.DATA_CONVERSION;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.impl.logging.NamingSystemException;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+/**
+ * Utility methods for Naming.
+ *
+ * @author Hemanth
+ */
+class Utility {
+ private static NamingSystemException wrapper =
+ NamingSystemException.get( CORBALogDomains.NAMING ) ;
+
+ /**
+ * cleanEscapes removes URL escapes as per IETF 2386 RFP.
+ */
+ 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 );
+ } else {
+ // Get the two hexadecimal digits and convert that into int
+ i++;
+ int Hex1 = hexOf( stringToDecode.charAt(i) );
+ i++;
+ int Hex2 = hexOf( stringToDecode.charAt(i) );
+ int value = (Hex1 * 16) + Hex2;
+ // Convert the integer to ASCII
+ 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.
+ **/
+ static int hexOf( char x )
+ {
+ int val;
+
+ val = x - '0';
+ if (val >=0 && val <= 9)
+ return val;
+
+ val = (x - 'a') + 10;
+ if (val >= 10 && val <= 15)
+ return val;
+
+ val = (x - 'A') + 10;
+ if (val >= 10 && val <= 15)
+ return val;
+
+ throw new DATA_CONVERSION( );
+ }
+
+ /**
+ * 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() ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingKey.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingKey.java
new file mode 100644
index 0000000..d7aad37
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingKey.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.pcosnaming;
+
+import java.io.Serializable;
+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.
+ */
+public class InternalBindingKey
+ implements Serializable
+{
+
+ // computed by serialver tool
+ private static final long serialVersionUID = -5410796631793704055L;
+
+ public String id;
+ public String kind;
+
+ // Default Constructor
+ public InternalBindingKey() {}
+
+ // Normal constructor
+ public InternalBindingKey(NameComponent n)
+ {
+ setup(n);
+ }
+
+ // Setup the object
+ protected void setup(NameComponent n) {
+ this.id = n.id;
+ this.kind = n.kind;
+ }
+
+ // Compare the keys by comparing name's id and kind
+ public boolean equals(java.lang.Object o) {
+ if (o == null)
+ return false;
+ if (o instanceof InternalBindingKey) {
+ InternalBindingKey that = (InternalBindingKey)o;
+ if( this.id != null && that.id != null )
+ {
+ if (this.id.length() != that.id.length() )
+ {
+ return false;
+ }
+ // If id is set is must be equal
+ if (this.id.length() > 0 && this.id.equals(that.id) == false)
+ {
+ return false;
+ }
+ }
+ else
+ {
+ // If One is Null and the other is not then it's a mismatch
+ // So, return false
+ if( ( this.id == null && that.id != null )
+ || ( this.id !=null && that.id == null ) )
+ {
+ return false;
+ }
+ }
+ if( this.kind != null && that.kind != null )
+ {
+ if (this.kind.length() != that.kind.length() )
+ {
+ return false;
+ }
+ // If kind is set it must be equal
+ if (this.kind.length() > 0 && this.kind.equals(that.kind) == false)
+ {
+ return false;
+ }
+ }
+ else
+ {
+ // If One is Null and the other is not then it's a mismatch
+ // So, return false
+ if( ( this.kind == null && that.kind != null )
+ || ( this.kind !=null && that.kind == null ) )
+ {
+ return false;
+ }
+ }
+ // We have checked all the possibilities, so return true
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+
+ // Return precomputed value
+ public int hashCode() {
+ int hashVal = 0;
+ if (this.id.length() > 0)
+ {
+ hashVal += this.id.hashCode();
+ }
+ if (this.kind.length() > 0)
+ {
+ hashVal += this.kind.hashCode();
+ }
+ return hashVal;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingValue.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingValue.java
new file mode 100644
index 0000000..26747ae
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/InternalBindingValue.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.pcosnaming;
+
+import org.omg.CORBA.Object;
+import org.omg.CosNaming.BindingType;
+import java.io.Serializable;
+
+/**
+ * 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
+ implements Serializable
+{
+ public BindingType theBindingType;
+ // The value stores both Stringified Object Reference and
+ // Non-Stringified Object Reference. This is done to avoid
+ // calling orb.string_to_object( ) everytime. Instead it
+ // will be set once and then the result will be used everytime.
+ public String strObjectRef;
+ transient private org.omg.CORBA.Object theObjectRef;
+
+ // Default constructor
+ public InternalBindingValue() {
+ }
+
+ // Normal constructor
+ public InternalBindingValue(BindingType b, String o) {
+ // Objectreference or Context
+ theBindingType = b;
+ strObjectRef = o;
+ }
+
+ public org.omg.CORBA.Object getObjectRef( )
+ {
+ return theObjectRef;
+ }
+
+ public void setObjectRef( org.omg.CORBA.Object ObjectRef )
+ {
+ theObjectRef = ObjectRef;
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameServer.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameServer.java
new file mode 100644
index 0000000..ef8dc58
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameServer.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.pcosnaming;
+
+import java.io.File;
+import java.util.Properties;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.activation.InitialNameService;
+import com.sun.corba.se.spi.activation.InitialNameServiceHelper;
+import org.omg.CosNaming.NamingContext;
+/**
+ * Class NameServer is a standalone application which
+ * implements a persistent and a transient name service.
+ * It uses the PersistentNameService and TransientNameService
+ * classes for the name service implementation.
+ *
+ * @author Hemanth Puttaswamy
+ * @since JDK1.2
+ */
+
+public class NameServer
+{
+ private ORB orb;
+
+ private File dbDir; // name server database directory
+
+ private final static String dbName = "names.db";
+
+ public static void main(String args[])
+ {
+ NameServer ns = new NameServer(args);
+ ns.run();
+ }
+
+ protected NameServer(String args[])
+ {
+ // create the ORB Object
+ java.util.Properties props = System.getProperties();
+ props.put( ORBConstants.SERVER_ID_PROPERTY, "1000" ) ;
+ props.put("org.omg.CORBA.ORBClass",
+ "com.sun.corba.se.impl.orb.ORBImpl");
+ orb = (ORB) org.omg.CORBA.ORB.init(args,props);
+
+ // set up the database directory
+ String dbDirName = props.getProperty( ORBConstants.DB_DIR_PROPERTY ) +
+ props.getProperty("file.separator") + dbName +
+ props.getProperty("file.separator");
+
+ dbDir = new File(dbDirName);
+ if (!dbDir.exists()) dbDir.mkdir();
+ }
+
+ protected void run()
+ {
+ try {
+
+ // create the persistent name service
+ NameService ns = new NameService(orb, dbDir);
+
+ // add root naming context to initial naming
+ NamingContext rootContext = ns.initialNamingContext();
+ InitialNameService ins = InitialNameServiceHelper.narrow(
+ orb.resolve_initial_references(
+ ORBConstants.INITIAL_NAME_SERVICE_NAME ));
+ ins.bind( "NameService", rootContext, true);
+ System.out.println(CorbaResourceUtil.getText("pnameserv.success"));
+
+ // wait for invocations
+ orb.run();
+
+ } catch (Exception ex) {
+
+ ex.printStackTrace(System.err);
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameService.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameService.java
new file mode 100644
index 0000000..992919b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NameService.java
@@ -0,0 +1,234 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.pcosnaming;
+
+import java.io.File;
+import java.util.Properties;
+
+import org.omg.CORBA.Policy;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.LifespanPolicyValue;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+import org.omg.CosNaming.NamingContext;
+import org.omg.CosNaming.NamingContextHelper;
+import org.omg.PortableServer.*;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+/**
+ * @author Hemanth Puttaswamy
+ * @since JDK1.2
+ */
+
+public class NameService
+{
+ private NamingContext rootContext = null;
+ private POA nsPOA = null;
+ private ServantManagerImpl contextMgr;
+ private ORB theorb;
+
+ /**
+ * Create NameService which starts the Root Naming Context in Persistent CosNaming
+ * @param orb an ORB object.
+ * @param logDir a File
+ * @exception java.lang.Exception a Java exception.
+ */
+ public NameService(ORB orb, File logDir)
+ throws Exception
+ {
+ theorb = orb;
+
+ // Moved this to the creation of the ORB that is passed into this
+ // constructor.
+ //
+ // This is required for creating Persistent Servants under this ORB
+ // Right now the Persistent NameService and ORBD are launched together
+ // Find out a better way of doing this, Since ORBD is an important
+ // process which should not be killed because of some external process
+ // orb.setPersistentServerId( (int) 1000 );
+
+ // get and activate the root naming POA
+ POA rootPOA = (POA)orb.resolve_initial_references(
+ ORBConstants.ROOT_POA_NAME ) ;
+ rootPOA.the_POAManager().activate();
+
+ // create a new POA for persistent Naming Contexts
+ // With Non-Retain policy, So that every time Servant Manager
+ // will be contacted when the reference is made for the context
+ // The id assignment is made by the NameServer, The Naming Context
+ // id's will be in the format NC<Index>
+ int i=0;
+ Policy[] poaPolicy = new Policy[4];
+ poaPolicy[i++] = rootPOA.create_lifespan_policy(
+ LifespanPolicyValue.PERSISTENT);
+ poaPolicy[i++] = rootPOA.create_request_processing_policy(
+ RequestProcessingPolicyValue.USE_SERVANT_MANAGER);
+ poaPolicy[i++] = rootPOA.create_id_assignment_policy(
+ IdAssignmentPolicyValue.USER_ID);
+ poaPolicy[i++] = rootPOA.create_servant_retention_policy(
+ ServantRetentionPolicyValue.NON_RETAIN);
+
+
+ nsPOA = rootPOA.create_POA("NameService", null, poaPolicy);
+ nsPOA.the_POAManager().activate( );
+
+ // create and set the servant manager
+ contextMgr = new
+ ServantManagerImpl(orb, logDir, this );
+
+ // The RootObject key will be NC0
+ String rootKey = contextMgr.getRootObjectKey( );
+ // initialize the root Naming Context
+ NamingContextImpl nc =
+ new NamingContextImpl( orb, rootKey, this, contextMgr );
+ nc = contextMgr.addContext( rootKey, nc );
+ nc.setServantManagerImpl( contextMgr );
+ nc.setORB( orb );
+ nc.setRootNameService( this );
+
+ nsPOA.set_servant_manager(contextMgr);
+ rootContext = NamingContextHelper.narrow(
+ nsPOA.create_reference_with_id( rootKey.getBytes( ),
+ NamingContextHelper.id( ) ) );
+ }
+
+ /**
+ * This method returns the Root Naming Context
+ */
+ public NamingContext initialNamingContext()
+ {
+ return rootContext;
+ }
+
+ /**
+ * This method returns nsPOA which is the only POA that we use for
+ * Persistent Naming Contexts.
+ */
+ POA getNSPOA( ) {
+ return nsPOA;
+ }
+
+
+ /**
+ * This method creates a NewContext, This will internally invoked from
+ * NamingContextImpl. It is not a public API. NewContext is in this class
+ * because a Persiten reference has to be created with Persistent NameService
+ * POA.
+ */
+ public NamingContext NewContext( ) throws org.omg.CORBA.SystemException
+ {
+ try
+ {
+ // Get the new Naming Context Key from
+ // the ServantManager
+ String newKey =
+ contextMgr.getNewObjectKey( );
+ // Create the new Naming context and create the Persistent
+ // reference
+ NamingContextImpl theContext =
+ new NamingContextImpl( theorb, newKey,
+ this, contextMgr );
+ NamingContextImpl tempContext = contextMgr.addContext( newKey,
+ theContext );
+ if( tempContext != null )
+ {
+ theContext = tempContext;
+ }
+ // If the context is read from the File, The following three entries
+ // will be null. So a fresh setup may be required.
+ theContext.setServantManagerImpl( contextMgr );
+ theContext.setORB( theorb );
+ theContext.setRootNameService( this );
+ NamingContext theNewContext =
+ NamingContextHelper.narrow(
+ nsPOA.create_reference_with_id( newKey.getBytes( ),
+ NamingContextHelper.id( )) );
+ return theNewContext;
+ }
+ catch( org.omg.CORBA.SystemException e )
+ {
+ throw e;
+ }
+ catch( java.lang.Exception e )
+ {
+ //throw e;
+ }
+ return null;
+ }
+
+ /**
+ * getObjectReferenceFromKey returns the Object reference from the objectkey using POA.create_reference_with_id method
+ * @param Object Key as String
+ * @return a CORBA.Object reference.
+ */
+ org.omg.CORBA.Object getObjectReferenceFromKey( String key )
+ {
+ org.omg.CORBA.Object theObject = null;
+ try
+ {
+ theObject = nsPOA.create_reference_with_id( key.getBytes( ), NamingContextHelper.id( ) );
+ }
+ catch (Exception e )
+ {
+ theObject = null;
+ }
+ return theObject;
+ }
+
+ /**
+ * getObjectKey gets the Object Key from the reference using POA.reference_to_id method
+ * @param reference an CORBA.Object.
+ * @return Object Key as String
+ */
+ String getObjectKey( org.omg.CORBA.Object reference )
+ {
+ byte theId[];
+ try
+ {
+ theId = nsPOA.reference_to_id( reference );
+ }
+ catch( org.omg.PortableServer.POAPackage.WrongAdapter e )
+ {
+ return null;
+ }
+ catch( org.omg.PortableServer.POAPackage.WrongPolicy e )
+ {
+ return null;
+ }
+ catch( Exception e )
+ {
+ return null;
+ }
+ String theKey = new String( theId );
+ return theKey;
+ }
+
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java
new file mode 100644
index 0000000..67483e0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/NamingContextImpl.java
@@ -0,0 +1,1302 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.pcosnaming;
+
+
+import org.omg.CORBA.Object;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.Policy;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.LifespanPolicyValue;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+
+import org.omg.CosNaming.*;
+import org.omg.CosNaming.NamingContextPackage.*;
+import org.omg.CosNaming.NamingContextExtPackage.*;
+
+import com.sun.corba.se.impl.naming.cosnaming.NamingContextDataStore;
+import com.sun.corba.se.impl.naming.cosnaming.NamingUtils;
+
+import com.sun.corba.se.impl.naming.namingutil.INSURLHandler;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.logging.NamingSystemException;
+
+import java.io.Serializable;
+import java.util.Hashtable;
+
+/**
+ * Class NamingContextImpl implements the org.omg.CosNaming::NamingContext and
+ * NamingContextExt interface.
+ * <p>
+ * 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.
+ * <p>
+ * None of the methods here are Synchronized because These methods will be
+ * invoked from Super class's doBind( ), doResolve( ) which are already
+ * Synchronized.
+ */
+
+
+public class NamingContextImpl
+ extends NamingContextExtPOA
+ implements NamingContextDataStore, Serializable
+{
+
+ // The ORB is required to do string_to_object() operations
+ // All the references are stored in the files in the form of IOR strings
+ private transient ORB orb;
+
+ // The ObjectKey will be in the format NC<Index> which uniquely identifies
+ // The NamingContext internaly
+ private final String objKey;
+
+ // Hash table contains all the entries in the NamingContexts. The
+ // CORBA.Object references will be stored in the form of IOR strings
+ // and the Child Naming Contexts will have it's key as the entry in the
+ // table. This table is written into File everytime an update is made
+ // on this context.
+ private final Hashtable theHashtable = new Hashtable( );
+
+ // The NameServiceHandle is required to get the ObjectId from the
+ // NamingContext's references. These references are created using
+ // POA in the NameService.
+ private transient NameService theNameServiceHandle;
+
+ // ServantManager is the single point of contact to Read, Write and
+ // Update the NamingContextFile
+ private transient ServantManagerImpl theServantManagerImplHandle;
+
+ // All the INS (Interoperable Naming Service) methods are defined in this class
+ // All the calls to INS will be delegated to this class.
+ private transient com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl insImpl;
+
+ private transient NamingSystemException readWrapper ;
+
+ private transient NamingSystemException updateWrapper ;
+
+ private static POA biPOA = null;
+
+ /**
+ * Create a naming context servant.
+ * Runs the super constructor.
+ * @param orb an ORB object.
+ * @param objKey as String
+ * @param theNameService as NameService
+ * @param theServantManagerImpl as ServantManagerImpl
+ * @exception java.lang.Exception a Java exception.
+ */
+
+ public NamingContextImpl(ORB orb, String objKey,
+ NameService theNameService, ServantManagerImpl theServantManagerImpl )
+ throws Exception
+ {
+ super();
+
+ this.orb = orb;
+ readWrapper = NamingSystemException.get( orb,
+ CORBALogDomains.NAMING_READ ) ;
+ updateWrapper = NamingSystemException.get( orb,
+ CORBALogDomains.NAMING_UPDATE ) ;
+
+ debug = true ; // orb.namingDebugFlag ;
+ this.objKey = objKey;
+ theNameServiceHandle = theNameService;
+ theServantManagerImplHandle = theServantManagerImpl;
+ insImpl =
+ new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();
+ }
+
+ com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl getINSImpl( )
+ {
+ if( insImpl == null )
+ {
+ // insImpl will be null if the NamingContext graph is rebuilt from
+ // the persistence store.
+ insImpl =
+ new com.sun.corba.se.impl.naming.cosnaming.InterOperableNamingImpl();
+ }
+ return insImpl;
+ }
+
+
+ public void setRootNameService( NameService theNameService ) {
+ theNameServiceHandle = theNameService;
+ }
+
+ public void setORB( ORB theOrb ) {
+ orb = theOrb;
+ }
+
+ public void setServantManagerImpl(
+ ServantManagerImpl theServantManagerImpl )
+ {
+ theServantManagerImplHandle = theServantManagerImpl;
+ }
+
+ public POA getNSPOA( ) {
+ return theNameServiceHandle.getNSPOA( );
+ }
+
+
+
+
+ /**
+ * 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 The supplied name
+ * is already bound.
+ * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
+ * @see doBind
+ */
+ 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 updateWrapper.objectIsNull() ;
+ }
+
+ if (debug)
+ dprint("bind " + nameToString(n) + " to " + obj);
+ // doBind implements all four flavors of binding
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ 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.
+ * @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.
+ * @see doBind
+ */
+ 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 ) {
+ throw updateWrapper.objectIsNull() ;
+ }
+ // doBind implements all four flavors of binding
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ 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.
+ * @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.
+ * @see doBind
+ */
+ 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 updateWrapper.objectIsNull() ;
+ }
+ try {
+ if (debug)
+ dprint("rebind " + nameToString(n) + " to " + obj);
+ // doBind implements all four flavors of binding
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ doBind(impl,n,obj,true,BindingType.nobject);
+ } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
+ // This should not happen
+ throw updateWrapper.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.
+ * @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.
+ * @see doBind
+ */
+ public void rebind_context(NameComponent[] n, NamingContext nc)
+ throws org.omg.CosNaming.NamingContextPackage.NotFound,
+ org.omg.CosNaming.NamingContextPackage.CannotProceed,
+ org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ try {
+ if (debug)
+ dprint("rebind_context " + nameToString(n) + " to " + nc);
+ // doBind implements all four flavors of binding
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ doBind(impl,n,nc,true,BindingType.ncontext);
+ } catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound ex) {
+ // This should not happen
+ throw updateWrapper.namingCtxRebindAlreadyBound( 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().
+ * @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.
+ * @see doResolve
+ */
+ public org.omg.CORBA.Object resolve(NameComponent[] n)
+ throws org.omg.CosNaming.NamingContextPackage.NotFound,
+ org.omg.CosNaming.NamingContextPackage.CannotProceed,
+ org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ if (debug)
+ dprint("resolve " + nameToString(n));
+ // doResolve actually resolves
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ 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.
+ * @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 doUnbind
+ */
+ public void unbind(NameComponent[] n)
+ throws org.omg.CosNaming.NamingContextPackage.NotFound,
+ org.omg.CosNaming.NamingContextPackage.CannotProceed,
+ org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ if (debug)
+ dprint("unbind " + nameToString(n));
+ // doUnbind actually unbinds
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ 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.
+ * @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.
+ * @see BindingListHolder
+ * @see BindingIteratorImpl
+ */
+ public void list(int how_many, BindingListHolder bl, BindingIteratorHolder bi)
+ {
+ if (debug)
+ dprint("list(" + how_many + ")");
+ // List actually generates the list
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ synchronized (impl) {
+ impl.List(how_many,bl,bi);
+ }
+ if (debug && bl.value != null)
+ dprint("list(" + how_many + ") -> bindings[" + bl.value.length +
+ "] + iterator: " + bi.value);
+ }
+
+
+ /**
+ * 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.
+ */
+ public synchronized NamingContext new_context()
+ {
+ // Create actually creates a new naming context
+ if (debug)
+ dprint("new_context()");
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ synchronized (impl) {
+ return impl.NewContext();
+ }
+ }
+
+
+ /**
+ * 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.
+ * @see new_context
+ * @see bind_context
+ */
+ 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 {
+ if (debug)
+ dprint("bind_new_context " + nameToString(n));
+ // The obvious solution:
+ nc = this.new_context();
+ this.bind_context(n,nc);
+ rnc = nc;
+ nc = null;
+ } finally {
+ try {
+ if(nc != null)
+ nc.destroy();
+ } catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e) {
+ }
+ }
+ return rnc;
+ }
+
+ /**
+ * 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.
+ */
+ public void destroy()
+ throws org.omg.CosNaming.NamingContextPackage.NotEmpty
+ {
+ if (debug)
+ dprint("destroy ");
+ NamingContextDataStore impl = (NamingContextDataStore)this;
+ synchronized (impl) {
+ if (impl.IsEmpty() == true)
+ // The context is empty so it can be destroyed
+ impl.Destroy();
+ else
+ // This context is not empty!
+ throw new org.omg.CosNaming.NamingContextPackage.NotEmpty();
+ }
+ }
+
+ /**
+ * 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 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.
+ * @see resolve
+ * @see unbind
+ * @see bind
+ * @see bind_context
+ * @see rebind
+ * @see rebind_context
+ */
+ private 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
+ {
+ // Valid name?
+ if (n.length < 1)
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+
+ // At bottom level?
+ if (n.length == 1) {
+ // The identifier must be set
+ if( (n[0].id.length() == 0) && (n[0].kind.length() == 0) )
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+
+ // Ensure synchronization of backend
+ synchronized (impl) {
+ // Yes: bind object in this context under the name
+ BindingTypeHolder bth = new BindingTypeHolder();
+ if (rebind) {
+ org.omg.CORBA.Object objRef = impl.Resolve( 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
+ // 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);
+ }
+ } 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);
+ }
+ }
+ impl.Unbind(n[0]);
+ }
+ } else {
+ if (impl.Resolve(n[0],bth) != null)
+ throw new org.omg.CosNaming.NamingContextPackage.AlreadyBound();
+ }
+
+ // Now there are no other bindings under this name
+ impl.Bind(n[0],obj,bt);
+ }
+ } else {
+ // No: bind in a different context
+ NamingContext context = resolveFirstAsContext(impl,n);
+
+ // Compute tail
+ NameComponent[] tail = new NameComponent[n.length - 1];
+ System.arraycopy(n,1,tail,0,n.length-1);
+
+ // How should we propagate the bind
+ switch (bt.value()) {
+ case BindingType._nobject:
+ {
+ // Bind as object
+ if (rebind)
+ context.rebind(tail,obj);
+ else
+ context.bind(tail,obj);
+ }
+ break;
+ case BindingType._ncontext:
+ {
+ // Narrow to a naming context using Java casts. It must work.
+ NamingContext objContext = (NamingContext)obj;
+ // Bind as context
+ if (rebind)
+ context.rebind_context(tail,objContext);
+ else
+ context.bind_context(tail,objContext);
+ }
+ break;
+ default:
+ // This should not happen
+ throw updateWrapper.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
+ */
+ 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 = null;
+ BindingTypeHolder bth = new BindingTypeHolder();
+
+ // Length must be greater than 0
+ if (n.length < 1)
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+
+ // The identifier must be set
+ if (n.length == 1) {
+ synchronized (impl) {
+ // Resolve first level in this context
+ obj = impl.Resolve(n[0],bth);
+ }
+ if (obj == null) {
+ // Object was not found
+ throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
+ }
+ return obj;
+ } else {
+ // n.length > 1
+ if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0 ) )
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+
+ NamingContext context = resolveFirstAsContext(impl,n);
+
+ // Compute restOfName = name[1..length]
+ NameComponent[] tail = new NameComponent[n.length -1];
+ System.arraycopy(n,1,tail,0,n.length-1);
+
+ // Resolve rest of name in context
+ 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
+ */
+ public static void doUnbind(NamingContextDataStore impl,
+ NameComponent[] n)
+ throws org.omg.CosNaming.NamingContextPackage.NotFound,
+ org.omg.CosNaming.NamingContextPackage.CannotProceed,
+ org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ // Name valid?
+ if (n.length < 1)
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+
+ // Unbind here?
+ if (n.length == 1) {
+ // The identifier must be set
+ if ( (n[0].id.length() == 0) && (n[0].kind.length() == 0 ) )
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+
+ org.omg.CORBA.Object objRef = null;
+ synchronized (impl) {
+ // Yes: unbind in this context
+ objRef = impl.Unbind(n[0]);
+ }
+
+ if (objRef == null)
+ // It was not bound
+ throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
+ // Done
+ return;
+ } else {
+ // No: unbind in a different context
+
+ // Resolve first - must be resolveable
+ NamingContext context = resolveFirstAsContext(impl,n);
+
+ // Compute tail
+ NameComponent[] tail = new NameComponent[n.length - 1];
+ System.arraycopy(n,1,tail,0,n.length-1);
+
+ // Propagate unbind to this context
+ 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.CosNaming.NamingContextPackage.CannotProceed Could not proceed
+ * in resolving the first component of the supplied name.
+ * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA system exceptions.
+ * @see resolve
+ */
+ protected static NamingContext resolveFirstAsContext(NamingContextDataStore impl,
+ NameComponent[] n)
+ throws org.omg.CosNaming.NamingContextPackage.NotFound {
+ org.omg.CORBA.Object topRef = null;
+ BindingTypeHolder bth = new BindingTypeHolder();
+ NamingContext context = null;
+
+ synchronized (impl) {
+ // Resolve first - must be resolveable
+ topRef = impl.Resolve(n[0],bth);
+ if (topRef == null) {
+ // It was not bound
+ throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.missing_node,n);
+ }
+ }
+
+ // Was it bound as a context?
+ if (bth.value != BindingType.ncontext) {
+ // It was not a context
+ throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
+ }
+
+ // Narrow to a naming context
+ try {
+ context = NamingContextHelper.narrow(topRef);
+ } catch (org.omg.CORBA.BAD_PARAM ex) {
+ // It was not a context
+ throw new org.omg.CosNaming.NamingContextPackage.NotFound(NotFoundReason.not_context,n);
+ }
+
+ // Hmm. must be ok
+ return context;
+ }
+
+ public static String nameToString(NameComponent[] name)
+ {
+ StringBuffer s = new StringBuffer("{");
+ if (name != null || name.length > 0) {
+ for (int i=0;i<name.length;i++) {
+ if (i>0)
+ s.append(",");
+ s.append("[").
+ append(name[i].id).
+ append(",").
+ append(name[i].kind).
+ append("]");
+ }
+ }
+ s.append("}");
+ return s.toString();
+ }
+
+ // Debugging aids.
+ private static boolean debug ;
+
+ private static void dprint(String msg) {
+ NamingUtils.dprint("NamingContextImpl(" +
+ Thread.currentThread().getName() + " at " +
+ System.currentTimeMillis() +
+ " ems): " + msg);
+ }
+
+
+ /**
+ * Implements all flavors of binding( bind and bindcontext)
+ * This method will be called from the superclass's doBind( ) method
+ * which takes care of all the conditions before calling this method.
+ * i.e., It checks whether the Name is already Bounded, Then in the
+ * case of rebind it calls Unbind first.
+ * This method does one level binding only, To have n-level binding
+ * with compound names, doBind( ) calls this method recursively.
+ * @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 bt Type of binding (as object or as context).
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound raised
+ * if the NameComoponent list is invalid
+ * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
+ * Could not proceed in resolving the Name from the given NameComponent
+ * @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
+ */
+ public void Bind(NameComponent n, org.omg.CORBA.Object obj, BindingType bt)
+ {
+ if( obj == null ) {
+ // Raise a Valid Exception and Return
+ return;
+ }
+
+ InternalBindingKey key = new InternalBindingKey(n);
+ InternalBindingValue value;
+
+ try {
+ if( bt.value() == BindingType._nobject ) {
+ // If the BindingType is an ObjectRef then Stringify this ref and
+ // Store it in InternalBindingValue instance. This is required
+ // because the Object References has to be stored in file
+ value = new InternalBindingValue(bt, orb.object_to_string(obj) );
+ value.setObjectRef( obj );
+ } else {
+ // If the BindingType is a NamingContext then get it's object key
+ // from the NameService and store it in the Internal Binding Value instance
+ String theNCKey = theNameServiceHandle.getObjectKey( obj );
+ value = new InternalBindingValue( bt, theNCKey );
+ value.setObjectRef( obj );
+ }
+
+ InternalBindingValue oldValue =
+ (InternalBindingValue)this.theHashtable.put(key,value);
+
+ if( oldValue != null) {
+ // There was an entry with this name in the Hashtable and hence throw CTX_ALREADY_BOUND
+ // exception
+ throw updateWrapper.namingCtxRebindAlreadyBound() ;
+ } else {
+ try {
+ // Everything went smooth so update the NamingContext file with the
+ // latest Hashtable image
+ theServantManagerImplHandle.updateContext( objKey, this );
+ } catch( Exception e ) {
+ // Something went wrong while updating the context
+ // so speak the error
+ throw updateWrapper.bindUpdateContextFailed( e ) ;
+ }
+ }
+ } catch( Exception e ) {
+ // Something went wrong while Binding the Object Reference
+ // Speak the error again.
+ throw updateWrapper.bindFailure( e ) ;
+ }
+ }
+
+ /**
+ * This method resolves the NamingContext or Object Reference for one level
+ * The doResolve( ) method calls Resolve( ) recursively to resolve n level
+ * Names.
+ * @param n a sequence of NameComponents which is the name to be resolved.
+ * @param bth Type of binding (as object or as context).
+ * @return the object reference bound under the supplied name.
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Neither a NamingContext
+ * or a Corba Object reference not found under this Name
+ * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
+ * in resolving the 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 Bind
+ */
+ public Object Resolve(NameComponent n, BindingTypeHolder bth)
+ throws SystemException
+ {
+ if( ( n.id.length() == 0 ) &&( n.kind.length() == 0 ) ) {
+ // If the NameComponent list has no entry then it means the current
+ // context was requested
+ bth.value = BindingType.ncontext;
+ return theNameServiceHandle.getObjectReferenceFromKey(
+ this.objKey );
+ }
+
+ InternalBindingKey key = new InternalBindingKey(n);
+ InternalBindingValue value =
+ (InternalBindingValue) this.theHashtable.get(key);
+
+ if( value == null ) {
+ // No entry was found for the given name and hence return NULL
+ // NamingContextDataStore throws appropriate exception if
+ // required.
+ return null;
+ }
+
+ Object theObjectFromStringifiedReference = null;
+ bth.value = value.theBindingType;
+
+ try {
+ // Check whether the entry found in the Hashtable starts with NC
+ // Which means it's a name context. So get the NamingContext reference
+ // from ServantManager, which would either return from the cache or
+ // read it from the File.
+ if( value.strObjectRef.startsWith( "NC" ) ) {
+ bth.value = BindingType.ncontext;
+ return theNameServiceHandle.getObjectReferenceFromKey( value.strObjectRef );
+ } else {
+ // Else, It is a Object Reference. Check whether Object Reference
+ // can be obtained directly, If not then convert the stringified
+ // reference to object and return.
+ theObjectFromStringifiedReference = value.getObjectRef( );
+
+ if (theObjectFromStringifiedReference == null ) {
+ try {
+ theObjectFromStringifiedReference =
+ orb.string_to_object( value.strObjectRef );
+ value.setObjectRef( theObjectFromStringifiedReference );
+ } catch( Exception e ) {
+ throw readWrapper.resolveConversionFailure(
+ CompletionStatus.COMPLETED_MAYBE, e );
+ }
+ }
+ }
+ } catch ( Exception e ) {
+ throw readWrapper.resolveFailure(
+ CompletionStatus.COMPLETED_MAYBE, e );
+ }
+
+ return theObjectFromStringifiedReference;
+ }
+
+ /**
+ * This method Unbinds the NamingContext or Object Reference for one level
+ * The doUnbind( ) method from superclass calls Unbind() to recursively
+ * Unbind using compound Names.
+ * @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 Neither a NamingContext
+ * or a Corba Object reference not found under this Name
+ * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not proceed
+ * in resolving the 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 Bind
+ */
+
+ public Object Unbind(NameComponent n) throws SystemException
+ {
+ try {
+ InternalBindingKey key = new InternalBindingKey(n);
+ InternalBindingValue value = null;
+
+ try {
+ value = (InternalBindingValue) this.theHashtable.remove(key);
+ } catch( Exception e ) {
+ // Ignore the exception in Hashtable.remove
+ }
+
+ theServantManagerImplHandle.updateContext( objKey, this );
+
+ if( value == null ) {
+ return null;
+ }
+
+ if( value.strObjectRef.startsWith( "NC" ) ) {
+ theServantManagerImplHandle.readInContext( value.strObjectRef );
+ Object theObjectFromStringfiedReference =
+ theNameServiceHandle.getObjectReferenceFromKey( value.strObjectRef );
+ return theObjectFromStringfiedReference;
+ } else {
+ Object theObjectFromStringifiedReference = value.getObjectRef( );
+
+ if( theObjectFromStringifiedReference == null ) {
+ theObjectFromStringifiedReference =
+ orb.string_to_object( value.strObjectRef );
+ }
+
+ return theObjectFromStringifiedReference;
+ }
+ } catch( Exception e ) {
+ throw updateWrapper.unbindFailure( CompletionStatus.COMPLETED_MAYBE, e );
+ }
+ }
+
+ /**
+ * List the contents of this NamingContext. It creates a new
+ * PersistentBindingIterator 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.
+ */
+
+ public void List(int how_many, BindingListHolder bl,
+ BindingIteratorHolder bi) throws SystemException
+ {
+ if( biPOA == null ) {
+ createbiPOA( );
+ }
+ try {
+ PersistentBindingIterator bindingIterator =
+ new PersistentBindingIterator(this.orb,
+ (Hashtable)this.theHashtable.clone(), biPOA);
+ // Have it set the binding list
+ bindingIterator.list(how_many,bl);
+
+ byte[] objectId = biPOA.activate_object( bindingIterator );
+ org.omg.CORBA.Object obj = biPOA.id_to_reference( objectId );
+
+ // Get the object reference for the binding iterator servant
+ 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 ) {
+ throw readWrapper.transNcListGotExc( e ) ;
+ }
+ }
+
+ private synchronized void createbiPOA( ) {
+ if( biPOA != null ) {
+ return;
+ }
+ try {
+ 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);
+ biPOA = rootPOA.create_POA("BindingIteratorPOA", null, poaPolicy );
+ biPOA.the_POAManager().activate( );
+ } catch( Exception e ) {
+ throw readWrapper.namingCtxBindingIteratorCreate( e ) ;
+ }
+ }
+
+
+ /**
+ * 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.
+ */
+ public NamingContext NewContext() throws SystemException
+ {
+ try {
+ return theNameServiceHandle.NewContext( );
+ } catch( org.omg.CORBA.SystemException e ) {
+ throw e;
+ } catch( Exception e ) {
+ throw updateWrapper.transNcNewctxGotExc( e ) ;
+ }
+ }
+
+
+ /**
+ * Destroys the NamingContext.
+ */
+ public void Destroy() throws SystemException
+ {
+ // XXX note that orb.disconnect is illegal here, since the
+ // POA is used. However, there may be some associated state
+ // that needs to be cleaned up in ServerManagerImpl which we will
+ // look into further at another time.
+ /*
+ // XXX This needs to be replaced by cleaning up the
+ // file that backs up the naming context. No explicit
+ // action is necessary at the POA level, since this is
+ // created with the non-retain policy.
+ /*
+ try { orb.disconnect(
+ theNameServiceHandle.getObjectReferenceFromKey( this.objKey ) );
+ } catch( org.omg.CORBA.SystemException e ) {
+ throw e;
+ } catch( Exception e ) {
+ throw updateWrapper.transNcDestroyGotEx( e ) ;
+ }
+ */
+ }
+
+ /**
+ * This operation creates a stringified name from the array of Name
+ * components.
+ * @param n Name of the object
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ */
+ public String to_string(org.omg.CosNaming.NameComponent[] n)
+ throws org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ // Name valid?
+ if ( (n == null ) || (n.length == 0) )
+ {
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+ }
+
+ String theStringifiedName = getINSImpl().convertToString( n );
+
+ if( theStringifiedName == null )
+ {
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+ }
+
+ return theStringifiedName;
+ }
+
+ /**
+ * This operation converts a Stringified Name into an equivalent array
+ * of Name Components.
+ * @param sn Stringified Name of the object
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ */
+ public org.omg.CosNaming.NameComponent[] to_name(String sn)
+ throws org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ // Name valid?
+ if ( (sn == null ) || (sn.length() == 0) )
+ {
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+ }
+ org.omg.CosNaming.NameComponent[] theNameComponents =
+ getINSImpl().convertToNameComponent( sn );
+ if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
+ {
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+ }
+ for( int i = 0; i < theNameComponents.length; i++ ) {
+ // If there is a name component whose id and kind null or
+ // zero length string, then an invalid name exception needs to be
+ // raised.
+ if ( ( ( theNameComponents[i].id == null )
+ ||( theNameComponents[i].id.length() == 0 ) )
+ &&( ( theNameComponents[i].kind == null )
+ ||( theNameComponents[i].kind.length() == 0 ) ) ) {
+ throw new InvalidName();
+ }
+ }
+ 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
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
+ * Indicates the internet based address of the host machine is
+ * incorrect
+ */
+
+ public String to_url(String addr, String sn)
+ throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
+ org.omg.CosNaming.NamingContextPackage.InvalidName
+ {
+ // Name valid?
+ if ( (sn == null ) || (sn.length() == 0) )
+ {
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+ }
+ if( addr == null )
+ {
+ throw new org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
+ }
+ String urlBasedAddress = null;
+ try {
+ urlBasedAddress = getINSImpl().createURLBasedAddress( addr, sn );
+ } catch (Exception e ) {
+ urlBasedAddress = null;
+ }
+ // Extra check to see that corba name url created is valid as per
+ // INS spec grammer.
+ try {
+ INSURLHandler.getINSURLHandler().parseURL( urlBasedAddress );
+ } catch( BAD_PARAM e ) {
+ throw new
+ org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
+ }
+ return urlBasedAddress;
+ }
+
+ /**
+ * This operation resolves the Stringified name into the object
+ * reference.
+ * @param sn Stringified Name of the 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
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ */
+ 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 = null;
+ // Name valid?
+ if ( (sn == null ) || (sn.length() == 0) )
+ {
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+ }
+ org.omg.CosNaming.NameComponent[] theNameComponents =
+ getINSImpl().convertToNameComponent( sn );
+ if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
+ {
+ throw new org.omg.CosNaming.NamingContextPackage.InvalidName();
+ }
+ theObject = resolve( theNameComponents );
+ return theObject;
+ }
+
+ /**
+ * This is a Debugging Method
+ */
+ public boolean IsEmpty()
+ {
+ return this.theHashtable.isEmpty();
+ }
+
+ /**
+ * This is a Debugging Method
+ */
+ public void printSize( )
+ {
+ System.out.println( "Hashtable Size = " + theHashtable.size( ) );
+ java.util.Enumeration e = theHashtable.keys( );
+ for( ; e.hasMoreElements(); )
+ {
+ InternalBindingValue thevalue =
+ (InternalBindingValue) this.theHashtable.get(e.nextElement());
+ if( thevalue != null )
+ {
+ System.out.println( "value = " + thevalue.strObjectRef);
+ }
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/PersistentBindingIterator.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/PersistentBindingIterator.java
new file mode 100644
index 0000000..7c43e6b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/PersistentBindingIterator.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.pcosnaming;
+
+// Import general CORBA classes
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.INTERNAL;
+
+// Get org.omg.CosNaming Types
+import org.omg.CosNaming.Binding;
+import org.omg.CosNaming.BindingType;
+import org.omg.CosNaming.BindingTypeHolder;
+import org.omg.CosNaming.NameComponent;
+import org.omg.PortableServer.POA;
+
+// Get base implementation
+import com.sun.corba.se.impl.naming.pcosnaming.NamingContextImpl;
+import com.sun.corba.se.impl.naming.pcosnaming.InternalBindingValue;
+
+import com.sun.corba.se.impl.naming.cosnaming.BindingIteratorImpl;
+
+// Get a hash table
+import java.util.Hashtable;
+import java.util.Enumeration;
+
+/**
+ * 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 PersistentBindingIterator extends BindingIteratorImpl
+{
+ private POA biPOA;
+ /**
+ * Constructs a new PersistentBindingIterator object.
+ * @param orb a org.omg.CORBA.ORB object.
+ * @param aTable A hashtable containing InternalBindingValues which is
+ * the content of the PersistentNamingContext.
+ * @exception Exception a Java exception thrown of the base class cannot
+ * initialize.
+ */
+ public PersistentBindingIterator(org.omg.CORBA.ORB orb, Hashtable aTable,
+ POA thePOA ) throws java.lang.Exception
+ {
+ super(orb);
+ this.orb = orb;
+ theHashtable = aTable;
+ theEnumeration = this.theHashtable.keys();
+ currentSize = this.theHashtable.size();
+ biPOA = 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 NextOne(org.omg.CosNaming.BindingHolder b)
+ {
+ // If there are more elements get the next element
+ boolean hasMore = theEnumeration.hasMoreElements();
+ if (hasMore) {
+ InternalBindingKey theBindingKey =
+ ((InternalBindingKey)theEnumeration.nextElement());
+ InternalBindingValue theElement =
+ (InternalBindingValue)theHashtable.get( theBindingKey );
+ NameComponent n = new NameComponent( theBindingKey.id, theBindingKey.kind );
+ NameComponent[] nlist = new NameComponent[1];
+ nlist[0] = n;
+ BindingType theType = theElement.theBindingType;
+
+ b.value =
+ new Binding( nlist, theType );
+ } else {
+ // Return empty but marshalable binding
+ 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.
+ */
+ final public void Destroy()
+ {
+ // Remove the object from the Active Object Map.
+ try {
+ byte[] objectId = biPOA.servant_to_id( this );
+ if( objectId != null ) {
+ biPOA.deactivate_object( objectId );
+ }
+ }
+ catch( Exception e ) {
+ throw new INTERNAL( "Exception in BindingIterator.Destroy " + e );
+ }
+ }
+
+ /**
+ * Returns the remaining number of elements in the iterator.
+ * @return the remaining number of elements in the iterator.
+ */
+ public final int RemainingElements() {
+ return currentSize;
+ }
+
+ private int currentSize;
+ private Hashtable theHashtable;
+ private Enumeration theEnumeration;
+ private org.omg.CORBA.ORB orb;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/ServantManagerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/ServantManagerImpl.java
new file mode 100644
index 0000000..4a2fff6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/naming/pcosnaming/ServantManagerImpl.java
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.naming.pcosnaming;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.Serializable;
+import java.util.Hashtable;
+
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.LocalObject;
+
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.ForwardRequest;
+import org.omg.PortableServer.ServantLocator;
+import org.omg.PortableServer.LifespanPolicyValue;
+import org.omg.PortableServer.RequestProcessingPolicyValue;
+import org.omg.PortableServer.IdAssignmentPolicyValue;
+import org.omg.PortableServer.ServantRetentionPolicyValue;
+import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+/**
+ * @author Rohit Garg
+ * @since JDK1.2
+ */
+
+public class ServantManagerImpl extends org.omg.CORBA.LocalObject implements ServantLocator
+{
+
+ // computed using serialver tool
+
+ private static final long serialVersionUID = 4028710359865748280L;
+ private ORB orb;
+
+ private NameService theNameService;
+
+ private File logDir;
+
+ private Hashtable contexts;
+
+ private CounterDB counterDb;
+
+ private int counter;
+
+ private final static String objKeyPrefix = "NC";
+
+ ServantManagerImpl(ORB orb, File logDir, NameService aNameService)
+ {
+ this.logDir = logDir;
+ this.orb = orb;
+ // initialize the counter database
+ counterDb = new CounterDB(logDir);
+ contexts = new Hashtable();
+ theNameService = aNameService;
+ }
+
+
+ public Servant preinvoke(byte[] oid, POA adapter, String operation,
+ CookieHolder cookie) throws ForwardRequest
+ {
+
+ String objKey = new String(oid);
+
+ Servant servant = (Servant) contexts.get(objKey);
+
+ if (servant == null)
+ {
+ servant = readInContext(objKey);
+ }
+
+ return servant;
+ }
+
+ public void postinvoke(byte[] oid, POA adapter, String operation,
+ java.lang.Object cookie, Servant servant)
+ {
+ // nada
+ }
+
+ public NamingContextImpl readInContext(String objKey)
+ {
+ NamingContextImpl context = (NamingContextImpl) contexts.get(objKey);
+ if( context != null )
+ {
+ // Returning Context from Cache
+ return context;
+ }
+
+ File contextFile = new File(logDir, objKey);
+ if (contextFile.exists()) {
+ try {
+ FileInputStream fis = new FileInputStream(contextFile);
+ ObjectInputStream ois = new ObjectInputStream(fis);
+ context = (NamingContextImpl) ois.readObject();
+ context.setORB( orb );
+ context.setServantManagerImpl( this );
+ context.setRootNameService( theNameService );
+ ois.close();
+ } catch (Exception ex) {
+ }
+ }
+
+ if (context != null)
+ {
+ contexts.put(objKey, context);
+ }
+ return context;
+ }
+
+ public NamingContextImpl addContext(String objKey,
+ NamingContextImpl context)
+ {
+ File contextFile = new File(logDir, objKey);
+
+ if (contextFile.exists())
+ {
+ context = readInContext(objKey);
+ }
+ else {
+ try {
+ FileOutputStream fos = new FileOutputStream(contextFile);
+ ObjectOutputStream oos = new ObjectOutputStream(fos);
+ oos.writeObject(context);
+ oos.close();
+ } catch (Exception ex) {
+ }
+ }
+ try
+ {
+ contexts.remove( objKey );
+ }
+ catch( Exception e)
+ {
+ }
+ contexts.put(objKey, context);
+
+ return context;
+ }
+
+ public void updateContext( String objKey,
+ NamingContextImpl context )
+ {
+ File contextFile = new File(logDir, objKey);
+ if (contextFile.exists())
+ {
+ contextFile.delete( );
+ contextFile = new File(logDir, objKey);
+ }
+
+ try {
+ FileOutputStream fos = new FileOutputStream(contextFile);
+ ObjectOutputStream oos = new ObjectOutputStream(fos);
+ oos.writeObject(context);
+ oos.close();
+ } catch (Exception ex) {
+ ex.printStackTrace( );
+ }
+ }
+
+ public static String getRootObjectKey()
+ {
+ return objKeyPrefix + CounterDB.rootCounter;
+ }
+
+ public String getNewObjectKey()
+ {
+ return objKeyPrefix + counterDb.getNextCounter();
+ }
+
+
+
+}
+
+class CounterDB implements Serializable
+{
+
+ CounterDB (File logDir)
+ {
+ counterFileName = "counter";
+ counterFile = new File(logDir, counterFileName);
+ if (!counterFile.exists()) {
+ counter = new Integer(rootCounter);
+ writeCounter();
+ } else {
+ readCounter();
+ }
+ }
+
+ private void readCounter()
+ {
+ try {
+ FileInputStream fis = new FileInputStream(counterFile);
+ ObjectInputStream ois = new ObjectInputStream(fis);
+ counter = (Integer) ois.readObject();
+ ois.close();
+ } catch (Exception ex) {
+ }
+ }
+
+ private void writeCounter()
+ {
+ try {
+ counterFile.delete();
+ FileOutputStream fos = new FileOutputStream(counterFile);
+ ObjectOutputStream oos = new ObjectOutputStream(fos);
+ oos.writeObject(counter);
+ oos.flush();
+ oos.close();
+
+ } catch (Exception ex) {
+ }
+ }
+
+ public synchronized int getNextCounter()
+ {
+ int counterVal = counter.intValue();
+ counter = new Integer(++counterVal);
+ writeCounter();
+
+ return counterVal;
+ }
+
+
+
+ private Integer counter;
+
+ private static String counterFileName = "counter";
+
+ private transient File counterFile;
+
+ public final static int rootCounter = 0;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/NullServantImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/NullServantImpl.java
new file mode 100644
index 0000000..2e911d9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/NullServantImpl.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa ;
+
+import org.omg.CORBA.SystemException ;
+
+import com.sun.corba.se.spi.oa.NullServant ;
+
+public class NullServantImpl implements NullServant
+{
+ private SystemException sysex ;
+
+ public NullServantImpl( SystemException ex )
+ {
+ this.sysex = ex ;
+ }
+
+ public SystemException getException()
+ {
+ return sysex ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java
new file mode 100644
index 0000000..d906afe
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/AOMEntry.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa ;
+
+import org.omg.CORBA.INTERNAL ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.orbutil.fsm.Action ;
+import com.sun.corba.se.spi.orbutil.fsm.ActionBase ;
+import com.sun.corba.se.spi.orbutil.fsm.Guard ;
+import com.sun.corba.se.spi.orbutil.fsm.GuardBase ;
+import com.sun.corba.se.spi.orbutil.fsm.State ;
+import com.sun.corba.se.spi.orbutil.fsm.StateImpl ;
+import com.sun.corba.se.spi.orbutil.fsm.Input ;
+import com.sun.corba.se.spi.orbutil.fsm.InputImpl ;
+import com.sun.corba.se.spi.orbutil.fsm.FSM ;
+import com.sun.corba.se.spi.orbutil.fsm.FSMImpl ;
+import com.sun.corba.se.spi.orbutil.fsm.StateEngine ;
+import com.sun.corba.se.spi.orbutil.fsm.StateEngineFactory ;
+
+import com.sun.corba.se.impl.orbutil.concurrent.Mutex ;
+import com.sun.corba.se.impl.orbutil.concurrent.CondVar ;
+
+import org.omg.CORBA.SystemException ;
+
+import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
+
+/** 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.
+*/
+public class AOMEntry extends FSMImpl {
+ 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 CondVar wait ; // accessed in actions
+
+ final POAImpl poa ;
+
+ public static final State INVALID = new StateImpl( "Invalid" ) ;
+ public static final State INCARN = new StateImpl( "Incarnating" ) {
+ public void postAction( FSM fsm ) {
+ AOMEntry entry = (AOMEntry)fsm ;
+ entry.wait.broadcast() ;
+ }
+ };
+ public static final State VALID = new StateImpl( "Valid" ) ;
+ public static final State ETHP = new StateImpl( "EtherealizePending" ) ;
+ public static final State ETH = new StateImpl( "Etherealizing" ) {
+ public void preAction( FSM fsm ) {
+ AOMEntry entry = (AOMEntry)fsm ;
+ Thread etherealizer = entry.etherealizer[0] ;
+ if (etherealizer != null)
+ etherealizer.start() ;
+ }
+
+ public void postAction( FSM fsm ) {
+ AOMEntry entry = (AOMEntry)fsm ;
+ entry.wait.broadcast() ;
+ }
+ };
+ public static final State DESTROYED = new StateImpl( "Destroyed" ) ;
+
+ static final Input START_ETH = new InputImpl( "startEtherealize" ) ;
+ static final Input ETH_DONE = new InputImpl( "etherealizeDone" ) ;
+ static final Input INC_DONE = new InputImpl( "incarnateDone" ) ;
+ static final Input INC_FAIL = new InputImpl( "incarnateFailure" ) ;
+ static final Input ACTIVATE = new InputImpl( "activateObject" ) ;
+ static final Input ENTER = new InputImpl( "enter" ) ;
+ static final Input EXIT = new InputImpl( "exit" ) ;
+
+ private static Action incrementAction = new ActionBase( "increment" ) {
+ public void doIt( FSM fsm, Input in ) {
+ AOMEntry entry = (AOMEntry)fsm ;
+ entry.counter[0]++ ;
+ }
+ } ;
+
+ private static Action decrementAction = new ActionBase( "decrement" ) {
+ public void doIt( FSM fsm, Input in ) {
+ AOMEntry entry = (AOMEntry)fsm ;
+ if (entry.counter[0] > 0)
+ entry.counter[0]-- ;
+ else
+ throw entry.poa.lifecycleWrapper().aomEntryDecZero() ;
+ }
+ } ;
+
+ private static Action throwIllegalStateExceptionAction = new ActionBase(
+ "throwIllegalStateException" ) {
+ public void doIt( FSM fsm, Input in ) {
+ throw new IllegalStateException(
+ "No transitions allowed from the DESTROYED state" ) ;
+ }
+ } ;
+
+ private static Action oaaAction = new ActionBase( "throwObjectAlreadyActive" ) {
+ public void doIt( FSM fsm, Input in ) {
+ throw new RuntimeException( new ObjectAlreadyActive() ) ;
+ }
+ } ;
+
+ private static Guard waitGuard = new GuardBase( "wait" ) {
+ public Guard.Result evaluate( FSM fsm, Input in ) {
+ AOMEntry entry = (AOMEntry)fsm ;
+ try {
+ entry.wait.await() ;
+ } catch (InterruptedException exc) {
+ // XXX Log this
+ // NO-OP
+ }
+
+ return Guard.Result.DEFERED ;
+ }
+ } ;
+
+
+ private static class CounterGuard extends GuardBase {
+ private int value ;
+
+ public CounterGuard( int value )
+ {
+ super( "counter>" + value ) ;
+ this.value = value ;
+ }
+
+ public Guard.Result evaluate( FSM fsm, Input in )
+ {
+ AOMEntry entry = (AOMEntry)fsm ;
+ return Guard.Result.convert( entry.counter[0] > value ) ;
+ }
+ } ;
+
+ private static GuardBase greaterZeroGuard = new CounterGuard( 0 ) ;
+ private static Guard zeroGuard = new Guard.Complement( greaterZeroGuard ) ;
+ private static GuardBase greaterOneGuard = new CounterGuard( 1 ) ;
+ private static Guard oneGuard = new Guard.Complement( greaterOneGuard ) ;
+
+ private static StateEngine engine ;
+
+ static {
+ engine = StateEngineFactory.create() ;
+
+ // 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, ACTIVATE, oaaAction, ETH ) ;
+ engine.add( ETH, ENTER, waitGuard, null, ETH ) ;
+
+ engine.setDefault( DESTROYED, throwIllegalStateExceptionAction, DESTROYED ) ;
+
+ engine.done() ;
+ }
+
+ public AOMEntry( POAImpl poa )
+ {
+ super( engine, INVALID, ((ORB)poa.getORB()).poaFSMDebugFlag ) ;
+ this.poa = poa ;
+ etherealizer = new Thread[1] ;
+ etherealizer[0] = null ;
+ counter = new int[1] ;
+ counter[0] = 0 ;
+ wait = new CondVar( poa.poaMutex,
+ ((ORB)poa.getORB()).poaConcurrencyDebugFlag ) ;
+ }
+
+ // 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 ;
+ doIt( START_ETH ) ;
+ }
+
+ public void etherealizeComplete() { doIt( ETH_DONE ) ; }
+ public void incarnateComplete() { doIt( INC_DONE ) ; }
+ public void incarnateFailure() { doIt( INC_FAIL ) ; }
+ public void activateObject() throws ObjectAlreadyActive {
+ try {
+ doIt( ACTIVATE ) ;
+ } catch (RuntimeException exc) {
+ Throwable thr = exc.getCause() ;
+ if (thr instanceof ObjectAlreadyActive)
+ throw (ObjectAlreadyActive)thr ;
+ else
+ throw exc ;
+ }
+ }
+ public void enter() { doIt( ENTER ) ; }
+ public void exit() { doIt( EXIT ) ; }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java
new file mode 100644
index 0000000..f1136df
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ActiveObjectMap.java
@@ -0,0 +1,265 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import java.util.Set ;
+import java.util.HashSet ;
+import java.util.Map ;
+import java.util.HashMap ;
+import java.util.Iterator ;
+import java.util.Vector ;
+
+import org.omg.PortableServer.Servant ;
+import org.omg.PortableServer.POAPackage.WrongPolicy ;
+import org.omg.CORBA.INTERNAL ;
+
+/** 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 suppots 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 static class Key {
+ public byte[] id;
+
+ Key(byte[] id) {
+ this.id = id;
+ }
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ for(int i = 0; i < id.length; i++) {
+ buffer.append(Integer.toString((int) id[i], 16));
+ if (i != id.length-1)
+ buffer.append(":");
+ }
+ return buffer.toString();
+ }
+
+ public boolean equals(java.lang.Object key) {
+ if (!(key instanceof Key))
+ return false;
+ Key k = (Key) key;
+ if (k.id.length != this.id.length)
+ return false;
+ for(int i = 0; i < this.id.length; i++)
+ if (this.id[i] != k.id[i])
+ return false;
+ return true;
+ }
+
+ // Use the same hash function as for String
+ public int hashCode() {
+ int h = 0;
+ for (int i = 0; i < id.length; i++)
+ h = 31*h + id[i];
+ return h;
+ }
+ }
+
+ protected POAImpl poa ;
+
+ protected ActiveObjectMap( POAImpl poa )
+ {
+ this.poa = poa ;
+ }
+
+ public static ActiveObjectMap create( POAImpl poa, boolean multipleIDsAllowed )
+ {
+ if (multipleIDsAllowed)
+ return new MultipleObjectMap( poa ) ;
+ else
+ return new SingleObjectMap(poa ) ;
+ }
+
+ private Map keyToEntry = new HashMap() ; // Map< Key, AOMEntry >
+ private Map entryToServant = new HashMap() ; // Map< AOMEntry, Servant >
+ private Map servantToEntry = new HashMap() ; // Map< Servant, AOMEntry >
+
+ public final boolean contains(Servant value)
+ {
+ return servantToEntry.containsKey( value ) ;
+ }
+
+ public final boolean containsKey(Key key)
+ {
+ return keyToEntry.containsKey(key);
+ }
+
+ /** get Returbs 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 = (AOMEntry)keyToEntry.get(key);
+ if (result == null) {
+ result = new AOMEntry( poa ) ;
+ putEntry( key, result ) ;
+ }
+
+ return result ;
+ }
+
+ public final Servant getServant( AOMEntry entry )
+ {
+ return (Servant)entryToServant.get( entry ) ;
+ }
+
+ public abstract Key getKey(AOMEntry value) throws WrongPolicy ;
+
+ public Key getKey(Servant value) throws WrongPolicy
+ {
+ AOMEntry entry = (AOMEntry)servantToEntry.get( value ) ;
+ return getKey( entry ) ;
+ }
+
+ 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 ) ;
+ }
+
+ protected abstract void removeEntry( AOMEntry entry, Key key ) ;
+
+ public final void remove( Key key )
+ {
+ AOMEntry entry = (AOMEntry)keyToEntry.remove( key ) ;
+ Servant servant = (Servant)entryToServant.remove( entry ) ;
+ if (servant != null)
+ servantToEntry.remove( servant ) ;
+
+ removeEntry( entry, key ) ;
+ }
+
+ public abstract boolean hasMultipleIDs(AOMEntry value) ;
+
+ protected void clear()
+ {
+ keyToEntry.clear();
+ }
+
+ public final Set keySet()
+ {
+ return keyToEntry.keySet() ;
+ }
+}
+
+class SingleObjectMap extends ActiveObjectMap
+{
+ private Map entryToKey = new HashMap() ; // Map< AOMEntry, Key >
+
+ public SingleObjectMap( POAImpl poa )
+ {
+ super( poa ) ;
+ }
+
+ public Key getKey(AOMEntry value) throws WrongPolicy
+ {
+ return (Key)entryToKey.get( value ) ;
+ }
+
+ protected void putEntry(Key key, AOMEntry value)
+ {
+ super.putEntry( key, value);
+
+ entryToKey.put( value, key ) ;
+ }
+
+ public boolean hasMultipleIDs(AOMEntry value)
+ {
+ return false;
+ }
+
+ // This case does not need the key.
+ protected void removeEntry(AOMEntry entry, Key key)
+ {
+ entryToKey.remove( entry ) ;
+ }
+
+ public void clear()
+ {
+ super.clear() ;
+ entryToKey.clear() ;
+ }
+}
+
+class MultipleObjectMap extends ActiveObjectMap
+{
+ private Map entryToKeys = new HashMap() ; // Map< AOMEntry, Set< Key > >
+
+ public MultipleObjectMap( POAImpl poa )
+ {
+ super( poa ) ;
+ }
+
+ public Key getKey(AOMEntry value) throws WrongPolicy
+ {
+ throw new WrongPolicy() ;
+ }
+
+ protected void putEntry(Key key, AOMEntry value)
+ {
+ super.putEntry( key, value);
+
+ Set set = (Set)entryToKeys.get( value ) ;
+ if (set == null) {
+ set = new HashSet() ;
+ entryToKeys.put( value, set ) ;
+ }
+ set.add( key ) ;
+ }
+
+ public boolean hasMultipleIDs(AOMEntry value)
+ {
+ Set set = (Set)entryToKeys.get( value ) ;
+ if (set == null)
+ return false ;
+ return set.size() > 1 ;
+ }
+
+ protected void removeEntry(AOMEntry entry, Key key)
+ {
+ Set keys = (Set)entryToKeys.get( entry ) ;
+ if (keys != null) {
+ keys.remove( key ) ;
+ if (keys.isEmpty())
+ entryToKeys.remove( entry ) ;
+ }
+ }
+
+ public void clear()
+ {
+ super.clear() ;
+ entryToKeys.clear() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/BadServerIdHandler.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/BadServerIdHandler.java
new file mode 100644
index 0000000..5899cd6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/BadServerIdHandler.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import com.sun.corba.se.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.
+ */
+public interface BadServerIdHandler
+{
+ void handle(ObjectKey objectKey) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/DelegateImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/DelegateImpl.java
new file mode 100644
index 0000000..2cc2cad
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/DelegateImpl.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.oa.poa;
+
+import java.util.EmptyStackException;
+
+import org.omg.PortableServer.*;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.POASystemException ;
+
+public class DelegateImpl implements org.omg.PortableServer.portable.Delegate
+{
+ private ORB orb ;
+ private POASystemException wrapper ;
+ private POAFactory factory;
+
+ public DelegateImpl(ORB orb, POAFactory factory){
+ this.orb = orb ;
+ this.wrapper = POASystemException.get( orb,
+ CORBALogDomains.OA ) ;
+ this.factory = factory;
+ }
+
+ public org.omg.CORBA.ORB orb(Servant self)
+ {
+ return orb;
+ }
+
+ 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
+ POAImpl defaultPOA = null;
+ try {
+ defaultPOA = (POAImpl)self._default_POA();
+ } catch (ClassCastException exception){
+ throw wrapper.defaultPoaNotPoaimpl( exception ) ;
+ }
+
+ try {
+ 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 ) ;
+ }
+ } catch (ClassCastException e) {
+ throw wrapper.defaultPoaNotPoaimpl( e ) ;
+ }
+ }
+
+ public POA poa(Servant self)
+ {
+ try {
+ return (POA)orb.peekInvocationInfo().oa();
+ } catch (EmptyStackException exception){
+ POA returnValue = factory.lookupPOA(self);
+ if (returnValue != null) {
+ return returnValue;
+ }
+
+ throw wrapper.noContext( exception ) ;
+ }
+ }
+
+ public byte[] object_id(Servant self)
+ {
+ try{
+ return orb.peekInvocationInfo().id();
+ } catch (EmptyStackException exception){
+ throw wrapper.noContext(exception) ;
+ }
+ }
+
+ 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<repositoryIds.length; i++ )
+ if ( repId.equals(repositoryIds[i]) )
+ return true;
+
+ return false;
+ }
+
+ public boolean non_existent(Servant self)
+ {
+ //REVISIT
+ try{
+ byte[] oid = orb.peekInvocationInfo().id();
+ if( oid == null) return true;
+ else return false;
+ } catch (EmptyStackException exception){
+ throw wrapper.noContext(exception) ;
+ }
+ }
+
+ // The get_interface() method has been replaced by get_interface_def()
+
+ public org.omg.CORBA.Object get_interface_def(Servant Self)
+ {
+ throw wrapper.methodNotImplemented() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/IdAssignmentPolicyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/IdAssignmentPolicyImpl.java
new file mode 100644
index 0000000..22fc566
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/IdAssignmentPolicyImpl.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+
+final class IdAssignmentPolicyImpl
+extends org.omg.CORBA.LocalObject
+implements org.omg.PortableServer.IdAssignmentPolicy {
+
+ public IdAssignmentPolicyImpl(IdAssignmentPolicyValue value) {
+ this.value = value;
+ }
+
+ public IdAssignmentPolicyValue value() {
+ return value;
+ }
+
+ public int policy_type()
+ {
+ return ID_ASSIGNMENT_POLICY_ID.value ;
+ }
+
+ public Policy copy() {
+ return new IdAssignmentPolicyImpl(value);
+ }
+
+ public void destroy() {
+ value = null;
+ }
+
+ private IdAssignmentPolicyValue value;
+
+ public String toString()
+ {
+ return "IdAssignmentPolicy[" +
+ ((value.value() == IdAssignmentPolicyValue._USER_ID) ?
+ "USER_ID" : "SYSTEM_ID" + "]") ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/IdUniquenessPolicyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/IdUniquenessPolicyImpl.java
new file mode 100644
index 0000000..af37b43
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/IdUniquenessPolicyImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+
+final class IdUniquenessPolicyImpl
+ extends org.omg.CORBA.LocalObject implements IdUniquenessPolicy {
+
+ public IdUniquenessPolicyImpl(IdUniquenessPolicyValue value) {
+ this.value = value;
+ }
+
+ public IdUniquenessPolicyValue value() {
+ return value;
+ }
+
+ public int policy_type()
+ {
+ return ID_UNIQUENESS_POLICY_ID.value ;
+ }
+
+ public Policy copy() {
+ return new IdUniquenessPolicyImpl(value);
+ }
+
+ public void destroy() {
+ value = null;
+ }
+
+ private IdUniquenessPolicyValue value;
+
+ public String toString()
+ {
+ return "IdUniquenessPolicy[" +
+ ((value.value() == IdUniquenessPolicyValue._UNIQUE_ID) ?
+ "UNIQUE_ID" : "MULTIPLE_ID" + "]") ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ImplicitActivationPolicyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ImplicitActivationPolicyImpl.java
new file mode 100644
index 0000000..fe85503
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ImplicitActivationPolicyImpl.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+
+final class ImplicitActivationPolicyImpl
+ extends org.omg.CORBA.LocalObject implements ImplicitActivationPolicy {
+
+ public
+ ImplicitActivationPolicyImpl(ImplicitActivationPolicyValue
+ value) {
+ this.value = value;
+ }
+
+ public ImplicitActivationPolicyValue value() {
+ return value;
+ }
+
+ public int policy_type()
+ {
+ return IMPLICIT_ACTIVATION_POLICY_ID.value ;
+ }
+
+ public Policy copy() {
+ return new ImplicitActivationPolicyImpl(value);
+ }
+
+ public void destroy() {
+ value = null;
+ }
+
+ private ImplicitActivationPolicyValue value;
+
+ public String toString()
+ {
+ return "ImplicitActivationPolicy[" +
+ ((value.value() == ImplicitActivationPolicyValue._IMPLICIT_ACTIVATION) ?
+ "IMPLICIT_ACTIVATION" : "NO_IMPLICIT_ACTIVATION" + "]") ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/LifespanPolicyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/LifespanPolicyImpl.java
new file mode 100644
index 0000000..92d3a20
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/LifespanPolicyImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+
+final class LifespanPolicyImpl
+ extends org.omg.CORBA.LocalObject implements LifespanPolicy {
+
+ public LifespanPolicyImpl(LifespanPolicyValue value) {
+ this.value = value;
+ }
+
+ public LifespanPolicyValue value() {
+ return value;
+ }
+
+ public int policy_type()
+ {
+ return LIFESPAN_POLICY_ID.value ;
+ }
+
+ public Policy copy() {
+ return new LifespanPolicyImpl(value);
+ }
+
+ public void destroy() {
+ value = null;
+ }
+
+ private LifespanPolicyValue value;
+
+ public String toString()
+ {
+ return "LifespanPolicy[" +
+ ((value.value() == LifespanPolicyValue._TRANSIENT) ?
+ "TRANSIENT" : "PERSISTENT" + "]") ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POACurrent.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POACurrent.java
new file mode 100644
index 0000000..c31cca9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POACurrent.java
@@ -0,0 +1,182 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import java.util.*;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.PortableServer.CurrentPackage.NoContext;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
+
+import com.sun.corba.se.spi.oa.OAInvocationInfo ;
+import com.sun.corba.se.spi.oa.ObjectAdapter ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.POASystemException ;
+
+// XXX Needs to be turned into LocalObjectImpl.
+
+public class POACurrent extends org.omg.CORBA.portable.ObjectImpl
+ implements org.omg.PortableServer.Current
+{
+ private ORB orb;
+ private POASystemException wrapper ;
+
+ public POACurrent(ORB orb)
+ {
+ this.orb = orb;
+ wrapper = POASystemException.get( orb,
+ CORBALogDomains.OA_INVOCATION ) ;
+ }
+
+ public String[] _ids()
+ {
+ String[] ids = new String[1];
+ ids[0] = "IDL:omg.org/PortableServer/Current:1.0";
+ return ids;
+ }
+
+ //
+ // Standard OMG operations.
+ //
+
+ public POA get_POA()
+ throws
+ NoContext
+ {
+ POA poa = (POA)(peekThrowNoContext().oa());
+ throwNoContextIfNull(poa);
+ return poa;
+ }
+
+ public byte[] get_object_id()
+ throws
+ NoContext
+ {
+ byte[] objectid = peekThrowNoContext().id();
+ throwNoContextIfNull(objectid);
+ return objectid;
+ }
+
+ //
+ // Implementation operations used by POA package.
+ //
+
+ public ObjectAdapter getOA()
+ {
+ ObjectAdapter oa = peekThrowInternal().oa();
+ throwInternalIfNull(oa);
+ return oa;
+ }
+
+ public byte[] getObjectId()
+ {
+ byte[] objectid = peekThrowInternal().id();
+ throwInternalIfNull(objectid);
+ return objectid;
+ }
+
+ Servant getServant()
+ {
+ Servant servant = (Servant)(peekThrowInternal().getServantContainer());
+ // If is OK for the servant to be null.
+ // This could happen if POAImpl.getServant is called but
+ // POAImpl.internalGetServant throws an exception.
+ return servant;
+ }
+
+ CookieHolder getCookieHolder()
+ {
+ CookieHolder cookieHolder = peekThrowInternal().getCookieHolder();
+ throwInternalIfNull(cookieHolder);
+ return cookieHolder;
+ }
+
+ // This is public so we can test the stack balance.
+ // It is not a security hole since this same info can be obtained from
+ // PortableInterceptors.
+ public String getOperation()
+ {
+ String operation = peekThrowInternal().getOperation();
+ throwInternalIfNull(operation);
+ return operation;
+ }
+
+ void setServant(Servant servant)
+ {
+ peekThrowInternal().setServant( servant );
+ }
+
+ //
+ // Class utilities.
+ //
+
+ private OAInvocationInfo peekThrowNoContext()
+ throws
+ NoContext
+ {
+ OAInvocationInfo invocationInfo = null;
+ try {
+ invocationInfo = orb.peekInvocationInfo() ;
+ } catch (EmptyStackException e) {
+ throw new NoContext();
+ }
+ return invocationInfo;
+ }
+
+ private OAInvocationInfo peekThrowInternal()
+ {
+ OAInvocationInfo invocationInfo = null;
+ try {
+ invocationInfo = orb.peekInvocationInfo() ;
+ } catch (EmptyStackException e) {
+ // The completion status is maybe because this could happen
+ // after the servant has been invoked.
+ throw wrapper.poacurrentUnbalancedStack( e ) ;
+ }
+ return invocationInfo;
+ }
+
+ private void throwNoContextIfNull(Object o)
+ throws
+ NoContext
+ {
+ if ( o == null ) {
+ throw new NoContext();
+ }
+ }
+
+ private void throwInternalIfNull(Object o)
+ {
+ if ( o == null ) {
+ throw wrapper.poacurrentNullField( CompletionStatus.COMPLETED_MAYBE ) ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAFactory.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAFactory.java
new file mode 100644
index 0000000..10840d2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAFactory.java
@@ -0,0 +1,248 @@
+/*
+ * Copyright (c) 2002, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa ;
+
+import java.util.Set ;
+import java.util.HashSet ;
+import java.util.Collections ;
+import java.util.Iterator ;
+import java.util.Map ;
+import java.util.WeakHashMap ;
+
+import org.omg.CORBA.OBJECT_NOT_EXIST ;
+import org.omg.CORBA.TRANSIENT ;
+
+import org.omg.CORBA.ORBPackage.InvalidName ;
+
+import org.omg.PortableServer.Servant ;
+import org.omg.PortableServer.POA ;
+import org.omg.PortableServer.POAManager ;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter ;
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
+
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.orbutil.closure.Closure ;
+import com.sun.corba.se.spi.orbutil.closure.ClosureFactory ;
+
+import com.sun.corba.se.spi.protocol.PIHandler ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.POASystemException ;
+import com.sun.corba.se.impl.logging.OMGSystemException ;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+import com.sun.corba.se.impl.oa.poa.POAManagerImpl ;
+
+public class POAFactory implements ObjectAdapterFactory
+{
+ // Maps servants to POAs for deactivating servants when unexportObject is called.
+ // Maintained by POAs activate_object and deactivate_object.
+ private Map exportedServantsToPOA = new WeakHashMap();
+
+ private Set poaManagers ;
+ private int poaManagerId ;
+ private int poaId ;
+ private POAImpl rootPOA ;
+ private DelegateImpl delegateImpl;
+ private ORB orb ;
+ private POASystemException wrapper ;
+ private OMGSystemException omgWrapper ;
+ private boolean isShuttingDown = false;
+
+ public POASystemException getWrapper()
+ {
+ return wrapper ;
+ }
+
+ /** All object adapter factories must have a no-arg constructor.
+ */
+ public POAFactory()
+ {
+ poaManagers = Collections.synchronizedSet(new HashSet(4));
+ poaManagerId = 0 ;
+ poaId = 0 ;
+ rootPOA = null ;
+ delegateImpl = null ;
+ orb = null ;
+ }
+
+ public synchronized POA lookupPOA (Servant servant)
+ {
+ return (POA)exportedServantsToPOA.get(servant);
+ }
+
+ public synchronized void registerPOAForServant(POA poa, Servant servant)
+ {
+ exportedServantsToPOA.put(servant, poa);
+ }
+
+ public synchronized void unregisterPOAForServant(POA poa, Servant servant)
+ {
+ exportedServantsToPOA.remove(servant);
+ }
+
+// Implementation of ObjectAdapterFactory interface
+
+ public void init( ORB orb )
+ {
+ this.orb = orb ;
+ wrapper = POASystemException.get( orb,
+ CORBALogDomains.OA_LIFECYCLE ) ;
+ omgWrapper = OMGSystemException.get( orb,
+ CORBALogDomains.OA_LIFECYCLE ) ;
+ delegateImpl = new DelegateImpl( orb, this ) ;
+ registerRootPOA() ;
+
+ POACurrent poaCurrent = new POACurrent(orb);
+ orb.getLocalResolver().register( ORBConstants.POA_CURRENT_NAME,
+ ClosureFactory.makeConstant( poaCurrent ) ) ;
+ }
+
+ public ObjectAdapter find( ObjectAdapterId oaid )
+ {
+ POA poa=null;
+ try {
+ boolean first = true ;
+ Iterator iter = oaid.iterator() ;
+ poa = getRootPOA();
+ while (iter.hasNext()) {
+ String name = (String)(iter.next()) ;
+
+ if (first) {
+ if (!name.equals( ORBConstants.ROOT_POA_NAME ))
+ throw wrapper.makeFactoryNotPoa( name ) ;
+ first = false ;
+ } else {
+ poa = poa.find_POA( name, true ) ;
+ }
+ }
+ } catch ( org.omg.PortableServer.POAPackage.AdapterNonExistent ex ){
+ throw omgWrapper.noObjectAdaptor( ex ) ;
+ } catch ( OBJECT_NOT_EXIST ex ) {
+ throw ex;
+ } catch ( TRANSIENT ex ) {
+ throw ex;
+ } catch ( Exception ex ) {
+ throw wrapper.poaLookupError( ex ) ;
+ }
+
+ if ( poa == null )
+ throw wrapper.poaLookupError() ;
+
+ return (ObjectAdapter)poa;
+ }
+
+ 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 ;
+ synchronized (this) {
+ isShuttingDown = true ;
+ managers = (new HashSet(poaManagers)).iterator();
+ }
+
+ while ( managers.hasNext() ) {
+ try {
+ ((POAManager)managers.next()).deactivate(true, waitForCompletion);
+ } catch ( org.omg.PortableServer.POAManagerPackage.AdapterInactive e ) {}
+ }
+ }
+
+// Special methods used to manipulate global POA related state
+
+ public synchronized void removePoaManager( POAManager manager )
+ {
+ poaManagers.remove(manager);
+ }
+
+ public synchronized void addPoaManager( POAManager manager )
+ {
+ poaManagers.add(manager);
+ }
+
+ synchronized public int newPOAManagerId()
+ {
+ return poaManagerId++ ;
+ }
+
+ 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.
+ Closure rpClosure = new Closure() {
+ public Object evaluate() {
+ return POAImpl.makeRootPOA( orb ) ;
+ }
+ } ;
+
+ orb.getLocalResolver().register( ORBConstants.ROOT_POA_NAME,
+ ClosureFactory.makeFuture( rpClosure ) ) ;
+ }
+
+
+ public synchronized POA getRootPOA()
+ {
+ if (rootPOA == null) {
+ // See if we are trying to getRootPOA while shutting down the ORB.
+ if (isShuttingDown) {
+ throw omgWrapper.noObjectAdaptor( ) ;
+ }
+
+ try {
+ Object obj = orb.resolve_initial_references(
+ ORBConstants.ROOT_POA_NAME ) ;
+ rootPOA = (POAImpl)obj ;
+ } catch (InvalidName inv) {
+ throw wrapper.cantResolveRootPoa( inv ) ;
+ }
+ }
+
+ return rootPOA;
+ }
+
+ public org.omg.PortableServer.portable.Delegate getDelegateImpl()
+ {
+ return delegateImpl ;
+ }
+
+ synchronized public int newPOAId()
+ {
+ return poaId++ ;
+ }
+
+ public ORB getORB()
+ {
+ return orb ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java
new file mode 100644
index 0000000..3205a5c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAImpl.java
@@ -0,0 +1,1693 @@
+/*
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.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 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;
+import org.omg.PortableServer.IdAssignmentPolicy;
+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 org.omg.IOP.TAG_INTERNET_IOP ;
+
+import com.sun.corba.se.spi.copyobject.CopierManager ;
+import com.sun.corba.se.spi.copyobject.ObjectCopier ;
+import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
+import com.sun.corba.se.spi.oa.OADestroyed ;
+import com.sun.corba.se.spi.oa.OAInvocationInfo ;
+import com.sun.corba.se.spi.oa.ObjectAdapter ;
+import com.sun.corba.se.spi.oa.ObjectAdapterBase ;
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.IORFactories ;
+import com.sun.corba.se.spi.ior.IORTemplate ;
+import com.sun.corba.se.spi.ior.IORTemplateList ;
+import com.sun.corba.se.spi.ior.TaggedProfile ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.protocol.ForwardException ;
+import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
+
+import com.sun.corba.se.impl.ior.POAObjectKeyTemplate ;
+import com.sun.corba.se.impl.ior.ObjectAdapterIdArray ;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.concurrent.Sync ;
+import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
+import com.sun.corba.se.impl.orbutil.concurrent.ReentrantMutex ;
+import com.sun.corba.se.impl.orbutil.concurrent.CondVar ;
+
+/**
+ * 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.
+ */
+public class POAImpl extends ObjectAdapterBase implements POA
+{
+ private boolean debug ;
+
+ /* 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 in state STATE_START.
+ Calling initialize( POAManager, Policies ) results in state STATE_RUN.
+ Calling destroy results in STATE_DESTROY, which marks the beginning of
+ POA destruction.
+ */
+
+ // Notes on concurrency.
+ // The POA requires careful design for concurrency management to correctly
+ // 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
+ // 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
+ // J2SE 1.5.
+
+ // POA state constants
+ //
+ // 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.
+ //
+ // 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()
+ {
+ 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 + ")" ;
+ }
+ }
+
+ // Current state of the POA
+ private int state ;
+
+ // The POA request handler that performs all policy specific operations
+ // Note that POAImpl handles all synchronization, so mediator is (mostly)
+ // unsynchronized.
+ private POAPolicyMediator mediator;
+
+ // Representation of object adapter ID
+ private int numLevels; // counts depth of tree. Root = 1.
+ private ObjectAdapterId poaId ; // the actual object adapter ID for this POA
+ private String name; // the name of this POA
+
+ private POAManagerImpl manager; // This POA's POAManager
+ private 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 Map children; // Map from name to POA of POAs created by
+ // this POA.
+
+ private AdapterActivator activator;
+ private int invocationCount ; // pending invocations on this POA.
+
+ // Data used to control POA concurrency
+ // XXX revisit for JSR 166
+
+ // Master lock for all POA synchronization. See lock and unlock.
+ // package private for access by AOMEntry.
+ Sync poaMutex ;
+
+ // Wait on this CV for AdapterActivator upcalls to complete
+ private CondVar adapterActivatorCV ;
+
+ // Wait on this CV for all active invocations to complete
+ private CondVar invokeCV ;
+
+ // Wait on this CV for the destroy method to complete doing its work
+ private CondVar beingDestroyedCV ;
+
+ // thread local variable to store a boolean to detect deadlock in
+ // POA.destroy().
+ protected ThreadLocal isDestroying ;
+
+ // This includes the most important information for debugging
+ // POA problems.
+ public String toString()
+ {
+ return "POA[" + poaId.toString() +
+ ", uniquePOAId=" + uniquePOAId +
+ ", state=" + stateToString() +
+ ", invocationCount=" + invocationCount + "]" ;
+ }
+
+ // package private for mediator implementations.
+ boolean getDebug()
+ {
+ return debug ;
+ }
+
+ // package private for access to servant to POA map
+ static POAFactory getPOAFactory( ORB orb )
+ {
+ return (POAFactory)orb.getRequestDispatcherRegistry().
+ getObjectAdapterFactory( ORBConstants.TRANSIENT_SCID ) ;
+ }
+
+ // package private so that POAFactory can access it.
+ static POAImpl makeRootPOA( ORB orb )
+ {
+ POAManagerImpl poaManager = new POAManagerImpl( getPOAFactory( orb ),
+ orb.getPIHandler() ) ;
+
+ POAImpl result = new POAImpl( ORBConstants.ROOT_POA_NAME,
+ null, orb, STATE_START ) ;
+ result.initialize( poaManager, Policies.rootPOAPolicies ) ;
+
+ return result ;
+ }
+
+ // package private so that POAPolicyMediatorBase can access it.
+ int getPOAId()
+ {
+ return uniquePOAId ;
+ }
+
+
+ // package private so that POAPolicyMediator can access it.
+ void lock()
+ {
+ SyncUtil.acquire( poaMutex ) ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "LOCKED poa " + this ) ;
+ }
+ }
+
+ // package private so that POAPolicyMediator can access it.
+ void unlock()
+ {
+ if (debug) {
+ ORBUtility.dprint( this, "UNLOCKED poa " + this ) ;
+ }
+
+ poaMutex.release() ;
+ }
+
+ // package private so that DelegateImpl can access it.
+ Policies getPolicies()
+ {
+ return mediator.getPolicies() ;
+ }
+
+ // Note that the parent POA must be locked when this constructor is called.
+ private POAImpl( String name, POAImpl parent, ORB orb, int initialState )
+ {
+ super( orb ) ;
+
+ debug = orb.poaDebugFlag ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Creating POA with name=" + name +
+ " parent=" + parent ) ;
+ }
+
+ this.state = initialState ;
+ this.name = 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() ;
+
+ if (parent == null) {
+ // This is the root POA, which counts as 1 level
+ numLevels = 1 ;
+ } else {
+ // My level is one more than that of my parent
+ 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 ;
+ while (poaImpl != null) {
+ names[ctr--] = poaImpl.name ;
+ poaImpl = poaImpl.parent ;
+ }
+
+ poaId = new ObjectAdapterIdArray( names ) ;
+
+ invocationCount = 0;
+
+ poaMutex = new ReentrantMutex( orb.poaConcurrencyDebugFlag ) ;
+
+ adapterActivatorCV = new CondVar( poaMutex,
+ orb.poaConcurrencyDebugFlag ) ;
+ invokeCV = new CondVar( poaMutex,
+ orb.poaConcurrencyDebugFlag ) ;
+ beingDestroyedCV = new CondVar( poaMutex,
+ orb.poaConcurrencyDebugFlag ) ;
+
+ isDestroying = new ThreadLocal () {
+ protected java.lang.Object initialValue() {
+ return Boolean.FALSE;
+ }
+ };
+ }
+
+ // The POA lock must be held when this method is called.
+ private void initialize( POAManagerImpl manager, Policies policies )
+ {
+ if (debug) {
+ ORBUtility.dprint( this, "Initializing poa " + this +
+ " with POAManager=" + manager + " policies=" + policies ) ;
+ }
+
+ this.manager = manager;
+ manager.addPOA(this);
+
+ mediator = POAPolicyMediatorFactory.create( policies, this ) ;
+
+ // Construct the object key template
+ int serverid = mediator.getServerId() ;
+ int scid = mediator.getScid() ;
+ String orbId = getORB().getORBData().getORBId();
+
+ ObjectKeyTemplate oktemp = new POAObjectKeyTemplate( getORB(),
+ scid, serverid, orbId, poaId ) ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Initializing poa: oktemp=" + oktemp ) ;
+ }
+
+ // 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()
+ ) ;
+
+ if (state == STATE_START)
+ state = STATE_RUN ;
+ else if (state == STATE_INIT)
+ state = STATE_INIT_DONE ;
+ else
+ throw lifecycleWrapper().illegalPoaStateTrans() ;
+ }
+
+ // The poaMutex must be held when this method is called
+ private boolean waitUntilRunning()
+ {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling waitUntilRunning on poa " + this ) ;
+ }
+
+ while (state < STATE_RUN) {
+ try {
+ adapterActivatorCV.await() ;
+ } catch (InterruptedException exc) {
+ // NO-OP
+ }
+ }
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting waitUntilRunning on poa " + this ) ;
+ }
+
+ // Note that a POA could be destroyed while in STATE_INIT due to a
+ // failure in the AdapterActivator upcall.
+ 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.
+ // 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.
+ //
+ // The poaMutex must NOT be held when this method is called.
+ private boolean destroyIfNotInitDone()
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling destroyIfNotInitDone on poa " + this ) ;
+ }
+
+ boolean success = (state == STATE_INIT_DONE) ;
+
+ if (success)
+ state = STATE_RUN ;
+ else {
+ // 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, debug );
+ destroyer.doIt( this, true ) ;
+ }
+
+ return success ;
+ } finally {
+ adapterActivatorCV.broadcast() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting destroyIfNotInitDone on poa " + this ) ;
+ }
+
+ unlock() ;
+ }
+ }
+
+ private byte[] internalReferenceToId(
+ org.omg.CORBA.Object reference ) throws WrongAdapter
+ {
+ IOR ior = ORBUtility.getIOR( reference ) ;
+ IORTemplateList thisTemplate = ior.getIORTemplates() ;
+
+ ObjectReferenceFactory orf = getCurrentFactory() ;
+ IORTemplateList poaTemplate =
+ IORFactories.getIORTemplateList( orf ) ;
+
+ 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
+ // every profile through the profile templates in the currentFactory,
+ // so we will get the same result from any profile.
+ Iterator iter = ior.iterator() ;
+ if (!iter.hasNext())
+ throw iorWrapper().noProfilesInIor() ;
+ TaggedProfile prof = (TaggedProfile)(iter.next()) ;
+ ObjectId oid = prof.getObjectId() ;
+
+ return oid.getId();
+ }
+
+ // Converted from anonymous class to local class
+ // so that we can call performDestroy() directly.
+ static class DestroyThread extends Thread {
+ private boolean wait ;
+ private boolean etherealize ;
+ private boolean debug ;
+ private POAImpl thePoa ;
+
+ public DestroyThread( boolean etherealize, boolean debug )
+ {
+ super(null, null, "POA-Destroy-Thread", 0, false);
+ this.etherealize = etherealize ;
+ this.debug = debug ;
+ }
+
+ public void doIt( POAImpl thePoa, boolean wait )
+ {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling DestroyThread.doIt(thePOA=" + thePoa +
+ " wait=" + wait + " etherealize=" + etherealize ) ;
+ }
+
+ this.thePoa = thePoa ;
+ this.wait = wait ;
+
+ if (wait) {
+ run() ;
+ } else {
+ // Catch exceptions since setDaemon can cause a
+ // security exception to be thrown under netscape
+ // in the Applet mode
+ try { setDaemon(true); } catch (Exception e) {}
+ start() ;
+ }
+ }
+
+ public void run()
+ {
+ Set destroyedPOATemplates = new HashSet() ;
+
+ performDestroy( thePoa, destroyedPOATemplates );
+
+ Iterator iter = destroyedPOATemplates.iterator() ;
+ ObjectReferenceTemplate[] orts = new ObjectReferenceTemplate[
+ destroyedPOATemplates.size() ] ;
+ int index = 0 ;
+ while (iter.hasNext())
+ orts[ index++ ] = (ObjectReferenceTemplate)iter.next();
+
+ thePoa.getORB().getPIHandler().adapterStateChanged( orts,
+ NON_EXISTENT.value ) ;
+ }
+
+ // Returns true if destruction must be completed, false
+ // if not, which means that another thread is already
+ // destroying poa.
+ 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.
+ try {
+ poa.lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling performDestroy on poa " + poa ) ;
+ }
+
+ if (poa.state <= STATE_RUN) {
+ 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
+ // until destruction is complete, then just return.
+ if (wait)
+ while (poa.state != STATE_DESTROYED) {
+ try {
+ poa.beingDestroyedCV.await() ;
+ } catch (InterruptedException exc) {
+ // NO-OP
+ }
+ }
+
+ 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 = (POAImpl[])poa.children.values().toArray(
+ new POAImpl[0] );
+ } finally {
+ poa.unlock() ;
+ }
+
+ // 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<childPoas.length; ctr++ ) {
+ performDestroy( childPoas[ctr], destroyedPOATemplates ) ;
+ }
+
+ return true ;
+ }
+
+ public void performDestroy( POAImpl poa, Set destroyedPOATemplates )
+ {
+ if (!prepareForDestruction( poa, destroyedPOATemplates ))
+ return ;
+
+ // 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
+ // still be pending invocations.
+
+ POAImpl parent = poa.parent ;
+ boolean isRoot = parent == null ;
+
+ try {
+ // Note that we must lock the parent before the child.
+ // The parent lock is required (if poa is not the root)
+ // to safely remove poa from parent's children Map.
+ if (!isRoot)
+ parent.lock() ;
+
+ try {
+ poa.lock() ;
+
+ completeDestruction( poa, parent,
+ destroyedPOATemplates ) ;
+ } finally {
+ poa.unlock() ;
+
+ if (isRoot)
+ // We have just destroyed the root POA, so we need to
+ // make sure that the next call to
+ // resolve_initial_reference( "RootPOA" )
+ // will recreate a valid root POA.
+ poa.manager.getFactory().registerRootPOA() ;
+ }
+ } finally {
+ if (!isRoot) {
+ parent.unlock() ;
+ poa.parent = null ;
+ }
+ }
+ }
+
+ private void completeDestruction( POAImpl poa, POAImpl parent,
+ Set destroyedPOATemplates )
+ {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling completeDestruction on poa " + poa ) ;
+ }
+
+ try {
+ while (poa.invocationCount != 0) {
+ try {
+ poa.invokeCV.await() ;
+ } catch (InterruptedException ex) {
+ // NO-OP
+ }
+ }
+
+ if (poa.mediator != null) {
+ if (etherealize)
+ poa.mediator.etherealizeAll();
+
+ poa.mediator.clearAOM() ;
+ }
+
+ if (poa.manager != null)
+ poa.manager.removePOA(poa);
+
+ if (parent != null)
+ parent.children.remove( poa.name ) ;
+
+ destroyedPOATemplates.add( poa.getAdapterTemplate() ) ;
+ } catch (Throwable thr) {
+ if (thr instanceof ThreadDeath)
+ throw (ThreadDeath)thr ;
+
+ poa.lifecycleWrapper().unexpectedException( thr, poa.toString() ) ;
+ } finally {
+ poa.state = STATE_DESTROYED ;
+ poa.beingDestroyedCV.broadcast();
+ poa.isDestroying.set(Boolean.FALSE);
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting completeDestruction on poa " + poa ) ;
+ }
+ }
+ }
+ }
+
+ void etherealizeAll()
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling etheralizeAll on poa " + this ) ;
+ }
+
+ mediator.etherealizeAll() ;
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting etheralizeAll on poa " + this ) ;
+ }
+
+ unlock() ;
+ }
+ }
+
+ //*******************************************************************
+ // Public POA API
+ //*******************************************************************
+
+ /**
+ * <code>create_POA</code>
+ * <b>Section 3.3.8.2</b>
+ */
+ public POA create_POA(String name, POAManager
+ theManager, Policy[] policies) throws AdapterAlreadyExists,
+ InvalidPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling create_POA(name=" + name +
+ " theManager=" + theManager + " policies=" + policies +
+ ") on poa " + this ) ;
+ }
+
+ // We cannot create children of a POA that is (being) destroyed.
+ // This has been added to the CORBA 3.0 spec.
+ if (state > STATE_RUN)
+ throw omgLifecycleWrapper().createPoaDestroy() ;
+
+ POAImpl poa = (POAImpl)(children.get(name)) ;
+
+ if (poa == null) {
+ poa = new POAImpl( name, this, getORB(), STATE_START ) ;
+ }
+
+ try {
+ poa.lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling create_POA: new poa is " + poa ) ;
+ }
+
+ if ((poa.state != STATE_START) && (poa.state != STATE_INIT))
+ throw new AdapterAlreadyExists();
+
+ POAManagerImpl newManager = (POAManagerImpl)theManager ;
+ if (newManager == null)
+ newManager = new POAManagerImpl( manager.getFactory(),
+ manager.getPIHandler() );
+
+ int defaultCopierId =
+ getORB().getCopierManager().getDefaultId() ;
+ Policies POAPolicies =
+ new Policies( policies, defaultCopierId ) ;
+
+ poa.initialize( newManager, POAPolicies ) ;
+
+ return poa;
+ } finally {
+ poa.unlock() ;
+ }
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>find_POA</code>
+ * <b>Section 3.3.8.3</b>
+ */
+ public POA find_POA(String name, boolean activate)
+ throws AdapterNonExistent
+ {
+ POAImpl found = null ;
+ AdapterActivator act = null ;
+
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling find_POA(name=" + name +
+ " activate=" + activate + ") on poa " + this ) ;
+ }
+
+ found = (POAImpl) children.get(name);
+
+ if (found != null) {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling find_POA: found poa " + found ) ;
+ }
+
+ try {
+ found.lock() ;
+
+ // Do not hold the parent POA lock while
+ // waiting for child to complete initialization.
+ unlock() ;
+
+ // Make sure that the child has completed its initialization,
+ // if it was created by an AdapterActivator, otherwise throw
+ // a standard TRANSIENT exception with minor code 4 (see
+ // CORBA 3.0 11.3.9.3, in reference to unknown_adapter)
+ if (!found.waitUntilRunning())
+ throw omgLifecycleWrapper().poaDestroyed() ;
+
+ // Note that found may be in state DESTROYING or DESTROYED at
+ // this point. That's OK, since destruction could start at
+ // any time.
+ } finally {
+ found.unlock() ;
+ }
+ } else {
+ try {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling find_POA: no poa found" ) ;
+ }
+
+ if (activate && (activator != null)) {
+ // Create a child, but don't initialize it. The newly
+ // created POA will be in state STATE_START, which will
+ // cause other calls to find_POA that are creating the same
+ // POA to block on the waitUntilRunning call above.
+ // Initialization must be completed by a call to create_POA
+ // inside the unknown_adapter upcall. Note that
+ // this.poaMutex must be held here so that this.children
+ // can be safely updated. The state is set to STATE_INIT
+ // so that initialize can make the correct state transition
+ // when create_POA is called inside the AdapterActivator.
+ // This avoids activating the new POA too soon
+ // by transitioning to STATE_RUN after unknown_adapter
+ // returns.
+ found = new POAImpl( name, this, getORB(), STATE_INIT ) ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling find_POA: created poa " + found ) ;
+ }
+
+ act = activator ;
+ } else {
+ throw new AdapterNonExistent();
+ }
+ } finally {
+ unlock() ;
+ }
+ }
+
+ // assert (found != null)
+ // assert not holding this.poaMutex OR found.poaMutex
+
+ // We must not hold either this.poaMutex or found.poaMutex here while
+ // waiting for intialization of found to complete to prevent possible
+ // deadlocks.
+
+ if (act != null) {
+ boolean status = false ;
+ boolean adapterResult = false ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling find_POA: calling AdapterActivator" ) ;
+ }
+
+ try {
+ // Prevent more than one thread at a time from executing in act
+ // in case act is shared between multiple POAs.
+ synchronized (act) {
+ status = act.unknown_adapter(this, name);
+ }
+ } catch (SystemException exc) {
+ throw omgLifecycleWrapper().adapterActivatorException( exc,
+ name, poaId.toString() ) ;
+ } catch (Throwable thr) {
+ // ignore most non-system exceptions, but log them for
+ // diagnostic purposes.
+ lifecycleWrapper().unexpectedException( thr, this.toString() ) ;
+
+ if (thr instanceof ThreadDeath)
+ throw (ThreadDeath)thr ;
+ } finally {
+ // 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
+ // will cause the system to hang in complex tests.
+ adapterResult = found.destroyIfNotInitDone() ;
+ }
+
+ if (status) {
+ if (!adapterResult)
+ throw omgLifecycleWrapper().adapterActivatorException( name,
+ poaId.toString() ) ;
+ } else {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling find_POA: AdapterActivator returned false" ) ;
+ }
+
+ // OMG Issue 3740 is resolved to throw AdapterNonExistent if
+ // unknown_adapter() returns false.
+ throw new AdapterNonExistent();
+ }
+ }
+
+ return found;
+ }
+
+ /**
+ * <code>destroy</code>
+ * <b>Section 3.3.8.4</b>
+ */
+ public void destroy(boolean etherealize, boolean wait_for_completion)
+ {
+ // This is to avoid deadlock
+ if (wait_for_completion && getORB().isDuringDispatch()) {
+ throw lifecycleWrapper().destroyDeadlock() ;
+ }
+
+ DestroyThread destroyer = new DestroyThread( etherealize, debug );
+ destroyer.doIt( this, wait_for_completion ) ;
+ }
+
+ /**
+ * <code>create_thread_policy</code>
+ * <b>Section 3.3.8.5</b>
+ */
+ public ThreadPolicy create_thread_policy(
+ ThreadPolicyValue value)
+ {
+ return new ThreadPolicyImpl(value);
+ }
+
+ /**
+ * <code>create_lifespan_policy</code>
+ * <b>Section 3.3.8.5</b>
+ */
+ public LifespanPolicy create_lifespan_policy(
+ LifespanPolicyValue value)
+ {
+ return new LifespanPolicyImpl(value);
+ }
+
+ /**
+ * <code>create_id_uniqueness_policy</code>
+ * <b>Section 3.3.8.5</b>
+ */
+ public IdUniquenessPolicy create_id_uniqueness_policy(
+ IdUniquenessPolicyValue value)
+ {
+ return new IdUniquenessPolicyImpl(value);
+ }
+
+ /**
+ * <code>create_id_assignment_policy</code>
+ * <b>Section 3.3.8.5</b>
+ */
+ public IdAssignmentPolicy create_id_assignment_policy(
+ IdAssignmentPolicyValue value)
+ {
+ return new IdAssignmentPolicyImpl(value);
+ }
+
+ /**
+ * <code>create_implicit_activation_policy</code>
+ * <b>Section 3.3.8.5</b>
+ */
+ public ImplicitActivationPolicy create_implicit_activation_policy(
+ ImplicitActivationPolicyValue value)
+ {
+ return new ImplicitActivationPolicyImpl(value);
+ }
+
+ /**
+ * <code>create_servant_retention_policy</code>
+ * <b>Section 3.3.8.5</b>
+ */
+ public ServantRetentionPolicy create_servant_retention_policy(
+ ServantRetentionPolicyValue value)
+ {
+ return new ServantRetentionPolicyImpl(value);
+ }
+
+ /**
+ * <code>create_request_processing_policy</code>
+ * <b>Section 3.3.8.5</b>
+ */
+ public RequestProcessingPolicy create_request_processing_policy(
+ RequestProcessingPolicyValue value)
+ {
+ return new RequestProcessingPolicyImpl(value);
+ }
+
+ /**
+ * <code>the_name</code>
+ * <b>Section 3.3.8.6</b>
+ */
+ public String the_name()
+ {
+ try {
+ lock() ;
+
+ return name;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>the_parent</code>
+ * <b>Section 3.3.8.7</b>
+ */
+ public POA the_parent()
+ {
+ try {
+ lock() ;
+
+ return parent;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>the_children</code>
+ */
+ public org.omg.PortableServer.POA[] the_children()
+ {
+ try {
+ lock() ;
+
+ 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 = (POA)(iter.next()) ;
+ result[ index++ ] = poa ;
+ }
+
+ return result ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>the_POAManager</code>
+ * <b>Section 3.3.8.8</b>
+ */
+ public POAManager the_POAManager()
+ {
+ try {
+ lock() ;
+
+ return manager;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>the_activator</code>
+ * <b>Section 3.3.8.9</b>
+ */
+ public AdapterActivator the_activator()
+ {
+ try {
+ lock() ;
+
+ return activator;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>the_activator</code>
+ * <b>Section 3.3.8.9</b>
+ */
+ public void the_activator(AdapterActivator activator)
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling the_activator on poa " +
+ this + " activator=" + activator ) ;
+ }
+
+ this.activator = activator;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>get_servant_manager</code>
+ * <b>Section 3.3.8.10</b>
+ */
+ public ServantManager get_servant_manager() throws WrongPolicy
+ {
+ try {
+ lock() ;
+
+ return mediator.getServantManager() ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>set_servant_manager</code>
+ * <b>Section 3.3.8.10</b>
+ */
+ public void set_servant_manager(ServantManager servantManager)
+ throws WrongPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling set_servant_manager on poa " +
+ this + " servantManager=" + servantManager ) ;
+ }
+
+ mediator.setServantManager( servantManager ) ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>get_servant</code>
+ * <b>Section 3.3.8.12</b>
+ */
+ public Servant get_servant() throws NoServant, WrongPolicy
+ {
+ try {
+ lock() ;
+
+ return mediator.getDefaultServant() ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>set_servant</code>
+ * <b>Section 3.3.8.13</b>
+ */
+ public void set_servant(Servant defaultServant)
+ throws WrongPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling set_servant on poa " +
+ this + " defaultServant=" + defaultServant ) ;
+ }
+
+ mediator.setDefaultServant( defaultServant ) ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>activate_object</code>
+ * <b>Section 3.3.8.14</b>
+ */
+ public byte[] activate_object(Servant servant)
+ throws ServantAlreadyActive, WrongPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling activate_object on poa " + this +
+ " (servant=" + servant + ")" ) ;
+ }
+
+ // Allocate a new system-generated object-id.
+ // This will throw WrongPolicy if not SYSTEM_ID
+ // policy.
+ byte[] id = mediator.newSystemId();
+
+ try {
+ mediator.activateObject( id, servant ) ;
+ } catch (ObjectAlreadyActive oaa) {
+ // This exception can not occur in this case,
+ // since id is always brand new.
+ //
+ }
+
+ return id ;
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting activate_object on poa " + this ) ;
+ }
+
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>activate_object_with_id</code>
+ * <b>Section 3.3.8.15</b>
+ */
+ public void activate_object_with_id(byte[] id,
+ Servant servant)
+ throws ObjectAlreadyActive, ServantAlreadyActive, WrongPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling activate_object_with_id on poa " + this +
+ " (servant=" + servant + " id=" + id + ")" ) ;
+ }
+
+ // 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 = (byte[])(id.clone()) ;
+
+ mediator.activateObject( idClone, servant ) ;
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting activate_object_with_id on poa " + this ) ;
+ }
+
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>deactivate_object</code>
+ * <b>3.3.8.16</b>
+ */
+ public void deactivate_object(byte[] id)
+ throws ObjectNotActive, WrongPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling deactivate_object on poa " + this +
+ " (id=" + id + ")" ) ;
+ }
+
+ mediator.deactivateObject( id ) ;
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting deactivate_object on poa " + this ) ;
+ }
+
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>create_reference</code>
+ * <b>3.3.8.17</b>
+ */
+ public org.omg.CORBA.Object create_reference(String repId)
+ throws WrongPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling create_reference(repId=" +
+ repId + ") on poa " + this ) ;
+ }
+
+ return makeObject( repId, mediator.newSystemId()) ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>create_reference_with_id</code>
+ * <b>3.3.8.18</b>
+ */
+ public org.omg.CORBA.Object
+ create_reference_with_id(byte[] oid, String repId)
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling create_reference_with_id(oid=" +
+ oid + " repId=" + repId + ") on poa " + this ) ;
+ }
+
+ // 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 = (byte[])(oid.clone()) ;
+
+ return makeObject( repId, idClone ) ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>servant_to_id</code>
+ * <b>3.3.8.19</b>
+ */
+ public byte[] servant_to_id(Servant servant)
+ throws ServantNotActive, WrongPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling servant_to_id(servant=" +
+ servant + ") on poa " + this ) ;
+ }
+
+ return mediator.servantToId( servant ) ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>servant_to_reference</code>
+ * <b>3.3.8.20</b>
+ */
+ public org.omg.CORBA.Object servant_to_reference(Servant servant)
+ throws ServantNotActive, WrongPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling servant_to_reference(servant=" +
+ servant + ") on poa " + this ) ;
+ }
+
+ byte[] oid = mediator.servantToId(servant);
+ String repId = servant._all_interfaces( this, oid )[0] ;
+ return create_reference_with_id(oid, repId);
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>reference_to_servant</code>
+ * <b>3.3.8.21</b>
+ */
+ public Servant reference_to_servant(org.omg.CORBA.Object reference)
+ throws ObjectNotActive, WrongPolicy, WrongAdapter
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling reference_to_servant(reference=" +
+ reference + ") on poa " + this ) ;
+ }
+
+ if ( state >= STATE_DESTROYING ) {
+ throw lifecycleWrapper().adapterDestroyed() ;
+ }
+
+ // reference_to_id should throw WrongAdapter
+ // if the objref was not created by this POA
+ byte [] id = internalReferenceToId(reference);
+
+ return mediator.idToServant( id ) ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>reference_to_id</code>
+ * <b>3.3.8.22</b>
+ */
+ public byte[] reference_to_id(org.omg.CORBA.Object reference)
+ throws WrongAdapter, WrongPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling reference_to_id(reference=" +
+ reference + ") on poa " + this ) ;
+ }
+
+ if( state >= STATE_DESTROYING ) {
+ throw lifecycleWrapper().adapterDestroyed() ;
+ }
+
+ return internalReferenceToId( reference ) ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>id_to_servant</code>
+ * <b>3.3.8.23</b>
+ */
+ public Servant id_to_servant(byte[] id)
+ throws ObjectNotActive, WrongPolicy
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling id_to_servant(id=" +
+ id + ") on poa " + this ) ;
+ }
+
+ if( state >= STATE_DESTROYING ) {
+ throw lifecycleWrapper().adapterDestroyed() ;
+ }
+ return mediator.idToServant( id ) ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>id_to_reference</code>
+ * <b>3.3.8.24</b>
+ */
+ public org.omg.CORBA.Object id_to_reference(byte[] id)
+ throws ObjectNotActive, WrongPolicy
+
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling id_to_reference(id=" +
+ id + ") on poa " + this ) ;
+ }
+
+ if( state >= STATE_DESTROYING ) {
+ throw lifecycleWrapper().adapterDestroyed() ;
+ }
+
+ Servant s = mediator.idToServant( id ) ;
+ String repId = s._all_interfaces( this, id )[0] ;
+ return makeObject(repId, id );
+ } finally {
+ unlock() ;
+ }
+ }
+
+ /**
+ * <code>id</code>
+ * <b>11.3.8.26 in ptc/00-08-06</b>
+ */
+ public byte[] id()
+ {
+ try {
+ lock() ;
+
+ return getAdapterId() ;
+ } finally {
+ unlock() ;
+ }
+ }
+
+ //***************************************************************
+ //Implementation of ObjectAdapter interface
+ //***************************************************************
+
+ public Policy getEffectivePolicy( int type )
+ {
+ return mediator.getPolicies().get_effective_policy( type ) ;
+ }
+
+ public int getManagerId()
+ {
+ return manager.getManagerId() ;
+ }
+
+ 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 ) ;
+ }
+
+ protected ObjectCopierFactory getObjectCopierFactory()
+ {
+ int copierId = mediator.getPolicies().getCopierId() ;
+ CopierManager cm = getORB().getCopierManager() ;
+ return cm.getObjectCopierFactory( copierId ) ;
+ }
+
+ public void enter() throws OADestroyed
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling enter on poa " + this ) ;
+ }
+
+ // 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
+ // etherealize upcall invokes a method on a colocated object
+ // served by this POA.
+ while ((state == STATE_DESTROYING) &&
+ (isDestroying.get() == Boolean.FALSE)) {
+ try {
+ beingDestroyedCV.await();
+ } catch (InterruptedException ex) {
+ // NO-OP
+ }
+ }
+
+ if (!waitUntilRunning())
+ throw new OADestroyed() ;
+
+ invocationCount++;
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this, "Exiting enter on poa " + this ) ;
+ }
+
+ unlock() ;
+ }
+
+ manager.enter();
+ }
+
+ public void exit()
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Calling exit on poa " + this ) ;
+ }
+
+ invocationCount--;
+
+ if ((invocationCount == 0) && (state == STATE_DESTROYING)) {
+ invokeCV.broadcast();
+ }
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this, "Exiting exit on poa " + this ) ;
+ }
+
+ unlock() ;
+ }
+
+ manager.exit();
+ }
+
+ public void getInvocationServant( OAInvocationInfo info )
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling getInvocationServant on poa " + this ) ;
+ }
+
+ java.lang.Object servant = null ;
+
+ try {
+ servant = mediator.getInvocationServant( info.id(),
+ info.getOperation() );
+ } catch (ForwardRequest freq) {
+ throw new ForwardException( getORB(), freq.forward_reference ) ;
+ }
+
+ info.setServant( servant ) ;
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting getInvocationServant on poa " + this ) ;
+ }
+
+ unlock() ;
+ }
+ }
+
+ 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.
+ */
+ public void returnServant()
+ {
+ try {
+ lock() ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling returnServant on poa " + this ) ;
+ }
+
+ mediator.returnServant();
+ } catch (Throwable thr) {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exception " + thr + " in returnServant on poa " + this ) ;
+ }
+
+ if (thr instanceof Error)
+ throw (Error)thr ;
+ else if (thr instanceof RuntimeException)
+ throw (RuntimeException)thr ;
+
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting returnServant on poa " + this ) ;
+ }
+
+ unlock() ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java
new file mode 100644
index 0000000..eb51310
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAManagerImpl.java
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import java.util.Iterator;
+import java.util.Collections;
+import java.util.Set;
+import java.util.HashSet;
+
+import org.omg.CORBA.LocalObject;
+import org.omg.CORBA.CompletionStatus ;
+
+import org.omg.PortableServer.POAManager;
+import org.omg.PortableServer.POAManagerPackage.State;
+import org.omg.PortableServer.POA;
+
+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.se.spi.protocol.PIHandler ;
+
+import com.sun.corba.se.impl.logging.POASystemException ;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+/** POAManagerImpl is the implementation of the POAManager interface.
+ * Its public methods are activate(), hold_requests(), discard_requests()
+ * and deactivate().
+ */
+
+public class POAManagerImpl extends org.omg.CORBA.LocalObject implements
+ POAManager
+{
+ private final POAFactory factory ; // factory which contains global state
+ // for all POAManagers
+ private PIHandler pihandler ; // for adapterManagerStateChanged
+ private State state; // current state of this POAManager
+ private Set poas = new HashSet(4) ; // all poas controlled by this POAManager
+ private int nInvocations=0; // Number of invocations in progress
+ private int nWaiters=0; // Number of threads waiting for
+ // invocations to complete
+ private int myId = 0 ; // This POAManager's ID
+ private boolean debug ;
+ private boolean explicitStateChange ; // initially false, set true as soon as
+ // one of activate, hold_request,
+ // discard_request, or deactivate is called.
+
+ private String stateToString( State state )
+ {
+ switch (state.value()) {
+ case State._HOLDING : return "State[HOLDING]" ;
+ case State._ACTIVE : return "State[ACTIVE]" ;
+ case State._DISCARDING : return "State[DISCARDING]" ;
+ case State._INACTIVE : return "State[INACTIVE]" ;
+ }
+
+ return "State[UNKNOWN]" ;
+ }
+
+ public String toString()
+ {
+ return "POAManagerImpl[myId=" + myId +
+ " state=" + stateToString(state) +
+ " nInvocations=" + nInvocations +
+ " nWaiters=" + nWaiters + "]" ;
+ }
+
+ POAFactory getFactory()
+ {
+ return factory ;
+ }
+
+ PIHandler getPIHandler()
+ {
+ return pihandler ;
+ }
+
+ private void countedWait()
+ {
+ try {
+ if (debug) {
+ ORBUtility.dprint( this, "Calling countedWait on POAManager " +
+ this + " nWaiters=" + nWaiters ) ;
+ }
+
+ nWaiters++ ;
+ wait();
+ } catch ( java.lang.InterruptedException ex ) {
+ // NOP
+ } finally {
+ nWaiters-- ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Exiting countedWait on POAManager " +
+ this + " nWaiters=" + nWaiters ) ;
+ }
+ }
+ }
+
+ private void notifyWaiters()
+ {
+ if (debug) {
+ ORBUtility.dprint( this, "Calling notifyWaiters on POAManager " +
+ this + " nWaiters=" + nWaiters ) ;
+ }
+
+ if (nWaiters >0)
+ notifyAll() ;
+ }
+
+ public int getManagerId()
+ {
+ return myId ;
+ }
+
+ POAManagerImpl( POAFactory factory, PIHandler pihandler )
+ {
+ this.factory = factory ;
+ factory.addPoaManager(this);
+ this.pihandler = pihandler ;
+ myId = factory.newPOAManagerId() ;
+ state = State.HOLDING;
+ debug = factory.getORB().poaDebugFlag ;
+ explicitStateChange = false ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Creating POAManagerImpl " + this ) ;
+ }
+ }
+
+ synchronized void addPOA(POA poa)
+ {
+ // XXX This is probably not the correct error
+ if (state.value() == State._INACTIVE) {
+ POASystemException wrapper = factory.getWrapper();
+ throw wrapper.addPoaInactive( CompletionStatus.COMPLETED_NO ) ;
+ }
+
+ poas.add(poa);
+ }
+
+ synchronized void removePOA(POA poa)
+ {
+ poas.remove(poa);
+ if ( poas.isEmpty() ) {
+ factory.removePoaManager(this);
+ }
+ }
+
+ 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 ;
+ }
+ }
+
+/****************************************************************************
+ * The following four public methods are used to change the POAManager's state.
+ *
+ * A note on the design of synchronization code:
+ * There are 4 places where a thread would need to wait for a condition:
+ * - in hold_requests, discard_requests, deactivate, enter
+ * There are 5 places where a thread notifies a condition:
+ * - in activate, hold_requests, discard_requests, deactivate, exit
+ *
+ * Since each notify needs to awaken waiters in several of the 4 places,
+ * and since wait() in Java has the nice property of releasing the lock
+ * on its monitor before sleeping, it seemed simplest to have just one
+ * monitor object: "this". Thus all notifies will awaken all waiters.
+ * On waking up, each waiter verifies that the condition it was waiting
+ * for is satisfied, otherwise it goes back into a wait().
+ *
+ ****************************************************************************/
+
+ /**
+ * <code>activate</code>
+ * <b>Spec: pages 3-14 thru 3-18</b>
+ */
+ public synchronized void activate()
+ throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
+ {
+ explicitStateChange = true ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling activate on POAManager " + this ) ;
+ }
+
+ try {
+ if ( state.value() == State._INACTIVE )
+ throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
+
+ // set the state to ACTIVE
+ state = State.ACTIVE;
+
+ 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 {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting activate on POAManager " + this ) ;
+ }
+ }
+ }
+
+ /**
+ * <code>hold_requests</code>
+ * <b>Spec: pages 3-14 thru 3-18</b>
+ */
+ public synchronized void hold_requests(boolean wait_for_completion)
+ throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
+ {
+ explicitStateChange = true ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling hold_requests on POAManager " + this ) ;
+ }
+
+ try {
+ if ( state.value() == State._INACTIVE )
+ throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
+ // set the state to HOLDING
+ state = State.HOLDING;
+
+ 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 > 0 ) {
+ countedWait() ;
+ }
+ }
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting hold_requests on POAManager " + this ) ;
+ }
+ }
+ }
+
+ /**
+ * <code>discard_requests</code>
+ * <b>Spec: pages 3-14 thru 3-18</b>
+ */
+ public synchronized void discard_requests(boolean wait_for_completion)
+ throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
+ {
+ explicitStateChange = true ;
+
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling hold_requests on POAManager " + this ) ;
+ }
+
+ try {
+ if ( state.value() == State._INACTIVE )
+ throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
+
+ // set the state to DISCARDING
+ state = State.DISCARDING;
+
+ pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
+
+ // Notify any invocations that were waiting because the previous
+ // state was HOLDING. Those invocations will henceforth be rejected with
+ // a TRANSIENT exception. Also notify any threads that were waiting
+ // inside hold_requests().
+ notifyWaiters();
+
+ if ( wait_for_completion ) {
+ while ( state.value() == State._DISCARDING && nInvocations > 0 ) {
+ countedWait() ;
+ }
+ }
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting hold_requests on POAManager " + this ) ;
+ }
+ }
+ }
+
+ /**
+ * <code>deactivate</code>
+ * <b>Spec: pages 3-14 thru 3-18</b>
+ * Note: INACTIVE is a permanent state.
+ */
+
+ public void deactivate(boolean etherealize_objects, boolean wait_for_completion)
+ throws org.omg.PortableServer.POAManagerPackage.AdapterInactive
+ {
+ explicitStateChange = true ;
+
+ try {
+ synchronized( this ) {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling deactivate on POAManager " + this ) ;
+ }
+
+ if ( state.value() == State._INACTIVE )
+ throw new org.omg.PortableServer.POAManagerPackage.AdapterInactive();
+
+ state = State.INACTIVE;
+
+ pihandler.adapterManagerStateChanged( myId, getORTState() ) ;
+
+ // Notify any invocations that were waiting because the previous
+ // state was HOLDING. Those invocations will then be rejected with
+ // an OBJ_ADAPTER exception. Also notify any threads that were waiting
+ // inside hold_requests() or discard_requests().
+ notifyWaiters();
+ }
+
+ POAManagerDeactivator deactivator = new POAManagerDeactivator( this,
+ etherealize_objects, debug ) ;
+
+ if (wait_for_completion)
+ deactivator.run() ;
+ else {
+ Thread thr = new Thread(null, deactivator, "POA-Deactivator-Thread", 0, false) ;
+ thr.start() ;
+ }
+ } finally {
+ synchronized(this) {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting deactivate on POAManager " + this ) ;
+ }
+ }
+ }
+ }
+
+ private class POAManagerDeactivator implements Runnable
+ {
+ private boolean etherealize_objects ;
+ private POAManagerImpl pmi ;
+ private boolean debug ;
+
+ POAManagerDeactivator( POAManagerImpl pmi, boolean etherealize_objects,
+ boolean debug )
+ {
+ this.etherealize_objects = etherealize_objects ;
+ this.pmi = pmi ;
+ this.debug = debug ;
+ }
+
+ public void run()
+ {
+ try {
+ synchronized (pmi) {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling run with etherealize_objects=" +
+ etherealize_objects + " pmi=" + pmi ) ;
+ }
+
+ while ( pmi.nInvocations > 0 ) {
+ countedWait() ;
+ }
+ }
+
+ if (etherealize_objects) {
+ Iterator iterator = null ;
+
+ // Make sure that poas cannot change while we copy it!
+ synchronized (pmi) {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "run: Preparing to etherealize with pmi=" +
+ pmi ) ;
+ }
+
+ iterator = (new HashSet(pmi.poas)).iterator();
+ }
+
+ while (iterator.hasNext()) {
+ // Each RETAIN+USE_SERVANT_MGR poa
+ // must call etherealize for all its objects
+ ((POAImpl)iterator.next()).etherealizeAll();
+ }
+
+ synchronized (pmi) {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "run: removing POAManager and clearing poas " +
+ "with pmi=" + pmi ) ;
+ }
+
+ factory.removePoaManager(pmi);
+ poas.clear();
+ }
+ }
+ } finally {
+ if (debug) {
+ synchronized (pmi) {
+ ORBUtility.dprint( this, "Exiting run" ) ;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Added according to the spec CORBA V2.3; this returns the
+ * state of the POAManager
+ */
+
+ public org.omg.PortableServer.POAManagerPackage.State get_state () {
+ return state;
+ }
+
+/****************************************************************************
+ * The following methods are used on the invocation path.
+ ****************************************************************************/
+
+ // called from POA.find_POA before calling
+ // AdapterActivator.unknown_adapter.
+ synchronized void checkIfActive()
+ {
+ try {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling checkIfActive for POAManagerImpl " + this ) ;
+ }
+
+ checkState();
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting checkIfActive for POAManagerImpl " + this ) ;
+ }
+ }
+ }
+
+ private void checkState()
+ {
+ while ( state.value() != State._ACTIVE ) {
+ switch ( state.value() ) {
+ case State._HOLDING:
+ while ( state.value() == State._HOLDING ) {
+ countedWait() ;
+ }
+ break;
+
+ case State._DISCARDING:
+ throw factory.getWrapper().poaDiscarding() ;
+
+ case State._INACTIVE:
+ throw factory.getWrapper().poaInactive() ;
+ }
+ }
+ }
+
+ synchronized void enter()
+ {
+ try {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling enter for POAManagerImpl " + this ) ;
+ }
+
+ checkState();
+ nInvocations++;
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting enter for POAManagerImpl " + this ) ;
+ }
+ }
+ }
+
+ synchronized void exit()
+ {
+ try {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Calling exit for POAManagerImpl " + this ) ;
+ }
+
+ nInvocations--;
+
+ if ( nInvocations == 0 ) {
+ // This notifies any threads that were in the
+ // wait_for_completion loop in hold/discard/deactivate().
+ notifyWaiters();
+ }
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this,
+ "Exiting exit for POAManagerImpl " + this ) ;
+ }
+ }
+ }
+
+ /** Activate the POAManager if no explicit state change has ever been
+ * previously invoked.
+ */
+ public synchronized void implicitActivation()
+ {
+ if (!explicitStateChange)
+ try {
+ activate() ;
+ } catch (org.omg.PortableServer.POAManagerPackage.AdapterInactive ai) {
+ // ignore the exception.
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediator.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediator.java
new file mode 100644
index 0000000..7ee5722
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediator.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa ;
+
+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.
+ */
+public interface POAPolicyMediator {
+ /** Return the policies object that was used to create this
+ * POAPolicyMediator.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ ServantManager getServantManager() throws WrongPolicy ;
+
+ /** Set the servant manager. Will throw 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.
+ */
+ Servant getDefaultServant() throws NoServant, WrongPolicy ;
+
+ /** Set the default servant. Will throw 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.
+ */
+ Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy ;
+
+ /** Allocate a new, unique system ID. Requires the ID assignment policy
+ * to be SYSTEM.
+ */
+ byte[] newSystemId() throws WrongPolicy ;
+
+ byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy ;
+
+ Servant idToServant( byte[] id ) throws ObjectNotActive, WrongPolicy ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase.java
new file mode 100644
index 0000000..60fe0e4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa ;
+
+import java.util.Collection;
+import java.util.Enumeration ;
+
+import org.omg.PortableServer.Servant ;
+import org.omg.PortableServer.ForwardRequest ;
+import org.omg.PortableServer.POAPackage.WrongPolicy ;
+
+import com.sun.corba.se.spi.extension.ServantCachingPolicy ;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
+
+
+/** Implementation of POARequesHandler that provides policy specific
+ * operations on the POA.
+ */
+public abstract class POAPolicyMediatorBase implements POAPolicyMediator {
+ protected POAImpl poa ;
+ protected ORB orb ;
+
+ private int sysIdCounter ;
+ private Policies policies ;
+ private DelegateImpl delegateImpl ;
+
+ private int serverid ;
+ private int scid ;
+
+ protected boolean isImplicit ;
+ protected boolean isUnique ;
+ protected boolean isSystemId ;
+
+ public final Policies getPolicies()
+ {
+ return policies ;
+ }
+
+ public final int getScid()
+ {
+ return scid ;
+ }
+
+ public final int getServerId()
+ {
+ return serverid ;
+ }
+
+ POAPolicyMediatorBase( Policies policies, POAImpl poa )
+ {
+ if (policies.isSingleThreaded())
+ throw poa.invocationWrapper().singleThreadNotSupported() ;
+
+ POAManagerImpl poam = (POAManagerImpl)(poa.the_POAManager()) ;
+ POAFactory poaf = poam.getFactory() ;
+ delegateImpl = (DelegateImpl)(poaf.getDelegateImpl()) ;
+ this.policies = policies ;
+ this.poa = poa ;
+ orb = (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 ;
+ }
+
+ if ( policies.isTransient() ) {
+ serverid = orb.getTransientServerId();
+ } else {
+ serverid = orb.getORBData().getPersistentServerId();
+ scid = ORBConstants.makePersistent( scid ) ;
+ }
+
+ isImplicit = policies.isImplicitlyActivated() ;
+ isUnique = policies.isUniqueIds() ;
+ isSystemId = policies.isSystemAssignedIds() ;
+
+ sysIdCounter = 0 ;
+ }
+
+ 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
+ // its initialization.
+ servant._set_delegate(delegateImpl);
+ }
+
+ 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);
+ return array;
+ }
+
+ protected abstract java.lang.Object internalGetServant( byte[] id,
+ String operation ) throws ForwardRequest ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java
new file mode 100644
index 0000000..3b14616
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorBase_R.java
@@ -0,0 +1,202 @@
+/*
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa ;
+
+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 com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
+
+import com.sun.corba.se.impl.oa.NullServantImpl ;
+
+public abstract class POAPolicyMediatorBase_R extends POAPolicyMediatorBase {
+ protected ActiveObjectMap activeObjectMap ;
+
+ POAPolicyMediatorBase_R( Policies policies, POAImpl poa )
+ {
+ super( policies, poa ) ;
+
+ // assert policies.retainServants() && policies.useActiveObjectMapOnly()
+ if (!policies.retainServants())
+ throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
+
+ activeObjectMap = ActiveObjectMap.create(poa, !isUnique);
+ }
+
+ public void returnServant()
+ {
+ // NO-OP
+ }
+
+ public void clearAOM()
+ {
+ activeObjectMap.clear() ;
+ activeObjectMap = null ;
+ }
+
+ protected Servant internalKeyToServant( ActiveObjectMap.Key key )
+ {
+ AOMEntry entry = activeObjectMap.get(key);
+ if (entry == null)
+ return null ;
+
+ return activeObjectMap.getServant( entry ) ;
+ }
+
+ protected Servant internalIdToServant( byte[] id )
+ {
+ ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
+ return internalKeyToServant( key ) ;
+ }
+
+ protected void activateServant( ActiveObjectMap.Key key, AOMEntry entry, Servant servant )
+ {
+ setDelegate(servant, key.id );
+
+ if (orb.shutdownDebugFlag) {
+ System.out.println("Activating object " + servant +
+ " with POA " + poa);
+ }
+
+ activeObjectMap.putServant( servant, entry ) ;
+
+ if (Util.isInstanceDefined()) {
+ POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
+ POAFactory factory = pm.getFactory() ;
+ factory.registerPOAForServant(poa, servant);
+ }
+ }
+
+ 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 ) ;
+
+ AOMEntry entry = activeObjectMap.get( key ) ;
+
+ // Check for an ObjectAlreadyActive error
+ entry.activateObject() ;
+ activateServant( key, entry, servant ) ;
+ }
+
+ public Servant deactivateObject( byte[] id )
+ throws ObjectNotActive, WrongPolicy
+ {
+ ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
+ return deactivateObject( key ) ;
+ }
+
+ 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);
+
+ if (Util.isInstanceDefined()) {
+ POAManagerImpl pm = (POAManagerImpl)poa.the_POAManager() ;
+ POAFactory factory = pm.getFactory() ;
+ factory.unregisterPOAForServant(poa, s);
+ }
+ }
+
+ public Servant deactivateObject( ActiveObjectMap.Key key )
+ throws ObjectNotActive, WrongPolicy
+ {
+ if (orb.poaDebugFlag) {
+ ORBUtility.dprint( this,
+ "Calling deactivateObject for key " + key ) ;
+ }
+
+ try {
+ AOMEntry entry = activeObjectMap.get(key);
+ if (entry == null)
+ throw new ObjectNotActive();
+
+ Servant s = activeObjectMap.getServant( entry ) ;
+ if (s == null)
+ throw new ObjectNotActive();
+
+ if (orb.poaDebugFlag) {
+ System.out.println("Deactivating object " + s + " with POA " + poa);
+ }
+
+ deactivateHelper( key, entry, s ) ;
+
+ return s ;
+ } finally {
+ if (orb.poaDebugFlag) {
+ ORBUtility.dprint( this,
+ "Exiting deactivateObject" ) ;
+ }
+ }
+ }
+
+ public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy
+ {
+ // XXX needs to handle call from an invocation on this POA
+
+ if (!isUnique && !isImplicit)
+ throw new WrongPolicy();
+
+ if (isUnique) {
+ ActiveObjectMap.Key key = activeObjectMap.getKey(servant);
+ if (key != null)
+ return key.id ;
+ }
+
+ // assert !isUnique || (servant not in activateObjectMap)
+
+ if (isImplicit)
+ try {
+ byte[] id = newSystemId() ;
+ activateObject( id, servant ) ;
+ return id ;
+ } catch (ObjectAlreadyActive oaa) {
+ // This can't occur here, since id is always brand new.
+ throw poa.invocationWrapper().servantToIdOaa( oaa ) ;
+ } catch (ServantAlreadyActive s) {
+ throw poa.invocationWrapper().servantToIdSaa( s ) ;
+ } catch (WrongPolicy w) {
+ throw poa.invocationWrapper().servantToIdWp( w ) ;
+ }
+
+ throw new ServantNotActive();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorFactory.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorFactory.java
new file mode 100644
index 0000000..9b78e1c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorFactory.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa ;
+
+abstract class POAPolicyMediatorFactory {
+ // 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 )
+ {
+ if (policies.retainServants()) {
+ if (policies.useActiveMapOnly())
+ return new POAPolicyMediatorImpl_R_AOM( policies, poa ) ;
+ else if (policies.useDefaultServant())
+ return new POAPolicyMediatorImpl_R_UDS( policies, poa ) ;
+ else if (policies.useServantManager())
+ return new POAPolicyMediatorImpl_R_USM( policies, poa ) ;
+ else
+ throw poa.invocationWrapper().pmfCreateRetain() ;
+ } else {
+ if (policies.useDefaultServant())
+ return new POAPolicyMediatorImpl_NR_UDS( policies, poa ) ;
+ else if (policies.useServantManager())
+ return new POAPolicyMediatorImpl_NR_USM( policies, poa ) ;
+ else
+ throw poa.invocationWrapper().pmfCreateNonRetain() ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java
new file mode 100644
index 0000000..8ad5a64
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_UDS.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa ;
+
+import java.util.Enumeration ;
+
+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 ;
+
+import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+/** Implementation of POAPolicyMediator that provides policy specific
+ * operations on the POA.
+ */
+public class POAPolicyMediatorImpl_NR_UDS extends POAPolicyMediatorBase {
+ private Servant defaultServant ;
+
+ POAPolicyMediatorImpl_NR_UDS( Policies policies, POAImpl poa )
+ {
+ super( policies, poa ) ;
+
+ // assert !policies.retainServants() && policies.useDefaultServant()
+ if (policies.retainServants())
+ throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
+
+ if (!policies.useDefaultServant())
+ throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
+
+ defaultServant = null ;
+ }
+
+ protected java.lang.Object internalGetServant( byte[] id,
+ String operation ) throws ForwardRequest
+ {
+ if (defaultServant == null)
+ throw poa.invocationWrapper().poaNoDefaultServant() ;
+
+ return defaultServant;
+ }
+
+ public void returnServant()
+ {
+ // NO-OP
+ }
+
+ public void etherealizeAll()
+ {
+ // NO-OP
+ }
+
+ public void clearAOM()
+ {
+ // NO-OP
+ }
+
+ public ServantManager getServantManager() throws WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public void setServantManager( ServantManager servantManager ) throws WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public Servant getDefaultServant() throws NoServant, WrongPolicy
+ {
+ if (defaultServant == null)
+ throw new NoServant();
+ return defaultServant;
+ }
+
+ 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
+ {
+ throw new WrongPolicy();
+ }
+
+ public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public Servant idToServant( byte[] id )
+ throws WrongPolicy, ObjectNotActive
+ {
+ if (defaultServant != null)
+ return defaultServant;
+
+ throw new ObjectNotActive() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java
new file mode 100644
index 0000000..280b8b1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_NR_USM.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa ;
+
+import java.util.Enumeration ;
+
+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.se.impl.orbutil.concurrent.SyncUtil ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+import com.sun.corba.se.spi.oa.OAInvocationInfo ;
+import com.sun.corba.se.impl.oa.NullServantImpl ;
+
+/** Implementation of POARequesHandler that provides policy specific
+ * operations on the POA.
+ */
+public class POAPolicyMediatorImpl_NR_USM extends POAPolicyMediatorBase {
+ private ServantLocator locator ;
+
+ POAPolicyMediatorImpl_NR_USM( Policies policies, POAImpl poa )
+ {
+ super( policies, poa ) ;
+
+ // assert !policies.retainServants() && policies.useServantManager()
+ if (policies.retainServants())
+ throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
+
+ if (!policies.useServantManager())
+ throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
+
+ locator = null ;
+ }
+
+ protected java.lang.Object internalGetServant( byte[] id,
+ String operation ) throws ForwardRequest
+ {
+ if (locator == null)
+ throw poa.invocationWrapper().poaNoServantManager() ;
+
+ CookieHolder cookieHolder = orb.peekInvocationInfo().getCookieHolder() ;
+
+ // Try - finally is J2EE requirement.
+ java.lang.Object servant;
+ try{
+ poa.unlock() ;
+
+ servant = locator.preinvoke(id, poa, operation, cookieHolder);
+ if (servant == null)
+ servant = new NullServantImpl( poa.omgInvocationWrapper().nullServantReturned() ) ;
+ else
+ setDelegate( (Servant)servant, id);
+ } finally {
+ poa.lock() ;
+ }
+
+ return servant;
+ }
+
+ public void returnServant()
+ {
+ OAInvocationInfo info = orb.peekInvocationInfo();
+ if (locator == null)
+ return;
+
+ try {
+ poa.unlock() ;
+ locator.postinvoke(info.id(), (POA)(info.oa()),
+ info.getOperation(), info.getCookieHolder().value,
+ (Servant)(info.getServantContainer()) );
+ } finally {
+ poa.lock() ;
+ }
+ }
+
+ public void etherealizeAll()
+ {
+ // NO-OP
+ }
+
+ public void clearAOM()
+ {
+ // NO-OP
+ }
+
+ public ServantManager getServantManager() throws WrongPolicy
+ {
+ return locator ;
+ }
+
+ public void setServantManager( ServantManager servantManager ) throws WrongPolicy
+ {
+ if (locator != null)
+ throw poa.invocationWrapper().servantManagerAlreadySet() ;
+
+ if (servantManager instanceof ServantLocator)
+ locator = (ServantLocator)servantManager;
+ else
+ throw poa.invocationWrapper().servantManagerBadType() ;
+ }
+
+ public Servant getDefaultServant() throws NoServant, WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public void setDefaultServant( Servant servant ) throws WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public final void activateObject(byte[] id, Servant servant)
+ throws WrongPolicy, ServantAlreadyActive, ObjectAlreadyActive
+ {
+ throw new WrongPolicy();
+ }
+
+ public Servant deactivateObject( byte[] id ) throws ObjectNotActive, WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public byte[] servantToId( Servant servant ) throws ServantNotActive, WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public Servant idToServant( byte[] id )
+ throws WrongPolicy, ObjectNotActive
+ {
+ throw new WrongPolicy();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java
new file mode 100644
index 0000000..795514e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_AOM.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.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 ;
+
+import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+import com.sun.corba.se.impl.oa.NullServantImpl ;
+
+/** Implementation of POARequesHandler that provides policy specific
+ * operations on the POA in the case:
+ * <ul>
+ * <li>retain</li>
+ * <li>useActiveObjectMapOnly</li>
+ * </ul>
+ */
+public class POAPolicyMediatorImpl_R_AOM extends POAPolicyMediatorBase_R {
+ POAPolicyMediatorImpl_R_AOM( Policies policies, POAImpl poa )
+ {
+ // assert policies.retainServants()
+ super( policies, poa ) ;
+
+ // policies.useActiveObjectMapOnly()
+ if (!policies.useActiveMapOnly())
+ throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
+ }
+
+ protected java.lang.Object internalGetServant( byte[] id,
+ String operation ) throws ForwardRequest
+ {
+ java.lang.Object servant = internalIdToServant( id ) ;
+ if (servant == null)
+ servant = new NullServantImpl(
+ poa.invocationWrapper().nullServant() ) ;
+ return servant ;
+ }
+
+ public void etherealizeAll()
+ {
+ // NO-OP
+ }
+
+ public ServantManager getServantManager() throws WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public void setServantManager( ServantManager servantManager )
+ throws WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public Servant getDefaultServant() throws NoServant, WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public void setDefaultServant( Servant servant ) throws WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public Servant idToServant( byte[] id )
+ throws WrongPolicy, ObjectNotActive
+ {
+ Servant s = internalIdToServant( id ) ;
+
+ if (s == null)
+ throw new ObjectNotActive() ;
+ else
+ return s;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java
new file mode 100644
index 0000000..8eb00dc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_UDS.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa ;
+
+import java.util.Enumeration ;
+
+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 ;
+
+import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+/** Implementation of POARequesHandler that provides policy specific
+ * operations on the POA.
+ */
+public class POAPolicyMediatorImpl_R_UDS extends POAPolicyMediatorBase_R {
+ private Servant defaultServant ;
+
+ POAPolicyMediatorImpl_R_UDS( Policies policies, POAImpl poa )
+ {
+ // assert policies.retainServants()
+ super( policies, poa ) ;
+ defaultServant = null ;
+
+ // policies.useDefaultServant()
+ if (!policies.useDefaultServant())
+ throw poa.invocationWrapper().policyMediatorBadPolicyInFactory() ;
+ }
+
+ protected java.lang.Object internalGetServant( byte[] id,
+ String operation ) throws ForwardRequest
+ {
+ Servant servant = internalIdToServant( id ) ;
+ if (servant == null)
+ servant = defaultServant ;
+
+ if (servant == null)
+ throw poa.invocationWrapper().poaNoDefaultServant() ;
+
+ return servant ;
+ }
+
+ public void etherealizeAll()
+ {
+ // NO-OP
+ }
+
+ public ServantManager getServantManager() throws WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public void setServantManager( ServantManager servantManager ) throws WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public Servant getDefaultServant() throws NoServant, WrongPolicy
+ {
+ if (defaultServant == null)
+ throw new NoServant();
+ else
+ return defaultServant;
+ }
+
+ public void setDefaultServant( Servant servant ) throws WrongPolicy
+ {
+ defaultServant = servant;
+ setDelegate(defaultServant, "DefaultServant".getBytes());
+ }
+
+ public Servant idToServant( byte[] id )
+ throws WrongPolicy, ObjectNotActive
+ {
+ ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
+ Servant s = internalKeyToServant(key);
+
+ if (s == null)
+ if (defaultServant != null)
+ s = defaultServant;
+
+ if (s == null)
+ throw new ObjectNotActive() ;
+
+ return s;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java
new file mode 100644
index 0000000..1a8badc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/POAPolicyMediatorImpl_R_USM.java
@@ -0,0 +1,381 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa ;
+
+import java.util.Set ;
+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.ServantNotActive ;
+import org.omg.PortableServer.POAPackage.ObjectAlreadyActive ;
+import org.omg.PortableServer.POAPackage.ServantAlreadyActive ;
+import org.omg.PortableServer.POAPackage.NoServant ;
+
+import com.sun.corba.se.impl.orbutil.concurrent.SyncUtil ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+import com.sun.corba.se.impl.oa.NullServantImpl ;
+
+import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
+
+import com.sun.corba.se.spi.oa.OAInvocationInfo ;
+import com.sun.corba.se.spi.oa.NullServant ;
+
+/** Implementation of POARequesHandler that provides policy specific
+ * operations on the POA.
+ */
+public class POAPolicyMediatorImpl_R_USM extends POAPolicyMediatorBase_R {
+ protected ServantActivator activator ;
+
+ POAPolicyMediatorImpl_R_USM( Policies policies, POAImpl poa )
+ {
+ // assert policies.retainServants()
+ super( policies, poa ) ;
+ activator = null ;
+
+ if (!policies.useServantManager())
+ throw poa.invocationWrapper().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.
+ */
+ private AOMEntry enterEntry( ActiveObjectMap.Key key )
+ {
+ AOMEntry result = null ;
+ boolean failed ;
+ do {
+ failed = false ;
+ result = activeObjectMap.get(key) ;
+
+ try {
+ result.enter() ;
+ } catch (Exception exc) {
+ failed = true ;
+ }
+ } while (failed) ;
+
+ return result ;
+ }
+
+ protected java.lang.Object internalGetServant( byte[] id,
+ String operation ) throws ForwardRequest
+ {
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "Calling POAPolicyMediatorImpl_R_USM.internalGetServant " +
+ "for poa " + poa + " operation=" + operation ) ;
+ }
+
+ try {
+ ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
+ AOMEntry entry = enterEntry(key) ;
+ java.lang.Object servant = activeObjectMap.getServant( entry ) ;
+ if (servant != null) {
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "internalGetServant: servant already activated" ) ;
+ }
+
+ return servant ;
+ }
+
+ if (activator == null) {
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "internalGetServant: no servant activator in POA" ) ;
+ }
+
+ entry.incarnateFailure() ;
+ throw poa.invocationWrapper().poaNoServantManager() ;
+ }
+
+ // Drop the POA lock during the incarnate call and
+ // 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 {
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "internalGetServant: upcall to incarnate" ) ;
+ }
+
+ poa.unlock() ;
+
+ servant = activator.incarnate(id, poa);
+
+ if (servant == null)
+ servant = new NullServantImpl(
+ poa.omgInvocationWrapper().nullServantReturned() ) ;
+ } catch (ForwardRequest freq) {
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "internalGetServant: incarnate threw ForwardRequest" ) ;
+ }
+
+ throw freq ;
+ } catch (SystemException exc) {
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "internalGetServant: incarnate threw SystemException " + exc ) ;
+ }
+
+ throw exc ;
+ } catch (Throwable exc) {
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "internalGetServant: incarnate threw Throwable " + exc ) ;
+ }
+
+ throw poa.invocationWrapper().poaServantActivatorLookupFailed(
+ exc ) ;
+ } finally {
+ 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
+ // entry state machine.
+ if ((servant == null) || (servant instanceof NullServant)) {
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "internalGetServant: incarnate failed" ) ;
+ }
+
+ // XXX Does the AOM leak in this case? Yes,
+ // 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() ;
+ } else {
+ // here check for unique_id policy, and if the servant
+ // is already registered for a different ID, then throw
+ // OBJ_ADAPTER exception, else activate it. Section 11.3.5.1
+ // 99-10-07.pdf
+ if (isUnique) {
+ // check if the servant already is associated with some id
+ if (activeObjectMap.contains((Servant)servant)) {
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "internalGetServant: servant already assigned to ID" ) ;
+ }
+
+ entry.incarnateFailure() ;
+ throw poa.invocationWrapper().poaServantNotUnique() ;
+ }
+ }
+
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "internalGetServant: incarnate complete" ) ;
+ }
+
+ entry.incarnateComplete() ;
+ activateServant(key, entry, (Servant)servant);
+ }
+ }
+
+ return servant ;
+ } finally {
+ if (poa.getDebug()) {
+ ORBUtility.dprint( this,
+ "Exiting POAPolicyMediatorImpl_R_USM.internalGetServant " +
+ "for poa " + poa ) ;
+ }
+ }
+ }
+
+ public void returnServant()
+ {
+ OAInvocationInfo info = orb.peekInvocationInfo();
+ byte[] id = info.id() ;
+ ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
+ AOMEntry entry = activeObjectMap.get( key ) ;
+ entry.exit() ;
+ }
+
+ 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
+ ActiveObjectMap.Key[] keys =
+ (ActiveObjectMap.Key[])keySet.toArray(
+ new ActiveObjectMap.Key[ keySet.size() ] ) ;
+
+ for (int ctr=0; ctr<keySet.size(); ctr++) {
+ ActiveObjectMap.Key key = keys[ctr] ;
+ AOMEntry entry = activeObjectMap.get( key ) ;
+ Servant servant = activeObjectMap.getServant( entry ) ;
+ if (servant != null) {
+ boolean remainingActivations =
+ activeObjectMap.hasMultipleIDs(entry) ;
+
+ // Here we etherealize in the thread that called this
+ // method, rather than etherealizing in a new thread
+ // as in the deactivate case. We still inform the
+ // entry state machine so that only one thread at a
+ // time can call the etherealize method.
+ entry.startEtherealize( null ) ;
+ try {
+ poa.unlock() ;
+ try {
+ activator.etherealize(key.id, poa, servant, true,
+ remainingActivations);
+ } catch (Exception exc) {
+ // ignore all exceptions
+ }
+ } finally {
+ poa.lock() ;
+ entry.etherealizeComplete() ;
+ }
+ }
+ }
+ }
+ }
+
+ public ServantManager getServantManager() throws WrongPolicy
+ {
+ return activator;
+ }
+
+ public void setServantManager(
+ ServantManager servantManager ) throws WrongPolicy
+ {
+ if (activator != null)
+ throw poa.invocationWrapper().servantManagerAlreadySet() ;
+
+ if (servantManager instanceof ServantActivator)
+ activator = (ServantActivator)servantManager;
+ else
+ throw poa.invocationWrapper().servantManagerBadType() ;
+ }
+
+ public Servant getDefaultServant() throws NoServant, WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ public void setDefaultServant( Servant servant ) throws WrongPolicy
+ {
+ throw new WrongPolicy();
+ }
+
+ class Etherealizer extends Thread {
+ private POAPolicyMediatorImpl_R_USM mediator ;
+ private ActiveObjectMap.Key key ;
+ private AOMEntry entry ;
+ private Servant servant ;
+ private boolean debug ;
+
+
+ public Etherealizer( POAPolicyMediatorImpl_R_USM mediator,
+ ActiveObjectMap.Key key, AOMEntry entry, Servant servant,
+ boolean debug )
+ {
+ super(null, null, "PAO-Etherealizer-Thread", 0, false);
+ this.mediator = mediator ;
+ this.key = key ;
+ this.entry = entry;
+ this.servant = servant;
+ this.debug = debug ;
+ }
+
+ public void run() {
+ if (debug) {
+ ORBUtility.dprint( this, "Calling Etherealizer.run on key " +
+ key ) ;
+ }
+
+ try {
+ try {
+ mediator.activator.etherealize( key.id, mediator.poa, servant,
+ false, mediator.activeObjectMap.hasMultipleIDs( entry ) );
+ } catch (Exception exc) {
+ // ignore all exceptions
+ }
+
+ try {
+ mediator.poa.lock() ;
+
+ entry.etherealizeComplete() ;
+ mediator.activeObjectMap.remove( key ) ;
+
+ POAManagerImpl pm = (POAManagerImpl)mediator.poa.the_POAManager() ;
+ POAFactory factory = pm.getFactory() ;
+ factory.unregisterPOAForServant( mediator.poa, servant);
+ } finally {
+ mediator.poa.unlock() ;
+ }
+ } finally {
+ if (debug) {
+ ORBUtility.dprint( this, "Exiting Etherealizer.run" ) ;
+ }
+ }
+ }
+ }
+
+ public void deactivateHelper( ActiveObjectMap.Key key, AOMEntry entry,
+ Servant servant ) throws ObjectNotActive, WrongPolicy
+ {
+ if (activator == null)
+ throw poa.invocationWrapper().poaNoServantManager() ;
+
+ Etherealizer eth = new Etherealizer( this, key, entry, servant, poa.getDebug() ) ;
+ entry.startEtherealize( eth ) ;
+ }
+
+ public Servant idToServant( byte[] id )
+ throws WrongPolicy, ObjectNotActive
+ {
+ ActiveObjectMap.Key key = new ActiveObjectMap.Key( id ) ;
+ AOMEntry entry = activeObjectMap.get(key);
+
+ Servant servant = activeObjectMap.getServant( entry ) ;
+ if (servant != null)
+ return servant ;
+ else
+ throw new ObjectNotActive() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/Policies.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/Policies.java
new file mode 100644
index 0000000..41b49bf
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/Policies.java
@@ -0,0 +1,352 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import java.util.HashMap ;
+import java.util.BitSet ;
+import java.util.Iterator ;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+import com.sun.corba.se.spi.extension.ServantCachingPolicy ;
+import com.sun.corba.se.spi.extension.ZeroPortPolicy ;
+import com.sun.corba.se.spi.extension.CopyObjectPolicy ;
+
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+import org.omg.PortableServer.POAPackage.*;
+
+public final class Policies {
+/* 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 HashMap policyMap = new HashMap() ; // Maps Integer(policy type) to Policy
+
+ 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 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 ) ;
+ }
+
+ public String toString() {
+ StringBuffer buffer = new StringBuffer();
+ buffer.append( "Policies[" ) ;
+ boolean first = true ;
+ Iterator iter = policyMap.values().iterator() ;
+ while (iter.hasNext()) {
+ if (first)
+ first = false ;
+ else
+ buffer.append( "," ) ;
+
+ buffer.append( iter.next().toString() ) ;
+ }
+ buffer.append( "]" ) ;
+ return buffer.toString() ;
+ }
+
+ /* Returns the integer value of the POA policy, if this is a
+ * POA policy, otherwise returns -1.
+ */
+ private int getPOAPolicyValue( Policy policy)
+ {
+ if (policy instanceof ThreadPolicy) {
+ return ((ThreadPolicy) policy).value().value();
+ } else if (policy instanceof LifespanPolicy) {
+ return ((LifespanPolicy) policy).value().value();
+ } else if (policy instanceof IdUniquenessPolicy) {
+ return ((IdUniquenessPolicy) policy).value().value();
+ } else if (policy instanceof IdAssignmentPolicy) {
+ return ((IdAssignmentPolicy) policy).value().value();
+ } else if (policy instanceof ServantRetentionPolicy) {
+ return ((ServantRetentionPolicy) policy).value().value();
+ } else if (policy instanceof RequestProcessingPolicy) {
+ return ((RequestProcessingPolicy) policy).value().value();
+ } else if (policy instanceof ImplicitActivationPolicy) {
+ return ((ImplicitActivationPolicy) policy).value().value();
+ } else
+ return -1 ;
+ }
+
+ /** 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<errorSet.length(); ctr++ )
+ if (errorSet.get(ctr))
+ throw new InvalidPolicy(ctr);
+ }
+
+ /** Add the first index in policies at which the policy is of type
+ * policyId to errorSet, if the polictId is in policies (it may not be).
+ */
+ private void addToErrorSet( Policy[] policies, int policyId,
+ BitSet errorSet )
+ {
+ for (int ctr=0; ctr<policies.length; ctr++ )
+ if (policies[ctr].policy_type() == policyId) {
+ errorSet.set( ctr ) ;
+ return ;
+ }
+ }
+
+ /** Main constructor used from POA::create_POA. This need only be visible
+ * within the POA package.
+ */
+ Policies(Policy[] policies, int id ) throws InvalidPolicy
+ {
+ // Make sure the defaults are set according to the POA spec
+ this();
+
+ defaultObjectCopierFactoryId = id ;
+
+ if ( policies == null )
+ return;
+
+ // Set to record all indices in policies for which errors
+ // were observed.
+ BitSet errorSet = new BitSet( policies.length ) ;
+
+ for(short i = 0; i < policies.length; i++) {
+ Policy policy = policies[i];
+ int POAPolicyValue = getPOAPolicyValue( policy ) ;
+
+ // Save the policy in policyMap to support
+ // POA.get_effective_policy, if it was not already saved
+ // in policyMap.
+ Integer key = new Integer( policy.policy_type() ) ;
+ Policy prev = (Policy)(policyMap.get( key )) ;
+ if (prev == null)
+ policyMap.put( key, policy ) ;
+
+ if (POAPolicyValue >= 0) {
+ setPolicyValue( key.intValue(), POAPolicyValue ) ;
+
+ // 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 ) ;
+ }
+ }
+
+ // 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 ) ;
+ }
+
+ // 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 ) ;
+ }
+
+ if (!isSystemAssignedIds()) {
+ addToErrorSet( policies, IMPLICIT_ACTIVATION_POLICY_ID.value,
+ errorSet ) ;
+ addToErrorSet( policies, ID_ASSIGNMENT_POLICY_ID.value,
+ errorSet ) ;
+ }
+ }
+
+ checkForPolicyError( errorSet ) ;
+ }
+
+ public Policy get_effective_policy( int type )
+ {
+ Integer key = new Integer( type ) ;
+ Policy result = (Policy)(policyMap.get(key)) ;
+ return result ;
+ }
+
+ /* Thread Policies */
+ public final boolean isOrbControlledThreads() {
+ return getPolicyValue( THREAD_POLICY_ID.value ) ==
+ ThreadPolicyValue._ORB_CTRL_MODEL;
+ }
+ public final boolean isSingleThreaded() {
+ return getPolicyValue( THREAD_POLICY_ID.value ) ==
+ ThreadPolicyValue._SINGLE_THREAD_MODEL;
+ }
+
+ /* Lifespan */
+ public final boolean isTransient() {
+ return getPolicyValue( LIFESPAN_POLICY_ID.value ) ==
+ LifespanPolicyValue._TRANSIENT;
+ }
+ public final boolean isPersistent() {
+ return getPolicyValue( LIFESPAN_POLICY_ID.value ) ==
+ LifespanPolicyValue._PERSISTENT;
+ }
+
+ /* ID Uniqueness */
+ public final boolean isUniqueIds() {
+ return getPolicyValue( ID_UNIQUENESS_POLICY_ID.value ) ==
+ IdUniquenessPolicyValue._UNIQUE_ID;
+ }
+ public final boolean isMultipleIds() {
+ 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;
+ }
+ public final boolean isSystemAssignedIds() {
+ 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;
+ }
+
+ /* Request Processing */
+ public final boolean useActiveMapOnly() {
+ 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;
+ }
+ public final boolean useServantManager() {
+ 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;
+ }
+
+ /* proprietary servant caching policy */
+ public final int servantCachingLevel()
+ {
+ Integer key = new Integer( ORBConstants.SERVANT_CACHING_POLICY ) ;
+ ServantCachingPolicy policy = (ServantCachingPolicy)policyMap.get( key ) ;
+ if (policy == null)
+ return ServantCachingPolicy.NO_SERVANT_CACHING ;
+ else
+ return policy.getType() ;
+ }
+
+ public final boolean forceZeroPort()
+ {
+ Integer key = new Integer( ORBConstants.ZERO_PORT_POLICY ) ;
+ ZeroPortPolicy policy = (ZeroPortPolicy)policyMap.get( key ) ;
+ if (policy == null)
+ return false ;
+ else
+ return policy.forceZeroPort() ;
+ }
+
+ public final int getCopierId()
+ {
+ Integer key = new Integer( ORBConstants.COPY_OBJECT_POLICY ) ;
+ CopyObjectPolicy policy = (CopyObjectPolicy)policyMap.get( key ) ;
+ if (policy != null)
+ return policy.getValue() ;
+ else
+ return defaultObjectCopierFactoryId ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/RequestProcessingPolicyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/RequestProcessingPolicyImpl.java
new file mode 100644
index 0000000..4ef1bd7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/RequestProcessingPolicyImpl.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+
+public class RequestProcessingPolicyImpl
+ extends org.omg.CORBA.LocalObject implements RequestProcessingPolicy {
+
+ public RequestProcessingPolicyImpl(RequestProcessingPolicyValue
+ value) {
+ this.value = value;
+ }
+
+ public RequestProcessingPolicyValue value() {
+ return value;
+ }
+
+ public int policy_type()
+ {
+ return REQUEST_PROCESSING_POLICY_ID.value ;
+ }
+
+ public Policy copy() {
+ return new RequestProcessingPolicyImpl(value);
+ }
+
+ public void destroy() {
+ value = null;
+ }
+
+ private RequestProcessingPolicyValue value;
+
+ 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 ;
+ }
+
+ return "RequestProcessingPolicy[" + type + "]" ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ServantRetentionPolicyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ServantRetentionPolicyImpl.java
new file mode 100644
index 0000000..c6c8801
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ServantRetentionPolicyImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+
+final class ServantRetentionPolicyImpl
+ extends org.omg.CORBA.LocalObject implements ServantRetentionPolicy {
+
+ public ServantRetentionPolicyImpl(ServantRetentionPolicyValue value) {
+ this.value = value;
+ }
+
+ public ServantRetentionPolicyValue value() {
+ return value;
+ }
+
+ public int policy_type()
+ {
+ return SERVANT_RETENTION_POLICY_ID.value ;
+ }
+
+ public Policy copy() {
+ return new ServantRetentionPolicyImpl(value);
+ }
+
+ public void destroy() {
+ value = null;
+ }
+
+ private ServantRetentionPolicyValue value;
+
+ public String toString()
+ {
+ return "ServantRetentionPolicy[" +
+ ((value.value() == ServantRetentionPolicyValue._RETAIN) ?
+ "RETAIN" : "NON_RETAIN" + "]") ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ThreadPolicyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ThreadPolicyImpl.java
new file mode 100644
index 0000000..f75d0fe
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/ThreadPolicyImpl.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.poa;
+
+import org.omg.CORBA.*;
+import org.omg.PortableServer.*;
+
+final class ThreadPolicyImpl
+ extends org.omg.CORBA.LocalObject implements ThreadPolicy {
+
+ public ThreadPolicyImpl(ThreadPolicyValue value) {
+ this.value = value;
+ }
+
+ public ThreadPolicyValue value() {
+ return value;
+ }
+
+ public int policy_type()
+ {
+ return THREAD_POLICY_ID.value ;
+ }
+
+ public Policy copy() {
+ return new ThreadPolicyImpl(value);
+ }
+
+ public void destroy() {
+ value = null;
+ }
+
+ private ThreadPolicyValue value;
+
+ public String toString()
+ {
+ return "ThreadPolicy[" +
+ ((value.value() == ThreadPolicyValue._SINGLE_THREAD_MODEL) ?
+ "SINGLE_THREAD_MODEL" : "ORB_CTRL_MODEL" + "]") ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/minor_code_example.txt b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/minor_code_example.txt
new file mode 100644
index 0000000..3cb3fc3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/minor_code_example.txt
@@ -0,0 +1,61 @@
+package @PKGNAME@ ;
+
+import org.omg.CORBA.OMGVMCID ;
+import org.omg.CORBA.CompletionStatus ;
+
+import org.omg.CORBA.@SYSEX@ ;
+
+public abstract class StandardException {
+ // @SYSEX@ BAD_CONTEXT
+
+ public void IdlContextNotFound( CompletionStatus completed )
+ {
+ throw new BAD_CONTEXT( "IDL context not found",
+ OMGVMCID.value + 1, completed ) ;
+ }
+
+ public void IdlContextNotFound( )
+ {
+ IdlContextNotFound( CompletionStatus.COMPLETED_NO ) ;
+ }
+
+Data structures: list[ ... ] vector[ ... ] ( record )
+
+list[ ( string{exception name} list[ ( string{code name} int{value} string{description} ] ) ]
+
+Processing:
+
+
+ open file (fname)
+ fr = new FileReader( fname )
+ br = new BufferedReader( fr )
+ br.readLine() returns null at EOF
+
+ want a BufferedReader
+
+ while not eol read line
+ if (line start with spaces)
+ add to current index
+ else
+ new exception
+
+ create StandardException class
+
+ foreach ( excname vec ) in data
+ add import statement for execname to output
+
+ foreach ( codename value descr ) in vec
+ generate full method
+ generate short method
+
+
+(define (read-file fname)
+ (begin
+ (let port (open-input-port fname))
+ (let obj (read port))
+ obj
+ )
+)
+
+
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/standard_minor_codes.txt b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/standard_minor_codes.txt
new file mode 100644
index 0000000..294ed5d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/poa/standard_minor_codes.txt
@@ -0,0 +1,160 @@
+(
+(BAD_CONTEXT
+ (IDL_CONTEXT_NOT_FOUND 1 "IDL context not found")
+ (NO_MATCHING_IDL_CONTEXT 2 "No matching IDL context property")
+)
+(BAD_INV_ORDER
+ (DEP_PREVENT_DESTRUCTION 1 "Dependency exists in IFR preventing destruction of this object")
+ (DESTROY_INDESTRUCTIBLE 2 "Attempt to destroy indestructible objects in IFR")
+ (OPERATION_DEADLOCK 3 "Operation would deadlock")
+ (ORB_SHUTDOWN 4 "ORB has shutdown")
+ (BAD_INVOKE 5 "Attempt to invoke send or invoke operation of the same Request object more than once ")
+ (BAD_SET_SERVANT_MANAGER 6 "Attempt to set a servent manager after one has already been set")
+ (BAD_ARGUMENTS_CALL 7 "ServerRequest::arguments called more than once or after a call to ServerRequest::set_exception")
+ (BAD_CTX_CALL 8 "ServerRequest::ctx called more than once or before ServerRequest::arguments or after ServerRequest::ctx, ServerRequest::set_result or ServerRequest::set_exception")
+ (BAD_RESULT_CALL 9 "ServerRequest::set_result called more than once or before ServerRequest::arguments or after ServerRequest::set_result or ServerRequest::set_exception")
+ (BAD_SEND 10 "Attempt to send a DII request after it was sent previously")
+ (BAD_POLL_BEFORE 11 "Attempt to poll a DII request or to retrieve its result before the request was sent")
+ (BAD_POLL_AFTER 12 "Attempt to poll a DII request or to retrieve its result after the result was retrieved previously")
+ (BAD_POLL_SYNC 13 "Attempt to poll a synchronous DII request or to retrieve results from a synchronous DII request")
+ (BAD_PI_CALL 14 "Invalid portable interceptor call")
+ (BAD_PI_ADD_SERVICE_CONTEXT 15 "Service context add failed in portable interceptor because a service context with the given id already exists")
+ (DUPLICATE_POLICY_FACTORY 16 "Registration of PolicyFactory failed because a factory already exists for the given PolicyType")
+ (CREATE_POA_DESTROY 17 "POA cannot create POAs while undergoing destruction")
+ (PRIORITY_REASSIGN 18 "Attempt to reassign priority")
+ (XA_START_OUTSIZE 19 "An OTS/XA integration xa_start() call returned XAER_OUTSIDE")
+ (XA_START_PROTO 20 "An OTS/XA integration xa_ call returned XAER_PROTO")
+)
+(BAD_OPERATION
+ (BAD_SERVANT_MANAGER_TYPE 1 "ServantManager returned wrong servant type")
+ (OPERATION_UNKNOWN_TO_TARGET 2 "Operation or attribute not known to target object ")
+)
+(BAD_PARAM
+ (VALUE_FACTORY_REG_ERROR 1 "Failure to register, unregister or lookup value factory")
+ (RID_ALREADY_DEFINED 2 "RID already defined in IFR")
+ (NAME_USED_IFR 3 "Name already used in the context in IFR ")
+ (TARGET_NOT_CONTAINER 4 "Target is not a valid container")
+ (NAME_CLASH 5 "Name clash in inherited context")
+ (BAD_ABSTRACT_INTERFACE_TYPE 6 "Incorrect type for abstract interface")
+ (SO_BAD_SCHEME_NAME 7 "string_to_object conversion failed due to bad scheme name")
+ (SO_BAD_ADDRESS 8 "string_to_object conversion failed due to bad address")
+ (SO_BAD_SCHEMA_SPECIFIC 9 "string_to_object conversion failed due to bad bad schema specific part")
+ (SO_NON_SPECIFIC 10 "string_to_object conversion failed due to non specific reason")
+ (IR_DERIVE_ABS_INT_BASE 11 "Attempt to derive abstract interface from non-abstract base interface in the Interface Repository")
+ (IR_VALUE_SUPPORT 12 "Attempt to let a ValueDef support more than one non-abstract interface in the Interface Repository")
+ (INCOMPLETE_TYPECODE 13 "Attempt to use an incomplete TypeCode as a parameter")
+ (INVALID_OBJECT_ID 14 "Invalid object id passed to POA::create_reference_by_id ")
+ (TYPECODE_BAD_NAME 15 "Bad name argument in TypeCode operation")
+ (TYPECODE_BAD_REPID 16 "Bad RepositoryId argument in TypeCode operation")
+ (TYPECODE_INV_MEMBER 17 "Invalid member name in TypeCode operation ")
+ (TC_UNION_DUP_LABEL 18 "Duplicate label value in create_union_tc ")
+ (TC_UNION_INCOMPATIBLE 19 "Incompatible TypeCode of label and discriminator in create_union_tc ")
+ (TC_UNION_BAD_DISC 20 "Supplied discriminator type illegitimate in create_union_tc ")
+ (SET_EXCEPTION_BAD_ANY 21 "Any passed to ServerRequest::set_exception does not contain an exception ")
+ (SET_EXCEPTION_UNLISTED 22 "Unlisted user exception passed to ServerRequest::set_exception ")
+ (NO_WCHAR_CODE_SET 23 "wchar transmission code set not in service context")
+ (ILLEGAL_SERVICE_CONTEXT 24 "Service context is not in OMG-defined range")
+ (ENUM_OUT_OF_RANGE 25 "Enum value out of range")
+ (PI_BAD_SERVICE_CONTEXT 26 "Invalid service context Id in portable interceptor")
+ (REG_INITIAL_NULL 27 "Attempt to call register_initial_reference with a null Object")
+ (PI_INV_COMPONENT_ID 28 "Invalid component Id in portable interceptor")
+ (PI_INV_PROFILE_ID 29 "Invalid profile Id in portable interceptor")
+ (POLICY_TYPE_DUPLICATE 30 "Two or more Policy objects with the same PolicyType value supplied to Object::set_policy_overrides or PolicyManager::set_policy_overrides")
+ (BAD_ONEWAY_DEFINITION 31 "Attempt to define a oneway operation with non-void result, out or inout parameters or user exceptions")
+ (DII_FOR_IMPLICIT_OPERATION 32 "DII asked to create request for an implicit operation")
+ (XA_CALL_INVAL 33 "An OTS/XA integration xa_ call returned XAER_INVAL")
+ (UNION_BAD_DISCRIMINATOR 34 "Union branch modifier method called with bad case label discriminator")
+ (CTX_ILLEGAL_PROPERTY_NAME 35 "Illegal IDL context property name")
+ (CTX_ILLEGAL_SEARCH_STRING 36 "Illegal IDL property search string")
+ (CTX_ILLEGAL_NAME 37 "Illegal IDL context name")
+ (CTX_NON_EMPTY 38 "Non-empty IDL context")
+ (RMI_STREAM_FORMAT 39 "Unsupported RMI/IDL custom value type stream format")
+ (OUTPUT_STREAM_NOT_VALUE 40 "ORB output stream does not support ValueOutputStream interface")
+ (INPUT_STREAM_NOT_VALUE 41 "ORB input stream does not support ValueInputStream interface")
+)
+(BAD_TYPECODE
+ (MARSHALL_INCOMPLETE_TYPECODE 1 "Attempt to marshal incomplete TypeCode")
+ (BAD_MEMBER_TYPECODE 2 "Member type code illegitimate in TypeCode operation")
+ (ILLEGAL_PARAMETER 3 "Illegal parameter type")
+)
+(DATA_CONVERSION
+ (CHAR_NOT_MAP_TCS 1 "Character does not map to negotiated transmission code set")
+ (PRIORITY_MAP_FAILRE 2 "Failure of PriorityMapping object")
+)
+(IMP_LIMIT
+ (NO_USABLE_PROFILE 1 "Unable to use any profile in IOR")
+)
+(INITIALIZE
+ (PRIORITY_RANGE_RESTRICT 1 "Priority range too restricted for ORB")
+)
+(INV_OBJREF
+ (NO_WCHAR_CODE_SET 1 "wchar Code Set support not specified")
+ (CODESET_COMPONENT_REQUIRED 2 "Codeset component required for type using wchar or wstring data")
+)
+(INV_POLICY
+ (IOR_POLICY_RECONCILE_ERROR 1 "Unable to reconcile IOR specified policy with effective policy override")
+ (INVALID_POLICY_TYPE 2 "Invalid PolicyType")
+ (NO_POLICY_FACTORY 3 "No PolicyFactory has been registered for the given PolicyType")
+)
+(INTERNAL
+ (XA_RMERR 1 "An OTS/XA integration xa_ call returned XAER_RMERR")
+ (XA_RMFAIL 2 "An OTS/XA integration xa_ call returned XAER_RMFAIL")
+)
+(INTF_REPOS
+ (NO_IR 1 "Interface Repository not available")
+ (NO_INTERFACE_IN_IR 2 "No entry for requested interface in Interface Repository")
+)
+(MARSHAL
+ (NO_VALUE_FACTORY 1 "Unable to locate value factory")
+ (SET_RESULT_BEFORE_CTX 2 "ServerRequest::set_result called before ServerRequest::ctx when the operation IDL contains a context clause ")
+ (BAD_NVLIST 3 "NVList passed to ServerRequest::arguments does not describe all parameters passed by client")
+ (MARSHAL_LOCAL_OBJECT 4 "Attempt to marshal Local object")
+ (WCHAR_BAD_GIOP_VERSION_SENT 5 "wchar or wstring data erroneosly sent by client over GIOP 1.0 connection ")
+ (WCHAR_BAD_GIOP_VERSION_RETURNED 6 "wchar or wstring data erroneously returned by server over GIOP 1.0 connection ")
+ (RMI_STREAM_FORMAT_2 7 "Unsupported RMI/IDL custom value type stream "format
+)
+(NO_IMPLEMENT
+ (NO_LOCAL_VALUE_IMPLEMENTATION 1 "Missing local value implementation")
+ (INCOMPAT_VALUE_IMPLEMENTATION 2 "Incompatible value implementation version")
+ (NO_USABLE_PROFILE_2 3 "Unable to use any profile in IOR")
+ (DII_LOCAL_OBJECT 4 "Attempt to use DII on Local object")
+ (BIO_RESET 5 "Biomolecular Sequence Analysis iterator cannot be reset")
+ (BIO_NOT_AVAILABLE 6 "Biomolecular Sequence Analysis metadata is not available as XML")
+ (BIO_GENOMIC_NO_ITERATOR 7 "Genomic Maps iterator cannot be reset")
+)
+(NO_RESOURCES
+ (PI_OPERATION_NOT_SUPPORTED 1 "Portable Interceptor operation not supported in this binding")
+ (NO_CONNECTION_PRIORITY 2 "No connection for request's priority")
+)
+(TRANSACTION_ROLLEDBACK
+ (XA_RB 1 "An OTS/XA integration xa_ call returned XAER_RB")
+ (XA_NOTA 2 "An OTS/XA integration xa_ call returned XAER_NOTA")
+ (XA_END_TRUE_ROLLBACK_DEFERRED 3 "OTS/XA integration end() was called with success set to TRUE while transaction rollback was deferred")
+)
+(TRANSIENT
+ (POA_REQUEST_DISCARD 1 "Request discarded because of resource exhaustion in POA or because POA is in DISCARDING state")
+ (NO_USABLE_PROFILE_3 2 "No usable profile in IOR")
+ (REQUEST_CANCELLED 3 "Request cancelled")
+ (POA_DESTROYED 4 "POA destroyed")
+)
+(OBJECT_NOT_EXIST
+ "(UNREGISTERED_VALUE_AS_OBJREF 1 Attempt to pass an unactivated (unregistered) value as an object reference")
+ (NO_OBJECT_ADAPTOR 2 "Failed to create or locate Object Adaptor")
+ (BIO_NOT_AVAILABLE 3 "Biomolecular Sequence Analysis Service is no longer available")
+ (OBJECT_ADAPTER_INACTIVE 4 "Object Adapter Inactive")
+)
+(OBJ_ADAPTER
+ (UNKNOWN_ADAPTER_SYS_EXCEPTION 1 "System exception in POA::unknown_adapter")
+ (BAD_SERVANT_TYPE 2 "Incorrect servant type returned by servant manager ")
+ (NO_DEFAULT_SERVANT 3 "No default servant available [POA policy"])
+ (NO_SERVANT_MANAGER 4 "No servant manager available [POA Policy"])
+ (BAD_POLICY_INCARNATE 5 "Violation of POA policy by ServantActivator::incarnate")
+ (PI_EXC_COMP_ESTABLISHED 6 "Exception in PortableInterceptor::IORInterceptor.components_established")
+ (NULL_SERVANT_RETURNED 7 "Null servant returned by servant manager")
+)
+(UNKNOWN
+ (UNLISTED_EXCEPTION_RECEIVED 1 "Unlisted user exception received by client ")
+ (UNSUPPORTED_SYSTEM_EXCEPTION 2 "Non-standard System Exception not supported")
+ (PI_UNKNOWN_USER_EXCEPTION 3 "An unknown user exception received by a portable interceptor")
+)
+)
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOA.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOA.java
new file mode 100644
index 0000000..655ce07
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOA.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.toa ;
+
+import com.sun.corba.se.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.
+ */
+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.
+ */
+ void connect( org.omg.CORBA.Object servant ) ;
+
+ /** Disconnect the object from this ORB.
+ */
+ void disconnect( org.omg.CORBA.Object obj ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java
new file mode 100644
index 0000000..5882322
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAFactory.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.toa ;
+
+import java.util.Map ;
+import java.util.HashMap ;
+
+import org.omg.CORBA.INTERNAL ;
+import org.omg.CORBA.CompletionStatus ;
+
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
+import com.sun.corba.se.spi.oa.ObjectAdapter ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+
+import com.sun.corba.se.impl.oa.toa.TOAImpl ;
+import com.sun.corba.se.impl.oa.toa.TransientObjectManager ;
+
+import com.sun.corba.se.impl.javax.rmi.CORBA.Util ;
+
+import com.sun.corba.se.impl.ior.ObjectKeyTemplateBase ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class TOAFactory implements ObjectAdapterFactory
+{
+ private ORB orb ;
+ private ORBUtilSystemException wrapper ;
+
+ private TOAImpl toa ;
+ private Map codebaseToTOA ;
+ private TransientObjectManager tom ;
+
+ public ObjectAdapter find ( ObjectAdapterId oaid )
+ {
+ if (oaid.equals( ObjectKeyTemplateBase.JIDL_OAID ) )
+ // Return the dispatch-only TOA, which can dispatch
+ // request for objects created by any TOA.
+ return getTOA() ;
+ else
+ throw wrapper.badToaOaid() ;
+ }
+
+ public void init( ORB orb )
+ {
+ this.orb = orb ;
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.OA_LIFECYCLE ) ;
+ tom = new TransientObjectManager( orb ) ;
+ codebaseToTOA = new HashMap() ;
+ }
+
+ public void shutdown( boolean waitForCompletion )
+ {
+ if (Util.isInstanceDefined()) {
+ Util.getInstance().unregisterTargetsForORB(orb);
+ }
+ }
+
+ public synchronized TOA getTOA( String codebase )
+ {
+ TOA toa = (TOA)(codebaseToTOA.get( codebase )) ;
+ if (toa == null) {
+ toa = new TOAImpl( orb, tom, codebase ) ;
+
+ codebaseToTOA.put( codebase, toa ) ;
+ }
+
+ return toa ;
+ }
+
+ 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 ) ;
+
+ return toa ;
+ }
+
+ public ORB getORB()
+ {
+ return orb ;
+ }
+} ;
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAImpl.java
new file mode 100644
index 0000000..8290e17
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TOAImpl.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.oa.toa ;
+
+import org.omg.CORBA.Policy ;
+import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
+import org.omg.PortableInterceptor.ObjectReferenceFactory ;
+import org.omg.PortableInterceptor.ACTIVE;
+import org.omg.PortableServer.ServantLocatorPackage.CookieHolder ;
+
+import com.sun.corba.se.pept.protocol.ClientDelegate ;
+
+import com.sun.corba.se.spi.copyobject.CopierManager ;
+import com.sun.corba.se.spi.copyobject.ObjectCopier ;
+import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
+import com.sun.corba.se.spi.oa.OAInvocationInfo ;
+import com.sun.corba.se.spi.oa.OADestroyed ;
+import com.sun.corba.se.spi.oa.ObjectAdapterBase ;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
+
+import com.sun.corba.se.impl.ior.JIDLObjectKeyTemplate ;
+import com.sun.corba.se.impl.oa.NullServantImpl;
+import com.sun.corba.se.impl.oa.poa.Policies;
+import com.sun.corba.se.impl.oa.toa.TransientObjectManager ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+import com.sun.corba.se.impl.protocol.JIDLLocalCRDImpl ;
+
+/** 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:
+* <UL>
+* <LI>There is only one OA instance of the TOA. Its OAId is { "TOA" }</LI>
+* <LI>There is not adapter manager. The TOA manager ID is fixed.</LI>
+* <LI>State is the same as ORB state (TBD)</LI>
+* </UL>
+* Other requirements:
+* <UL>
+* <LI>All object adapters must invoke ORB.adapterCreated when they are created.
+* </LI>
+* <LI>All adapter managers must invoke ORB.adapterManagerStateChanged when
+* their state changes, mapping the internal state to an ORT state.</LI>
+* <LI>AdapterStateChanged must be invoked (from somewhere) whenever
+* an adapter state changes that is not due to an adapter manager state change.</LI>
+* </UL>
+*/
+public class TOAImpl extends ObjectAdapterBase implements TOA
+{
+ private TransientObjectManager servants ;
+
+ public TOAImpl( ORB orb, TransientObjectManager tom, String codebase )
+ {
+ super( orb ) ;
+ servants = tom ;
+
+ // Make the object key template
+ int serverid = ((ORB)getORB()).getTransientServerId();
+ int scid = ORBConstants.TOA_SCID ;
+
+ 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()
+ ) ;
+ }
+
+ // Methods required for dispatching requests
+
+ 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 ) ) ;
+ }
+
+ /** 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
+ */
+ public void getInvocationServant( OAInvocationInfo info )
+ {
+ java.lang.Object servant = servants.lookupServant( info.id() ) ;
+ if (servant == null)
+ // This is expected to result in an RMI-IIOP NoSuchObjectException.
+ // See bug 4973160.
+ servant = new NullServantImpl( lifecycleWrapper().nullServant() ) ;
+ info.setServant( servant ) ;
+ }
+
+ 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 ) ;
+ }
+
+ // XXX For now, this does nothing.
+ // This will need fixing once we support ORB and thread level policies,
+ // but for now, there is no way to associate policies with the TOA, so
+ // getEffectivePolicy must always return null.
+ public Policy getEffectivePolicy( int type )
+ {
+ return null ;
+ }
+
+ public int getManagerId()
+ {
+ return -1 ;
+ }
+
+ public short getState()
+ {
+ return ACTIVE.value ;
+ }
+
+ public void enter() throws OADestroyed
+ {
+ }
+
+ public void exit()
+ {
+ }
+
+ // Methods unique to the TOA
+
+ 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] ;
+
+ // Create the new objref
+ ObjectReferenceFactory orf = getCurrentFactory() ;
+ org.omg.CORBA.Object obj = orf.make_object( id, key ) ;
+
+ // Copy the delegate from the new objref to the argument
+ // XXX handle the case of an attempt to connect a local object.
+
+ org.omg.CORBA.portable.Delegate delegate = StubAdapter.getDelegate(
+ obj ) ;
+ CorbaContactInfoList ccil = (CorbaContactInfoList)
+ ((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 ) ;
+ }
+
+ StubAdapter.setDelegate( objref, delegate ) ;
+ }
+
+ 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 ) ;
+ CorbaContactInfoList ccil = (CorbaContactInfoList)
+ ((ClientDelegate)del).getContactInfoList() ;
+ LocalClientRequestDispatcher lcs =
+ ccil.getLocalClientRequestDispatcher() ;
+
+ if (lcs instanceof JIDLLocalCRDImpl) {
+ 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 ) ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TransientObjectManager.java b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TransientObjectManager.java
new file mode 100644
index 0000000..827b666
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/oa/toa/TransientObjectManager.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.oa.toa;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+import com.sun.corba.se.spi.orb.ORB ;
+
+public final class TransientObjectManager {
+ private ORB orb ;
+ private int maxSize = 128;
+ private Element[] elementArray;
+ private Element freeList;
+
+ void dprint( String msg ) {
+ ORBUtility.dprint( this, msg ) ;
+ }
+
+ 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]);
+ freeList = elementArray[0];
+ }
+
+ public synchronized byte[] storeServant(java.lang.Object servant, java.lang.Object servantData)
+ {
+ if ( freeList == null )
+ doubleSize();
+
+ Element elem = freeList;
+ freeList = (Element)freeList.servant;
+
+ byte[] result = elem.getKey(servant, servantData);
+ if (orb.transientObjectManagerDebugFlag)
+ dprint( "storeServant returns key for element " + elem ) ;
+ return result ;
+ }
+
+ public synchronized java.lang.Object lookupServant(byte transientKey[])
+ {
+ int index = ORBUtility.bytesToInt(transientKey,0);
+ int counter = ORBUtility.bytesToInt(transientKey,4);
+
+ if (orb.transientObjectManagerDebugFlag)
+ dprint( "lookupServant called with index=" + index + ", counter=" + counter ) ;
+
+ if (elementArray[index].counter == counter &&
+ elementArray[index].valid ) {
+ if (orb.transientObjectManagerDebugFlag)
+ dprint( "\tcounter is valid" ) ;
+ return elementArray[index].servant;
+ }
+
+ // servant not found
+ if (orb.transientObjectManagerDebugFlag)
+ dprint( "\tcounter is invalid" ) ;
+ return null;
+ }
+
+ public synchronized java.lang.Object lookupServantData(byte transientKey[])
+ {
+ int index = ORBUtility.bytesToInt(transientKey,0);
+ int counter = ORBUtility.bytesToInt(transientKey,4);
+
+ if (orb.transientObjectManagerDebugFlag)
+ dprint( "lookupServantData called with index=" + index + ", counter=" + counter ) ;
+
+ if (elementArray[index].counter == counter &&
+ elementArray[index].valid ) {
+ if (orb.transientObjectManagerDebugFlag)
+ dprint( "\tcounter is valid" ) ;
+ return elementArray[index].servantData;
+ }
+
+ // servant not found
+ if (orb.transientObjectManagerDebugFlag)
+ dprint( "\tcounter is invalid" ) ;
+ return null;
+ }
+
+ public synchronized void deleteServant(byte transientKey[])
+ {
+ int index = ORBUtility.bytesToInt(transientKey,0);
+ if (orb.transientObjectManagerDebugFlag)
+ dprint( "deleting servant at index=" + index ) ;
+
+ elementArray[index].delete(freeList);
+ freeList = elementArray[index];
+ }
+
+ public synchronized byte[] getKey(java.lang.Object servant)
+ {
+ for ( int i=0; i<maxSize; i++ )
+ if ( elementArray[i].valid &&
+ elementArray[i].servant == servant )
+ return elementArray[i].toBytes();
+
+ // if we come here Object does not exist
+ return null;
+ }
+
+ private void doubleSize()
+ {
+ // Assume caller is synchronized
+
+ Element old[] = elementArray;
+ int oldSize = maxSize;
+ maxSize *= 2;
+ elementArray = new Element[maxSize];
+
+ for ( int i=0; i<oldSize; i++ )
+ elementArray[i] = old[i];
+
+ 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];
+ }
+}
+
+
+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
+ // a valid servant
+
+ Element(int i, java.lang.Object next)
+ {
+ servant = next;
+ index = i;
+ }
+
+ byte[] getKey(java.lang.Object servant, java.lang.Object servantData)
+ {
+ this.servant = servant;
+ this.servantData = servantData;
+ this.valid = true;
+
+ return toBytes();
+ }
+
+ byte[] toBytes()
+ {
+ // Convert the index+counter into an 8-byte (big-endian) key.
+
+ byte key[] = new byte[8];
+ ORBUtility.intToBytes(index, key, 0);
+ ORBUtility.intToBytes(counter, key, 4);
+
+ return key;
+ }
+
+ void delete(Element freeList)
+ {
+ if ( !valid ) // prevent double deletion
+ return;
+ counter++;
+ servantData = null;
+ valid = false;
+
+ // add this to freeList
+ servant = freeList;
+ }
+
+ public String toString()
+ {
+ return "Element[" + index + ", " + counter + "]" ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/AppletDataCollector.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/AppletDataCollector.java
new file mode 100644
index 0000000..ed2c984
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/AppletDataCollector.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import java.applet.Applet ;
+import java.util.Properties ;
+
+public class AppletDataCollector extends DataCollectorBase {
+ private Applet applet ;
+
+ AppletDataCollector( Applet app, Properties props, String localHostName,
+ String configurationHostName )
+ {
+ super( props, localHostName, configurationHostName ) ;
+ this.applet = app ;
+ }
+
+ public boolean isApplet()
+ {
+ return true ;
+ }
+
+ protected void collect( )
+ {
+ checkPropertyDefaults() ;
+
+ findPropertiesFromFile() ;
+
+ // We do not use system properties for applets in order to
+ // avoid security exceptions.
+
+ findPropertiesFromProperties() ;
+ findPropertiesFromApplet( applet ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorBase.java
new file mode 100644
index 0000000..56b3899
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorBase.java
@@ -0,0 +1,473 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import com.sun.corba.se.impl.orbutil.GetPropertyAction ;
+
+import java.security.PrivilegedAction ;
+import java.security.AccessController ;
+
+import java.applet.Applet ;
+
+import java.util.Properties ;
+import java.util.Vector ;
+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.security.AccessController ;
+
+import java.io.File ;
+import java.io.FileInputStream ;
+
+import com.sun.corba.se.spi.orb.DataCollector ;
+import com.sun.corba.se.spi.orb.PropertyParser ;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+public abstract class DataCollectorBase implements DataCollector {
+ private PropertyParser parser ;
+ 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 )
+ {
+ // XXX This is fully initialized here. So do we ever want to
+ // generalize this (or perhaps this is the wrong place for this?)
+ 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 ) ;
+
+ propertyPrefixes = new HashSet() ;
+
+ 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 void setParser( PropertyParser parser )
+ {
+ Iterator iter = parser.iterator() ;
+ while (iter.hasNext()) {
+ ParserAction pa = (ParserAction)(iter.next()) ;
+ if (pa.isPrefix())
+ propertyPrefixes.add( pa.getPropertyName() ) ;
+ else
+ propertyNames.add( pa.getPropertyName() ) ;
+ }
+
+ collect() ;
+ setParserCalled = true ;
+ }
+
+ public Properties getProperties()
+ {
+ checkSetParserCalled() ;
+ return resultProps ;
+ }
+
+//////////////////////////////////////////////////////////
+// public interface from DataCollector that must be defined
+// in subclasses
+//////////////////////////////////////////////////////////
+
+ public abstract boolean isApplet() ;
+
+//////////////////////////////////////////////////////////
+// Implementation methods needed in subclasses
+//////////////////////////////////////////////////////////
+
+ protected abstract void collect() ;
+
+//////////////////////////////////////////////////////////
+// methods for use by subclasses
+//////////////////////////////////////////////////////////
+
+ protected void checkPropertyDefaults()
+ {
+ String host =
+ resultProps.getProperty( ORBConstants.INITIAL_HOST_PROPERTY ) ;
+
+ if ((host == null) || (host.equals("")))
+ setProperty( ORBConstants.INITIAL_HOST_PROPERTY,
+ configurationHostName );
+
+ String serverHost =
+ resultProps.getProperty( ORBConstants.SERVER_HOST_PROPERTY ) ;
+
+ if (serverHost == null ||
+ serverHost.equals("") ||
+ serverHost.equals("0.0.0.0") ||
+ serverHost.equals("::") ||
+ serverHost.toLowerCase().equals("::ffff:0.0.0.0"))
+ {
+ setProperty(ORBConstants.SERVER_HOST_PROPERTY,
+ localHostName);
+ setProperty(ORBConstants.LISTEN_ON_ALL_INTERFACES,
+ ORBConstants.LISTEN_ON_ALL_INTERFACES);
+ }
+ }
+
+ protected void findPropertiesFromArgs( String[] params )
+ {
+ if (params == null)
+ return;
+
+ // All command-line args are of the form "-ORBkey value".
+ // The key is mapped to <prefix>.ORBkey.
+
+ String name ;
+ String value ;
+
+ for ( int i=0; i<params.length; i++ ) {
+ value = null ;
+ name = null ;
+
+ if ( params[i] != null && params[i].startsWith("-ORB") ) {
+ String argName = params[i].substring( 1 ) ;
+ name = findMatchingPropertyName( propertyNames, argName ) ;
+
+ if (name != null)
+ if ( i+1 < params.length && params[i+1] != null ) {
+ value = params[++i];
+ }
+ }
+
+ if (value != null) {
+ setProperty( name, value ) ;
+ }
+ }
+ }
+
+ protected void findPropertiesFromApplet( final Applet app )
+ {
+ // Cannot use propertyPrefixes here, since there is no
+ // way to fetch properties by prefix from an Applet.
+ if (app == null)
+ return;
+
+ PropertyCallback callback = new PropertyCallback() {
+ public String get(String name) {
+ return app.getParameter(name);
+ }
+ } ;
+
+ findPropertiesByName( propertyNames.iterator(), callback ) ;
+
+ // Special Case:
+ //
+ // Convert any applet parameter relative URLs to an
+ // absolute URL based on the Document Root. This is so HTML
+ // URLs can be kept relative which is sometimes useful for
+ // managing the Document Root layout.
+ PropertyCallback URLCallback = new PropertyCallback() {
+ public String get( String name ) {
+ String value = resultProps.getProperty(name);
+ if (value == null)
+ return null ;
+
+ try {
+ URL url = new URL( app.getDocumentBase(), value ) ;
+ return url.toExternalForm() ;
+ } catch (java.net.MalformedURLException exc) {
+ // Just preserve the original (malformed) value:
+ // the error will be handled later.
+ return value ;
+ }
+ }
+ } ;
+
+ findPropertiesByName( URLPropertyNames.iterator(),
+ URLCallback ) ;
+ }
+
+ private void doProperties( final Properties props )
+ {
+ PropertyCallback callback = new PropertyCallback() {
+ public String get(String name) {
+ return props.getProperty(name);
+ }
+ } ;
+
+ findPropertiesByName( propertyNames.iterator(), callback ) ;
+
+ findPropertiesByPrefix( propertyPrefixes,
+ makeIterator( props.propertyNames()), callback );
+ }
+
+ protected void findPropertiesFromFile()
+ {
+ final Properties fileProps = getFileProperties() ;
+ if (fileProps==null)
+ return ;
+
+ doProperties( fileProps ) ;
+ }
+
+ protected void findPropertiesFromProperties()
+ {
+ if (originalProps == null)
+ return;
+
+ doProperties( originalProps ) ;
+ }
+
+ //
+ // Map System properties to ORB properties.
+ // Security bug fix 4278205:
+ // Only allow reading of system properties with ORB prefixes.
+ // Previously a malicious subclass was able to read ANY system property.
+ // Note that other prefixes are fine in other contexts; it is only
+ // system properties that should impose a restriction.
+ 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 ) ;
+
+ findPropertiesByPrefix( prefixNames,
+ getSystemPropertyNames(), callback ) ;
+ }
+
+//////////////////////////////////////////////////////////
+// internal implementation
+//////////////////////////////////////////////////////////
+
+ // 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 ) ) {
+ // Value is <name>=<URL>
+ StringTokenizer st = new StringTokenizer( value, "=" ) ;
+ if (st.countTokens() != 2)
+ throw new IllegalArgumentException() ;
+
+ String refName = st.nextToken() ;
+ String refValue = st.nextToken() ;
+
+ resultProps.setProperty( name + "." + refName, refValue ) ;
+ } else {
+ resultProps.setProperty( name, value ) ;
+ }
+ }
+
+ private void checkSetParserCalled()
+ {
+ if (!setParserCalled)
+ throw new IllegalStateException( "setParser not called." ) ;
+ }
+
+ // 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 )
+ {
+ while (propertyNames.hasNext()) {
+ String name = (String)(propertyNames.next()) ;
+ Iterator iter = prefixes.iterator() ;
+ while (iter.hasNext()) {
+ String prefix = (String)(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 ) ;
+ }
+ }
+ }
+ }
+
+ // 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 )
+ {
+ while (names.hasNext()) {
+ String name = (String)(names.next()) ;
+ String value = getProperty.get( name ) ;
+ if (value != null)
+ setProperty( name, value ) ;
+ }
+ }
+
+ 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() ;
+ while (iter.hasNext()) {
+ String name = (String)(iter.next()) ;
+ if (name.endsWith( suffix ))
+ return name ;
+ }
+
+ return null ;
+ }
+
+ private static Iterator makeIterator( final Enumeration enumeration )
+ {
+ return new Iterator() {
+ public boolean hasNext() { return enumeration.hasMoreElements() ; }
+ public Object next() { return enumeration.nextElement() ; }
+ public void remove() { throw new UnsupportedOperationException() ; }
+ } ;
+ }
+
+ private static Iterator getSystemPropertyNames()
+ {
+ // This will not throw a SecurityException because this
+ // class was loaded from rt.jar using the bootstrap classloader.
+ Enumeration enumeration = (Enumeration)
+ AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public java.lang.Object run() {
+ return System.getProperties().propertyNames();
+ }
+ }
+ );
+
+ return makeIterator( enumeration ) ;
+ }
+
+ private void getPropertiesFromFile( Properties props, String fileName )
+ {
+ try {
+ File file = new File( fileName ) ;
+ if (!file.exists())
+ return ;
+
+ FileInputStream in = new FileInputStream( file ) ;
+
+ try {
+ props.load( in ) ;
+ } finally {
+ in.close() ;
+ }
+ } catch (Exception exc) {
+ // if (ORBInitDebug)
+ // dprint( "ORB properties file " + fileName + " not found: " +
+ // exc) ;
+ }
+ }
+
+ private Properties getFileProperties()
+ {
+ Properties defaults = new Properties() ;
+
+ String javaHome = getSystemProperty( "java.home" ) ;
+ String fileName = javaHome + File.separator + "lib" + File.separator +
+ "orb.properties" ;
+
+ getPropertiesFromFile( defaults, fileName ) ;
+
+ Properties results = new Properties( defaults ) ;
+
+ String userHome = getSystemProperty( "user.home" ) ;
+ fileName = userHome + File.separator + "orb.properties" ;
+
+ getPropertiesFromFile( results, fileName ) ;
+ return results ;
+ }
+
+ private boolean hasCORBAPrefix( String prefix )
+ {
+ return prefix.startsWith( ORBConstants.ORG_OMG_PREFIX ) ||
+ prefix.startsWith( ORBConstants.SUN_PREFIX ) ||
+ prefix.startsWith( ORBConstants.SUN_LC_PREFIX ) ||
+ prefix.startsWith( ORBConstants.SUN_LC_VERSION_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() ;
+ while (iter.hasNext()) {
+ String element = (String)(iter.next()) ;
+ if (hasCORBAPrefix( element ))
+ result.add( element ) ;
+ }
+
+ return result ;
+ }
+}
+
+// Used to collect properties from various sources.
+abstract class PropertyCallback
+{
+ abstract public String get(String name);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorFactory.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorFactory.java
new file mode 100644
index 0000000..b28b4b9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/DataCollectorFactory.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import java.applet.Applet ;
+import java.util.Properties ;
+import java.net.URL ;
+
+import com.sun.corba.se.spi.orb.DataCollector ;
+
+public abstract class DataCollectorFactory {
+ private DataCollectorFactory() {}
+
+ public static DataCollector create( Applet app, Properties props,
+ String localHostName )
+ {
+ String appletHost = localHostName ;
+
+ if (app != null) {
+ URL appletCodeBase = app.getCodeBase() ;
+
+ if (appletCodeBase != null)
+ appletHost = appletCodeBase.getHost() ;
+ }
+
+ 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( Properties props,
+ String localHostName )
+ {
+ return new PropertyOnlyDataCollector( props, localHostName,
+ localHostName ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalDataCollector.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalDataCollector.java
new file mode 100644
index 0000000..aba45bc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalDataCollector.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import java.net.InetAddress ;
+
+import java.util.Properties ;
+
+import org.omg.CORBA.INTERNAL ;
+import org.omg.CORBA.CompletionStatus ;
+
+public class NormalDataCollector extends DataCollectorBase {
+ private String[] args ;
+
+ public NormalDataCollector( String[] args, Properties props,
+ String localHostName, String configurationHostName )
+ {
+ super( props, localHostName, configurationHostName ) ;
+ this.args = args ;
+ }
+
+ public boolean isApplet()
+ {
+ return false ;
+ }
+
+ protected void collect()
+ {
+ checkPropertyDefaults() ;
+
+ findPropertiesFromFile() ;
+ findPropertiesFromSystem() ;
+ findPropertiesFromProperties() ;
+ findPropertiesFromArgs( args ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserAction.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserAction.java
new file mode 100644
index 0000000..cad8276
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserAction.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import java.util.Properties ;
+
+import com.sun.corba.se.spi.orb.Operation ;
+
+public class NormalParserAction extends ParserActionBase {
+ 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.
+ */
+ public Object apply( Properties props )
+ {
+ Object value = props.getProperty( getPropertyName() ) ;
+ if (value != null)
+ return getOperation().operate( value ) ;
+ else
+ return null ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserData.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserData.java
new file mode 100644
index 0000000..4a7cff3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/NormalParserData.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import java.util.Properties ;
+
+import com.sun.corba.se.spi.orb.Operation ;
+import com.sun.corba.se.spi.orb.PropertyParser ;
+
+public class NormalParserData extends ParserDataBase {
+ 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 void addToParser( PropertyParser parser )
+ {
+ parser.add( getPropertyName(), getOperation(), getFieldName() ) ;
+ }
+
+ public void addToProperties( Properties props )
+ {
+ props.setProperty( getPropertyName(), testData ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBConfiguratorImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBConfiguratorImpl.java
new file mode 100644
index 0000000..1d2684d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBConfiguratorImpl.java
@@ -0,0 +1,628 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.net.InetAddress ;
+import java.security.PrivilegedAction ;
+import java.security.PrivilegedExceptionAction ;
+import java.security.AccessController ;
+import java.util.Collection ;
+import java.util.Iterator ;
+
+import org.omg.CORBA.CompletionStatus ;
+import org.omg.CORBA.portable.ValueFactory ;
+
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher ;
+import com.sun.corba.se.pept.transport.Acceptor;
+
+import com.sun.corba.se.spi.activation.Locator ;
+import com.sun.corba.se.spi.activation.Activator ;
+import com.sun.corba.se.spi.activation.LocatorHelper ;
+import com.sun.corba.se.spi.activation.ActivatorHelper ;
+import com.sun.corba.se.spi.activation.EndPointInfo ;
+
+import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
+import com.sun.corba.se.spi.copyobject.CopyobjectDefaults ;
+import com.sun.corba.se.spi.copyobject.CopierManager ;
+
+import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories ;
+
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
+
+import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.spi.oa.OADefault ;
+import com.sun.corba.se.spi.oa.ObjectAdapter ;
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
+
+import com.sun.corba.se.spi.orb.Operation ;
+import com.sun.corba.se.spi.orb.OperationFactory ;
+import com.sun.corba.se.spi.orb.ORBData ;
+import com.sun.corba.se.spi.orb.DataCollector ;
+import com.sun.corba.se.spi.orb.ORBConfigurator ;
+import com.sun.corba.se.spi.orb.ParserImplBase ;
+import com.sun.corba.se.spi.orb.PropertyParser ;
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.orbutil.closure.Closure ;
+import com.sun.corba.se.spi.orbutil.closure.ClosureFactory ;
+
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+import com.sun.corba.se.spi.protocol.RequestDispatcherDefault ;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
+
+import com.sun.corba.se.spi.resolver.LocalResolver ;
+import com.sun.corba.se.spi.resolver.Resolver ;
+import com.sun.corba.se.spi.resolver.ResolverDefault ;
+
+import com.sun.corba.se.spi.transport.CorbaContactInfoList;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
+import com.sun.corba.se.spi.transport.SocketInfo;
+import com.sun.corba.se.spi.transport.TransportDefault ;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContext ;
+import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ;
+import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext ;
+import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext ;
+import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext ;
+import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext ;
+import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.transport.SocketOrChannelAcceptorImpl;
+
+// XXX This should go away once we get rid of the port exchange for ORBD
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
+import com.sun.corba.se.impl.legacy.connection.SocketFactoryAcceptorImpl;
+import com.sun.corba.se.impl.legacy.connection.SocketFactoryContactInfoListImpl;
+import com.sun.corba.se.impl.legacy.connection.USLPort;
+
+// XXX These should move to SPI
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+// XXX This needs an SPI
+import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl ;
+
+public class ORBConfiguratorImpl implements ORBConfigurator {
+ private ORBUtilSystemException wrapper ;
+
+ public static class ConfigParser extends ParserImplBase {
+ public Class[] userConfigurators = null ;
+
+ public PropertyParser makeParser()
+ {
+ PropertyParser parser = new PropertyParser() ;
+ Operation action = OperationFactory.compose(
+ OperationFactory.suffixAction(),
+ OperationFactory.classAction()
+ ) ;
+ parser.addPrefix( ORBConstants.SUN_PREFIX + "ORBUserConfigurators",
+ action, "userConfigurators", Class.class ) ;
+ return parser ;
+ }
+ }
+
+ public void configure( DataCollector collector, ORB orb )
+ {
+ ORB theOrb = orb ;
+ wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.ORB_LIFECYCLE ) ;
+
+ initObjectCopiers( theOrb ) ;
+ initIORFinders( theOrb ) ;
+
+ theOrb.setClientDelegateFactory(
+ // REVISIT: this should be ProtocolDefault.
+ TransportDefault.makeClientDelegateFactory( theOrb )) ;
+
+ initializeTransport(theOrb) ;
+
+ initializeNaming( theOrb ) ;
+ initServiceContextRegistry( theOrb ) ;
+ initRequestDispatcherRegistry( theOrb ) ;
+ registerInitialReferences( theOrb ) ;
+
+ persistentServerInitialization( theOrb ) ;
+
+ runUserConfigurators( collector, theOrb ) ;
+ }
+
+ 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() ;
+ parser.init( collector ) ;
+ if (parser.userConfigurators != null) {
+ for (int ctr=0; ctr<parser.userConfigurators.length; ctr++) {
+ Class cls = parser.userConfigurators[ctr] ;
+ try {
+ ORBConfigurator config = (ORBConfigurator)(cls.newInstance()) ;
+ config.configure( collector, orb ) ;
+ } catch (Exception exc) {
+ // XXX Log this exception
+ // ignore this for now: a bad user configurator does nothing
+ }
+ }
+ }
+ }
+
+ private void persistentServerInitialization( ORB orb )
+ {
+ ORBData data = orb.getORBData() ;
+
+ // determine the ORBD port so that persistent objrefs can be
+ // created.
+ if (data.getServerIsORBActivated()) {
+ try {
+ Locator locator = LocatorHelper.narrow(
+ orb.resolve_initial_references(
+ ORBConstants.SERVER_LOCATOR_NAME )) ;
+ Activator activator = ActivatorHelper.narrow(
+ orb.resolve_initial_references(
+ ORBConstants.SERVER_ACTIVATOR_NAME )) ;
+ Collection serverEndpoints =
+ orb.getCorbaTransportManager().getAcceptors(null, null);
+ EndPointInfo[] endpointList =
+ new EndPointInfo[serverEndpoints.size()];
+ Iterator iterator = serverEndpoints.iterator();
+ int i = 0 ;
+ while (iterator.hasNext()) {
+ Object n = iterator.next();
+ if (! (n instanceof LegacyServerSocketEndPointInfo)) {
+ continue;
+ }
+ LegacyServerSocketEndPointInfo ep =
+ (LegacyServerSocketEndPointInfo) n;
+ // REVISIT - use exception instead of -1.
+ int port = locator.getEndpoint(ep.getType());
+ if (port == -1) {
+ port = locator.getEndpoint(SocketInfo.IIOP_CLEAR_TEXT);
+ if (port == -1) {
+ throw new Exception(
+ "ORBD must support IIOP_CLEAR_TEXT");
+ }
+ }
+
+ ep.setLocatorPort(port);
+
+ endpointList[i++] =
+ new EndPointInfo(ep.getType(), ep.getPort());
+ }
+
+ activator.registerEndpoints(
+ data.getPersistentServerId(), data.getORBId(),
+ endpointList);
+ } catch (Exception ex) {
+ throw wrapper.persistentServerInitError(
+ CompletionStatus.COMPLETED_MAYBE, ex ) ;
+ }
+ }
+ }
+
+ /**
+ * This is made somewhat complex because we are currently supporting
+ * the ContactInfoList/Acceptor *AND* the legacy SocketFactory
+ * transport architecture.
+ */
+ private void initializeTransport(final ORB orb)
+ {
+ ORBData od = orb.getORBData();
+
+ CorbaContactInfoListFactory contactInfoListFactory =
+ od.getCorbaContactInfoListFactory();
+ Acceptor[] acceptors = od.getAcceptors();
+
+ // BEGIN Legacy
+ ORBSocketFactory legacySocketFactory = od.getLegacySocketFactory();
+ USLPort[] uslPorts = od.getUserSpecifiedListenPorts() ;
+ setLegacySocketFactoryORB(orb, legacySocketFactory);
+ // END Legacy
+
+ //
+ // Check for incorrect configuration.
+ //
+
+ if (legacySocketFactory != null && contactInfoListFactory != null) {
+ throw wrapper.socketFactoryAndContactInfoListAtSameTime();
+ }
+
+ if (acceptors.length != 0 && legacySocketFactory != null) {
+ throw wrapper.acceptorsAndLegacySocketFactoryAtSameTime();
+ }
+
+
+ //
+ // Client and Server side setup.
+ //
+
+ od.getSocketFactory().setORB(orb);
+
+ //
+ // Set up client side.
+ //
+
+ if (legacySocketFactory != null) {
+ // BEGIN Legacy
+ // Since the user specified a legacy socket factory we need to
+ // use a ContactInfoList that will use the legacy socket factory.
+ contactInfoListFactory =
+ new CorbaContactInfoListFactory() {
+ public void setORB(ORB orb) { }
+ public CorbaContactInfoList create( IOR ior ) {
+ return new SocketFactoryContactInfoListImpl(
+ orb, ior);
+ }
+ };
+ // END Legacy
+ } else if (contactInfoListFactory != null) {
+ // The user specified an explicit ContactInfoListFactory.
+ contactInfoListFactory.setORB(orb);
+ } else {
+ // Use the default.
+ contactInfoListFactory =
+ TransportDefault.makeCorbaContactInfoListFactory(orb);
+ }
+ orb.setCorbaContactInfoListFactory(contactInfoListFactory);
+
+ //
+ // Set up server side.
+ //
+
+ //
+ // Maybe allocate the Legacy default listener.
+ //
+ // If old legacy properties set, or there are no explicit
+ // acceptors then register a default listener. Type of
+ // default listener depends on presence of legacy socket factory.
+ //
+ // Note: this must happen *BEFORE* registering explicit acceptors.
+ //
+
+ // BEGIN Legacy
+ int port = -1;
+ if (od.getORBServerPort() != 0) {
+ port = od.getORBServerPort();
+ } else if (od.getPersistentPortInitialized()) {
+ port = od.getPersistentServerPort();
+ } else if (acceptors.length == 0) {
+ port = 0;
+ }
+ if (port != -1) {
+ createAndRegisterAcceptor(orb, legacySocketFactory, port,
+ LegacyServerSocketEndPointInfo.DEFAULT_ENDPOINT,
+ SocketInfo.IIOP_CLEAR_TEXT);
+ }
+ // END Legacy
+
+ for (int i = 0; i < acceptors.length; i++) {
+ orb.getCorbaTransportManager().registerAcceptor(acceptors[i]);
+ }
+
+ // BEGIN Legacy
+ // Allocate user listeners.
+ USLPort[] ports = od.getUserSpecifiedListenPorts() ;
+ if (ports != null) {
+ for (int i = 0; i < ports.length; i++) {
+ createAndRegisterAcceptor(
+ orb, legacySocketFactory, ports[i].getPort(),
+ LegacyServerSocketEndPointInfo.NO_NAME,
+ ports[i].getType());
+ }
+ }
+ // END Legacy
+ }
+
+ /*
+ * Legacy: name.
+ */
+ // REVISIT: see ORBD. make factory in TransportDefault.
+ private void createAndRegisterAcceptor(ORB orb,
+ ORBSocketFactory legacySocketFactory,
+ int port, String name, String type)
+ {
+ Acceptor acceptor;
+ if (legacySocketFactory == null) {
+ acceptor =
+ new SocketOrChannelAcceptorImpl(orb, port, name, type);
+ } else {
+ acceptor =
+ new SocketFactoryAcceptorImpl(orb, port, name, type);
+ }
+ orb.getTransportManager().registerAcceptor(acceptor);
+ }
+
+ private void setLegacySocketFactoryORB(
+ final ORB orb, final ORBSocketFactory legacySocketFactory)
+ {
+ if (legacySocketFactory == null) {
+ return;
+ }
+
+ // Note: the createServerSocket and createSocket methods on the
+ // DefaultSocketFactory need to get data from the ORB but
+ // we cannot change the interface. So set the ORB (if it's ours)
+ // by reflection.
+
+ try {
+ AccessController.doPrivileged(
+ new PrivilegedExceptionAction() {
+ public Object run()
+ throws InstantiationException, IllegalAccessException
+ {
+ try {
+ Class[] params = { ORB.class };
+ Method method =
+ legacySocketFactory.getClass().getMethod(
+ "setORB", params);
+ Object[] args = { orb };
+ method.invoke(legacySocketFactory, args);
+ } catch (NoSuchMethodException e) {
+ // NOTE: If there is no method then it
+ // is not ours - so ignore it.
+ ;
+ } catch (IllegalAccessException e) {
+ RuntimeException rte = new RuntimeException();
+ rte.initCause(e);
+ throw rte;
+ } catch (InvocationTargetException e) {
+ RuntimeException rte = new RuntimeException();
+ rte.initCause(e);
+ throw rte;
+ }
+ return null;
+ }
+ }
+ );
+ } catch (Throwable t) {
+ throw wrapper.unableToSetSocketFactoryOrb(t);
+ }
+ }
+
+ private void initializeNaming( ORB orb )
+ {
+ LocalResolver localResolver = ResolverDefault.makeLocalResolver() ;
+ orb.setLocalResolver( localResolver ) ;
+
+ Resolver bootResolver = ResolverDefault.makeBootstrapResolver( orb,
+ orb.getORBData().getORBInitialHost(),
+ orb.getORBData().getORBInitialPort() ) ;
+
+ Operation urlOperation = ResolverDefault.makeINSURLOperation( orb,
+ bootResolver ) ;
+ orb.setURLOperation( urlOperation ) ;
+
+ Resolver irResolver = ResolverDefault.makeORBInitRefResolver( urlOperation,
+ orb.getORBData().getORBInitialReferences() ) ;
+
+ Resolver dirResolver = ResolverDefault.makeORBDefaultInitRefResolver(
+ urlOperation, orb.getORBData().getORBDefaultInitialReference() ) ;
+
+ Resolver resolver =
+ ResolverDefault.makeCompositeResolver( localResolver,
+ ResolverDefault.makeCompositeResolver( irResolver,
+ ResolverDefault.makeCompositeResolver( dirResolver,
+ bootResolver ) ) ) ;
+ orb.setResolver( resolver ) ;
+ }
+
+ private void initServiceContextRegistry( ORB orb )
+ {
+ ServiceContextRegistry scr = orb.getServiceContextRegistry() ;
+
+ scr.register( UEInfoServiceContext.class ) ;
+ scr.register( CodeSetServiceContext.class ) ;
+ scr.register( SendingContextServiceContext.class ) ;
+ scr.register( ORBVersionServiceContext.class ) ;
+ scr.register( MaxStreamFormatVersionServiceContext.class ) ;
+ }
+
+ private void registerInitialReferences( final ORB orb )
+ {
+ // Register the Dynamic Any factory
+ Closure closure = new Closure() {
+ public java.lang.Object evaluate() {
+ return new DynAnyFactoryImpl( orb ) ;
+ }
+ } ;
+
+ Closure future = ClosureFactory.makeFuture( closure ) ;
+ orb.getLocalResolver().register( ORBConstants.DYN_ANY_FACTORY_NAME,
+ future ) ;
+ }
+
+ private static final int ORB_STREAM = 0 ;
+
+ private void initObjectCopiers( ORB orb )
+ {
+ // No optimization or policy selection here.
+ ObjectCopierFactory orbStream =
+ CopyobjectDefaults.makeORBStreamObjectCopierFactory( orb ) ;
+
+ CopierManager cm = orb.getCopierManager() ;
+ cm.setDefaultId( 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());
+
+ // Register the ValueFactory instances for ORT
+ IORFactories.registerValueFactories( orb ) ;
+
+ // Register an ObjectKeyFactory
+ orb.setObjectKeyFactory( IORFactories.makeObjectKeyFactory(orb) ) ;
+ }
+
+ 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 ) ;
+
+ // register server delegates
+ CorbaServerRequestDispatcher 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.
+ */
+ CorbaServerRequestDispatcher 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 ) ;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java
new file mode 100644
index 0000000..94bb5d9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBDataParserImpl.java
@@ -0,0 +1,418 @@
+/*
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.corba.se.impl.orb ;
+
+import java.net.URL ;
+
+import org.omg.CORBA.CompletionStatus ;
+import org.omg.PortableInterceptor.ORBInitializer ;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.spi.orb.DataCollector ;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBData ;
+import com.sun.corba.se.spi.orb.ParserImplTableBase ;
+import com.sun.corba.se.spi.orb.StringPair ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
+import com.sun.corba.se.spi.transport.CorbaTransportManager;
+import com.sun.corba.se.spi.transport.IORToSocketInfo;
+import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo;
+import com.sun.corba.se.spi.transport.ReadTimeouts;
+
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
+import com.sun.corba.se.impl.legacy.connection.USLPort;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+
+public class ORBDataParserImpl extends ParserImplTableBase implements ORBData
+{
+ private ORB orb ;
+ private ORBUtilSystemException wrapper ;
+ private String ORBInitialHost ;
+ private int ORBInitialPort ;
+ private String ORBServerHost ;
+ private int ORBServerPort ;
+ private String listenOnAllInterfaces;
+ private com.sun.corba.se.spi.legacy.connection.ORBSocketFactory legacySocketFactory ;
+ private com.sun.corba.se.spi.transport.ORBSocketFactory socketFactory;
+ private USLPort[] userSpecifiedListenPorts ;
+ private IORToSocketInfo iorToSocketInfo;
+ private IIOPPrimaryToContactInfo iiopPrimaryToContactInfo;
+ private String orbId ;
+ private boolean orbServerIdPropertySpecified ;
+ private URL servicesURL ;
+ private String propertyInitRef ;
+ 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 StringPair[] orbInitialReferences ;
+ private String defaultInitRef ;
+ private String[] debugFlags ;
+ private Acceptor[] acceptors;
+ private CorbaContactInfoListFactory corbaContactInfoListFactory;
+ private String acceptorSocketType;
+ private boolean acceptorSocketUseSelectThreadToWait;
+ private boolean acceptorSocketUseWorkerThreadForEvent;
+ private String connectionSocketType;
+ private boolean connectionSocketUseSelectThreadToWait;
+ private boolean connectionSocketUseWorkerThreadForEvent;
+ private ReadTimeouts readTimeouts;
+ private boolean disableDirectByteBufferUse;
+ private boolean enableJavaSerialization;
+ private boolean useRepId;
+
+ // This is not initialized from ParserTable.
+ private CodeSetComponentInfo codesets ;
+
+// Public accessor methods ========================================================================
+
+ public String getORBInitialHost()
+ {
+ return ORBInitialHost;
+ }
+
+ public int getORBInitialPort()
+ {
+ return ORBInitialPort;
+ }
+
+ public String getORBServerHost()
+ {
+ return ORBServerHost;
+ }
+
+ public String getListenOnAllInterfaces()
+ {
+ return listenOnAllInterfaces;
+ }
+
+ public int getORBServerPort()
+ {
+ return ORBServerPort;
+ }
+
+ public com.sun.corba.se.spi.legacy.connection.ORBSocketFactory getLegacySocketFactory()
+ {
+ return legacySocketFactory;
+ }
+
+ public com.sun.corba.se.spi.transport.ORBSocketFactory getSocketFactory()
+ {
+ return socketFactory;
+ }
+
+ public USLPort[] getUserSpecifiedListenPorts ()
+ {
+ return userSpecifiedListenPorts;
+ }
+
+ public IORToSocketInfo getIORToSocketInfo()
+ {
+ return iorToSocketInfo;
+ }
+
+ public IIOPPrimaryToContactInfo getIIOPPrimaryToContactInfo()
+ {
+ return iiopPrimaryToContactInfo;
+ }
+
+ public String getORBId()
+ {
+ return orbId;
+ }
+
+ public boolean getORBServerIdPropertySpecified()
+ {
+ return orbServerIdPropertySpecified;
+ }
+
+ public boolean isLocalOptimizationAllowed()
+ {
+ return allowLocalOptimization ;
+ }
+
+ public GIOPVersion getGIOPVersion()
+ {
+ return giopVersion;
+ }
+
+ public int getHighWaterMark()
+ {
+ return highWaterMark;
+ }
+
+ public int getLowWaterMark()
+ {
+ return lowWaterMark;
+ }
+
+ public int getNumberToReclaim()
+ {
+ return numberToReclaim;
+ }
+
+ public int getGIOPFragmentSize()
+ {
+ return giopFragmentSize;
+ }
+
+ public int getGIOPBufferSize()
+ {
+ return giopBufferSize;
+ }
+
+ public int getGIOPBuffMgrStrategy(GIOPVersion gv)
+ {
+ if(gv!=null){
+ if (gv.equals(GIOPVersion.V1_0)) return 0; //Always grow for 1.0
+ if (gv.equals(GIOPVersion.V1_1)) return giop11BuffMgr;
+ if (gv.equals(GIOPVersion.V1_2)) return giop12BuffMgr;
+ }
+ //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
+ */
+ public short getGIOPTargetAddressPreference()
+ {
+ return giopTargetAddressPreference;
+ }
+
+ public short getGIOPAddressDisposition()
+ {
+ return giopAddressDisposition;
+ }
+
+ public boolean useByteOrderMarkers()
+ {
+ return useByteOrderMarkers;
+ }
+
+ public boolean useByteOrderMarkersInEncapsulations()
+ {
+ return useByteOrderMarkersInEncaps;
+ }
+
+ public boolean alwaysSendCodeSetServiceContext()
+ {
+ return alwaysSendCodeSetCtx;
+ }
+
+ public boolean getPersistentPortInitialized()
+ {
+ return persistentPortInitialized ;
+ }
+
+ //public void setPersistentServerPort(int sp)
+ //{
+ //persistentServerPort = sp;
+ //persistentPortInitialized = true;
+ //}
+
+ public int getPersistentServerPort()
+ {
+ if ( persistentPortInitialized ) // this is a user-activated server
+ return persistentServerPort;
+ else {
+ throw wrapper.persistentServerportNotSet(
+ CompletionStatus.COMPLETED_MAYBE );
+ }
+ }
+
+ public boolean getPersistentServerIdInitialized()
+ {
+ return persistentServerIdInitialized;
+ }
+
+ /** Set the persistent-server-id of this server. This id is the same
+ * across multiple activations of this server. The id can be set to any
+ * integer value other than 0. This id must be set before any persistent
+ * objects can be created.
+ */
+ //public void setPersistentServerId(int id)
+ //{
+ //persistentServerId = id;
+ //persistentServerIdInitialized = true;
+ //}
+
+ /** 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.se.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 ) {
+ return persistentServerId;
+ } else {
+ throw wrapper.persistentServeridNotSet(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ public boolean getServerIsORBActivated()
+ {
+ return serverIsORBActivated ;
+ }
+
+ public Class getBadServerIdHandler()
+ {
+ return badServerIdHandlerClass ;
+ }
+
+ /**
+ * 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 ORBInitializer[] getORBInitializers()
+ {
+ return orbInitializers ;
+ }
+
+ public StringPair[] getORBInitialReferences()
+ {
+ return orbInitialReferences ;
+ }
+
+ public String getORBDefaultInitialReference()
+ {
+ return defaultInitRef ;
+ }
+
+ public String[] getORBDebugFlags()
+ {
+ return debugFlags ;
+ }
+
+ public Acceptor[] getAcceptors()
+ {
+ return acceptors;
+ }
+
+ public CorbaContactInfoListFactory getCorbaContactInfoListFactory()
+ {
+ return corbaContactInfoListFactory;
+ }
+
+ public String acceptorSocketType()
+ {
+ return acceptorSocketType;
+ }
+ public boolean acceptorSocketUseSelectThreadToWait()
+ {
+ return acceptorSocketUseSelectThreadToWait;
+ }
+ public boolean acceptorSocketUseWorkerThreadForEvent()
+ {
+ return acceptorSocketUseWorkerThreadForEvent;
+ }
+ public String connectionSocketType()
+ {
+ return connectionSocketType;
+ }
+ public boolean connectionSocketUseSelectThreadToWait()
+ {
+ return connectionSocketUseSelectThreadToWait;
+ }
+ public boolean connectionSocketUseWorkerThreadForEvent()
+ {
+ return connectionSocketUseWorkerThreadForEvent;
+ }
+ public boolean isJavaSerializationEnabled()
+ {
+ return enableJavaSerialization;
+ }
+ public ReadTimeouts getTransportTCPReadTimeouts()
+ {
+ return readTimeouts;
+ }
+ public boolean disableDirectByteBufferUse()
+ {
+ return disableDirectByteBufferUse ;
+ }
+ public boolean useRepId()
+ {
+ return useRepId;
+ }
+
+// Methods for constructing and initializing this object ===========================================
+
+ public ORBDataParserImpl( ORB orb, DataCollector coll )
+ {
+ super( ParserTable.get().getParserData() ) ;
+ this.orb = orb ;
+ wrapper = ORBUtilSystemException.get( orb, CORBALogDomains.ORB_LIFECYCLE ) ;
+ init( coll ) ;
+ complete() ;
+ }
+
+ public void complete()
+ {
+ codesets = new CodeSetComponentInfo(charData, wcharData);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
new file mode 100644
index 0000000..007e6b8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBImpl.java
@@ -0,0 +1,2128 @@
+/*
+ * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb;
+
+import java.applet.Applet;
+
+import java.io.IOException;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.InvocationTargetException;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.Vector;
+import java.util.Hashtable;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.StringTokenizer;
+import java.util.Enumeration;
+import java.util.WeakHashMap;
+
+import java.net.InetAddress;
+
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.ValueHandler;
+
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.Environment;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.UnionMember;
+import org.omg.CORBA.ValueMember;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.MARSHAL;
+
+import org.omg.CORBA.portable.ValueFactory;
+
+import org.omg.CORBA.ORBPackage.InvalidName;
+
+import com.sun.org.omg.SendingContext.CodeBase;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.protocol.ClientInvocationInfo;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.ConnectionCache;
+import com.sun.corba.se.pept.transport.TransportManager;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder;
+import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder;
+import com.sun.corba.se.spi.ior.IORFactories;
+import com.sun.corba.se.spi.ior.ObjectKey;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory;
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.oa.OAInvocationInfo;
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory;
+import com.sun.corba.se.spi.orb.DataCollector;
+import com.sun.corba.se.spi.orb.Operation;
+import com.sun.corba.se.spi.orb.ORBData;
+import com.sun.corba.se.spi.orb.ORBConfigurator;
+import com.sun.corba.se.spi.orb.ParserImplBase;
+import com.sun.corba.se.spi.orb.PropertyParser;
+import com.sun.corba.se.spi.orb.OperationFactory;
+import com.sun.corba.se.spi.orb.ORBVersion;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.orbutil.closure.ClosureFactory;
+import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;
+import com.sun.corba.se.spi.protocol.ClientDelegateFactory;
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher;
+import com.sun.corba.se.spi.protocol.RequestDispatcherDefault;
+import com.sun.corba.se.spi.protocol.PIHandler;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.protocol.ForwardException;
+import com.sun.corba.se.spi.resolver.Resolver;
+import com.sun.corba.se.spi.resolver.LocalResolver;
+import com.sun.corba.se.spi.orb.StringPair;
+import com.sun.corba.se.spi.orb.StringPair;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
+import com.sun.corba.se.spi.transport.CorbaTransportManager;
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
+import com.sun.corba.se.spi.copyobject.CopierManager;
+import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry;
+
+import com.sun.corba.se.impl.corba.TypeCodeFactory;
+import com.sun.corba.se.impl.corba.TypeCodeImpl;
+import com.sun.corba.se.impl.corba.NVListImpl;
+import com.sun.corba.se.impl.corba.ExceptionListImpl;
+import com.sun.corba.se.impl.corba.ContextListImpl;
+import com.sun.corba.se.impl.corba.NamedValueImpl;
+import com.sun.corba.se.impl.corba.EnvironmentImpl;
+import com.sun.corba.se.impl.corba.AsynchInvoke;
+import com.sun.corba.se.impl.corba.AnyImpl;
+import com.sun.corba.se.impl.corba.RequestImpl;
+import com.sun.corba.se.impl.dynamicany.DynAnyFactoryImpl;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+import com.sun.corba.se.impl.encoding.CachedCodeBase;
+import com.sun.corba.se.impl.interceptors.PIHandlerImpl;
+import com.sun.corba.se.impl.interceptors.PINoOpHandlerImpl;
+import com.sun.corba.se.impl.ior.TaggedComponentFactoryFinderImpl;
+import com.sun.corba.se.impl.ior.TaggedProfileFactoryFinderImpl;
+import com.sun.corba.se.impl.ior.TaggedProfileTemplateFactoryFinderImpl;
+import com.sun.corba.se.impl.oa.toa.TOAFactory;
+import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
+import com.sun.corba.se.impl.oa.poa.DelegateImpl;
+import com.sun.corba.se.impl.oa.poa.POAFactory;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.orbutil.StackImpl;
+import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl;
+import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolManagerImpl;
+import com.sun.corba.se.impl.protocol.RequestDispatcherRegistryImpl;
+import com.sun.corba.se.impl.protocol.CorbaInvocationInfo;
+import com.sun.corba.se.impl.transport.CorbaTransportManagerImpl;
+import com.sun.corba.se.impl.legacy.connection.LegacyServerSocketManagerImpl;
+import com.sun.corba.se.impl.util.Utility;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.copyobject.CopierManagerImpl;
+import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl;
+
+/**
+ * The JavaIDL ORB implementation.
+ */
+public class ORBImpl extends com.sun.corba.se.spi.orb.ORB
+{
+ protected TransportManager transportManager;
+ protected LegacyServerSocketManager legacyServerSocketManager;
+
+ private ThreadLocal OAInvocationInfoStack ;
+
+ private ThreadLocal clientInvocationInfoStack ;
+
+ // pure java orb, caching the servant IOR per ORB
+ private static IOR codeBaseIOR ;
+
+ // Vector holding deferred Requests
+ private Vector dynamicRequests ;
+ private SynchVariable svResponseReceived ;
+
+ private java.lang.Object runObj = new java.lang.Object();
+ private java.lang.Object shutdownObj = new java.lang.Object();
+ private java.lang.Object waitForCompletionObj = new java.lang.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 byte status = STATUS_OPERATING;
+
+ // XXX Should we move invocation tracking to the first level server dispatcher?
+ private java.lang.Object invocationObj = new java.lang.Object();
+ private int numInvocations = 0;
+
+ // thread local variable to store a boolean to detect deadlock in
+ // ORB.shutdown(true).
+ private ThreadLocal isProcessingInvocation = new ThreadLocal () {
+ protected java.lang.Object initialValue() {
+ return Boolean.FALSE;
+ }
+ };
+
+ // This map is caching TypeCodes created for a certain class (key)
+ // and is used in Util.writeAny()
+ private Map typeCodeForClassMap ;
+
+ // Cache to hold ValueFactories (Helper classes) keyed on repository ids
+ private Hashtable valueFactoryCache = new Hashtable();
+
+ // 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 RequestDispatcherRegistry requestDispatcherRegistry ;
+
+ private CopierManager copierManager ;
+
+ private int transientServerId ;
+
+ private ServiceContextRegistry serviceContextRegistry ;
+
+ // Needed here to implement connect/disconnect
+ private TOAFactory toaFactory ;
+
+ // Needed here for set_delegate
+ private POAFactory poaFactory ;
+
+ // The interceptor handler, which provides portable interceptor services for
+ // subcontracts and object adapters.
+ private PIHandler pihandler ;
+
+ private ORBData configData ;
+
+ private BadServerIdHandler badServerIdHandler ;
+
+ private ClientDelegateFactory clientDelegateFactory ;
+
+ private CorbaContactInfoListFactory corbaContactInfoListFactory ;
+
+ // All access to resolver, localResolver, and urlOperation must be protected using
+ // resolverLock. 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
+ // to bug 6980681 and 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
+ // 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 ;
+
+ // Used for register_initial_references
+ private LocalResolver localResolver ;
+
+ // Converts strings to object references for resolvers and string_to_object
+ private Operation urlOperation ;
+ private final Object urlOperationLock = new java.lang.Object() ;
+
+ private CorbaServerRequestDispatcher 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
+ // insNamingDelegate.
+ private final Object resolverLock = new Object() ;
+
+ private TaggedComponentFactoryFinder taggedComponentFactoryFinder ;
+
+ private IdentifiableFactoryFinder taggedProfileFactoryFinder ;
+
+ private IdentifiableFactoryFinder taggedProfileTemplateFactoryFinder ;
+
+ private ObjectKeyFactory objectKeyFactory ;
+
+ private boolean orbOwnsThreadPoolManager = false ;
+
+ private ThreadPoolManager threadpoolMgr;
+
+ private void dprint( String msg )
+ {
+ ORBUtility.dprint( this, msg ) ;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // NOTE:
+ //
+ // Methods that are synchronized MUST stay synchronized.
+ //
+ // Methods that are NOT synchronized must stay that way to avoid deadlock.
+ //
+ //
+ // REVISIT:
+ //
+ // checkShutDownState - lock on different object - and normalize usage.
+ // starting/FinishDispatch and Shutdown
+ //
+
+ public ORBData getORBData()
+ {
+ return configData ;
+ }
+
+ public PIHandler getPIHandler()
+ {
+ return pihandler ;
+ }
+
+ /**
+ * Create a new ORB. Should be followed by the appropriate
+ * set_parameters() call.
+ */
+ public ORBImpl()
+ {
+ // All initialization is done through set_parameters().
+ }
+
+ public ORBVersion getORBVersion()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ return (ORBVersion)(orbVersionThreadLocal.get()) ;
+ }
+
+ public void setORBVersion(ORBVersion verObj)
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ orbVersionThreadLocal.set(verObj);
+ }
+
+/****************************************************************************
+ * 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 )
+ {
+ // Before ORBConfiguration we need to set a PINoOpHandlerImpl,
+ // because PersisentServer Initialization inside configurator will
+ // invoke orb.resolve_initial_references( ) which will result in a
+ // check on piHandler to invoke Interceptors. We do not want any
+ // Interceptors to be invoked before the complete ORB initialization.
+ // piHandler will be replaced by a real PIHandler implementation at the
+ // end of this method.
+ pihandler = new PINoOpHandlerImpl( );
+
+ // 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
+ // 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.
+ //
+ // XXX need to move server ID to a string for CORBA 3.0. At that point,
+ // make this more unique (possibly use java.rmi.server.UID).
+ transientServerId = (int)System.currentTimeMillis();
+
+ orbVersionThreadLocal = new ThreadLocal () {
+ protected java.lang.Object initialValue() {
+ // set default to version of the ORB with correct Rep-ids
+ return ORBVersionFactory.getORBVersion() ;
+ }
+ };
+
+
+ requestDispatcherRegistry = new RequestDispatcherRegistryImpl(
+ this, ORBConstants.DEFAULT_SCID);
+ copierManager = new CopierManagerImpl( this ) ;
+
+ taggedComponentFactoryFinder =
+ new TaggedComponentFactoryFinderImpl(this) ;
+ taggedProfileFactoryFinder =
+ new TaggedProfileFactoryFinderImpl(this) ;
+ taggedProfileTemplateFactoryFinder =
+ new TaggedProfileTemplateFactoryFinderImpl(this) ;
+
+ dynamicRequests = new Vector();
+ svResponseReceived = new SynchVariable();
+
+ OAInvocationInfoStack =
+ new ThreadLocal () {
+ protected java.lang.Object initialValue()
+ {
+ return new StackImpl();
+ }
+ };
+
+ clientInvocationInfoStack =
+ new ThreadLocal() {
+ protected java.lang.Object initialValue() {
+ return new StackImpl();
+ }
+ };
+
+ serviceContextRegistry = new ServiceContextRegistry( this ) ;
+ }
+
+ protected void setDebugFlags( String[] args )
+ {
+ for (int ctr=0; ctr<args.length; ctr++ ) {
+ String token = args[ctr] ;
+
+ // If there is a public boolean data member in this class
+ // named token + "DebugFlag", set it to true.
+ try {
+ Field fld = this.getClass().getField( token + "DebugFlag" ) ;
+ int mod = fld.getModifiers() ;
+ if (Modifier.isPublic( mod ) && !Modifier.isStatic( mod ))
+ if (fld.getType() == boolean.class)
+ fld.setBoolean( this, true ) ;
+ } catch (Exception exc) {
+ // ignore it XXX log this as info
+ }
+ }
+ }
+
+ // Class that defines a parser that gets the name of the
+ // ORBConfigurator class.
+ private static class ConfigParser extends ParserImplBase {
+ // The default here is the ORBConfiguratorImpl that we define,
+ // but this can be replaced.
+ public Class configurator = ORBConfiguratorImpl.class ;
+
+ public PropertyParser makeParser()
+ {
+ PropertyParser parser = new PropertyParser() ;
+ parser.add( ORBConstants.SUN_PREFIX + "ORBConfigurator",
+ OperationFactory.classAction(), "configurator" ) ;
+ return parser ;
+ }
+ }
+
+ private void postInit( String[] params, DataCollector dataCollector )
+ {
+ // First, create the standard ORB config data.
+ // This must be initialized before the ORBConfigurator
+ // is executed.
+ configData = new ORBDataParserImpl( this, dataCollector) ;
+
+ // Set the debug flags early so they can be used by other
+ // parts of the initialization.
+ setDebugFlags( configData.getORBDebugFlags() ) ;
+
+ // REVISIT: this should go away after more transport init cleanup
+ // and going to ORT based ORBD.
+ getTransportManager();
+ getLegacyServerSocketManager();
+
+ // Create a parser to get the configured ORBConfigurator.
+ ConfigParser parser = new ConfigParser() ;
+ parser.init( dataCollector ) ;
+
+ ORBConfigurator configurator = null ;
+ try {
+ configurator =
+ (ORBConfigurator)(parser.configurator.newInstance()) ;
+ } catch (Exception iexc) {
+ throw wrapper.badOrbConfigurator( iexc, parser.configurator.getName() ) ;
+ }
+
+ // 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 ) ;
+ } catch (Exception exc) {
+ throw wrapper.orbConfiguratorError( exc ) ;
+ }
+
+ // Last of all, create the PIHandler and run the ORB initializers.
+ pihandler = new PIHandlerImpl( this, params) ;
+ pihandler.initialize() ;
+
+ // Initialize the thread manager pool and byte buffer pool
+ // so they may be initialized & accessed without synchronization
+ getThreadPoolManager();
+
+ super.getByteBufferPool();
+ }
+
+ private synchronized POAFactory getPOAFactory()
+ {
+ if (poaFactory == null) {
+ poaFactory = (POAFactory)requestDispatcherRegistry.getObjectAdapterFactory(
+ ORBConstants.TRANSIENT_SCID ) ;
+ }
+
+ return poaFactory ;
+ }
+
+ private synchronized TOAFactory getTOAFactory()
+ {
+ if (toaFactory == null) {
+ toaFactory = (TOAFactory)requestDispatcherRegistry.getObjectAdapterFactory(
+ ORBConstants.TOA_SCID ) ;
+ }
+
+ return toaFactory ;
+ }
+
+ public void set_parameters( Properties props )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ preInit( null, props ) ;
+ DataCollector dataCollector =
+ DataCollectorFactory.create( props, getLocalHostName() ) ;
+ postInit( null, dataCollector ) ;
+ }
+
+ protected void set_parameters(Applet app, Properties props)
+ {
+ preInit( null, props ) ;
+ DataCollector dataCollector =
+ DataCollectorFactory.create( app, props, getLocalHostName() ) ;
+ postInit( null, dataCollector ) ;
+ }
+
+ 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()
+ {
+ checkShutdownState();
+ return sun.corba.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");
+ *
+ * @return a Current pseudo-object.
+ * @deprecated
+ */
+ 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. */
+
+ throw wrapper.genericNoImpl() ;
+ }
+
+ /**
+ * Create an NVList
+ *
+ * @param count size of list to create
+ * @return NVList created
+ *
+ * @see NVList
+ */
+ public synchronized NVList create_list(int count)
+ {
+ checkShutdownState();
+ return new NVListImpl(this, count);
+ }
+
+ /**
+ * Create an NVList corresponding to an OperationDef
+ *
+ * @param oper operation def to use to create list
+ * @return NVList created
+ *
+ * @see NVList
+ */
+ public synchronized NVList create_operation_list(org.omg.CORBA.Object oper)
+ {
+ checkShutdownState();
+ throw wrapper.genericNoImpl() ;
+ }
+
+ /**
+ * Create a NamedValue
+ *
+ * @return NamedValue created
+ */
+ public synchronized NamedValue create_named_value(String s, Any any, int flags)
+ {
+ checkShutdownState();
+ return new NamedValueImpl(this, s, any, flags);
+ }
+
+ /**
+ * Create an ExceptionList
+ *
+ * @return ExceptionList created
+ */
+ public synchronized org.omg.CORBA.ExceptionList create_exception_list()
+ {
+ checkShutdownState();
+ return new ExceptionListImpl();
+ }
+
+ /**
+ * Create a ContextList
+ *
+ * @return ContextList created
+ */
+ public synchronized org.omg.CORBA.ContextList create_context_list()
+ {
+ checkShutdownState();
+ return new ContextListImpl(this);
+ }
+
+ /**
+ * Get the default Context object
+ *
+ * @return the default Context object
+ */
+ public synchronized org.omg.CORBA.Context get_default_context()
+ {
+ checkShutdownState();
+ throw wrapper.genericNoImpl() ;
+ }
+
+ /**
+ * Create an Environment
+ *
+ * @return Environment created
+ */
+ public synchronized org.omg.CORBA.Environment create_environment()
+ {
+ checkShutdownState();
+ return new EnvironmentImpl();
+ }
+
+ public synchronized void send_multiple_requests_oneway(Request[] req)
+ {
+ checkShutdownState();
+
+ // Invoke the send_oneway on each new Request
+ for (int i = 0; i < req.length; i++) {
+ req[i].send_oneway();
+ }
+ }
+
+ /**
+ * Send multiple dynamic requests asynchronously.
+ *
+ * @param req an array of request objects.
+ */
+ public synchronized void send_multiple_requests_deferred(Request[] req)
+ {
+ checkShutdownState();
+
+ // add the new Requests to pending dynamic Requests
+ for (int i = 0; i < req.length; i++) {
+ dynamicRequests.addElement(req[i]);
+ }
+
+ // Invoke the send_deferred on each new Request
+ for (int i = 0; i < req.length; i++) {
+ AsynchInvoke invokeObject = new AsynchInvoke( this,
+ (com.sun.corba.se.impl.corba.RequestImpl)req[i], true);
+ new Thread(null, invokeObject, "ORB-Request-Thread", 0, false).start();
+ }
+ }
+
+ /**
+ * Find out if any of the deferred invocations have a response yet.
+ */
+ public synchronized boolean poll_next_response()
+ {
+ checkShutdownState();
+
+ Request currRequest;
+
+ // poll on each pending request
+ Enumeration ve = dynamicRequests.elements();
+ while (ve.hasMoreElements() == true) {
+ currRequest = (Request)ve.nextElement();
+ if (currRequest.poll_response() == true) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Get the next request that has gotten 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 ) {
+ checkShutdownState();
+ }
+
+ while (true) {
+ // check if there already is a response
+ synchronized ( dynamicRequests ) {
+ Enumeration elems = dynamicRequests.elements();
+ while ( elems.hasMoreElements() ) {
+ Request currRequest = (Request)elems.nextElement();
+ if ( currRequest.poll_response() ) {
+ // get the response for this successfully polled Request
+ currRequest.get_response();
+ dynamicRequests.removeElement(currRequest);
+ return currRequest;
+ }
+ }
+ }
+
+ // wait for a response
+ synchronized(this.svResponseReceived) {
+ while (!this.svResponseReceived.value()) {
+ try {
+ this.svResponseReceived.wait();
+ } catch(java.lang.InterruptedException ex) {
+ // NO-OP
+ }
+ }
+ // reinitialize the response flag
+ this.svResponseReceived.reset();
+ }
+ }
+ }
+
+ /**
+ * Notify response to ORB for get_next_response
+ */
+ public void notifyORB()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (this.svResponseReceived) {
+ this.svResponseReceived.set();
+ this.svResponseReceived.notify();
+ }
+ }
+
+ /**
+ * 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)
+ {
+ checkShutdownState();
+
+ // Handle the null objref case
+ if (obj == null) {
+ IOR nullIOR = IORFactories.makeIOR( this ) ;
+ return nullIOR.stringify();
+ }
+
+ IOR ior = null ;
+
+ try {
+ ior = ORBUtility.connectAndGetIOR( this, obj ) ;
+ } 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 ) ;
+ } else
+ // Not a local object problem: just rethrow the exception.
+ // Do not wrap and log this, since it was already logged at its
+ // point of origin.
+ throw bp ;
+ }
+
+ 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 ;
+
+ synchronized (this) {
+ checkShutdownState();
+ op = urlOperation ;
+ }
+
+ if (str == null)
+ throw wrapper.nullParam() ;
+
+ synchronized (urlOperationLock) {
+ 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()
+ {
+ checkShutdownState();
+
+ if (codeBaseIOR != null) // i.e. We are already connected to it
+ return codeBaseIOR;
+
+ // backward compatability 4365188
+ CodeBase cb;
+
+ ValueHandler vh = ORBUtility.createValueHandler();
+
+ cb = (CodeBase)vh.getRunTimeCodeBase();
+ return ORBUtility.connectAndGetIOR( this, cb ) ;
+ }
+
+ /**
+ * Get the TypeCode for a primitive type.
+ *
+ * @param tcKind the integer kind for the primitive type
+ * @return the requested TypeCode
+ */
+ public synchronized TypeCode get_primitive_tc(TCKind tcKind)
+ {
+ checkShutdownState();
+ 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.
+ */
+ public synchronized TypeCode create_struct_tc(String id,
+ String name,
+ StructMember[] members)
+ {
+ checkShutdownState();
+ return new TypeCodeImpl(this, TCKind._tk_struct, id, name, members);
+ }
+
+ /**
+ * 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.
+ */
+ 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);
+ }
+
+ /**
+ * 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.
+ */
+ public synchronized TypeCode create_enum_tc(String id,
+ String name,
+ String[] members)
+ {
+ checkShutdownState();
+ return new TypeCodeImpl(this, TCKind._tk_enum, id, name, members);
+ }
+
+ /**
+ * 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.
+ */
+ 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);
+ }
+
+ /**
+ * 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.
+ */
+ public synchronized TypeCode create_exception_tc(String id,
+ String name,
+ StructMember[] members)
+ {
+ checkShutdownState();
+ return new TypeCodeImpl(this, TCKind._tk_except, id, name, members);
+ }
+
+ /**
+ * 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.
+ */
+ public synchronized TypeCode create_interface_tc(String id,
+ String name)
+ {
+ checkShutdownState();
+ return new TypeCodeImpl(this, TCKind._tk_objref, id, name);
+ }
+
+ /**
+ * Create a TypeCode for a string.
+ *
+ * @param bound the bound for the string.
+ * @return the requested TypeCode.
+ */
+ public synchronized TypeCode create_string_tc(int bound)
+ {
+ checkShutdownState();
+ return new TypeCodeImpl(this, TCKind._tk_string, bound);
+ }
+
+ /**
+ * Create a TypeCode for a wide string.
+ *
+ * @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);
+ }
+
+ /**
+ * Create a TypeCode for a sequence.
+ *
+ * @param bound the bound for the sequence.
+ * @param element_type
+ * the type of elements of the sequence.
+ * @return the requested TypeCode.
+ */
+ public synchronized TypeCode create_sequence_tc(int bound,
+ TypeCode element_type)
+ {
+ checkShutdownState();
+ return new TypeCodeImpl(this, TCKind._tk_sequence, bound, element_type);
+ }
+
+
+ /**
+ * Create a recursive TypeCode in a sequence.
+ *
+ * @param bound the bound for the sequence.
+ * @param offset the index to the enclosing TypeCode that is
+ * being referenced.
+ * @return the requested TypeCode.
+ */
+ public synchronized TypeCode create_recursive_sequence_tc(int bound,
+ int offset)
+ {
+ checkShutdownState();
+ return new TypeCodeImpl(this, TCKind._tk_sequence, bound, offset);
+ }
+
+
+ /**
+ * Create a TypeCode for an array.
+ *
+ * @param length the length of the array.
+ * @param element_type
+ * the type of elements of the array.
+ * @return the requested TypeCode.
+ */
+ public synchronized TypeCode create_array_tc(int length,
+ TypeCode element_type)
+ {
+ checkShutdownState();
+ return new TypeCodeImpl(this, TCKind._tk_array, length, element_type);
+ }
+
+
+ public synchronized org.omg.CORBA.TypeCode create_native_tc(String id,
+ String name)
+ {
+ checkShutdownState();
+ return new TypeCodeImpl(this, TCKind._tk_native, id, 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);
+ }
+
+ public synchronized org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale)
+ {
+ checkShutdownState();
+ return new TypeCodeImpl(this, TCKind._tk_fixed, digits, scale);
+ }
+
+ 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);
+ }
+
+ public synchronized org.omg.CORBA.TypeCode create_recursive_tc(String id) {
+ checkShutdownState();
+ return new TypeCodeImpl(this, id);
+ }
+
+ 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);
+ }
+
+ /**
+ * Create a new Any
+ *
+ * @return the new Any created.
+ */
+ public synchronized Any create_any()
+ {
+ checkShutdownState();
+ return new AnyImpl(this);
+ }
+
+ // TypeCodeFactory interface methods.
+ // Keeping track of type codes by repository id.
+
+ // Keeping a cache of TypeCodes associated with the class
+ // they got created from in Util.writeAny().
+
+ public synchronized void setTypeCodeForClass(Class c, TypeCodeImpl tci)
+ {
+ checkShutdownState();
+
+ if (typeCodeForClassMap == null)
+ typeCodeForClassMap = Collections.synchronizedMap(
+ new WeakHashMap(64));
+ // Store only one TypeCode per class.
+ if ( ! typeCodeForClassMap.containsKey(c))
+ typeCodeForClassMap.put(c, tci);
+ }
+
+ public synchronized TypeCodeImpl getTypeCodeForClass(Class c)
+ {
+ checkShutdownState();
+
+ if (typeCodeForClassMap == null)
+ return null;
+ return (TypeCodeImpl)typeCodeForClassMap.get(c);
+ }
+
+/****************************************************************************
+ * The following methods deal with listing and resolving the initial
+ * (bootstrap) object references such as "NameService".
+ ****************************************************************************/
+
+ /**
+ * Get a list of the initially available CORBA services.
+ * This does not work unless an ORBInitialHost is specified during
+ * initialization (or unless there is an ORB running on the AppletHost)
+ * since the localhostname
+ * is inaccessible to applets. If a service properties URL was specified,
+ * then it is used, otherwise the bootstrapping protocol is used.
+ * @return A list of the initial services available.
+ */
+ public String[] list_initial_services()
+ {
+ Resolver res ;
+
+ synchronized( this ) {
+ checkShutdownState();
+ res = resolver ;
+ }
+
+ synchronized (resolverLock) {
+ java.util.Set keys = res.list() ;
+ return (String[])keys.toArray( new String[keys.size()] ) ;
+ }
+ }
+
+ /**
+ * Resolve the stringified reference of one of the initially
+ * available CORBA services.
+ * @param identifier The stringified object reference of the
+ * desired service.
+ * @return An object reference for the desired service.
+ * @exception InvalidName The supplied identifier is not associated
+ * with a known service.
+ * @exception SystemException One of a fixed set of Corba system exceptions.
+ */
+ public org.omg.CORBA.Object resolve_initial_references(
+ String identifier) throws InvalidName
+ {
+ Resolver res ;
+
+ synchronized( this ) {
+ checkShutdownState();
+ res = resolver ;
+ }
+
+ synchronized (resolverLock) {
+ org.omg.CORBA.Object result = res.resolve( identifier ) ;
+
+ if (result == null)
+ throw new InvalidName() ;
+ else
+ return result ;
+ }
+ }
+
+ /**
+ * If this operation is called with an id, <code>"Y"</code>, and an
+ * object, <code>YY</code>, then a subsequent call to
+ * <code>ORB.resolve_initial_references( "Y" )</code> will
+ * return object <code>YY</code>.
+ *
+ * @param id The ID by which the initial reference will be known.
+ * @param obj The initial reference itself.
+ * @throws InvalidName if this operation is called with an empty string id
+ * or this operation is called with an id that is already registered,
+ * including the default names defined by OMG.
+ * @throws BAD_PARAM if the obj parameter is null.
+ */
+ public void register_initial_reference(
+ String id, org.omg.CORBA.Object obj ) throws InvalidName
+ {
+ CorbaServerRequestDispatcher insnd ;
+
+ synchronized (this) {
+ checkShutdownState();
+ }
+
+ if ((id == null) || (id.length() == 0))
+ throw new InvalidName() ;
+
+ synchronized (this) {
+ checkShutdownState();
+ }
+
+ synchronized (resolverLock) {
+ insnd = insNamingDelegate ;
+
+ java.lang.Object obj2 = localResolver.resolve( id ) ;
+ if (obj2 != null)
+ throw new InvalidName(id + " already registered") ;
+
+ localResolver.register( id, ClosureFactory.makeConstant( obj )) ;
+ }
+
+ synchronized (this) {
+ if (StubAdapter.isStub(obj))
+ // Make all remote object references available for INS.
+ requestDispatcherRegistry.registerServerRequestDispatcher(
+ insnd, id ) ;
+ }
+ }
+
+/****************************************************************************
+ * The following methods (introduced in POA / CORBA2.1) deal with
+ * shutdown / single threading.
+ ****************************************************************************/
+
+ public void run()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+
+ synchronized (runObj) {
+ try {
+ runObj.wait();
+ } catch ( InterruptedException ex ) {}
+ }
+ }
+
+ public void shutdown(boolean wait_for_completion) {
+ boolean wait = false;
+
+ synchronized (this) {
+ checkShutdownState();
+
+ // 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 (status == STATUS_SHUTTING_DOWN) {
+ if (wait_for_completion) {
+ wait = true;
+ } else {
+ return;
+ }
+ }
+
+ status = STATUS_SHUTTING_DOWN;
+ }
+
+ // Avoid more than one thread performing shutdown at a time.
+ synchronized (shutdownObj) {
+ // At this point, the ORB status is certainly STATUS_SHUTTING_DOWN.
+ // If wait is true, another thread already called shutdown( true ),
+ // and so we wait for completion
+ if (wait) {
+ while (true) {
+ synchronized (this) {
+ if (status == STATUS_SHUTDOWN)
+ break;
+ }
+
+ try {
+ shutdownObj.wait();
+ } catch (InterruptedException exc) {
+ // NOP: just loop and wait until state is changed
+ }
+ }
+ } else {
+ // perform the actual shutdown
+ shutdownServants(wait_for_completion);
+
+ if (wait_for_completion) {
+ synchronized ( waitForCompletionObj ) {
+ while (numInvocations > 0) {
+ try {
+ waitForCompletionObj.wait();
+ } catch (InterruptedException ex) {}
+ }
+ }
+ }
+
+ synchronized (runObj) {
+ runObj.notifyAll();
+ }
+
+ status = STATUS_SHUTDOWN;
+
+ shutdownObj.notifyAll();
+ }
+ }
+ }
+
+ // 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.
+ protected void shutdownServants(boolean wait_for_completion) {
+ Set<ObjectAdapterFactory> oaset;
+ synchronized (this) {
+ oaset = new HashSet<>(requestDispatcherRegistry.getObjectAdapterFactories());
+ }
+
+ for (ObjectAdapterFactory oaf : oaset)
+ oaf.shutdown(wait_for_completion);
+ }
+
+ // Note that the caller must hold the ORBImpl lock.
+ public void checkShutdownState()
+ {
+ if (status == STATUS_DESTROYED) {
+ throw wrapper.orbDestroyed() ;
+ }
+
+ if (status == STATUS_SHUTDOWN) {
+ throw omgWrapper.badOperationAfterShutdown() ;
+ }
+ }
+
+ public boolean isDuringDispatch()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ Boolean value = (Boolean)(isProcessingInvocation.get()) ;
+ return value.booleanValue() ;
+ }
+
+ public void startingDispatch()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (invocationObj) {
+ isProcessingInvocation.set(Boolean.TRUE);
+ numInvocations++;
+ }
+ }
+
+ public void finishedDispatch()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (invocationObj) {
+ numInvocations--;
+ isProcessingInvocation.set(false);
+ if (numInvocations == 0) {
+ synchronized (waitForCompletionObj) {
+ waitForCompletionObj.notifyAll();
+ }
+ } else if (numInvocations < 0) {
+ throw wrapper.numInvocationsAlreadyZero(
+ CompletionStatus.COMPLETED_YES);
+ }
+ }
+ }
+
+ /**
+ * 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."
+ */
+ public void destroy()
+ {
+ boolean shutdownFirst = false;
+
+ synchronized (this) {
+ shutdownFirst = (status == STATUS_OPERATING);
+ }
+
+ if (shutdownFirst) {
+ shutdown(true);
+ }
+
+ synchronized (this) {
+ if (status < STATUS_DESTROYED) {
+ getCorbaTransportManager().close();
+ getPIHandler().destroyInterceptors();
+ status = STATUS_DESTROYED;
+ }
+ }
+ synchronized (threadPoolManagerAccessLock) {
+ if (orbOwnsThreadPoolManager) {
+ try {
+ threadpoolMgr.close();
+ threadpoolMgr = null;
+ } catch (IOException exc) {
+ wrapper.ioExceptionOnClose(exc);
+ }
+ }
+ }
+
+ try {
+ monitoringManager.close();
+ monitoringManager = null;
+ } catch (IOException exc) {
+ wrapper.ioExceptionOnClose(exc);
+ }
+
+ CachedCodeBase.cleanCache(this);
+ try {
+ pihandler.close();
+ } catch (IOException exc) {
+ wrapper.ioExceptionOnClose(exc);
+ }
+
+ super.destroy();
+
+ badServerIdHandlerAccessLock = null;
+ clientDelegateFactoryAccessorLock = null;
+ corbaContactInfoListFactoryAccessLock = null;
+
+ objectKeyFactoryAccessLock = null;
+ legacyServerSocketManagerAccessLock = null;
+ threadPoolManagerAccessLock = null;
+ transportManager = null;
+ legacyServerSocketManager = null;
+ OAInvocationInfoStack = null;
+ clientInvocationInfoStack = null;
+ codeBaseIOR = null;
+ dynamicRequests = null;
+ svResponseReceived = null;
+ runObj = null;
+ shutdownObj = null;
+ waitForCompletionObj = null;
+ invocationObj = null;
+ isProcessingInvocation = null;
+ typeCodeForClassMap = null;
+ valueFactoryCache = null;
+ orbVersionThreadLocal = null;
+ requestDispatcherRegistry = null;
+ copierManager = 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;
+ }
+
+ /**
+ * Registers a value factory for a particular repository ID.
+ *
+ * @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.
+ * @exception org.omg.CORBA.BAD_PARAM if the registration fails.
+ **/
+ public synchronized ValueFactory register_value_factory(String repositoryID,
+ ValueFactory factory)
+ {
+ checkShutdownState();
+
+ if ((repositoryID == null) || (factory == null))
+ throw omgWrapper.unableRegisterValueFactory() ;
+
+ return (ValueFactory)valueFactoryCache.put(repositoryID, factory);
+ }
+
+ /**
+ * Unregisters a value factory for a particular repository ID.
+ *
+ * @param repositoryID the repository ID.
+ **/
+ public synchronized void unregister_value_factory(String repositoryID)
+ {
+ checkShutdownState();
+
+ if (valueFactoryCache.remove(repositoryID) == null)
+ throw wrapper.nullParam() ;
+ }
+
+ /**
+ * 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.
+ **/
+ public synchronized ValueFactory lookup_value_factory(String repositoryID)
+ {
+ checkShutdownState();
+
+ ValueFactory factory =
+ (ValueFactory)valueFactoryCache.get(repositoryID);
+
+ if (factory == null) {
+ try {
+ factory = Utility.getFactory(null, null, null, repositoryID);
+ } catch(org.omg.CORBA.MARSHAL ex) {
+ throw wrapper.unableFindValueFactory( ex ) ;
+ }
+ }
+
+ return factory ;
+ }
+
+ public OAInvocationInfo peekInvocationInfo()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ;
+ return (OAInvocationInfo)(stack.peek()) ;
+ }
+
+ public void pushInvocationInfo( OAInvocationInfo info )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ;
+ stack.push( info ) ;
+ }
+
+ public OAInvocationInfo popInvocationInfo()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ StackImpl stack = (StackImpl)(OAInvocationInfoStack.get()) ;
+ return (OAInvocationInfo)(stack.pop()) ;
+ }
+
+ /**
+ * The bad server id handler is used by the Locator to
+ * send back the location of a persistant server to the client.
+ */
+
+ private Object badServerIdHandlerAccessLock = new Object();
+
+ public void initBadServerIdHandler()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (badServerIdHandlerAccessLock) {
+ 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};
+ Constructor cons = cls.getConstructor(params);
+ badServerIdHandler =
+ (BadServerIdHandler) cons.newInstance(args);
+ } catch (Exception e) {
+ throw wrapper.errorInitBadserveridhandler( e ) ;
+ }
+ }
+ }
+ }
+
+ public void setBadServerIdHandler( BadServerIdHandler handler )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (badServerIdHandlerAccessLock) {
+ badServerIdHandler = handler;
+ }
+ }
+
+ public void handleBadServerId( ObjectKey okey )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (badServerIdHandlerAccessLock) {
+ if (badServerIdHandler == null)
+ throw wrapper.badServerId() ;
+ else
+ badServerIdHandler.handle( okey ) ;
+ }
+ }
+
+ 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 ) ;
+ }
+
+ /** This is the implementation of the public API used to connect
+ * a servant-skeleton to the ORB.
+ */
+ public synchronized void connect(org.omg.CORBA.Object servant)
+ {
+ checkShutdownState();
+ if (getTOAFactory() == null)
+ throw wrapper.noToa() ;
+
+ try {
+ String codebase = javax.rmi.CORBA.Util.getCodebase( servant.getClass() ) ;
+ getTOAFactory().getTOA( codebase ).connect( servant ) ;
+ } catch ( Exception ex ) {
+ throw wrapper.orbConnectError( ex ) ;
+ }
+ }
+
+ 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 ) ;
+ }
+ }
+
+ public int getTransientServerId()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ if( configData.getORBServerIdPropertySpecified( ) ) {
+ // ORBServerId is specified then use that value
+ return configData.getPersistentServerId( );
+ }
+ return transientServerId;
+ }
+
+ public RequestDispatcherRegistry getRequestDispatcherRegistry()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ return requestDispatcherRegistry;
+ }
+
+ public ServiceContextRegistry getServiceContextRegistry()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ return serviceContextRegistry ;
+ }
+
+ // XXX All of the isLocalXXX 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
+ // 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.
+
+ // XXX What about multi-homed host?
+ public boolean isLocalHost( String hostName )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ return hostName.equals( configData.getORBServerHost() ) ||
+ hostName.equals( getLocalHostName() ) ;
+ }
+
+ public boolean isLocalServerId( int subcontractId, int serverId )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ 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 ))
+ return (serverId == getTransientServerId()) ;
+ else if (configData.getPersistentServerIdInitialized())
+ return (serverId == configData.getPersistentServerId()) ;
+ else
+ return false ;
+ }
+
+ /*************************************************************************
+ * 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 static String localHostString = null;
+
+ private synchronized String getLocalHostName()
+ {
+ if (localHostString == null) {
+ try {
+ localHostString = InetAddress.getLocalHost().getHostAddress();
+ } catch (Exception ex) {
+ throw wrapper.getLocalHostFailed( ex ) ;
+ }
+ }
+ return localHostString ;
+ }
+
+ /******************************************************************************
+ * The following public methods are for ORB shutdown.
+ *
+ ******************************************************************************/
+
+ /** This method always returns false because the ORB never needs the
+ * main thread to do work.
+ */
+ public synchronized boolean work_pending()
+ {
+ checkShutdownState();
+ throw wrapper.genericNoImpl() ;
+ }
+
+ /** This method does nothing. It is not required by the spec to do anything!
+ */
+ public synchronized void perform_work()
+ {
+ checkShutdownState();
+ throw wrapper.genericNoImpl() ;
+ }
+
+ public synchronized void set_delegate(java.lang.Object servant){
+ checkShutdownState();
+
+ POAFactory poaFactory = getPOAFactory() ;
+ if (poaFactory != null)
+ ((org.omg.PortableServer.Servant)servant)
+ ._set_delegate( poaFactory.getDelegateImpl() ) ;
+ else
+ throw wrapper.noPoa() ;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.broker.Broker
+ //
+
+ public ClientInvocationInfo createOrIncrementInvocationInfo()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ StackImpl invocationInfoStack =
+ (StackImpl) clientInvocationInfoStack.get();
+ ClientInvocationInfo clientInvocationInfo = null;
+ if (!invocationInfoStack.empty()) {
+ clientInvocationInfo =
+ (ClientInvocationInfo) invocationInfoStack.peek();
+ }
+ if ((clientInvocationInfo == null) ||
+ (!clientInvocationInfo.isRetryInvocation()))
+ {
+ // This is a new call - not a retry.
+ clientInvocationInfo = new CorbaInvocationInfo(this);
+ startingDispatch();
+ invocationInfoStack.push(clientInvocationInfo);
+ }
+ // Reset retry so recursive calls will get a new info object.
+ clientInvocationInfo.setIsRetryInvocation(false);
+ clientInvocationInfo.incrementEntryCount();
+ return clientInvocationInfo;
+ }
+
+ public void releaseOrDecrementInvocationInfo()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ int entryCount = -1;
+ ClientInvocationInfo clientInvocationInfo = null;
+ StackImpl invocationInfoStack =
+ (StackImpl)clientInvocationInfoStack.get();
+ if (!invocationInfoStack.empty()) {
+ clientInvocationInfo =
+ (ClientInvocationInfo)invocationInfoStack.peek();
+ } else {
+ throw wrapper.invocationInfoStackEmpty() ;
+ }
+ clientInvocationInfo.decrementEntryCount();
+ entryCount = clientInvocationInfo.getEntryCount();
+ if (clientInvocationInfo.getEntryCount() == 0) {
+ // 6763340: don't pop if this is a retry!
+ if (!clientInvocationInfo.isRetryInvocation()) {
+ invocationInfoStack.pop();
+ }
+ finishedDispatch();
+ }
+ }
+
+ public ClientInvocationInfo getInvocationInfo()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ StackImpl invocationInfoStack =
+ (StackImpl) clientInvocationInfoStack.get();
+ return (ClientInvocationInfo) invocationInfoStack.peek();
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ //
+ //
+
+ private Object clientDelegateFactoryAccessorLock = new Object();
+
+ public void setClientDelegateFactory( ClientDelegateFactory factory )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (clientDelegateFactoryAccessorLock) {
+ clientDelegateFactory = factory ;
+ }
+ }
+
+ public ClientDelegateFactory getClientDelegateFactory()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (clientDelegateFactoryAccessorLock) {
+ return clientDelegateFactory ;
+ }
+ }
+
+ private Object corbaContactInfoListFactoryAccessLock = new Object();
+
+ public void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (corbaContactInfoListFactoryAccessLock) {
+ corbaContactInfoListFactory = factory ;
+ }
+ }
+
+ public synchronized CorbaContactInfoListFactory getCorbaContactInfoListFactory()
+ {
+ checkShutdownState();
+ return corbaContactInfoListFactory ;
+ }
+
+ /** Set the resolver used in this ORB. This resolver will be used for list_initial_services
+ * and resolve_initial_references.
+ */
+ public void setResolver( Resolver resolver )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (resolverLock) {
+ this.resolver = resolver ;
+ }
+ }
+
+ /** Get the resolver used in this ORB. This resolver will be used for list_initial_services
+ * and resolve_initial_references.
+ */
+ public Resolver getResolver()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (resolverLock) {
+ return resolver ;
+ }
+ }
+
+ /** Set the LocalResolver used in this ORB. This LocalResolver is used for
+ * register_initial_reference only.
+ */
+ public void setLocalResolver( LocalResolver resolver )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (resolverLock) {
+ this.localResolver = resolver ;
+ }
+ }
+
+ /** Get the LocalResolver used in this ORB. This LocalResolver is used for
+ * register_initial_reference only.
+ */
+ public LocalResolver getLocalResolver()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (resolverLock) {
+ return localResolver ;
+ }
+ }
+
+ /** Set the operation used in string_to_object calls. The Operation must expect a
+ * String and return an org.omg.CORBA.Object.
+ */
+ public void setURLOperation( Operation stringToObject )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (urlOperationLock) {
+ urlOperation = stringToObject ;
+ }
+ }
+
+ /** Get the operation used in string_to_object calls. The Operation must expect a
+ * String and return an org.omg.CORBA.Object.
+ */
+ public Operation getURLOperation()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (urlOperationLock) {
+ return urlOperation ;
+ }
+ }
+
+ public void setINSDelegate( CorbaServerRequestDispatcher sdel )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (resolverLock) {
+ insNamingDelegate = sdel ;
+ }
+ }
+
+ public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ return taggedComponentFactoryFinder ;
+ }
+
+ public IdentifiableFactoryFinder getTaggedProfileFactoryFinder()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ return taggedProfileFactoryFinder ;
+ }
+
+ public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ return taggedProfileTemplateFactoryFinder ;
+ }
+
+ private Object objectKeyFactoryAccessLock = new Object();
+
+ public ObjectKeyFactory getObjectKeyFactory()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (objectKeyFactoryAccessLock) {
+ return objectKeyFactory ;
+ }
+ }
+
+ public void setObjectKeyFactory( ObjectKeyFactory factory )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (objectKeyFactoryAccessLock) {
+ objectKeyFactory = factory ;
+ }
+ }
+
+ private Object transportManagerAccessorLock = new Object();
+
+ public TransportManager getTransportManager()
+ {
+ synchronized (transportManagerAccessorLock) {
+ if (transportManager == null) {
+ transportManager = new CorbaTransportManagerImpl(this);
+ }
+ return transportManager;
+ }
+ }
+
+ public CorbaTransportManager getCorbaTransportManager()
+ {
+ return (CorbaTransportManager) getTransportManager();
+ }
+
+ private Object legacyServerSocketManagerAccessLock = new Object();
+
+ public LegacyServerSocketManager getLegacyServerSocketManager()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (legacyServerSocketManagerAccessLock) {
+ if (legacyServerSocketManager == null) {
+ legacyServerSocketManager = new LegacyServerSocketManagerImpl(this);
+ }
+ return legacyServerSocketManager;
+ }
+ }
+
+ private Object threadPoolManagerAccessLock = new Object();
+
+ public void setThreadPoolManager(ThreadPoolManager mgr)
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (threadPoolManagerAccessLock) {
+ threadpoolMgr = mgr;
+ }
+ }
+
+ public ThreadPoolManager getThreadPoolManager()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ synchronized (threadPoolManagerAccessLock) {
+ if (threadpoolMgr == null) {
+ threadpoolMgr = new ThreadPoolManagerImpl();
+ orbOwnsThreadPoolManager = true;
+ }
+ return threadpoolMgr;
+ }
+ }
+
+ public CopierManager getCopierManager()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ return copierManager ;
+ }
+} // Class ORBImpl
+
+////////////////////////////////////////////////////////////////////////
+/// Helper class for a Synchronization Variable
+////////////////////////////////////////////////////////////////////////
+
+class SynchVariable
+{
+ // Synchronization Variable
+ public boolean _flag;
+
+ // Constructor
+ SynchVariable()
+ {
+ _flag = false;
+ }
+
+ // set Flag to true
+ public void set()
+ {
+ _flag = true;
+ }
+
+ // get value
+ public boolean value()
+ {
+ return _flag;
+ }
+
+ // reset Flag to true
+ public void reset()
+ {
+ _flag = false;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java
new file mode 100644
index 0000000..63bec8b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBSingleton.java
@@ -0,0 +1,773 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.orb;
+
+import java.util.Collection;
+import java.util.Properties;
+import java.util.Hashtable;
+
+import java.applet.Applet;
+
+import java.net.URL;
+
+import java.io.IOException ;
+
+import java.util.logging.Logger ;
+
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.Environment;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.ORBPackage.InvalidName;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.TCKind;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.NO_IMPLEMENT;
+import org.omg.CORBA.Object;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.StructMember;
+import org.omg.CORBA.UnionMember;
+import org.omg.CORBA.ValueMember;
+import org.omg.CORBA.Policy;
+import org.omg.CORBA.PolicyError;
+
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+
+import com.sun.corba.se.pept.protocol.ClientInvocationInfo ;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.ConnectionCache;
+import com.sun.corba.se.pept.transport.Selector ;
+import com.sun.corba.se.pept.transport.TransportManager;
+
+import com.sun.corba.se.spi.legacy.connection.ORBSocketFactory;
+import com.sun.corba.se.spi.orb.ORBData;
+import com.sun.corba.se.spi.orb.Operation;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersion;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.oa.OAInvocationInfo;
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.protocol.ClientDelegateFactory;
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher;
+import com.sun.corba.se.spi.protocol.PIHandler;
+import com.sun.corba.se.spi.resolver.Resolver;
+import com.sun.corba.se.spi.resolver.LocalResolver;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder;
+import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder;
+import com.sun.corba.se.spi.ior.ObjectKey;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.pept.transport.ByteBufferPool ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ;
+import com.sun.corba.se.spi.transport.CorbaTransportManager;
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
+import com.sun.corba.se.spi.orbutil.closure.Closure;
+import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;
+import com.sun.corba.se.spi.logging.LogWrapperFactory;
+import com.sun.corba.se.spi.logging.LogWrapperBase;
+import com.sun.corba.se.spi.copyobject.CopierManager;
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
+import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+
+import com.sun.corba.se.impl.corba.TypeCodeFactory;
+import com.sun.corba.se.impl.corba.TypeCodeImpl;
+import com.sun.corba.se.impl.corba.NVListImpl;
+import com.sun.corba.se.impl.corba.NamedValueImpl;
+import com.sun.corba.se.impl.corba.ExceptionListImpl;
+import com.sun.corba.se.impl.corba.ContextListImpl;
+import com.sun.corba.se.impl.corba.EnvironmentImpl;
+import com.sun.corba.se.impl.corba.AnyImpl;
+import com.sun.corba.se.impl.encoding.BufferManagerFactory;
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
+import com.sun.corba.se.impl.encoding.MarshalInputStream;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+import com.sun.corba.se.impl.encoding.MarshalOutputStream;
+import com.sun.corba.se.impl.oa.poa.BadServerIdHandler;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
+
+/*
+ * The restricted singleton ORB implementation.
+ *
+ * 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.
+ */
+public class ORBSingleton extends ORB
+{
+ // This is used to support read_Object.
+ private ORB fullORB;
+ private static PresentationManager.StubFactoryFactory staticStubFactoryFactory =
+ PresentationDefaults.getStaticStubFactoryFactory() ;
+
+ public void set_parameters( Properties props ) {
+ }
+
+ protected void set_parameters(Applet app, Properties props) {
+ }
+
+ protected void set_parameters (String params[], Properties props) {
+ }
+
+ public OutputStream create_output_stream() {
+ return sun.corba.OutputStreamFactory.newEncapsOutputStream(this);
+ }
+
+ public TypeCode create_struct_tc(String id,
+ String name,
+ StructMember[] members)
+ {
+ return new TypeCodeImpl(this, TCKind._tk_struct, id, name, 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);
+ }
+
+ public TypeCode create_enum_tc(String id,
+ String name,
+ String[] members)
+ {
+ return new TypeCodeImpl(this, TCKind._tk_enum, id, name, members);
+ }
+
+ public TypeCode create_alias_tc(String id,
+ String name,
+ TypeCode original_type)
+ {
+ return new TypeCodeImpl(this, TCKind._tk_alias, id, name, original_type);
+ }
+
+ public TypeCode create_exception_tc(String id,
+ String name,
+ StructMember[] members)
+ {
+ return new TypeCodeImpl(this, TCKind._tk_except, id, name, members);
+ }
+
+ public TypeCode create_interface_tc(String id,
+ String name)
+ {
+ return new TypeCodeImpl(this, TCKind._tk_objref, id, name);
+ }
+
+ public TypeCode create_string_tc(int bound) {
+ return new TypeCodeImpl(this, TCKind._tk_string, bound);
+ }
+
+ public TypeCode create_wstring_tc(int bound) {
+ return new TypeCodeImpl(this, TCKind._tk_wstring, bound);
+ }
+
+ public TypeCode create_sequence_tc(int bound,
+ TypeCode element_type)
+ {
+ return new TypeCodeImpl(this, TCKind._tk_sequence, bound, element_type);
+ }
+
+ public TypeCode create_recursive_sequence_tc(int bound,
+ int offset)
+ {
+ return new TypeCodeImpl(this, TCKind._tk_sequence, bound, offset);
+ }
+
+ public TypeCode create_array_tc(int length,
+ TypeCode element_type)
+ {
+ return new TypeCodeImpl(this, TCKind._tk_array, length, element_type);
+ }
+
+ public org.omg.CORBA.TypeCode create_native_tc(String id,
+ String name)
+ {
+ return new TypeCodeImpl(this, TCKind._tk_native, id, name);
+ }
+
+ public org.omg.CORBA.TypeCode create_abstract_interface_tc(
+ String id,
+ String name)
+ {
+ return new TypeCodeImpl(this, TCKind._tk_abstract_interface, id, name);
+ }
+
+ 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
+
+ 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_recursive_tc(String id) {
+ return new TypeCodeImpl(this, id);
+ }
+
+ 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);
+ }
+
+ public TypeCode get_primitive_tc( TCKind tckind )
+ {
+ return get_primitive_tc( tckind.value() ) ;
+ }
+
+ public Any create_any() {
+ return new AnyImpl(this);
+ }
+
+ // TypeCodeFactory interface methods.
+ // Keeping track of type codes by repository id.
+ /*
+ * Not strictly needed for TypeCode factory duty but these seem
+ * harmless enough.
+ */
+
+ public NVList create_list(int count) {
+ return new NVListImpl(this, count);
+ }
+
+ public org.omg.CORBA.NVList
+ create_operation_list(org.omg.CORBA.Object oper) {
+ throw wrapper.genericNoImpl() ;
+ }
+
+ public org.omg.CORBA.NamedValue
+ create_named_value(String s, Any any, int flags) {
+ return new NamedValueImpl(this, s, any, flags);
+ }
+
+ public org.omg.CORBA.ExceptionList create_exception_list() {
+ return new ExceptionListImpl();
+ }
+
+ public org.omg.CORBA.ContextList create_context_list() {
+ return new ContextListImpl(this);
+ }
+
+ public org.omg.CORBA.Context get_default_context()
+ {
+ throw wrapper.genericNoImpl() ;
+ }
+
+ public org.omg.CORBA.Environment create_environment()
+ {
+ return new EnvironmentImpl();
+ }
+
+ public org.omg.CORBA.Current get_current()
+ {
+ throw wrapper.genericNoImpl() ;
+ }
+
+ /*
+ * Things that aren't allowed.
+ */
+
+ public String[] list_initial_services ()
+ {
+ throw wrapper.genericNoImpl() ;
+ }
+
+ public org.omg.CORBA.Object resolve_initial_references(String identifier)
+ throws InvalidName
+ {
+ throw wrapper.genericNoImpl() ;
+ }
+
+ public void register_initial_reference(
+ String id, org.omg.CORBA.Object obj ) throws InvalidName
+ {
+ throw wrapper.genericNoImpl() ;
+ }
+
+ public void send_multiple_requests_oneway(Request[] req) {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public void send_multiple_requests_deferred(Request[] req) {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public boolean poll_next_response() {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public org.omg.CORBA.Request get_next_response() {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public String object_to_string(org.omg.CORBA.Object obj) {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ 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
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public void connect(org.omg.CORBA.Object servant) {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public void disconnect(org.omg.CORBA.Object obj) {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public void run()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public void shutdown(boolean wait_for_completion)
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ protected void shutdownServants(boolean wait_for_completion) {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ protected void destroyConnections() {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public void destroy() {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public boolean work_pending()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public void perform_work()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public org.omg.CORBA.portable.ValueFactory register_value_factory(String repositoryID,
+ org.omg.CORBA.portable.ValueFactory factory)
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public void unregister_value_factory(String repositoryID)
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public org.omg.CORBA.portable.ValueFactory lookup_value_factory(String repositoryID)
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public TransportManager getTransportManager()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public CorbaTransportManager getCorbaTransportManager()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public LegacyServerSocketManager getLegacyServerSocketManager()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+/*************************************************************************
+ These are methods from com.sun.corba.se.impl.se.core.ORB
+ ************************************************************************/
+
+ private synchronized ORB getFullORB()
+ {
+ if (fullORB == null) {
+ Properties props = new Properties() ;
+ fullORB = new ORBImpl() ;
+ fullORB.set_parameters( props ) ;
+ }
+
+ return fullORB ;
+ }
+
+ public RequestDispatcherRegistry getRequestDispatcherRegistry()
+ {
+ // To enable read_Object.
+
+ return getFullORB().getRequestDispatcherRegistry();
+ }
+
+ /**
+ * Return the service context registry
+ */
+ public ServiceContextRegistry getServiceContextRegistry()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ /**
+ * Get the transient server ID
+ */
+ public int getTransientServerId()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ /**
+ * Return the bootstrap naming port specified in the ORBInitialPort param.
+ */
+ public int getORBInitialPort()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ /**
+ * Return the bootstrap naming host specified in the ORBInitialHost param.
+ */
+ public String getORBInitialHost()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public String getORBServerHost()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public int getORBServerPort()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public CodeSetComponentInfo getCodeSetComponentInfo()
+ {
+ return new CodeSetComponentInfo();
+ }
+
+ public boolean isLocalHost( String host )
+ {
+ // To enable read_Object.
+ return false;
+ }
+
+ public boolean isLocalServerId( int subcontractId, int serverId )
+ {
+ // To enable read_Object.
+ return false;
+ }
+
+ /*
+ * Things from corba.ORB.
+ */
+
+ public ORBVersion getORBVersion()
+ {
+ // Always use our latest ORB version (latest fixes, etc)
+ return ORBVersionFactory.getORBVersion();
+ }
+
+ public void setORBVersion(ORBVersion verObj)
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public String getAppletHost()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public URL getAppletCodeBase()
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public int getHighWaterMark(){
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public int getLowWaterMark(){
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public int getNumberToReclaim(){
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public int getGIOPFragmentSize() {
+ return ORBConstants.GIOP_DEFAULT_BUFFER_SIZE;
+ }
+
+ public int getGIOPBuffMgrStrategy(GIOPVersion gv) {
+ return BufferManagerFactory.GROW;
+ }
+
+ public IOR getFVDCodeBaseIOR(){
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public Policy create_policy( int type, Any val ) throws PolicyError
+ {
+ throw new NO_IMPLEMENT();
+ }
+
+ public LegacyServerSocketEndPointInfo getServerEndpoint()
+ {
+ return null ;
+ }
+
+ public void setPersistentServerId( int id )
+ {
+ }
+
+ public TypeCodeImpl getTypeCodeForClass( Class c )
+ {
+ return null ;
+ }
+
+ public void setTypeCodeForClass( Class c, TypeCodeImpl tcimpl )
+ {
+ }
+
+ public boolean alwaysSendCodeSetServiceContext()
+ {
+ return true ;
+ }
+
+ public boolean isDuringDispatch()
+ {
+ return false ;
+ }
+
+ public void notifyORB() { }
+
+ public PIHandler getPIHandler()
+ {
+ return null ;
+ }
+
+ public void checkShutdownState()
+ {
+ }
+
+ public void startingDispatch()
+ {
+ }
+
+ public void finishedDispatch()
+ {
+ }
+
+ public void registerInitialReference( String id, Closure closure )
+ {
+ }
+
+ public ORBData getORBData()
+ {
+ return getFullORB().getORBData() ;
+ }
+
+ public void setClientDelegateFactory( ClientDelegateFactory factory )
+ {
+ }
+
+ public ClientDelegateFactory getClientDelegateFactory()
+ {
+ return getFullORB().getClientDelegateFactory() ;
+ }
+
+ public void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory )
+ {
+ }
+
+ public CorbaContactInfoListFactory getCorbaContactInfoListFactory()
+ {
+ return getFullORB().getCorbaContactInfoListFactory() ;
+ }
+
+ public Operation getURLOperation()
+ {
+ return null ;
+ }
+
+ public void setINSDelegate( CorbaServerRequestDispatcher sdel )
+ {
+ }
+
+ public TaggedComponentFactoryFinder getTaggedComponentFactoryFinder()
+ {
+ return getFullORB().getTaggedComponentFactoryFinder() ;
+ }
+
+ public IdentifiableFactoryFinder getTaggedProfileFactoryFinder()
+ {
+ return getFullORB().getTaggedProfileFactoryFinder() ;
+ }
+
+ public IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder()
+ {
+ return getFullORB().getTaggedProfileTemplateFactoryFinder() ;
+ }
+
+ public ObjectKeyFactory getObjectKeyFactory()
+ {
+ return getFullORB().getObjectKeyFactory() ;
+ }
+
+ public void setObjectKeyFactory( ObjectKeyFactory factory )
+ {
+ throw new SecurityException("ORBSingleton: access denied");
+ }
+
+ public void handleBadServerId( ObjectKey okey )
+ {
+ }
+
+ public OAInvocationInfo peekInvocationInfo()
+ {
+ return null ;
+ }
+
+ public void pushInvocationInfo( OAInvocationInfo info )
+ {
+ }
+
+ public OAInvocationInfo popInvocationInfo()
+ {
+ return null ;
+ }
+
+ public ClientInvocationInfo createOrIncrementInvocationInfo()
+ {
+ return null ;
+ }
+
+ public void releaseOrDecrementInvocationInfo()
+ {
+ }
+
+ public ClientInvocationInfo getInvocationInfo()
+ {
+ return null ;
+ }
+
+ public ConnectionCache getConnectionCache(ContactInfo contactInfo)
+ {
+ return null;
+ }
+
+ public void setResolver( Resolver resolver )
+ {
+ }
+
+ public Resolver getResolver()
+ {
+ return null ;
+ }
+
+ public void setLocalResolver( LocalResolver resolver )
+ {
+ }
+
+ public LocalResolver getLocalResolver()
+ {
+ return null ;
+ }
+
+ public void setURLOperation( Operation stringToObject )
+ {
+ }
+
+ // NOTE: REMOVE THIS METHOD ONCE WE HAVE A ORT BASED ORBD
+ public void setBadServerIdHandler( BadServerIdHandler handler )
+ {
+ }
+
+ // NOTE: REMOVE THIS METHOD ONCE WE HAVE A ORT BASED ORBD
+ public void initBadServerIdHandler()
+ {
+ }
+
+ public Selector getSelector(int x)
+ {
+ return null;
+ }
+
+ public void setThreadPoolManager(ThreadPoolManager mgr) {
+ }
+
+ public ThreadPoolManager getThreadPoolManager() {
+ return null;
+ }
+
+ public CopierManager getCopierManager() {
+ return null ;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBVersionImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBVersionImpl.java
new file mode 100644
index 0000000..5307c4b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ORBVersionImpl.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import org.omg.CORBA.portable.OutputStream ;
+
+import com.sun.corba.se.spi.orb.ORBVersion ;
+
+public class ORBVersionImpl implements ORBVersion {
+ private byte orbType ;
+
+ public ORBVersionImpl( byte orbType )
+ {
+ this.orbType = orbType ;
+ }
+
+ public static final ORBVersion FOREIGN = new ORBVersionImpl(
+ ORBVersion.FOREIGN ) ;
+
+ public static final ORBVersion OLD = new ORBVersionImpl(
+ ORBVersion.OLD ) ;
+
+ 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 NEWER = new ORBVersionImpl(
+ ORBVersion.NEWER ) ;
+
+ public static final ORBVersion PEORB = new ORBVersionImpl(
+ ORBVersion.PEORB ) ;
+
+ public byte getORBType()
+ {
+ return orbType ;
+ }
+
+ public void write( OutputStream os )
+ {
+ os.write_octet( (byte)orbType ) ;
+ }
+
+ public String toString()
+ {
+ return "ORBVersionImpl[" + Byte.toString( orbType ) + "]" ;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof ORBVersion))
+ return false ;
+
+ ORBVersion version = (ORBVersion)obj ;
+ return version.getORBType() == orbType ;
+ }
+
+ public int hashCode()
+ {
+ return orbType ;
+ }
+
+ public boolean lessThan(ORBVersion version) {
+ return orbType < version.getORBType();
+ }
+
+ public int compareTo(Object obj) {
+ // The Comparable interface says that this
+ // method throws a ClassCastException if the
+ // given object's type prevents it from being
+ // compared.
+ return getORBType() - ((ORBVersion)obj).getORBType();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserAction.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserAction.java
new file mode 100644
index 0000000..0d783cc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserAction.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import java.util.Properties ;
+
+public interface ParserAction {
+ /** Return the property name or prefix for which this action
+ * is applied.
+ */
+ String getPropertyName() ;
+
+ /** Return whether this action is for an exact match or a prefix
+ * match (true).
+ */
+ boolean isPrefix() ;
+
+ /** Return the field name in an object that is set with the result
+ */
+ String getFieldName() ;
+
+ /** Apply this action to props and return the result.
+ */
+ Object apply( Properties props ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionBase.java
new file mode 100644
index 0000000..43c2909
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionBase.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import java.util.Properties ;
+
+import com.sun.corba.se.spi.orb.Operation ;
+
+public abstract class ParserActionBase implements ParserAction {
+ 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 boolean equals( Object obj )
+ {
+ if (obj == this)
+ return true ;
+
+ if (!(obj instanceof ParserActionBase))
+ return false ;
+
+ ParserActionBase other = (ParserActionBase)obj ;
+
+ 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 String getPropertyName()
+ {
+ return propertyName ;
+ }
+
+ public boolean isPrefix()
+ {
+ return prefix ;
+ }
+
+ public String getFieldName()
+ {
+ return fieldName ;
+ }
+
+ public abstract Object apply( Properties props ) ;
+
+ protected Operation getOperation()
+ {
+ return operation ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionFactory.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionFactory.java
new file mode 100644
index 0000000..01df18f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserActionFactory.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import com.sun.corba.se.spi.orb.Operation ;
+
+public class ParserActionFactory{
+ private ParserActionFactory() {}
+
+ 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 ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserDataBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserDataBase.java
new file mode 100644
index 0000000..84dd09a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserDataBase.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import com.sun.corba.se.spi.orb.ParserData ;
+import com.sun.corba.se.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 ;
+ }
+
+ 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 ; }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserTable.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserTable.java
new file mode 100644
index 0000000..f1ddd17
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/ParserTable.java
@@ -0,0 +1,1110 @@
+/*
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import java.net.URL ;
+import java.net.InetSocketAddress;
+import java.net.Socket ;
+import java.net.ServerSocket ;
+
+import java.io.IOException ;
+
+import java.util.HashMap ;
+import java.util.List;
+import java.util.Map ;
+
+import java.security.AccessController ;
+import java.security.PrivilegedExceptionAction ;
+import java.security.PrivilegedActionException ;
+
+import org.omg.PortableInterceptor.ORBInitializer ;
+import org.omg.PortableInterceptor.ORBInitInfo ;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.ContactInfoList;
+import com.sun.corba.se.pept.transport.EventHandler;
+import com.sun.corba.se.pept.transport.InboundConnectionCache;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.ObjectKey ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.Operation ;
+import com.sun.corba.se.spi.orb.OperationFactory ;
+import com.sun.corba.se.spi.orb.ParserData ;
+import com.sun.corba.se.spi.orb.ParserDataFactory ;
+import com.sun.corba.se.spi.orb.StringPair ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
+import com.sun.corba.se.spi.transport.CorbaTransportManager;
+import com.sun.corba.se.spi.transport.IORToSocketInfo;
+import com.sun.corba.se.spi.transport.ReadTimeouts;
+import com.sun.corba.se.spi.transport.SocketInfo;
+import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo;
+import com.sun.corba.se.spi.transport.TransportDefault;
+
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry ;
+import com.sun.corba.se.impl.legacy.connection.USLPort ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr ;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr ;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr ;
+import com.sun.corba.se.impl.transport.DefaultIORToSocketInfoImpl;
+import com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl;
+
+import sun.corba.SharedSecrets;
+
+/** 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 String MY_CLASS_NAME = ParserTable.class.getName() ;
+
+ private static ParserTable myInstance = new ParserTable() ;
+
+ private ORBUtilSystemException wrapper ;
+
+ public static ParserTable get()
+ {
+ return myInstance ;
+ }
+
+ private ParserData[] parserData ;
+
+ public ParserData[] getParserData()
+ {
+ ParserData[] parserArray = new ParserData[parserData.length];
+ System.arraycopy(parserData, 0, parserArray, 0, parserData.length);
+ return parserArray;
+ }
+
+ private ParserTable() {
+ wrapper = ORBUtilSystemException.get( CORBALogDomains.ORB_LIFECYCLE ) ;
+
+ 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 ) } ;
+
+ ReadTimeouts readTimeouts =
+ TransportDefault.makeReadTimeoutsFactory().create(
+ ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT,
+ ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT,
+ ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT,
+ ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR);
+
+ ORBInitializer[] TestORBInitializers =
+ { null,
+ new TestORBInitializer1(),
+ new TestORBInitializer2() } ;
+ StringPair[] TestORBInitData = {
+ new StringPair( "foo.bar.blech.NonExistent", "dummy" ),
+ new StringPair( MY_CLASS_NAME + "$TestORBInitializer1", "dummy" ),
+ new StringPair( MY_CLASS_NAME + "$TestORBInitializer2", "dummy" ) } ;
+
+ Acceptor[] TestAcceptors =
+ { new TestAcceptor2(),
+ new TestAcceptor1(),
+ null } ;
+ // REVISIT: The test data gets put into a Properties object where
+ // order is not guaranteed. Thus the above array is in reverse.
+ StringPair[] TestAcceptorData = {
+ new StringPair( "foo.bar.blech.NonExistent", "dummy" ),
+ new StringPair( MY_CLASS_NAME + "$TestAcceptor1", "dummy" ),
+ new StringPair( MY_CLASS_NAME + "$TestAcceptor2", "dummy" ) } ;
+
+ StringPair[] TestORBInitRefData =
+ { new StringPair( "Foo", "ior:930492049394" ),
+ new StringPair( "Bar", "ior:3453465785633576" ) } ;
+
+ URL testServicesURL = null ;
+ String testServicesString = "corbaloc::camelot/NameService" ;
+
+ try {
+ testServicesURL = new URL( testServicesString ) ;
+ } catch (Exception exc) {
+ }
+
+ // 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", new Integer( ORBConstants.DEFAULT_INITIAL_PORT ),
+ new Integer( 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", new Integer( 0 ),
+ new Integer( 38143 ), "38143" ),
+ // NOTE: We are putting SERVER_HOST_NAME configuration info into
+ // DataCollectorBase to avoid a security hole. However, that forces
+ // us to also set LISTEN_ON_ALL_INTERFACES at the same time.
+ // This all needs to be cleaned up for two reasons: to get configuration
+ // out of DataCollectorBase and to correctly support multihoming.
+ ParserDataFactory.make( ORBConstants.LISTEN_ON_ALL_INTERFACES,
+ OperationFactory.stringAction(),
+ "listenOnAllInterfaces", ORBConstants.LISTEN_ON_ALL_INTERFACES,
+ "foo", "foo" ),
+ 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", new Integer(-1),
+ new Integer( 1234), "1234" ),
+ ParserDataFactory.make(
+ ORBConstants.ORB_SERVER_ID_PROPERTY,
+ OperationFactory.setFlagAction(),
+ "persistentServerIdInitialized", Boolean.FALSE,
+ Boolean.TRUE, "1234" ),
+ ParserDataFactory.make(
+ ORBConstants.ORB_SERVER_ID_PROPERTY,
+ OperationFactory.setFlagAction(),
+ "orbServerIdPropertySpecified", 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,
+ // "Fooref", "Fooref" ),
+ ParserDataFactory.make( ORBConstants.HIGH_WATER_MARK_PROPERTY,
+ OperationFactory.integerAction(),
+ "highWaterMark", new Integer( 240 ),
+ new Integer( 3745 ), "3745" ),
+ ParserDataFactory.make( ORBConstants.LOW_WATER_MARK_PROPERTY,
+ OperationFactory.integerAction(),
+ "lowWaterMark", new Integer( 100 ),
+ new Integer( 12 ), "12" ),
+ ParserDataFactory.make( ORBConstants.NUMBER_TO_RECLAIM_PROPERTY,
+ OperationFactory.integerAction(),
+ "numberToReclaim", new Integer( 5 ),
+ new Integer( 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",
+ new Integer( ORBConstants.GIOP_DEFAULT_FRAGMENT_SIZE ),
+ new Integer( 65536 ), "65536" ),
+ ParserDataFactory.make( ORBConstants.GIOP_BUFFER_SIZE,
+ OperationFactory.integerAction(),
+ "giopBufferSize", new Integer( ORBConstants.GIOP_DEFAULT_BUFFER_SIZE ),
+ new Integer( 234000 ), "234000" ),
+ ParserDataFactory.make( ORBConstants.GIOP_11_BUFFMGR,
+ makeBMGROperation(),
+ "giop11BuffMgr", new Integer( ORBConstants.DEFAULT_GIOP_11_BUFFMGR ),
+ new Integer( 1 ), "CLCT" ),
+ ParserDataFactory.make( ORBConstants.GIOP_12_BUFFMGR,
+ makeBMGROperation(),
+ "giop12BuffMgr", new Integer( ORBConstants.DEFAULT_GIOP_12_BUFFMGR ),
+ new Integer( 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",
+ new Short( ORBConstants.ADDR_DISP_HANDLE_ALL ),
+ new Short( (short)2 ), "2" ),
+ ParserDataFactory.make( ORBConstants.GIOP_TARGET_ADDRESSING,
+ makeADOperation(),
+ "giopAddressDisposition", new Short( KeyAddr.value ),
+ new Short( (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", new Integer( 0 ),
+ new Integer( 2743 ), "2743" ),
+ ParserDataFactory.make( ORBConstants.PERSISTENT_SERVER_PORT_PROPERTY,
+ OperationFactory.setFlagAction(),
+ "persistentPortInitialized", Boolean.FALSE,
+ Boolean.TRUE, "2743" ),
+ ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
+ OperationFactory.integerAction(),
+ "persistentServerId", new Integer( 0 ),
+ new Integer( 294 ), "294" ),
+ ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
+ OperationFactory.setFlagAction(),
+ "persistentServerIdInitialized", Boolean.FALSE,
+ Boolean.TRUE, "294" ),
+ ParserDataFactory.make( ORBConstants.SERVER_ID_PROPERTY,
+ OperationFactory.setFlagAction(),
+ "orbServerIdPropertySpecified", Boolean.FALSE,
+ Boolean.TRUE, "294" ),
+ ParserDataFactory.make( ORBConstants.ACTIVATED_PROPERTY,
+ OperationFactory.booleanAction(),
+ "serverIsORBActivated", Boolean.FALSE,
+ Boolean.TRUE, "true" ),
+ ParserDataFactory.make( ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY,
+ OperationFactory.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.DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY,
+ OperationFactory.booleanAction(),
+ "disableDirectByteBufferUse", Boolean.FALSE,
+ Boolean.TRUE, "true" ),
+ ParserDataFactory.make(ORBConstants.TRANSPORT_TCP_READ_TIMEOUTS_PROPERTY,
+ makeTTCPRTOperation(),
+ "readTimeouts", TransportDefault.makeReadTimeoutsFactory().create(
+ ORBConstants.TRANSPORT_TCP_INITIAL_TIME_TO_WAIT,
+ ORBConstants.TRANSPORT_TCP_MAX_TIME_TO_WAIT,
+ ORBConstants.TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT,
+ ORBConstants.TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR),
+ readTimeouts, "100:3000:300:20" ),
+ 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 StringPair[0],
+ TestORBInitRefData, TestORBInitRefData, StringPair.class )
+ } ;
+
+ parserData = pd ;
+ }
+
+ public final class TestBadServerIdHandler implements BadServerIdHandler
+ {
+ public boolean equals( Object other )
+ {
+ return other instanceof TestBadServerIdHandler ;
+ }
+
+ public int hashCode() {
+ return 1;
+ }
+
+ public void handle( ObjectKey objectKey )
+ {
+ }
+ }
+
+ private Operation makeTTCPRTOperation()
+ {
+ Operation[] fourIop = { OperationFactory.integerAction(),
+ OperationFactory.integerAction(),
+ OperationFactory.integerAction(),
+ OperationFactory.integerAction() } ;
+
+ Operation op2 = OperationFactory.sequenceAction( ":", fourIop ) ;
+
+ Operation rtOp = new Operation() {
+ public Object operate(Object value)
+ {
+ Object[] values = (Object[])value ;
+ Integer initialTime = (Integer)(values[0]) ;
+ Integer maxGIOPHdrTime = (Integer)(values[1]) ;
+ Integer maxGIOPBodyTime = (Integer)(values[2]) ;
+ Integer backoffPercent = (Integer)(values[3]) ;
+ return TransportDefault.makeReadTimeoutsFactory().create(
+ initialTime.intValue(),
+ maxGIOPHdrTime.intValue(),
+ maxGIOPBodyTime.intValue(),
+ backoffPercent.intValue());
+ }
+ } ;
+
+ Operation ttcprtOp = OperationFactory.compose(op2, rtOp);
+ return ttcprtOp;
+ }
+
+ 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() ) ;
+ }
+ } ;
+
+ Operation op3 = OperationFactory.compose( op2, uslop ) ;
+ Operation listenop = OperationFactory.listAction( ",", op3 ) ;
+ return listenop ;
+ }
+
+ public static final class TestLegacyORBSocketFactory
+ implements com.sun.corba.se.spi.legacy.connection.ORBSocketFactory
+ {
+ public boolean equals( Object other )
+ {
+ return other instanceof TestLegacyORBSocketFactory ;
+ }
+
+ public int hashCode() {
+ return 1;
+ }
+
+ public ServerSocket createServerSocket( String type, int port )
+ {
+ return null ;
+ }
+
+ public SocketInfo getEndPointInfo( org.omg.CORBA.ORB orb,
+ IOR ior, SocketInfo socketInfo )
+ {
+ return null ;
+ }
+
+ public Socket createSocket( SocketInfo socketInfo )
+ {
+ return null ;
+ }
+ }
+
+ public static final class TestORBSocketFactory
+ implements com.sun.corba.se.spi.transport.ORBSocketFactory
+ {
+ public boolean equals( Object other )
+ {
+ return other instanceof TestORBSocketFactory ;
+ }
+
+ public int hashCode() {
+ return 1;
+ }
+
+ public void setORB(ORB orb)
+ {
+ }
+
+ public ServerSocket createServerSocket( String type, InetSocketAddress a )
+ {
+ return null ;
+ }
+
+ public Socket createSocket( String type, InetSocketAddress a )
+ {
+ return null ;
+ }
+
+ public void setAcceptedSocketOptions(Acceptor acceptor,
+ ServerSocket serverSocket,
+ Socket socket)
+ {
+ }
+ }
+
+ public static final class TestIORToSocketInfo
+ implements IORToSocketInfo
+ {
+ public boolean equals( Object other )
+ {
+ return other instanceof TestIORToSocketInfo;
+ }
+
+ public int hashCode() {
+ return 1;
+ }
+
+ public List getSocketInfo(IOR ior)
+ {
+ return null;
+ }
+ }
+
+ public static final class TestIIOPPrimaryToContactInfo
+ implements IIOPPrimaryToContactInfo
+ {
+ public void reset(ContactInfo primary)
+ {
+ }
+
+ public boolean hasNext(ContactInfo primary,
+ ContactInfo previous,
+ List contactInfos)
+ {
+ return true;
+ }
+
+ public ContactInfo next(ContactInfo primary,
+ ContactInfo previous,
+ List contactInfos)
+ {
+ return null;
+ }
+ }
+
+ public static final class TestContactInfoListFactory
+ implements CorbaContactInfoListFactory
+ {
+ public boolean equals( Object other )
+ {
+ return other instanceof TestContactInfoListFactory;
+ }
+
+ public int hashCode() {
+ return 1;
+ }
+
+ public void setORB(ORB orb) { }
+
+ public CorbaContactInfoList create( IOR ior ) { return null; }
+ }
+
+ private Operation makeMapOperation( final Map map )
+ {
+ return new Operation() {
+ public Object operate( Object value )
+ {
+ return map.get( value ) ;
+ }
+ } ;
+ }
+
+ private Operation makeBMGROperation()
+ {
+ Map map = new HashMap() ;
+ map.put( "GROW", new Integer(0) ) ;
+ map.put( "CLCT", new Integer(1) ) ;
+ map.put( "STRM", new Integer(2) ) ;
+ return makeMapOperation( map ) ;
+ }
+
+ private Operation makeLegacySocketFactoryOperation()
+ {
+ Operation sfop = new Operation() {
+ public Object operate( Object value )
+ {
+ String param = (String)value ;
+
+ try {
+ Class<?> legacySocketFactoryClass =
+ SharedSecrets.getJavaCorbaAccess().loadClass(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.se.spi.legacy.connection.ORBSocketFactory.class.isAssignableFrom(legacySocketFactoryClass)) {
+ return legacySocketFactoryClass.newInstance();
+ } else {
+ throw wrapper.illegalSocketFactoryType( legacySocketFactoryClass.toString() ) ;
+ }
+ } catch (Exception ex) {
+ // ClassNotFoundException, IllegalAccessException,
+ // InstantiationException, SecurityException or
+ // ClassCastException
+ throw wrapper.badCustomSocketFactory( ex, param ) ;
+ }
+ }
+ } ;
+
+ return sfop ;
+ }
+
+ private Operation makeSocketFactoryOperation()
+ {
+ Operation sfop = new Operation() {
+ public Object operate( Object value )
+ {
+ String param = (String)value ;
+
+ try {
+ Class<?> socketFactoryClass =
+ SharedSecrets.getJavaCorbaAccess().loadClass(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.se.spi.transport.ORBSocketFactory.class.isAssignableFrom(socketFactoryClass)) {
+ return socketFactoryClass.newInstance();
+ } else {
+ throw wrapper.illegalSocketFactoryType( socketFactoryClass.toString() ) ;
+ }
+ } catch (Exception ex) {
+ // ClassNotFoundException, IllegalAccessException,
+ // InstantiationException, SecurityException or
+ // ClassCastException
+ throw wrapper.badCustomSocketFactory( ex, param ) ;
+ }
+ }
+ } ;
+
+ return sfop ;
+ }
+
+ private Operation makeIORToSocketInfoOperation()
+ {
+ Operation op = new Operation() {
+ public Object operate( Object value )
+ {
+ String param = (String)value ;
+
+ try {
+ Class<?> iorToSocketInfoClass =
+ SharedSecrets.getJavaCorbaAccess().loadClass(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() ) ;
+ }
+ } catch (Exception ex) {
+ // ClassNotFoundException, IllegalAccessException,
+ // InstantiationException, SecurityException or
+ // ClassCastException
+ throw wrapper.badCustomIorToSocketInfo( ex, param ) ;
+ }
+ }
+ } ;
+
+ return op ;
+ }
+
+ private Operation makeIIOPPrimaryToContactInfoOperation()
+ {
+ Operation op = new Operation() {
+ public Object operate( Object value )
+ {
+ String param = (String)value ;
+
+ try {
+ Class<?> iiopPrimaryToContactInfoClass =
+ SharedSecrets.getJavaCorbaAccess().loadClass(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)) {
+ return iiopPrimaryToContactInfoClass.newInstance();
+ } else {
+ throw wrapper.illegalIiopPrimaryToContactInfoType( iiopPrimaryToContactInfoClass.toString() ) ;
+ }
+ } catch (Exception ex) {
+ // ClassNotFoundException, IllegalAccessException,
+ // InstantiationException, SecurityException or
+ // ClassCastException
+ throw wrapper.badCustomIiopPrimaryToContactInfo( ex, param ) ;
+ }
+ }
+ } ;
+
+ return op ;
+ }
+
+ private Operation makeContactInfoListFactoryOperation()
+ {
+ Operation op = new Operation() {
+ public Object operate( Object value )
+ {
+ String param = (String)value ;
+
+ try {
+ Class<?> contactInfoListFactoryClass =
+ SharedSecrets.getJavaCorbaAccess().loadClass(param);
+ // For security reasons avoid creating an instance if
+ // this socket factory class is not one that would fail
+ // the class cast anyway.
+ if (CorbaContactInfoListFactory.class.isAssignableFrom(
+ contactInfoListFactoryClass)) {
+ return contactInfoListFactoryClass.newInstance();
+ } else {
+ throw wrapper.illegalContactInfoListFactoryType(
+ contactInfoListFactoryClass.toString() ) ;
+ }
+ } catch (Exception ex) {
+ // ClassNotFoundException, IllegalAccessException,
+ // InstantiationException, SecurityException or
+ // ClassCastException
+ throw wrapper.badContactInfoListFactory( ex, param ) ;
+ }
+ }
+ } ;
+
+ return op ;
+ }
+
+ private Operation makeCSOperation()
+ {
+ Operation csop = new Operation() {
+ public Object operate( Object value )
+ {
+ String val = (String)value ;
+ return CodeSetComponentInfo.createFromString( val ) ;
+ }
+ } ;
+
+ return csop ;
+ }
+
+ private Operation makeADOperation()
+ {
+ Operation admap = new Operation() {
+ private Integer[] map = {
+ new Integer( KeyAddr.value ),
+ new Integer( ProfileAddr.value ),
+ new Integer( ReferenceAddr.value ),
+ new Integer( 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 ;
+ }
+
+ 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( new Integer( giopFragmentSize ),
+ new Integer( ORBConstants.GIOP_FRAGMENT_MINIMUM_SIZE ) ) ;
+ }
+
+ if (giopFragmentSize % ORBConstants.GIOP_FRAGMENT_DIVISOR != 0)
+ throw wrapper.fragmentSizeDiv( new Integer( giopFragmentSize ),
+ new Integer( ORBConstants.GIOP_FRAGMENT_DIVISOR ) ) ;
+
+ return value ;
+ }
+ } ;
+
+ Operation result = OperationFactory.compose( OperationFactory.integerAction(),
+ fschecker ) ;
+ return result ;
+ }
+
+ private Operation makeGVOperation() {
+ 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 static final class TestORBInitializer1 extends org.omg.CORBA.LocalObject
+ implements ORBInitializer
+ {
+ public boolean equals( Object other )
+ {
+ return other instanceof TestORBInitializer1 ;
+ }
+
+ public int hashCode() {
+ return 1;
+ }
+
+ public void pre_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 int hashCode() {
+ return 1;
+ }
+
+ public void pre_init( ORBInitInfo info )
+ {
+ }
+
+ public void post_init( ORBInitInfo info )
+ {
+ }
+ }
+
+ private Operation makeROIOperation() {
+ Operation clsop = OperationFactory.classAction() ;
+ Operation indexOp = OperationFactory.suffixAction() ;
+ Operation op1 = OperationFactory.compose( indexOp, clsop ) ;
+ Operation mop = OperationFactory.maskErrorAction( op1 ) ;
+
+ Operation mkinst = new Operation() {
+ public Object operate( Object value )
+ {
+ final Class initClass = (Class)value ;
+ if (initClass == null)
+ return null ;
+
+ // 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 ) ) {
+ // Now that we have a class object, instantiate one and
+ // remember it:
+ ORBInitializer initializer = null ;
+
+ try {
+ 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() ) ;
+ } catch (Exception exc) {
+ throw wrapper.orbInitializerFailure( exc, initClass.getName() ) ;
+ }
+
+ return initializer ;
+ } else {
+ throw wrapper.orbInitializerType( initClass.getName() ) ;
+ }
+ }
+ } ;
+
+ Operation result = OperationFactory.compose( mop, mkinst ) ;
+
+ return result ;
+ }
+
+ public static final class TestAcceptor1
+ implements Acceptor
+ {
+ public boolean equals( Object other )
+ {
+ return other instanceof TestAcceptor1 ;
+ }
+
+ public int hashCode() { return 1; }
+ 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 void accept() { }
+ public void close() { }
+ public EventHandler getEventHandler() { return null; }
+ public MessageMediator createMessageMediator(
+ Broker xbroker, Connection xconnection) { return null; }
+ public MessageMediator finishCreatingMessageMediator(
+ Broker xbroker, Connection xconnection,
+ MessageMediator messageMediator) { return null; }
+ public InputObject createInputObject(
+ Broker broker, MessageMediator messageMediator) { return null; }
+ public OutputObject createOutputObject(
+ Broker broker, MessageMediator messageMediator) { return null; }
+ }
+
+ public static final class TestAcceptor2
+ implements Acceptor
+ {
+ public boolean equals( Object other )
+ {
+ return other instanceof TestAcceptor2 ;
+ }
+ public int hashCode() { return 1; }
+ 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 void accept() { }
+ public void close() { }
+ public EventHandler getEventHandler() { return null; }
+ public MessageMediator createMessageMediator(
+ Broker xbroker, Connection xconnection) { return null; }
+ public MessageMediator finishCreatingMessageMediator(
+ Broker xbroker, Connection xconnection,
+ MessageMediator messageMediator) { return null; }
+ public InputObject createInputObject(
+ Broker broker, MessageMediator messageMediator) { return null; }
+ public OutputObject createOutputObject(
+ Broker broker, MessageMediator messageMediator) { return null; }
+ }
+
+ // REVISIT - this is a cut and paste modification of makeROIOperation.
+ private Operation makeAcceptorInstantiationOperation() {
+ Operation clsop = OperationFactory.classAction() ;
+ Operation indexOp = OperationFactory.suffixAction() ;
+ Operation op1 = OperationFactory.compose( indexOp, clsop ) ;
+ Operation mop = OperationFactory.maskErrorAction( op1 ) ;
+
+ Operation mkinst = new Operation() {
+ public Object operate( Object value )
+ {
+ final Class initClass = (Class)value ;
+ if (initClass == null)
+ return null ;
+
+ // 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 ) ) {
+ // Now that we have a class object, instantiate one and
+ // remember it:
+ Acceptor acceptor = null ;
+
+ try {
+ 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() ) ;
+ } catch (Exception exc) {
+ throw wrapper.acceptorInstantiationFailure( exc, initClass.getName() ) ;
+ }
+
+ return acceptor ;
+ } else {
+ throw wrapper.acceptorInstantiationTypeFailure( initClass.getName() ) ;
+ }
+ }
+ } ;
+
+ Operation result = OperationFactory.compose( mop, mkinst ) ;
+
+ return result ;
+ }
+
+ private Operation makeInitRefOperation() {
+ return new Operation() {
+ public Object operate( Object value )
+ {
+ // Object is String[] of length 2.
+ String[] values = (String[])value ;
+ if (values.length != 2)
+ throw wrapper.orbInitialreferenceSyntax() ;
+
+ return values[0] + "=" + values[1] ;
+ }
+ } ;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserAction.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserAction.java
new file mode 100644
index 0000000..ace0d79
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserAction.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import org.omg.CORBA.INITIALIZE ;
+
+import java.util.Properties ;
+import java.util.List ;
+import java.util.LinkedList ;
+import java.util.Iterator ;
+
+import java.lang.reflect.Array ;
+
+import com.sun.corba.se.spi.orb.Operation ;
+import com.sun.corba.se.spi.orb.StringPair ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.orbutil.ObjectUtility ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class PrefixParserAction extends ParserActionBase {
+ private Class componentType ;
+ private ORBUtilSystemException wrapper ;
+
+ public PrefixParserAction( String propertyName,
+ Operation operation, String fieldName, Class componentType )
+ {
+ super( propertyName, true, operation, fieldName ) ;
+ this.componentType = componentType ;
+ this.wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.ORB_LIFECYCLE ) ;
+ }
+
+ /** 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++ ;
+ }
+
+ List matches = new LinkedList() ;
+
+ // Find all keys in props that start with propertyName
+ 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 ) ;
+ StringPair data = new StringPair( suffix, value ) ;
+ Object result = getOperation().operate( data ) ;
+ matches.add( result ) ;
+ }
+ }
+
+ 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
+ // any errors carefully, as errors here or in parsers that
+ // use this Operation often show up at ORB.init().
+ Object result = null ;
+ try {
+ result = Array.newInstance( componentType, size ) ;
+ } catch (Throwable thr) {
+ throw wrapper.couldNotCreateArray( thr,
+ getPropertyName(), componentType,
+ new Integer( size ) ) ;
+ }
+
+ Iterator iter2 = matches.iterator() ;
+ int ctr = 0 ;
+ while (iter2.hasNext()) {
+ Object obj = iter2.next() ;
+
+ try {
+ Array.set( result, ctr, obj ) ;
+ } catch (Throwable thr) {
+ throw wrapper.couldNotSetArray( thr,
+ getPropertyName(), new Integer(ctr),
+ componentType, new Integer(size),
+ obj.toString() ) ;
+ }
+ ctr++ ;
+ }
+
+ return result ;
+ } else
+ return null ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserData.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserData.java
new file mode 100644
index 0000000..c6adfbc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PrefixParserData.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orb ;
+
+import java.util.Properties ;
+
+import com.sun.corba.se.spi.orb.StringPair ;
+import com.sun.corba.se.spi.orb.Operation ;
+import com.sun.corba.se.spi.orb.PropertyParser ;
+
+public class PrefixParserData extends ParserDataBase {
+
+ private StringPair[] testData ;
+ private Class componentType ;
+
+ public PrefixParserData( String propertyName,
+ Operation operation, String fieldName, Object defaultValue,
+ Object testValue, StringPair[] 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 addToProperties( Properties props )
+ {
+ for (int ctr=0; ctr<testData.length; ctr++) {
+ StringPair sp = testData[ctr] ;
+
+ String propName = getPropertyName() ;
+ if (propName.charAt( propName.length() - 1 ) != '.')
+ propName += "." ;
+
+ props.setProperty( propName + sp.getFirst(), sp.getSecond() ) ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PropertyOnlyDataCollector.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PropertyOnlyDataCollector.java
new file mode 100644
index 0000000..20363eb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/PropertyOnlyDataCollector.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.corba.se.impl.orb ;
+
+import java.net.InetAddress ;
+
+import java.util.Properties ;
+
+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 boolean isApplet()
+ {
+ return false ;
+ }
+
+ protected void collect()
+ {
+ checkPropertyDefaults() ;
+
+ findPropertiesFromProperties() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orb/parsing_combinators.txt b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/parsing_combinators.txt
new file mode 100644
index 0000000..f6d78e2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orb/parsing_combinators.txt
@@ -0,0 +1,194 @@
+Parsing
+
+- primtive types
+- lists of various sorts
+
+ Basic models
+
+ prefix A,BCDF scans left-to-right
+ suffix ABCD:F scans right-to-left
+
+ Model 1:
+ data is sep,op,next,combine
+
+ if (sep found in data)
+ split data into prefix, rest
+ return combine( op(prefix), next(rest) )
+ else
+ return combine( default, next(data) )
+
+ pop = suffix1( ":", op3, op4, ++ )
+ op = prefix1( ",", op2, pop, ++ )
+
+ op( A,BDF.FGH:Z ) =
+
+ op2(A) ++ pop( BDF.FGH:Z ) =
+ op2(A) ++ op4( BDF.FGH ) ++ op3( Z )
+
+ Model 2:
+ data is sep,op,next,combine
+
+ if (sep found in data)
+ split data into prefix, rest
+ return combine( op(prefix), next(rest) )
+ else
+ return op(data)
+
+ example
+ op = prefix2( ":", op2, null, ++ )
+ op.setNext( op ) ;
+
+ op( A:B:C:D ) =
+
+ op2(A) ++ op2(B) ++ op2(C) ++ op2(D)
+
+
+
+reduce( sep, initial, op, combine )
+
+ operate( data )
+ if (sep in data)
+ split data into prefix, rest
+ return combine( op(prefix), operate( rest ))
+ else
+ return combine( op(data), initial )
+
+reduce( sep, op1, op2, initial, combine )
+
+ operate(data)
+ if (sep in data) // either first from left orfirst from right
+ split data into prefix, rest
+ return combine( op1( prefix ), op2( rest ) )
+ else
+ return opx( data )
+
+type<X,Y>
+ class combine
+ init : X
+ add( X, Y ) : X
+ op1( String ) : X
+ op2( String ) : Y
+
+ reduce( sep, op1, op2, comb ) ( String ) : X
+
+ operate(data)
+ if (sep in data) // either first from left orfirst from right
+ split data into prefix, rest
+ return comb.add( op2.operate( rest ), op1.operate( prefix ) )
+ else
+ return comb.add( comb.init(), op1.operate( data ) )
+
+ example
+
+ op = reduce( ":", op1, null, comb )
+ op.setop2( op )
+
+ op.operate( "A:B:C" ) =
+ comb.add( op.operate( "B:C" ), op1.operate( "A" ) ) =
+ comb.add( comb.add( op.operate("C"), op1.operate("B") ), op1.operate( "A" ) =
+ comb.add( comb.add( comb.add( comb.init(), op1.operate("C") ), op1.operate("B") ),
+ op1.operate("A") )
+
+
+Splitter interface
+
+interface Splitter {
+ List split( String str )
+}
+
+variations:
+ - separated list SL
+ - first sep rest FSR
+ - fail if not present one arg
+ - default value two args
+ - rest sep last RSL
+ - fail if not present one arg
+ - default value two args
+
+Have we just pushed the real problem off a level?
+
+How do we combine:
+ op1 = FSR("@",v12)
+ op2 = LSR(":",9090)
+
+ str = 1.2@myhost:2345
+
+ op1(str) = ( "1.2" "myhost:2345" )
+
+ define splice( int index, Operator op ) on a list of strings, with op( String ) : (String)
+ to replace the indexth element of a list of strings with the list returned
+ from op( element ).
+
+ compose( op1, splice( 1, op2 )) is the correct parser.
+
+
+A grammar for parsers?
+
+parser : simple_parser
+ | parser ":" simple_parser ;
+
+simple_parser : ident
+ | ident "(" param_list ")" ;
+
+param_list : param
+ | param_list "," param ;
+
+param : constant
+ | parser ;
+
+constant is a Java constant
+ident x is interpreted as either a public static method on OperationFactory
+named xAction which takes as arguments the types of the param list, or as
+the fully qualified class name of a class that implements Operation and has
+a constructor which takes as arguments the types of the param list.
+
+From parser table:
+
+debugFlags string
+ORBInitialHost string
+ORBInitialPort integer
+ORBServerHost string
+ORBServerPort integer
+orbId string
+highWaterMark integer
+lowWaterMark integer
+etc.
+
+giopVersion construct(GIOPVersion.class):map(integer):list('.')
+giopFragmentSize mod(ORBConstants.GIOP_FRAGMENT_DIVISOR):min(ORBConstants.GIOP_FRAGMENT_SIZE):integer
+
+Lisp notation:
+ parse((mod ORBConstants.GIOP_FRAGMENT_DIVISOR) (min ...) (integer))
+
+giop11BuffMgr makeMap(map) where map is constructed in java with
+ map.get("GROW") = Integer(0)
+ map.get("CLCT") = Integer(1)
+ map.get("STRM") = Integer(2)
+
+giopTargetAddressPreference intToShort:integerRange(0,3)
+giopAddressDisposition another map variant
+
+charData construct(CodeSetComponentInfo.class):string
+
+
+What about corbaloc:?
+
+v12 = GIOPVersion.v12 ;
+
+giopVersion = construct( GIOPVersion.class ):mapSequence( [integer,integer] ):FSR(".")
+
+iiopAddress = mapSequence( [giopVersion,identity,integer] ):
+ splice( 1, LSR( ":" 9090 )):
+ FSR( "@", v12 )
+
+addressHandler = choice(
+ "iiop:", iiopAddress
+ ":", iiopAddress
+)
+
+addressList = map(addressHandler):SL(",")
+
+choice(
+ "corbaloc:", mapSequence( [addressList,string] ):RSL("/", "NameService"),
+ "corbaname:", ...
+)
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CacheTable.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CacheTable.java
new file mode 100644
index 0000000..04ca47e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CacheTable.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+public class CacheTable {
+ class Entry {
+ java.lang.Object key;
+ int val;
+ Entry next; // this chains the collision list of table "map"
+ Entry rnext; // this chains the collision list of table "rmap"
+ public Entry(java.lang.Object k, int v) {
+ key = k;
+ val = v;
+ next = null;
+ rnext = null;
+ }
+ }
+ private boolean noReverseMap;
+ // size must be power of 2
+ static final int INITIAL_SIZE = 16;
+ static final int MAX_SIZE = 1 << 30;
+ int size;
+ int entryCount;
+ private Entry [] map;
+ private Entry [] rmap;
+
+ private ORB orb;
+ private ORBUtilSystemException wrapper;
+
+ private CacheTable() {}
+ public CacheTable(ORB orb, boolean u) {
+ //System.out.println("using new cache table");
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get(orb,
+ CORBALogDomains.RPC_ENCODING);
+ noReverseMap = u;
+ size = INITIAL_SIZE;
+ entryCount = 0;
+ initTables();
+ }
+ private void initTables() {
+ map = new Entry[size];
+ rmap = noReverseMap ? null : new Entry[size];
+ }
+ private void grow() {
+ if (size == MAX_SIZE)
+ return;
+ Entry [] oldMap = map;
+ int oldSize = size;
+ size <<= 1;
+ initTables();
+ // now rehash the entries into the new table
+ for (int i = 0; i < oldSize; i++) {
+ for (Entry e = oldMap[i]; e != null; e = e.next)
+ put_table(e.key, e.val);
+ }
+ }
+ private int moduloTableSize(int h) {
+ // these are the "supplemental hash function" copied from
+ // java.util.HashMap, supposed to be "critical"
+ h += ~(h << 9);
+ h ^= (h >>> 14);
+ h += (h << 4);
+ h ^= (h >>> 10);
+ return h & (size - 1);
+ }
+ private int hash(java.lang.Object key) {
+ return moduloTableSize(System.identityHashCode(key));
+ }
+ private int hash(int val) {
+ return moduloTableSize(val);
+ }
+ public final void put(java.lang.Object key, int val) {
+ if (put_table(key, val)) {
+ entryCount++;
+ if (entryCount > size * 3 / 4)
+ grow();
+ }
+ }
+ private boolean put_table(java.lang.Object key, int val) {
+ int index = hash(key);
+ for (Entry e = map[index]; e != null; e = e.next) {
+ if (e.key == key) {
+ if (e.val != val) {
+ throw wrapper.duplicateIndirectionOffset();
+ }
+ // 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;
+ }
+ }
+ // this means the key is not present in our table
+ // then it shouldnt be present in our reverse table either
+ Entry newEntry = new Entry(key, val);
+ newEntry.next = map[index];
+ map[index] = newEntry;
+ if (!noReverseMap) {
+ int rindex = hash(val);
+ newEntry.rnext = rmap[rindex];
+ rmap[rindex] = newEntry;
+ }
+ return true;
+ }
+ public final boolean containsKey(java.lang.Object key) {
+ return (getVal(key) != -1);
+ }
+ public final int getVal(java.lang.Object key) {
+ int index = hash(key);
+ for (Entry e = map[index]; e != null; e = e.next) {
+ if (e.key == key)
+ return e.val;
+ }
+ return -1;
+ }
+ public final boolean containsVal(int val) {
+ return (getKey(val) != null);
+ }
+ public final boolean containsOrderedVal(int val) {
+ return containsVal(val);
+ }
+ public final java.lang.Object getKey(int val) {
+ int index = hash(val);
+ for (Entry e = rmap[index]; e != null; e = e.rnext) {
+ if (e.val == val)
+ return e.key;
+ }
+ return null;
+ }
+ public void done() {
+ map = null;
+ rmap = null;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java
new file mode 100644
index 0000000..5f14120
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/CorbaResourceUtil.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import java.util.ResourceBundle;
+import java.util.MissingResourceException;
+
+public class CorbaResourceUtil {
+ public static String getString(String key) {
+ if (!resourcesInitialized) {
+ initResources();
+ }
+
+ try {
+ return resources.getString(key);
+ } catch (MissingResourceException ignore) {
+ }
+ return null;
+ }
+
+ public static String getText(String key) {
+ String message = getString(key);
+ if (message == null) {
+ message = "no text found: \"" + key + "\"";
+ }
+ return message;
+ }
+
+ public static String getText(String key, int num) {
+ return getText(key, Integer.toString(num), null, null);
+ }
+
+ public static String getText(String key, String arg0) {
+ return getText(key, arg0, null, null);
+ }
+
+ public static String getText(String key, String arg0, String arg1) {
+ return getText(key, arg0, arg1, null);
+ }
+
+ public static String getText(String key,
+ String arg0, String arg1, String arg2)
+ {
+ String format = getString(key);
+ if (format == null) {
+ format = "no text found: key = \"" + key + "\", " +
+ "arguments = \"{0}\", \"{1}\", \"{2}\"";
+ }
+
+ String[] args = new String[3];
+ args[0] = (arg0 != null ? arg0.toString() : "null");
+ args[1] = (arg1 != null ? arg1.toString() : "null");
+ args[2] = (arg2 != null ? arg2.toString() : "null");
+
+ return java.text.MessageFormat.format(format, (Object[]) args);
+ }
+
+ private static boolean resourcesInitialized = false;
+ private static ResourceBundle resources;
+
+ private static void initResources() {
+ try {
+ resources =
+ ResourceBundle.getBundle("com.sun.corba.se.impl.orbutil.resources.sunorb");
+ resourcesInitialized = true;
+ } catch (MissingResourceException e) {
+ throw new Error("fatal: missing resource bundle: " +
+ e.getClassName());
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java
new file mode 100644
index 0000000..95be165
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/DenseIntMapImpl.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil ;
+
+import java.util.ArrayList ;
+
+/** Utility for managing mappings from densely allocated integer
+ * keys to arbitrary objects. This should only be used for
+ * keys in the range 0..max such that "most" of the key space is actually
+ * used.
+ */
+public class DenseIntMapImpl
+{
+ private ArrayList list = new ArrayList() ;
+
+ private void checkKey( int key )
+ {
+ if (key < 0)
+ throw new IllegalArgumentException( "Key must be >= 0." ) ;
+ }
+
+ /**
+ * If {@code key >= 0}, return the value bound to key, or null if none.
+ * Throws IllegalArgumentException if {@code key < 0}.
+ */
+ public Object get( int key )
+ {
+ checkKey( key ) ;
+
+ Object result = null ;
+ if (key < list.size())
+ result = list.get( key ) ;
+
+ return result ;
+ }
+
+ /**
+ * If {@code key >= 0}, bind value to the key.
+ * Throws IllegalArgumentException if {@code key < 0}.
+ */
+ public void set( int key, Object value )
+ {
+ checkKey( key ) ;
+ extend( key ) ;
+ list.set( key, value ) ;
+ }
+
+ private void extend( int index )
+ {
+ if (index >= list.size()) {
+ list.ensureCapacity( index + 1 ) ;
+ int max = list.size() ;
+ while (max++ <= index)
+ list.add( null ) ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/GetPropertyAction.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/GetPropertyAction.java
new file mode 100644
index 0000000..9cb69d8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/GetPropertyAction.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil ;
+
+/**
+ * A convenience class for retrieving the string value of a system
+ * property as a privileged action. This class is directly copied
+ * from sun.security.action.GetPropertyAction in order to avoid
+ * depending on the sun.security.action package.
+ *
+ * <p>An instance of this class can be used as the argument of
+ * <code>AccessController.doPrivileged</code>.
+ *
+ * <p>The following code retrieves the value of the system
+ * property named <code>"prop"</code> as a privileged action:
+ *
+ * <pre>
+ * String s = (String) java.security.AccessController.doPrivileged(
+ * new GetPropertyAction("prop"));
+ * </pre>
+ *
+ * @author Roland Schemers
+ * @author Ken Cavanaugh
+ * @see java.security.PrivilegedAction
+ * @see java.security.AccessController
+ */
+
+public class GetPropertyAction implements java.security.PrivilegedAction {
+ private String theProp;
+ private String defaultVal;
+
+ /**
+ * Constructor that takes the name of the system property whose
+ * string value needs to be determined.
+ *
+ * @param theProp the name of the system property.
+ */
+ public GetPropertyAction(String theProp) {
+ this.theProp = theProp;
+ }
+
+ /**
+ * Constructor that takes the name of the system property and the default
+ * value of that property.
+ *
+ * @param theProp the name of the system property.
+ * @param defaultVal the default value.
+ */
+ public GetPropertyAction(String theProp, String defaultVal) {
+ this.theProp = theProp;
+ this.defaultVal = defaultVal;
+ }
+
+ /**
+ * Determines the string value of the system property whose
+ * name was specified in the constructor.
+ *
+ * @return the string value of the system property,
+ * or the default value if there is no property with that key.
+ */
+ public Object run() {
+ String value = System.getProperty(theProp);
+ return (value == null) ? defaultVal : value;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/HexOutputStream.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/HexOutputStream.java
new file mode 100644
index 0000000..0502a95
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/HexOutputStream.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1996, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import java.io.StringWriter;
+import java.io.OutputStream;
+import java.io.IOException;
+
+/**
+ * Writes each input byte as a 2 byte hexidecimal output pair making it
+ * possible to turn arbitrary binary data into an ASCII format.
+ * The high 4 bits of the byte is translated into the first byte.
+ *
+ * @author Jeff Nisewanger
+ */
+public class HexOutputStream extends OutputStream
+{
+ static private final char hex[] = {
+ '0', '1', '2', '3', '4', '5', '6', '7',
+ '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'
+ };
+
+ private StringWriter writer;
+
+ /**
+ * Creates a new HexOutputStream.
+ * @param w The underlying StringWriter.
+ */
+ public
+ HexOutputStream(StringWriter w) {
+ writer = w;
+ }
+
+
+ /**
+ * Writes a byte. Will block until the byte is actually
+ * written.
+ * param b The byte to write out.
+ * @exception java.io.IOException I/O error occurred.
+ */
+ public synchronized void write(int b) throws IOException {
+ writer.write(hex[((b >> 4) & 0xF)]);
+ writer.write(hex[((b >> 0) & 0xF)]);
+ }
+
+ public synchronized void write(byte[] b) throws IOException {
+ write(b, 0, b.length);
+ }
+
+ public synchronized void write(byte[] b, int off, int len)
+ throws IOException
+ {
+ for(int i=0; i < len; i++) {
+ write(b[off + i]);
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookGetFields.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookGetFields.java
new file mode 100644
index 0000000..b05e8a9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookGetFields.java
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ */
+package com.sun.corba.se.impl.orbutil;
+
+import java.io.*;
+import java.util.Hashtable;
+
+class LegacyHookGetFields extends ObjectInputStream.GetField {
+ private Hashtable fields = null;
+
+ LegacyHookGetFields(Hashtable fields){
+ this.fields = fields;
+ }
+
+ /**
+ * Get the ObjectStreamClass that describes the fields in the stream.
+ */
+ public java.io.ObjectStreamClass getObjectStreamClass() {
+ return null;
+ }
+
+ /**
+ * Return true if the named field is defaulted and has no value
+ * in this stream.
+ */
+ 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 {
+ 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 {
+ if (defaulted(name))
+ return defvalue;
+ else return ((Character)fields.get(name)).charValue();
+
+ }
+
+ /**
+ * Get the value of the named byte field from the persistent fields.
+ */
+ public byte get(String name, byte defvalue)
+ throws IOException, IllegalArgumentException {
+ if (defaulted(name))
+ return defvalue;
+ else return ((Byte)fields.get(name)).byteValue();
+
+ }
+
+ /**
+ * Get the value of the named short field from the persistent fields.
+ */
+ public short get(String name, short defvalue)
+ throws IOException, IllegalArgumentException {
+ if (defaulted(name))
+ return defvalue;
+ else return ((Short)fields.get(name)).shortValue();
+
+ }
+
+ /**
+ * Get the value of the named int field from the persistent fields.
+ */
+ 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 {
+ 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 {
+ 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 {
+ 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 {
+ if (defaulted(name))
+ return defvalue;
+ else return fields.get(name);
+
+ }
+
+ public String toString(){
+ return fields.toString();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookPutFields.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookPutFields.java
new file mode 100644
index 0000000..74bc200
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LegacyHookPutFields.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ */
+package com.sun.corba.se.impl.orbutil;
+
+import java.io.*;
+import java.util.Hashtable;
+
+/**
+ * Since ObjectOutputStream.PutField methods specify no exceptions,
+ * we are not checking for null parameters on put methods.
+ */
+class LegacyHookPutFields extends ObjectOutputStream.PutField
+{
+ private Hashtable fields = new Hashtable();
+
+ /**
+ * Put the value of the named boolean field into the persistent field.
+ */
+ public void put(String name, boolean value){
+ fields.put(name, new Boolean(value));
+ }
+
+ /**
+ * Put the value of the named char field into the persistent fields.
+ */
+ public void put(String name, char value){
+ fields.put(name, new Character(value));
+ }
+
+ /**
+ * Put the value of the named byte field into the persistent fields.
+ */
+ public void put(String name, byte value){
+ fields.put(name, new Byte(value));
+ }
+
+ /**
+ * Put the value of the named short field into the persistent fields.
+ */
+ public void put(String name, short value){
+ fields.put(name, new Short(value));
+ }
+
+ /**
+ * Put the value of the named int field into the persistent fields.
+ */
+ public void put(String name, int value){
+ fields.put(name, new Integer(value));
+ }
+
+ /**
+ * Put the value of the named long field into the persistent fields.
+ */
+ public void put(String name, long value){
+ fields.put(name, new Long(value));
+ }
+
+ /**
+ * Put the value of the named float field into the persistent fields.
+ *
+ */
+ public void put(String name, float value){
+ fields.put(name, new Float(value));
+ }
+
+ /**
+ * Put the value of the named double field into the persistent field.
+ */
+ public void put(String name, double value){
+ fields.put(name, new Double(value));
+ }
+
+ /**
+ * Put the value of the named Object field into the persistent field.
+ */
+ 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/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LogKeywords.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LogKeywords.java
new file mode 100644
index 0000000..32ce53d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/LogKeywords.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+/**
+ * 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
+ **/
+ public final static String LIFECYCLE_CREATE = "<<LIFECYCLE CREATE>>";
+ public final static String LIFECYCLE_INITIALIZE = "<<LIFECYCLE INITIALIZE>>";
+ public final static String LIFECYCLE_SHUTDOWN = "<<LIFECYCLE SHUTDOWN>>";
+ public final static String LIFECYCLE_DESTROY = "<<LIFECYCLE DESTROY>>";
+
+
+ public final static String LIFECYCLE_CREATE_SUCCESS =
+ LIFECYCLE_CREATE + "<<SUCCESS>>";
+ public final static String LIFECYCLE_CREATE_FAILURE =
+ LIFECYCLE_CREATE + "<<FAILURE>>";
+ public final static String LIFECYCLE_INITIALIZE_SUCCESS =
+ LIFECYCLE_INITIALIZE + "<<SUCCESS>>";
+ public final static String LIFECYCLE_INITIALIZE_FAILURE =
+ LIFECYCLE_INITIALIZE + "<<FAILURE>>";
+ public final static String LIFECYCLE_SHUTDOWN_SUCCESS =
+ LIFECYCLE_SHUTDOWN + "<<SUCCESS>>";
+ public final static String LIFECYCLE_SHUTDOWN_FAILURE =
+ LIFECYCLE_SHUTDOWN + "<<FAILURE>>";
+ public final static String LIFECYCLE_DESTROY_SUCCESS =
+ LIFECYCLE_DESTROY + "<<SUCCESS>>";
+ public final static String LIFECYCLE_DESTROY_FAILURE =
+ LIFECYCLE_DESTROY + "<<FAILURE>>";
+
+ /**
+ ** Keywords for Naming Read Loggers.
+ **/
+ public final static String NAMING_RESOLVE = "<<NAMING RESOLVE>>";
+ public final static String NAMING_LIST = "<<NAMING LIST>>";
+
+ public final static String NAMING_RESOLVE_SUCCESS =
+ NAMING_RESOLVE + "<<SUCCESS>>";
+ public final static String NAMING_RESOLVE_FAILURE =
+ NAMING_RESOLVE + "<<FAILURE>>";
+ public final static String NAMING_LIST_SUCCESS =
+ NAMING_LIST + "<<SUCCESS>>";
+ public final static String NAMING_LIST_FAILURE =
+ NAMING_LIST + "<<FAILURE>>";
+
+ /**
+ ** Keywords for Naming Update Loggers.
+ **/
+ public final static String NAMING_BIND = "<<NAMING BIND>>";
+ public final static String NAMING_UNBIND = "<<NAMING UNBIND>>";
+ public final static String NAMING_REBIND = "<<NAMING REBIND>>";
+
+ public final static String NAMING_BIND_SUCCESS =
+ NAMING_BIND + "<<SUCCESS>>";
+ public final static String NAMING_BIND_FAILURE =
+ NAMING_BIND + "<<FAILURE>>";
+ public final static String NAMING_UNBIND_SUCCESS =
+ NAMING_UNBIND + "<<SUCCESS>>";
+ public final static String NAMING_UNBIND_FAILURE =
+ NAMING_UNBIND + "<<FAILURE>>";
+ public final static String NAMING_REBIND_SUCCESS =
+ NAMING_REBIND + "<<SUCCESS>>";
+ public final static String NAMING_REBIND_FAILURE =
+ NAMING_REBIND + "<<FAILURE>>";
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBConstants.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBConstants.java
new file mode 100644
index 0000000..68a901f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBConstants.java
@@ -0,0 +1,471 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import com.sun.corba.se.impl.util.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")
+ */
+
+ // 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 SUN_TAGGED_COMPONENT_ID_BASE = 0x53554e00;
+ public static final int SUN_SERVICE_CONTEXT_ID_BASE = 0x53554e00;
+
+ //
+ // Tagged Components Ids
+ //
+
+ // Used by AS 7 for IIOP failover.
+ 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;
+ // TaggedComponentId for Java serialization tagged component.
+ public static final int TAG_JAVA_SERIALIZATION_ID =
+ SUN_TAGGED_COMPONENT_ID_BASE + 2;
+
+ //
+ // Service Context Ids
+ //
+
+ // Used by AS 7 for IIOP failover.
+ public static final int CONTAINER_ID_SERVICE_CONTEXT =
+ SUN_SERVICE_CONTEXT_ID_BASE + 0;
+
+ // All Sun policies are allocated using the SUNVMCID, which is also
+ // 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 ;
+
+ // 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 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 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
+ // ORG_OMG_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.
+ // 4. proprietary property names should have a subsystem
+ // 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 ORG_OMG_PREFIX = "org.omg." ;
+ public static final String ORG_OMG_CORBA_PREFIX = "org.omg.CORBA." ;
+
+ public static final String INITIAL_HOST_PROPERTY =
+ ORG_OMG_CORBA_PREFIX + "ORBInitialHost" ;
+ public static final String INITIAL_PORT_PROPERTY =
+ ORG_OMG_CORBA_PREFIX + "ORBInitialPort" ;
+ public static final String INITIAL_SERVICES_PROPERTY =
+ ORG_OMG_CORBA_PREFIX + "ORBInitialServices" ;
+ public static final String DEFAULT_INIT_REF_PROPERTY =
+ ORG_OMG_CORBA_PREFIX + "ORBDefaultInitRef" ;
+ public static final String ORB_INIT_REF_PROPERTY =
+ ORG_OMG_CORBA_PREFIX + "ORBInitRef" ;
+
+ // All of our proprietary properties must start with com.sun.CORBA
+ public static final String SUN_PREFIX = "com.sun.CORBA." ;
+
+ // 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 = ORG_OMG_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 = ORG_OMG_CORBA_PREFIX + "ORBServerId" ;
+ public static final String DEBUG_PROPERTY = SUN_PREFIX + "ORBDebug" ;
+ // Property for setting use of repository Ids during serialization.
+ public static final String USE_REP_ID = SUN_PREFIX + "ORBUseRepId";
+
+ // NOTE: This is an internal property. It should never be set by
+ // a user. That is the reason it has spaces in its name - to make it
+ // harder to use.
+ public static final String LISTEN_ON_ALL_INTERFACES = SUN_PREFIX + "INTERNAL USE ONLY: listen on all interfaces";
+
+ // 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 int GIOP_DEFAULT_FRAGMENT_SIZE = 1024;
+ public static final int GIOP_DEFAULT_BUFFER_SIZE = 1024;
+ 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
+ public static final short ADDR_DISP_HANDLE_ALL = 3; // accept all target addressing dispositions (default)
+
+ // CORBA formal 00-11-03 sections 15.4.2.2, 15.4.3.2, 15.4.6.2
+ // state that the GIOP 1.2 RequestMessage, ReplyMessage, and
+ // 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
+ // to GIOP 1.1 fragments, as well.
+ public static final int GIOP_FRAGMENT_DIVISOR = 8;
+ public static final int GIOP_FRAGMENT_MINIMUM_SIZE = 32;
+
+ // 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 ACCEPTOR_CLASS_PREFIX_PROPERTY =
+ SUN_PREFIX + "transport.ORBAcceptor";
+
+ 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 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_MAX_THREAD_POOL_ID = 63;
+
+ // transport read tcp timeout property, colon separated property
+ // with syntax <initial time to wait:max read giop header time to
+ // wait: max read message time to wait:backoff factor>
+ public static final String TRANSPORT_TCP_READ_TIMEOUTS_PROPERTY =
+ SUN_PREFIX + "transport.ORBTCPReadTimeouts";
+
+ // initial time to wait in milliseconds if a transport
+ // tcp read returns 0 bytes
+ public static final int TRANSPORT_TCP_INITIAL_TIME_TO_WAIT = 100;
+
+ // max time to spend in cumulative waits in milliseconds
+ // if a transport tcp read returns 0 bytes
+ public static final int TRANSPORT_TCP_MAX_TIME_TO_WAIT = 3000;
+
+ // max time to spend in cumulative waits in milliseconds
+ // if a transport tcp read of GIOP header returns 0 bytes
+ public static final int TRANSPORT_TCP_GIOP_HEADER_MAX_TIME_TO_WAIT = 300;
+
+ // A backoff percentage used to compute the next amount of time to
+ // wait on a subsequent transport tcp read of 0 bytes
+ public static final int TRANSPORT_TCP_TIME_TO_WAIT_BACKOFF_FACTOR = 20;
+
+ 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";
+
+ // Applicable if using SocketChannel and using select thread.
+ 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";
+
+ // Applicable if using SocketChannel and using select thread
+ 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
+ // viewed in most (all?) debuggers.
+ public static final String DISABLE_DIRECT_BYTE_BUFFER_USE_PROPERTY =
+ SUN_PREFIX + "transport.ORBDisableDirectByteBufferUse" ;
+
+ public static final String SOCKET = "Socket";
+ public static final String SOCKETCHANNEL = "SocketChannel";
+
+ // POA related policies
+ public static final String PERSISTENT_SERVER_PORT_PROPERTY = SUN_PREFIX + "POA.ORBPersistentServerPort" ;
+ public static final String SERVER_ID_PROPERTY = SUN_PREFIX + "POA.ORBServerId" ;
+ 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" ;
+
+ // This one is an exception, but it may be externally visible
+ public static final String SUN_LC_PREFIX = "com.sun.corba." ;
+
+ // Necessary for package renaming to work correctly
+ public static final String SUN_LC_VERSION_PREFIX = "com.sun.corba.se.";
+
+ public static final String JTS_CLASS_PROPERTY = SUN_LC_VERSION_PREFIX + "CosTransactions.ORBJTSClass" ;
+
+ // Property for enabling ORB's use of Java serialization.
+ 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 USE_DYNAMIC_STUB_PROPERTY = SUN_PREFIX + "ORBUseDynamicStub" ;
+
+ 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 String DEFAULT_INS_HOST = "localhost";
+
+ public static final int DEFAULT_INS_PORT = 2089;
+
+ 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;
+
+
+ // 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;
+
+ // Subcontract's differentiation using the TRANSIENT and PERSISTENT
+ // Name Service Property.
+ public static final int TRANSIENT = 1;
+ public static final int PERSISTENT = 2;
+
+ // Constants for ORBD properties ****************************************************************
+
+ // 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 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 DEFAULT_SERVER_STARTUP_DELAY = 1000;
+
+
+ //***************** Constants for Logging ****************
+
+ public static final String LOG_LEVEL_PROPERTY = SUN_PREFIX + "ORBLogLevel";
+
+ public static final String LOG_RESOURCE_FILE =
+ "com.sun.corba.se.impl.logging.LogStrings";
+
+ // Constants for initial references *************************************************************
+
+ 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" ;
+
+ // New for Portable Interceptors
+ public static final String PI_CURRENT_NAME = "PICurrent" ;
+ public static final String CODEC_FACTORY_NAME = "CodecFactory" ;
+
+ // 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" ;
+
+ // Constants for ThreadPool ********************************************************************
+
+ // Default value for when inactive threads in the pool can stop running (ms)
+ public static final int DEFAULT_INACTIVITY_TIMEOUT = 120000;
+ // Default name of the threadpool
+ public static final String THREADPOOL_DEFAULT_NAME = "default-threadpool";
+ // Default name of the workqueue
+ public static final String WORKQUEUE_DEFAULT_NAME = "default-workqueue";
+
+ // Constants for minor code bases **************************************************************
+ // 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 ;
+
+ // Code Set related *******************************************************
+
+ // If we don't always send the code set context, there's a possibility
+ // of failure when fragments of a smaller request are interleved with
+ // 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";
+
+ // 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";
+
+ // Use byte order markers in encapsulations when applicable?
+ public static final boolean DEFAULT_USE_BYTE_ORDER_MARKERS_IN_ENCAPS = false;
+ 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
+ // set.
+ //
+ // Number can be specified as hex if preceded by 0x, otherwise they are
+ // interpreted as decimal.
+ //
+ // Code sets that we accept currently (see core/OSFCodeSetRegistry):
+ //
+ // char/string:
+ //
+ // ISO8859-1 (Latin-1) 0x00010001
+ // ISO646 (ASCII) 0x00010020
+ // UTF-8 0x05010001
+ //
+ // wchar/string:
+ //
+ // UTF-16 0x00010109
+ // UCS-2 0x00010100
+ // UTF-8 0x05010001
+ //
+ // 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;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java
new file mode 100644
index 0000000..a368ee9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ORBUtility.java
@@ -0,0 +1,846 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import java.lang.Character;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.rmi.NoSuchObjectException;
+import java.security.AccessController;
+import java.security.PermissionCollection;
+import java.security.Policy;
+import java.security.PrivilegedAction;
+import java.security.ProtectionDomain;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Enumeration;
+import java.util.StringTokenizer;
+import java.util.NoSuchElementException;
+
+import javax.rmi.CORBA.ValueHandler;
+import javax.rmi.CORBA.ValueHandlerMultiFormat;
+import javax.rmi.CORBA.Util;
+
+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.DATA_CONVERSION ;
+import org.omg.CORBA.BAD_PARAM ;
+import org.omg.CORBA.BAD_OPERATION ;
+import org.omg.CORBA.INTERNAL ;
+import org.omg.CORBA.TypeCodePackage.BadKind ;
+import org.omg.CORBA.portable.OutputStream ;
+import org.omg.CORBA.portable.InputStream ;
+
+import com.sun.corba.se.pept.transport.ContactInfoList ;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.spi.orb.ORBVersionFactory ;
+import com.sun.corba.se.spi.protocol.CorbaClientDelegate ;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate;
+
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.corba.CORBAObjectImpl ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.logging.OMGSystemException ;
+import com.sun.corba.se.impl.ior.iiop.JavaSerializationComponent;
+
+import sun.corba.SharedSecrets;
+
+/**
+ * Handy class full of static functions that don't belong in util.Utility for pure ORB reasons.
+ */
+public final class ORBUtility {
+ private ORBUtility() {}
+
+ private static ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.UTIL ) ;
+ private static OMGSystemException omgWrapper = OMGSystemException.get(
+ CORBALogDomains.UTIL ) ;
+
+ private static StructMember[] members = null;
+
+ private static StructMember[] systemExceptionMembers (ORB orb) {
+ if (members == null) {
+ members = new StructMember[3];
+ members[0] = new StructMember("id", orb.create_string_tc(0), null);
+ members[1] = new StructMember("minor", orb.get_primitive_tc(TCKind.tk_long), null);
+ members[2] = new StructMember("completed", orb.get_primitive_tc(TCKind.tk_long), null);
+ }
+ return members;
+ }
+
+ private static TypeCode getSystemExceptionTypeCode(ORB orb, String repID, String name) {
+ synchronized (TypeCode.class) {
+ return orb.create_exception_tc(repID, name, systemExceptionMembers(orb));
+ }
+ }
+
+ 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));
+ } catch (BadKind ex) {
+ return false;
+ } catch (org.omg.CORBA.TypeCodePackage.Bounds ex) {
+ return false;
+ }
+ }
+
+ /**
+ * Static method for writing a CORBA standard exception to an Any.
+ * @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());
+ 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));
+ }
+
+ public static SystemException extractSystemException(Any any) {
+ InputStream in = any.create_input_stream();
+ ORB orb = (ORB)(in.orb());
+ if ( ! isSystemExceptionTypeCode(any.type(), orb)) {
+ throw wrapper.unknownDsiSysex(CompletionStatus.COMPLETED_MAYBE);
+ }
+ return ORBUtility.readSystemException(in);
+ }
+
+ /**
+ * Return default ValueHandler
+ */
+ public static ValueHandler createValueHandler() {
+ ValueHandler vh;
+ try {
+ vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
+ public ValueHandler run() throws Exception {
+ return Util.createValueHandler();
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw new InternalError(e.getCause());
+ }
+ return vh;
+ }
+
+ /**
+ * 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.
+ */
+ public static boolean isForeignORB(ORB orb)
+ {
+ if (orb == null)
+ return false;
+
+ try {
+ return orb.getORBVersion().equals(ORBVersionFactory.getFOREIGN());
+ } catch (SecurityException se) {
+ return false;
+ }
+ }
+
+ /** 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.
+ */
+ 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;
+
+ 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 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
+ */
+ public static int hexOf( char x )
+ {
+ int val;
+
+ val = x - '0';
+ if (val >=0 && val <= 9)
+ return val;
+
+ val = (x - 'a') + 10;
+ if (val >= 10 && val <= 15)
+ return val;
+
+ val = (x - 'A') + 10;
+ if (val >= 10 && val <= 15)
+ return val;
+
+ throw wrapper.badHexDigit() ;
+ }
+
+ // method moved from util.Utility
+
+ /**
+ * Static method for writing a CORBA standard exception to a stream.
+ * @param strm The OutputStream to use for marshaling.
+ */
+ public static void writeSystemException(SystemException ex, OutputStream strm)
+ {
+ String s;
+
+ s = repositoryIdOf(ex.getClass().getName());
+ strm.write_string(s);
+ strm.write_long(ex.minor);
+ strm.write_long(ex.completed.value());
+ }
+
+ /**
+ * Static method for reading a CORBA standard exception from a stream.
+ * @param strm The InputStream to use for unmarshaling.
+ */
+ public static SystemException readSystemException(InputStream strm)
+ {
+ try {
+ String name = classNameOf(strm.read_string());
+ SystemException ex = (SystemException)SharedSecrets.
+ getJavaCorbaAccess().loadClass(name).newInstance();
+ ex.minor = strm.read_long();
+ ex.completed = CompletionStatus.from_int(strm.read_long());
+ return ex;
+ } catch ( Exception ex ) {
+ throw wrapper.unknownSysex( CompletionStatus.COMPLETED_MAYBE, 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.
+ * @param repositoryId The repository Id for which we want a class name.
+ */
+ public static String classNameOf(String repositoryId)
+ {
+ String className=null;
+
+ className = (String) exceptionClassNames.get(repositoryId);
+ if (className == null)
+ className = "org.omg.CORBA.UNKNOWN";
+
+ return className;
+ }
+
+ /**
+ * Return true if this repositoryId is a SystemException.
+ * @param repositoryId The repository Id to check.
+ */
+ public static boolean isSystemException(String repositoryId)
+ {
+ String className=null;
+
+ className = (String) exceptionClassNames.get(repositoryId);
+ if (className == null)
+ return false;
+ else
+ return true;
+ }
+
+ /**
+ * @return the Java serialization encoding version.
+ */
+ public static byte getEncodingVersion(ORB orb, IOR ior) {
+
+ // Is Java serialization enabled?
+ // Check the JavaSerializationComponent (tagged component)
+ // in the IIOPProfile. If present, the peer ORB's GIOP is capable
+ // of using Java serialization instead of CDR serialization.
+ // In such a case, use Java serialization, iff the java serialization
+ // versions match.
+
+ if (orb.getORBData().isJavaSerializationEnabled()) {
+ IIOPProfile prof = ior.getProfile();
+ IIOPProfileTemplate profTemp =
+ (IIOPProfileTemplate) prof.getTaggedProfileTemplate();
+ java.util.Iterator iter = profTemp.iteratorById(
+ ORBConstants.TAG_JAVA_SERIALIZATION_ID);
+ if (iter.hasNext()) {
+ JavaSerializationComponent jc =
+ (JavaSerializationComponent) iter.next();
+ byte jcVersion = jc.javaSerializationVersion();
+ if (jcVersion >= Message.JAVA_ENC_VERSION) {
+ return Message.JAVA_ENC_VERSION;
+ } else if (jcVersion > Message.CDR_ENC_VERSION) {
+ return jc.javaSerializationVersion();
+ } else {
+ // throw error?
+ // Since encodingVersion is <= 0 (CDR_ENC_VERSION).
+ }
+ }
+ }
+ return Message.CDR_ENC_VERSION; // default
+ }
+
+ /**
+ * 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.
+ */
+ public static String repositoryIdOf(String name)
+ {
+ String id;
+
+ id = (String) exceptionRepositoryIds.get(name);
+ if (id == null)
+ id = "IDL:omg.org/CORBA/UNKNOWN:1.0";
+
+ return id;
+ }
+
+ private static final Hashtable exceptionClassNames = new Hashtable();
+ private static final Hashtable exceptionRepositoryIds = new Hashtable();
+
+ static {
+
+ //
+ // 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");
+
+ // 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");
+
+ // from portability RTF 98-07-01.txt
+ 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");
+
+ // 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");
+
+ // 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");
+
+ //
+ // construct className -> repositoryId hashtable
+ //
+ Enumeration keys = exceptionClassNames.keys();
+ java.lang.Object s;
+ String rId;
+ String cName;
+
+ try{
+ while (keys.hasMoreElements()) {
+ s = keys.nextElement();
+ rId = (String) s;
+ cName = (String) exceptionClassNames.get(rId);
+ exceptionRepositoryIds.put (cName, rId);
+ }
+ } 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.
+ */
+ 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
+ int start = 0;
+ for (; start < s.length && (s[start] < '0' || s[start] > '9'); ++start)
+ if (start == s.length) //no digit found
+ return new int[0];
+ int end = start + 1;
+ int size = 1;
+ for (; end < s.length; ++end)
+ if (s[end] == '.')
+ ++size;
+ else if (s[end] < '0' || s[end] > '9')
+ break;
+ int[] val = new int[size];
+ for (int i = 0; i < size; ++i) {
+ int dot = version.indexOf('.', start);
+ if (dot == -1 || dot > end)
+ dot = end;
+ if (start >= dot) //cases like "n." or "n..m"
+ val[i] = 0; //convert equivalent to "n.0" or "n.0.m"
+ else
+ 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.
+ */
+ public static int compareVersion(int[] v1, int[] v2) {
+ if (v1 == null)
+ v1 = new int[0];
+ if (v2 == null)
+ v2 = new int[0];
+ for (int i = 0; i < v1.length; ++i) {
+ if (i >= v2.length || v1[i] > v2[i]) //v1 is longer or greater than v2
+ return 1;
+ if (v1[i] < v2[i])
+ return -1;
+ }
+ 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.
+ */
+ public static synchronized int compareVersion(String v1, String v2) {
+ return compareVersion(parseVersion(v1), parseVersion(v2));
+ }
+
+ private static String compressClassName( String name )
+ {
+ // Note that this must end in . in order to be renamed correctly.
+ String prefix = "com.sun.corba.se." ;
+ if (name.startsWith( prefix ) ) {
+ return "(ORB)." + name.substring( prefix.length() ) ;
+ } else
+ return name ;
+ }
+
+ // 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 )
+ {
+ if (thr == null)
+ return "null" ;
+
+ // This depends on the formatting in SelectReaderThread and CorbaConnectionImpl.
+ // Pattern for SelectReaderThreads:
+ // SelectReaderThread CorbaConnectionImpl[ <host> <post> <state>]
+ // Any other pattern in the Thread's name is just returned.
+ 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<numTokens; ctr++ )
+ tokens[ctr] = st.nextToken() ;
+
+ if( !tokens[0].equals("SelectReaderThread"))
+ return name ;
+
+ return "SelectReaderThread[" + tokens[2] + ":" + tokens[3] + "]" ;
+ }
+
+ 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:" ) ;
+ // 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] ) ) ;
+ }
+ }
+
+ //
+ // 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);
+ }
+
+ public static synchronized void dprint(String className, String msg) {
+ System.out.println(
+ compressClassName( className ) + "(" +
+ getThreadName( Thread.currentThread() ) + "): " + msg);
+ }
+
+ public synchronized void dprint(String msg) {
+ ORBUtility.dprint(this, msg);
+ }
+
+ public static synchronized void dprintTrace(Object obj, String msg) {
+ ORBUtility.dprint(obj, msg);
+
+ 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);
+
+ if (t != null)
+ printStackTrace( t.getStackTrace() ) ;
+ }
+
+ public static String[] concatenateStringArrays( String[] arr1, String[] arr2 )
+ {
+ String[] result = new String[
+ arr1.length + arr2.length ] ;
+
+ for (int ctr = 0; ctr<arr1.length; ctr++)
+ result[ctr] = arr1[ctr] ;
+
+ for (int ctr = 0; ctr<arr2.length; ctr++)
+ result[ctr + arr1.length] = arr2[ctr] ;
+
+ 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:
+ *
+ * 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.
+ */
+ public static void throwNotSerializableForCorba(String className) {
+ throw omgWrapper.notSerializable( CompletionStatus.COMPLETED_MAYBE,
+ className ) ;
+ }
+
+ /**
+ * Returns the maximum stream format version supported by our
+ * ValueHandler.
+ */
+ public static byte getMaxStreamFormatVersion() {
+ ValueHandler vh;
+ try {
+ vh = AccessController.doPrivileged(new PrivilegedExceptionAction<ValueHandler>() {
+ public ValueHandler run() throws Exception {
+ return Util.createValueHandler();
+ }
+ });
+ } catch (PrivilegedActionException e) {
+ throw new InternalError(e.getCause());
+ }
+
+ if (!(vh instanceof javax.rmi.CORBA.ValueHandlerMultiFormat))
+ return ORBConstants.STREAM_FORMAT_VERSION_1;
+ else
+ return ((ValueHandlerMultiFormat)vh).getMaximumStreamFormatVersion();
+ }
+
+ public static CorbaClientDelegate makeClientDelegate( IOR ior )
+ {
+ ORB orb = ior.getORB() ;
+ CorbaContactInfoList ccil = orb.getCorbaContactInfoListFactory().create( ior ) ;
+ CorbaClientDelegate del = orb.getClientDelegateFactory().create(ccil);
+ return del ;
+ }
+
+ /** This method is used to create untyped object references.
+ */
+ public static org.omg.CORBA.Object makeObjectReference( IOR ior )
+ {
+ CorbaClientDelegate del = makeClientDelegate( ior ) ;
+ org.omg.CORBA.Object objectImpl = new CORBAObjectImpl() ;
+ StubAdapter.setDelegate( objectImpl, del ) ;
+ return objectImpl ;
+ }
+
+ /** This method obtains an IOR from a CORBA object reference.
+ * It will return null if obj is a local object, a null object,
+ * or an object implemented by a different ORB. It will
+ * throw BAD_OPERATION if obj is an unconnected RMI-IIOP object.
+ * @return IOR the IOR that represents this objref. This will
+ * never be null.
+ * @exception BAD_OPERATION (from oi._get_delegate) if obj is a
+ * normal objref, but does not have a delegate set.
+ * @exception BAD_PARAM if obj is a local object, or else was
+ * created by a foreign ORB.
+ */
+ public static IOR getIOR( org.omg.CORBA.Object obj )
+ {
+ if (obj == null)
+ throw wrapper.nullObjectReference() ;
+
+ IOR ior = null ;
+ if (StubAdapter.isStub(obj)) {
+ org.omg.CORBA.portable.Delegate del = StubAdapter.getDelegate(
+ obj ) ;
+
+ if (del instanceof CorbaClientDelegate) {
+ CorbaClientDelegate cdel = (CorbaClientDelegate)del ;
+ ContactInfoList cil = cdel.getContactInfoList() ;
+
+ if (cil instanceof CorbaContactInfoList) {
+ CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
+ ior = ccil.getTargetIOR() ;
+ if (ior == null)
+ throw wrapper.nullIor() ;
+
+ return ior ;
+ } else {
+ // This is our code, but the ContactInfoList is not a
+ // CorbaContactInfoList. This should not happen, because
+ // we are in the CORBA application of the DCSA framework.
+ // This is a coding error, and thus an INTERNAL exception
+ // should be thrown.
+ // XXX needs minor code
+ throw new INTERNAL() ;
+ }
+ }
+
+ // obj is implemented by a foreign ORB, because the Delegate is not a
+ // ClientDelegate.
+ // XXX this case could be handled by marshalling and
+ // unmarshalling. However, object_to_string cannot be used
+ // here, as it is implemented with getIOR. Note that this
+ // will require access to an ORB, so that we can create streams
+ // as needed. The ORB is available simply as io._orb().
+ throw wrapper.objrefFromForeignOrb() ;
+ } else
+ throw wrapper.localObjectNotAllowed() ;
+ }
+
+ /** Obtains an IOR for the object reference obj, first connecting it to
+ * the ORB if necessary.
+ * @return IOR the IOR that represents this objref. This will
+ * never be null.
+ * @exception BAD_OPERATION if the object could not be connected,
+ * if a connection attempt was needed.
+ * @exception BAD_PARAM if obj is a local object, or else was
+ * created by a foreign ORB.
+ */
+ public static IOR connectAndGetIOR( ORB orb, org.omg.CORBA.Object obj )
+ {
+ IOR result ;
+ try {
+ result = getIOR( obj ) ;
+ } catch (BAD_OPERATION bop) {
+ if (StubAdapter.isStub(obj)) {
+ try {
+ StubAdapter.connect( obj, orb ) ;
+ } catch (java.rmi.RemoteException exc) {
+ throw wrapper.connectingServant( exc ) ;
+ }
+ } else {
+ orb.connect( obj ) ;
+ }
+
+ result = getIOR( obj ) ;
+ }
+
+ return result ;
+ }
+
+ public static String operationNameAndRequestId(CorbaMessageMediator m)
+ {
+ return "op/" + m.getOperationName() + " id/" + m.getRequestId();
+ }
+
+ public static boolean isPrintable(char c)
+ {
+ if (Character.isJavaIdentifierStart(c)) {
+ // Letters and $ _
+ return true;
+ }
+ if (Character.isDigit(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; // ) ] }
+ }
+ return false;
+ }
+
+ public static String getClassSecurityInfo(final Class cl)
+ {
+ // Returns a String which looks similar to:
+ // PermissionCollection java.security.Permissions@1053693 ...
+ // (java.io.FilePermission <<ALL FILES>> ....)
+ // (java.io.FilePermission /export0/sunwappserv/lib/- ...)
+ // ... other permissions ...
+ // Domain ProtectionDomain (file:/export0/sunwappserv/lib-)
+ // java.security.Permissions@141fedb (
+ // (java.io.FilePermission <<ALL FILES>> ...)
+ // (java.io.FilePermission /var/tmp//- ...)
+
+ String result =
+ (String)AccessController.doPrivileged(new PrivilegedAction() {
+ public java.lang.Object run() {
+ StringBuffer sb = new StringBuffer(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;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java
new file mode 100644
index 0000000..8a4fdc0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClassUtil_1_3.java
@@ -0,0 +1,558 @@
+/*
+ * Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+// for computing the structural UID
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.DigestOutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedAction;
+import java.io.DataOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Array;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
+
+
+import com.sun.corba.se.impl.io.ObjectStreamClass;
+
+public final class ObjectStreamClassUtil_1_3 {
+
+ // maintained here for backward compatability with JDK 1.3, where
+ // writeObject method was not being checked at all, so there is
+ // no need to lookup the ObjectStreamClass
+
+ public static long computeSerialVersionUID(final Class cl) {
+
+ long csuid = ObjectStreamClass.getSerialVersionUID(cl);
+ if (csuid == 0)
+ return csuid; // for non-serializable/proxy classes
+
+ csuid = (ObjectStreamClassUtil_1_3.getSerialVersion(csuid, cl).longValue());
+ return csuid;
+ }
+
+
+ // to maintain same suid as the JDK 1.3, we pick
+ // up suid only for classes with private,static,final
+ // declarations, and compute it for all others
+
+ private static Long getSerialVersion(final long csuid, final Class cl)
+ {
+ return (Long) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ long suid;
+ try {
+ final Field f = cl.getDeclaredField("serialVersionUID");
+ int mods = f.getModifiers();
+ if (Modifier.isStatic(mods) &&
+ Modifier.isFinal(mods) && Modifier.isPrivate(mods)) {
+ suid = csuid;
+ } else {
+ suid = _computeSerialVersionUID(cl);
+ }
+ } catch (NoSuchFieldException ex) {
+ suid = _computeSerialVersionUID(cl);
+ //} catch (IllegalAccessException ex) {
+ // suid = _computeSerialVersionUID(cl);
+ }
+ return new Long(suid);
+ }
+ });
+ }
+
+ public static long computeStructuralUID(boolean hasWriteObject, Class<?> cl) {
+ ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
+
+ long h = 0;
+ try {
+
+ if ((!java.io.Serializable.class.isAssignableFrom(cl)) ||
+ (cl.isInterface())){
+ return 0;
+ }
+
+ if (java.io.Externalizable.class.isAssignableFrom(cl)) {
+ return 1;
+ }
+
+ MessageDigest md = MessageDigest.getInstance("SHA");
+ DigestOutputStream mdo = new DigestOutputStream(devnull, md);
+ DataOutputStream data = new DataOutputStream(mdo);
+
+ //In the old case, for the caller class, the write Method wasn't considered
+ // for rep-id calculations correctly, but for parent classes it was taken
+ // into account. That is the reason there is the klude of getting the write
+ // Object method in there
+
+ // Get SUID of parent
+ Class<?> parent = cl.getSuperclass();
+ if ((parent != null) && (parent != java.lang.Object.class)) {
+ boolean hasWriteObjectFlag = false;
+ Class [] args = {java.io.ObjectOutputStream.class};
+ Method hasWriteObjectMethod = ObjectStreamClassUtil_1_3.getDeclaredMethod(parent, "writeObject", args,
+ Modifier.PRIVATE, Modifier.STATIC);
+ if (hasWriteObjectMethod != null)
+ hasWriteObjectFlag = true;
+ data.writeLong(ObjectStreamClassUtil_1_3.computeStructuralUID(hasWriteObjectFlag, parent));
+ }
+
+ if (hasWriteObject)
+ data.writeInt(2);
+ else
+ data.writeInt(1);
+
+ /* Sort the field names to get a deterministic order */
+ Field[] field = ObjectStreamClassUtil_1_3.getDeclaredFields(cl);
+ Arrays.sort(field, compareMemberByName);
+
+ for (int i = 0; i < field.length; i++) {
+ Field f = field[i];
+
+ /* Include in the hash all fields except those that are
+ * transient or static.
+ */
+ int m = f.getModifiers();
+ if (Modifier.isTransient(m) || Modifier.isStatic(m))
+ continue;
+
+ data.writeUTF(f.getName());
+ data.writeUTF(getSignature(f.getType()));
+ }
+
+ /* 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);
+ for (int i = minimum; i > 0; i--) {
+ h += (long)(hasharray[i] & 255) << (i * 8);
+ }
+ } catch (IOException ignore) {
+ /* can't happen, but be deterministic anyway. */
+ h = -1;
+ } catch (NoSuchAlgorithmException complain) {
+ throw new SecurityException(complain.getMessage());
+ }
+ return h;
+ }
+
+ /*
+ * 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) {
+ ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
+
+ long h = 0;
+ try {
+ MessageDigest md = MessageDigest.getInstance("SHA");
+ DigestOutputStream mdo = new DigestOutputStream(devnull, md);
+ DataOutputStream data = new DataOutputStream(mdo);
+
+
+ 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.
+ * Previously this hack was previously present in the VM.
+ */
+ Method[] method = cl.getDeclaredMethods();
+ if ((classaccess & Modifier.INTERFACE) != 0) {
+ classaccess &= (~Modifier.ABSTRACT);
+ if (method.length > 0) {
+ classaccess |= Modifier.ABSTRACT;
+ }
+ }
+
+ data.writeInt(classaccess);
+
+ /*
+ * Get the list of interfaces supported,
+ * Accumulate their names their names in Lexical order
+ * and add them to the hash
+ */
+ if (!cl.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.
+ */
+
+ Class interfaces[] = cl.getInterfaces();
+ Arrays.sort(interfaces, compareClassByName);
+
+ for (int i = 0; i < interfaces.length; i++) {
+ data.writeUTF(interfaces[i].getName());
+ }
+ }
+
+ /* Sort the field names to get a deterministic order */
+ Field[] field = cl.getDeclaredFields();
+ Arrays.sort(field, compareMemberByName);
+
+ 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.
+ */
+ int m = f.getModifiers();
+ if (Modifier.isPrivate(m) &&
+ (Modifier.isTransient(m) || Modifier.isStatic(m)))
+ continue;
+
+ data.writeUTF(f.getName());
+ data.writeInt(m);
+ data.writeUTF(getSignature(f.getType()));
+ }
+
+ // need to find the java replacement for hasStaticInitializer
+ if (hasStaticInitializer(cl)) {
+ data.writeUTF("<clinit>");
+ data.writeInt(Modifier.STATIC); // TBD: what modifiers does it have
+ 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
+ */
+
+ MethodSignature[] constructors =
+ MethodSignature.removePrivateAndSort(cl.getDeclaredConstructors());
+ for (int i = 0; i < constructors.length; i++) {
+ MethodSignature c = constructors[i];
+ String mname = "<init>";
+ String desc = c.signature;
+ desc = desc.replace('/', '.');
+ data.writeUTF(mname);
+ data.writeInt(c.member.getModifiers());
+ data.writeUTF(desc);
+ }
+
+ /* 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 m = methods[i];
+ String desc = m.signature;
+ desc = desc.replace('/', '.');
+ data.writeUTF(m.member.getName());
+ data.writeInt(m.member.getModifiers());
+ data.writeUTF(desc);
+ }
+
+ /* 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);
+ }
+ } catch (IOException ignore) {
+ /* can't happen, but be deterministic anyway. */
+ h = -1;
+ } catch (NoSuchAlgorithmException complain) {
+ throw new SecurityException(complain.getMessage());
+ }
+ return h;
+ }
+
+ /*
+ * Comparator object for Classes and Interfaces
+ */
+ private static Comparator compareClassByName =
+ new CompareClassByName();
+
+ private static class CompareClassByName implements Comparator {
+ public int compare(Object o1, Object o2) {
+ Class c1 = (Class)o1;
+ Class c2 = (Class)o2;
+ return (c1.getName()).compareTo(c2.getName());
+ }
+ }
+
+ /*
+ * Comparator object for Members, Fields, and Methods
+ */
+ private static Comparator compareMemberByName =
+ new CompareMemberByName();
+
+ private static class CompareMemberByName implements Comparator {
+ public int compare(Object o1, Object o2) {
+ String s1 = ((Member)o1).getName();
+ String s2 = ((Member)o2).getName();
+
+ if (o1 instanceof Method) {
+ s1 += getSignature((Method)o1);
+ s2 += getSignature((Method)o2);
+ } else if (o1 instanceof Constructor) {
+ s1 += getSignature((Constructor)o1);
+ s2 += getSignature((Constructor)o2);
+ }
+ return s1.compareTo(s2);
+ }
+ }
+
+ /**
+ * Compute the JVM signature for the class.
+ */
+ private static String getSignature(Class clazz) {
+ String type = null;
+ if (clazz.isArray()) {
+ Class cl = clazz;
+ int dimensions = 0;
+ while (cl.isArray()) {
+ dimensions++;
+ cl = cl.getComponentType();
+ }
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < dimensions; i++) {
+ sb.append("[");
+ }
+ sb.append(getSignature(cl));
+ type = sb.toString();
+ } else if (clazz.isPrimitive()) {
+ if (clazz == Integer.TYPE) {
+ type = "I";
+ } else if (clazz == Byte.TYPE) {
+ type = "B";
+ } else if (clazz == Long.TYPE) {
+ type = "J";
+ } else if (clazz == Float.TYPE) {
+ type = "F";
+ } else if (clazz == Double.TYPE) {
+ type = "D";
+ } else if (clazz == Short.TYPE) {
+ type = "S";
+ } else if (clazz == Character.TYPE) {
+ type = "C";
+ } else if (clazz == Boolean.TYPE) {
+ type = "Z";
+ } else if (clazz == Void.TYPE) {
+ type = "V";
+ }
+ } else {
+ type = "L" + clazz.getName().replace('.', '/') + ";";
+ }
+ return type;
+ }
+
+ /*
+ * Compute the JVM method descriptor for the method.
+ */
+ private static String getSignature(Method meth) {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("(");
+
+ Class[] params = meth.getParameterTypes(); // avoid clone
+ for (int j = 0; j < params.length; j++) {
+ sb.append(getSignature(params[j]));
+ }
+ sb.append(")");
+ sb.append(getSignature(meth.getReturnType()));
+ return sb.toString();
+ }
+
+ /*
+ * Compute the JVM constructor descriptor for the constructor.
+ */
+ private static String getSignature(Constructor cons) {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("(");
+
+ Class[] params = cons.getParameterTypes(); // avoid clone
+ for (int j = 0; j < params.length; j++) {
+ sb.append(getSignature(params[j]));
+ }
+ sb.append(")V");
+ return sb.toString();
+ }
+
+ private static Field[] getDeclaredFields(final Class clz) {
+ return (Field[]) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return clz.getDeclaredFields();
+ }
+ });
+ }
+
+ private static class MethodSignature implements Comparator {
+ Member member;
+ 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.*/
+ static MethodSignature[] removePrivateAndSort(Member[] m) {
+ int numNonPrivate = 0;
+ for (int i = 0; i < m.length; i++) {
+ 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())) {
+ cm[cmi] = new MethodSignature(m[i]);
+ cmi++;
+ }
+ }
+ if (cmi > 0)
+ Arrays.sort(cm, cm[0]);
+ return cm;
+ }
+
+ /* Assumes that o1 and o2 are either both methods
+ or both constructors.*/
+ public int compare(Object o1, Object o2) {
+ /* Arrays.sort calls compare when o1 and o2 are equal.*/
+ if (o1 == o2)
+ return 0;
+
+ MethodSignature c1 = (MethodSignature)o1;
+ MethodSignature c2 = (MethodSignature)o2;
+
+ int result;
+ if (isConstructor()) {
+ result = c1.signature.compareTo(c2.signature);
+ } else { // is a Method.
+ result = c1.member.getName().compareTo(c2.member.getName());
+ if (result == 0)
+ result = c1.signature.compareTo(c2.signature);
+ }
+ return result;
+ }
+
+ final private boolean isConstructor() {
+ return member instanceof Constructor;
+ }
+ private MethodSignature(Member m) {
+ member = m;
+ if (isConstructor()) {
+ signature = ObjectStreamClassUtil_1_3.getSignature((Constructor)m);
+ } else {
+ signature = ObjectStreamClassUtil_1_3.getSignature((Method)m);
+ }
+ }
+ }
+
+ /* Find out if the class has a static class initializer <clinit> */
+ // use java.io.ObjectStream's hasStaticInitializer method
+ // private static native boolean hasStaticInitializer(Class cl);
+
+ private static Method hasStaticInitializerMethod = null;
+ /**
+ * Returns true if the given class defines a static initializer method,
+ * false otherwise.
+ */
+ private static boolean hasStaticInitializer(Class cl) {
+ if (hasStaticInitializerMethod == null) {
+ Class classWithThisMethod = null;
+
+ try {
+ if (classWithThisMethod == null)
+ classWithThisMethod = java.io.ObjectStreamClass.class;
+
+ hasStaticInitializerMethod =
+ classWithThisMethod.getDeclaredMethod("hasStaticInitializer",
+ new Class[] { Class.class });
+ } catch (NoSuchMethodException ex) {
+ }
+
+ if (hasStaticInitializerMethod == null) {
+ throw new InternalError("Can't find hasStaticInitializer method on "
+ + classWithThisMethod.getName());
+ }
+ hasStaticInitializerMethod.setAccessible(true);
+ }
+ try {
+ Boolean retval = (Boolean)
+ hasStaticInitializerMethod.invoke(null, new Object[] { cl });
+ return retval.booleanValue();
+ } catch (Exception ex) {
+ throw new InternalError("Error invoking hasStaticInitializer: "
+ + ex);
+ }
+ }
+
+ private static Method getDeclaredMethod(final Class cl, final String methodName, final Class[] args,
+ final int requiredModifierMask,
+ final int disallowedModifierMask) {
+ return (Method) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ Method method = null;
+ try {
+ method =
+ cl.getDeclaredMethod(methodName, args);
+ int mods = method.getModifiers();
+ if ((mods & disallowedModifierMask) != 0 ||
+ (mods & requiredModifierMask) != requiredModifierMask) {
+ method = null;
+ }
+ //if (!Modifier.isPrivate(mods) ||
+ // Modifier.isStatic(mods)) {
+ // method = null;
+ //}
+ } catch (NoSuchMethodException e) {
+ // Since it is alright if methodName does not exist,
+ // no need to do anything special here.
+ }
+ return method;
+ }
+ });
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java
new file mode 100644
index 0000000..5188975
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamClass_1_3_1.java
@@ -0,0 +1,1262 @@
+/*
+ * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+import java.security.DigestOutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedExceptionAction;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedAction;
+
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Member;
+import java.lang.reflect.Method;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Proxy;
+import java.lang.reflect.InvocationTargetException;
+
+import java.io.IOException;
+import java.io.DataOutputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.InvalidClassException;
+import java.io.Serializable;
+import java.io.Externalizable;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.Hashtable;
+
+import org.omg.CORBA.ValueMember;
+
+import com.sun.corba.se.impl.io.ValueUtility;
+import com.sun.corba.se.impl.io.ObjectStreamClass;
+
+/**
+ * This is duplicated here to preserve the JDK 1.3.1FCS behavior
+ * of calculating the OMG hash code incorrectly when serialPersistentFields
+ * is used, but some of the fields no longer exist in the class itself.
+ *
+ * We have to duplicate it since we aren't allowed to modify the
+ * com.sun.corba.se.impl.io version further, and can't make it
+ * public outside of its package for security reasons.
+ */
+/**
+ * A ObjectStreamClass_1_3_1 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.
+ * <br>
+ * The ObjectStreamClass_1_3_1 for a specific class loaded in this Java VM can
+ * be found using the lookup method.
+ *
+ * @author Roger Riggs
+ * @since JDK1.1
+ */
+public class ObjectStreamClass_1_3_1 implements java.io.Serializable {
+
+ public static final long kDefaultUID = -1;
+
+ private static Object noArgsList[] = {};
+ private static Class<?> noTypesList[] = {};
+
+ private static Hashtable translatedFields;
+
+ /** 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.
+ */
+ static final ObjectStreamClass_1_3_1 lookup(Class<?> cl)
+ {
+ ObjectStreamClass_1_3_1 desc = lookupInternal(cl);
+ if (desc.isSerializable() || desc.isExternalizable())
+ return desc;
+ return null;
+ }
+
+ /*
+ * Find the class descriptor for the specified class.
+ * Package access only so it can be called from ObjectIn/OutStream.
+ */
+ static ObjectStreamClass_1_3_1 lookupInternal(Class<?> cl)
+ {
+ /* Synchronize on the hashtable so no two threads will do
+ * this at the same time.
+ */
+ ObjectStreamClass_1_3_1 desc = null;
+ synchronized (descriptorFor) {
+ /* Find the matching descriptor if it already known */
+ desc = findDescriptorFor(cl);
+ if (desc != null) {
+ return desc;
+ }
+
+ /* Check if it's serializable */
+ boolean serializable = Serializable.class.isAssignableFrom(cl);
+ /* If the class is only Serializable,
+ * lookup the descriptor for the superclass.
+ */
+ ObjectStreamClass_1_3_1 superdesc = null;
+ if (serializable) {
+ Class<?> superclass = cl.getSuperclass();
+ if (superclass != null)
+ 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.
+ */
+ boolean externalizable = false;
+ if (serializable) {
+ externalizable =
+ ((superdesc != null) && superdesc.isExternalizable()) ||
+ Externalizable.class.isAssignableFrom(cl);
+ if (externalizable) {
+ serializable = false;
+ }
+ }
+
+ /* Create a new version descriptor,
+ * it put itself in the known table.
+ */
+ desc = new ObjectStreamClass_1_3_1(cl, superdesc,
+ serializable, externalizable);
+ }
+ desc.init();
+ return desc;
+ }
+
+ /**
+ * The name of the class described by this descriptor.
+ */
+ public final String getName() {
+ return name;
+ }
+
+ /**
+ * 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.
+ */
+ public static final long getSerialVersionUID( java.lang.Class<?> clazz) {
+ ObjectStreamClass_1_3_1 theosc = ObjectStreamClass_1_3_1.lookup( clazz );
+ if( theosc != null )
+ {
+ 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.
+ */
+ public final long getSerialVersionUID() {
+ return suid;
+ }
+
+ /**
+ * 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.
+ */
+ public final String getSerialVersionUIDStr() {
+ if (suidStr == null)
+ suidStr = Long.toHexString(suid).toUpperCase();
+ return suidStr;
+ }
+
+ /**
+ * Return the actual (computed) serialVersionUID for this class.
+ */
+ public static final long getActualSerialVersionUID( java.lang.Class<?> clazz )
+ {
+ ObjectStreamClass_1_3_1 theosc = ObjectStreamClass_1_3_1.lookup( clazz );
+ if( theosc != null )
+ {
+ return theosc.getActualSerialVersionUID( );
+ }
+ return 0;
+ }
+
+ /**
+ * Return the actual (computed) serialVersionUID for this class.
+ */
+ public final long getActualSerialVersionUID() {
+ return actualSuid;
+ }
+
+ /**
+ * Return the actual (computed) serialVersionUID for this class.
+ */
+ public final String getActualSerialVersionUIDStr() {
+ if (actualSuidStr == null)
+ actualSuidStr = Long.toHexString(actualSuid).toUpperCase();
+ return actualSuidStr;
+ }
+
+ /**
+ * Return the class in the local VM that this version is mapped to.
+ * Null is returned if there is no corresponding local class.
+ */
+ public final Class<?> forClass() {
+ return ofClass;
+ }
+
+ /**
+ * 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
+ * there are no fields.
+ * @since JDK1.2
+ */
+ public ObjectStreamField[] getFields() {
+ // Return a copy so the caller can't change the fields.
+ if (fields.length > 0) {
+ ObjectStreamField[] dup = new ObjectStreamField[fields.length];
+ System.arraycopy(fields, 0, dup, 0, fields.length);
+ return dup;
+ } else {
+ return fields;
+ }
+ }
+
+ public boolean hasField(ValueMember field){
+
+ for (int i = 0; i < fields.length; i++){
+ try{
+ if (fields[i].getName().equals(field.name)) {
+
+ if (fields[i].getSignature().equals(ValueUtility.getSignature(field)))
+ return true;
+ }
+ }
+ catch(Throwable t){}
+ }
+ return false;
+ }
+
+ /* Avoid unnecessary allocations. */
+ final ObjectStreamField[] getFieldsNoCopy() {
+ return fields;
+ }
+
+ /**
+ * Get the field of this class by name.
+ * @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.
+ */
+ for (int i = fields.length-1; i >= 0; i--) {
+ if (name.equals(fields[i].getName())) {
+ return fields[i];
+ }
+ }
+ return null;
+ }
+
+ public Serializable writeReplace(Serializable value) {
+ if (writeReplaceObjectMethod != null) {
+ try {
+ return (Serializable) writeReplaceObjectMethod.invoke(value,noArgsList);
+ }
+ catch(Throwable t) {
+ throw new RuntimeException(t.getMessage());
+ }
+ }
+ else return value;
+ }
+
+ public Object readResolve(Object value) {
+ if (readResolveObjectMethod != null) {
+ try {
+ return readResolveObjectMethod.invoke(value,noArgsList);
+ }
+ catch(Throwable t) {
+ throw new RuntimeException(t.getMessage());
+ }
+ }
+ else return value;
+ }
+
+ /**
+ * Return a string describing this ObjectStreamClass_1_3_1.
+ */
+ public final String toString() {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append(name);
+ sb.append(": static final long serialVersionUID = ");
+ sb.append(Long.toString(suid));
+ sb.append("L;");
+ return sb.toString();
+ }
+
+ /*
+ * Create a new ObjectStreamClass_1_3_1 from a loaded class.
+ * Don't call this directly, call lookup instead.
+ */
+ private ObjectStreamClass_1_3_1(java.lang.Class<?> cl, ObjectStreamClass_1_3_1 superdesc,
+ boolean serial, boolean extern)
+ {
+ ofClass = cl; /* created from this class */
+
+ if (Proxy.isProxyClass(cl)) {
+ forProxyClass = true;
+ }
+
+ name = cl.getName();
+ superclass = superdesc;
+ serializable = serial;
+ if (!forProxyClass) {
+ // proxy classes are never externalizable
+ externalizable = extern;
+ }
+
+ /*
+ * 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.
+ */
+ insertDescriptorFor(this);
+
+ /*
+ * The remainder of initialization occurs in init(), which is called
+ * after the lock on the global class descriptor table has been
+ * released.
+ */
+ }
+
+ /*
+ * Initialize class descriptor. This method is only invoked on class
+ * descriptors created via calls to lookupInternal(). This method is kept
+ * separate from the ObjectStreamClass_1_3_1 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).
+ */
+
+
+ private void init() {
+ synchronized (lock) {
+
+ final Class<?> cl = ofClass;
+
+ if (fields != null) // already initialized
+ return;
+
+
+ if (!serializable ||
+ externalizable ||
+ forProxyClass ||
+ name.equals("java.lang.String")) {
+ fields = NO_FIELDS;
+ } else if (serializable) {
+
+ /* 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.
+ */
+ try {
+ Field pf = cl.getDeclaredField("serialPersistentFields");
+ // serial bug 7; the serialPersistentFields were not
+ // being read and stored as Accessible bit was not set
+ pf.setAccessible(true);
+ // serial bug 7; need to find if the field is of type
+ // java.io.ObjectStreamField
+ java.io.ObjectStreamField[] f =
+ (java.io.ObjectStreamField[])pf.get(cl);
+ int mods = pf.getModifiers();
+ if ((Modifier.isPrivate(mods)) &&
+ (Modifier.isStatic(mods)) &&
+ (Modifier.isFinal(mods)))
+ {
+ fields = (ObjectStreamField[])translateFields((Object[])pf.get(cl));
+ }
+ } catch (NoSuchFieldException e) {
+ fields = null;
+ } catch (IllegalAccessException e) {
+ fields = null;
+ } catch (IllegalArgumentException e) {
+ fields = null;
+ } catch (ClassCastException e) {
+ /* Thrown if a field serialPersistentField exists
+ * but it is not of type ObjectStreamField.
+ */
+ fields = null;
+ }
+
+
+ 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.
+ */
+ Field[] actualfields = cl.getDeclaredFields();
+
+ int numFields = 0;
+ ObjectStreamField[] tempFields =
+ new ObjectStreamField[actualfields.length];
+ for (int i = 0; i < actualfields.length; i++) {
+ int modifiers = actualfields[i].getModifiers();
+ if (!Modifier.isStatic(modifiers) &&
+ !Modifier.isTransient(modifiers)) {
+ tempFields[numFields++] =
+ new ObjectStreamField(actualfields[i]);
+ }
+ }
+ fields = new ObjectStreamField[numFields];
+ System.arraycopy(tempFields, 0, fields, 0, numFields);
+
+ } else {
+ // 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_1_3_1 for that field.
+ for (int j = fields.length-1; j >= 0; j--) {
+ try {
+ Field reflField = cl.getDeclaredField(fields[j].getName());
+ if (fields[j].getType() == reflField.getType()) {
+ // reflField.setAccessible(true);
+ fields[j].setField(reflField);
+ }
+ } catch (NoSuchFieldException e) {
+ // Nothing to do
+ }
+ }
+ }
+ return null;
+ }
+ });
+
+ if (fields.length > 1)
+ Arrays.sort(fields);
+
+ /* Set up field data for use while writing using the API api. */
+ computeFieldInfo();
+ }
+
+ /* 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.
+ */
+ if (isNonSerializable()) {
+ 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
+ suid = 0L;
+ } else {
+ 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) ) {
+ f.setAccessible(true);
+ suid = f.getLong(cl);
+ // get rid of native code
+ // suid = getSerialVersionUIDField(cl);
+ // SerialBug 2: should be computed after writeObject
+ // actualSuid = computeStructuralUID(cl);
+ } else {
+ suid = ObjectStreamClass.getSerialVersionUID(cl);
+ // SerialBug 2: should be computed after writeObject
+ // actualSuid = computeStructuralUID(cl);
+ }
+ } catch (NoSuchFieldException ex) {
+ suid = ObjectStreamClass.getSerialVersionUID(cl);
+ // SerialBug 2: should be computed after writeObject
+ // actualSuid = computeStructuralUID(cl);
+ } catch (IllegalAccessException ex) {
+ suid = ObjectStreamClass.getSerialVersionUID(cl);
+ }
+ }
+
+
+ try {
+ writeReplaceObjectMethod = cl.getDeclaredMethod("writeReplace", noTypesList);
+ if (Modifier.isStatic(writeReplaceObjectMethod.getModifiers())) {
+ writeReplaceObjectMethod = null;
+ } else {
+ writeReplaceObjectMethod.setAccessible(true);
+ }
+
+ } catch (NoSuchMethodException e2) {
+
+ }
+
+ try {
+ readResolveObjectMethod = cl.getDeclaredMethod("readResolve", noTypesList);
+ if (Modifier.isStatic(readResolveObjectMethod.getModifiers())) {
+ readResolveObjectMethod = null;
+ } else {
+ readResolveObjectMethod.setAccessible(true);
+ }
+
+ } catch (NoSuchMethodException e2) {
+
+ }
+
+ /* Cache lookup of writeObject and readObject for
+ * Serializable classes. (Do not lookup for
+ * Externalizable)
+ */
+
+ if (serializable && !forProxyClass) {
+
+ /* Look for the writeObject method
+ * Set the accessible flag on it here. ObjectOutputStream
+ * will call it as necessary.
+ */
+ try {
+ Class<?>[] args = {java.io.ObjectOutputStream.class};
+ writeObjectMethod = cl.getDeclaredMethod("writeObject", args);
+ hasWriteObjectMethod = true;
+ int mods = writeObjectMethod.getModifiers();
+
+ // Method must be private and non-static
+ if (!Modifier.isPrivate(mods) ||
+ Modifier.isStatic(mods)) {
+ writeObjectMethod = null;
+ hasWriteObjectMethod = false;
+ }
+
+ } catch (NoSuchMethodException e) {
+ }
+
+ /* Look for the readObject method
+ * set the access override and save the reference for
+ * ObjectInputStream so it can all the method directly.
+ */
+ try {
+ Class<?>[] args = {java.io.ObjectInputStream.class};
+ readObjectMethod = cl.getDeclaredMethod("readObject", args);
+ int mods = readObjectMethod.getModifiers();
+
+ // Method must be private and non-static
+ if (!Modifier.isPrivate(mods) ||
+ Modifier.isStatic(mods)) {
+ readObjectMethod = null;
+ }
+ } catch (NoSuchMethodException e) {
+ }
+ // Compute the structural UID. This must be done after the
+ // calculation for writeObject. Fixed 4/20/2000, eea1
+ // SerialBug 2: to have correct value in RepId
+ }
+ return null;
+ }
+ });
+ }
+
+ actualSuid = computeStructuralUID(this, cl);
+ }
+
+ }
+
+ /*
+ * Create an empty ObjectStreamClass_1_3_1 for a class about to be read.
+ * This is separate from read so ObjectInputStream can assign the
+ * wire handle early, before any nested ObjectStreamClass_1_3_1 might
+ * be read.
+ */
+ ObjectStreamClass_1_3_1(String n, long s) {
+ name = n;
+ suid = s;
+ superclass = null;
+ }
+
+ private static Object[] translateFields(Object objs[])
+ throws NoSuchFieldException {
+ try{
+ java.io.ObjectStreamField fields[] = (java.io.ObjectStreamField[])objs;
+ Object translation[] = null;
+
+ if (translatedFields == null)
+ translatedFields = new Hashtable();
+
+ translation = (Object[])translatedFields.get(fields);
+
+ if (translation != null)
+ return translation;
+ else {
+ Class<?> osfClass = com.sun.corba.se.impl.orbutil.ObjectStreamField.class;
+
+ translation = (Object[])java.lang.reflect.Array.newInstance(osfClass, objs.length);
+ Object arg[] = new Object[2];
+ Class<?> types[] = {String.class, Class.class};
+ Constructor constructor = osfClass.getDeclaredConstructor(types);
+ for (int i = fields.length -1; i >= 0; i--){
+ arg[0] = fields[i].getName();
+ arg[1] = fields[i].getType();
+
+ translation[i] = constructor.newInstance(arg);
+ }
+ translatedFields.put(fields, translation);
+
+ }
+
+ return (Object[])translation;
+ }
+ catch(Throwable t){
+ throw new NoSuchFieldException();
+ }
+ }
+
+ /* Compare the base class names of streamName and localName.
+ *
+ * @return Return true iff the base class name compare.
+ * @param streamName Fully qualified class name.
+ * @param localName Fully qualified class name.
+ * @param pkgSeparator class names use either '.' or '/'.
+ *
+ * Only compare base class name to allow package renaming.
+ */
+ 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)
+ streamNameIndex = 0;
+
+ int localNameIndex = localName.lastIndexOf(pkgSeparator);
+ if (localNameIndex < 0)
+ localNameIndex = 0;
+
+ 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
+ */
+ final boolean typeEquals(ObjectStreamClass_1_3_1 other) {
+ return (suid == other.suid) &&
+ compareClassNames(name, other.name, '.');
+ }
+
+ /*
+ * Return the superclass descriptor of this descriptor.
+ */
+ final void setSuperclass(ObjectStreamClass_1_3_1 s) {
+ superclass = s;
+ }
+
+ /*
+ * Return the superclass descriptor of this descriptor.
+ */
+ final ObjectStreamClass_1_3_1 getSuperclass() {
+ return superclass;
+ }
+
+ /*
+ * Return whether the class has a writeObject method
+ */
+ final boolean hasWriteObject() {
+ return hasWriteObjectMethod;
+ }
+
+ final boolean isCustomMarshaled() {
+ return (hasWriteObject() || isExternalizable());
+ }
+
+ /*
+ * Return true if all instances of 'this' Externalizable class
+ * are written in block-data mode from the stream that 'this' was read
+ * from. <p>
+ *
+ * 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.
+ *
+ * @see ObjectOutputStream#useProtocolVersion
+ * @see ObjectStreamConstants#PROTOCOL_VERSION_1
+ * @see ObjectStreamConstants#PROTOCOL_VERSION_2
+ *
+ * @since JDK 1.2
+ */
+ boolean hasExternalizableBlockDataMode() {
+ return hasExternalizableBlockData;
+ }
+
+ /*
+ * Return the ObjectStreamClass_1_3_1 of the local class this one is based on.
+ */
+ final ObjectStreamClass_1_3_1 localClassDescriptor() {
+ return localClassDesc;
+ }
+
+ /*
+ * Get the Serializability of the class.
+ */
+ boolean isSerializable() {
+ return serializable;
+ }
+
+ /*
+ * Get the externalizability of the class.
+ */
+ boolean isExternalizable() {
+ return externalizable;
+ }
+
+ boolean isNonSerializable() {
+ 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.
+ */
+ private void computeFieldInfo() {
+ primBytes = 0;
+ objFields = 0;
+
+ for (int i = 0; i < fields.length; i++ ) {
+ switch (fields[i].getTypeCode()) {
+ case 'B':
+ case 'Z':
+ primBytes += 1;
+ break;
+ case 'C':
+ case 'S':
+ primBytes += 2;
+ break;
+
+ case 'I':
+ case 'F':
+ primBytes += 4;
+ break;
+ case 'J':
+ case 'D' :
+ primBytes += 8;
+ break;
+
+ case 'L':
+ case '[':
+ objFields += 1;
+ break;
+ }
+ }
+ }
+
+ private static long computeStructuralUID(ObjectStreamClass_1_3_1 osc, Class<?> cl) {
+ ByteArrayOutputStream devnull = new ByteArrayOutputStream(512);
+
+ long h = 0;
+ try {
+
+ if ((!java.io.Serializable.class.isAssignableFrom(cl)) ||
+ (cl.isInterface())){
+ return 0;
+ }
+
+ if (java.io.Externalizable.class.isAssignableFrom(cl)) {
+ return 1;
+ }
+
+ MessageDigest md = MessageDigest.getInstance("SHA");
+ DigestOutputStream mdo = new DigestOutputStream(devnull, md);
+ DataOutputStream data = new DataOutputStream(mdo);
+
+ // Get SUID of parent
+ Class<?> parent = cl.getSuperclass();
+ if ((parent != null))
+ // SerialBug 1; acc. to spec the one for
+ // java.lang.object
+ // should be computed and put
+ // && (parent != java.lang.Object.class))
+ {
+ //data.writeLong(computeSerialVersionUID(null,parent));
+ data.writeLong(computeStructuralUID(lookup(parent), parent));
+ }
+
+ if (osc.hasWriteObject())
+ data.writeInt(2);
+ else
+ data.writeInt(1);
+
+ /* Sort the field names to get a deterministic order */
+ // Field[] field = ObjectStreamClass_1_3_1.getDeclaredFields(cl);
+
+ ObjectStreamField[] fields = osc.getFields();
+
+ // Must make sure that the Field array we allocate
+ // below is exactly the right size. Bug fix for
+ // 4397133.
+ int numNonNullFields = 0;
+ for (int i = 0; i < fields.length; i++)
+ if (fields[i].getField() != null)
+ numNonNullFields++;
+
+ Field [] field = new java.lang.reflect.Field[numNonNullFields];
+ for (int i = 0, fieldNum = 0; i < fields.length; i++) {
+ if (fields[i].getField() != null) {
+ field[fieldNum++] = fields[i].getField();
+ }
+ }
+
+ if (field.length > 1)
+ Arrays.sort(field, compareMemberByName);
+
+ for (int i = 0; i < field.length; i++) {
+ Field f = field[i];
+
+ /* Include in the hash all fields except those that are
+ * transient
+ */
+ int m = f.getModifiers();
+ //Serial 6
+ //if (Modifier.isTransient(m) || Modifier.isStatic(m))
+ // spec reference 00-01-06.pdf, 1.3.5.6, states non-static
+ // non-transient, public fields are mapped to Java IDL.
+ //
+ // Here's the quote from the first paragraph:
+ // Java non-static non-transient public fields are mapped to
+ // OMG IDL public data members, and other Java fields are
+ // not mapped.
+
+ // if (Modifier.isTransient(m) || Modifier.isStatic(m))
+ // continue;
+
+ data.writeUTF(f.getName());
+ data.writeUTF(getSignature(f.getType()));
+ }
+
+ /* 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 = 0; i < Math.min(8, hasharray.length); i++) {
+ h += (long)(hasharray[i] & 255) << (i * 8);
+ }
+ } catch (IOException ignore) {
+ /* can't happen, but be deterministic anyway. */
+ h = -1;
+ } catch (NoSuchAlgorithmException complain) {
+ throw new SecurityException(complain.getMessage());
+ }
+ return h;
+ }
+
+ /**
+ * Compute the JVM signature for the class.
+ */
+ static String getSignature(Class<?> clazz) {
+ String type = null;
+ if (clazz.isArray()) {
+ Class<?> cl = clazz;
+ int dimensions = 0;
+ while (cl.isArray()) {
+ dimensions++;
+ cl = cl.getComponentType();
+ }
+ StringBuffer sb = new StringBuffer();
+ for (int i = 0; i < dimensions; i++) {
+ sb.append("[");
+ }
+ sb.append(getSignature(cl));
+ type = sb.toString();
+ } else if (clazz.isPrimitive()) {
+ if (clazz == Integer.TYPE) {
+ type = "I";
+ } else if (clazz == Byte.TYPE) {
+ type = "B";
+ } else if (clazz == Long.TYPE) {
+ type = "J";
+ } else if (clazz == Float.TYPE) {
+ type = "F";
+ } else if (clazz == Double.TYPE) {
+ type = "D";
+ } else if (clazz == Short.TYPE) {
+ type = "S";
+ } else if (clazz == Character.TYPE) {
+ type = "C";
+ } else if (clazz == Boolean.TYPE) {
+ type = "Z";
+ } else if (clazz == Void.TYPE) {
+ type = "V";
+ }
+ } else {
+ type = "L" + clazz.getName().replace('.', '/') + ";";
+ }
+ return type;
+ }
+
+ /*
+ * Compute the JVM method descriptor for the method.
+ */
+ static String getSignature(Method meth) {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("(");
+
+ Class<?>[] params = meth.getParameterTypes(); // avoid clone
+ for (int j = 0; j < params.length; j++) {
+ sb.append(getSignature(params[j]));
+ }
+ sb.append(")");
+ sb.append(getSignature(meth.getReturnType()));
+ return sb.toString();
+ }
+
+ /*
+ * Compute the JVM constructor descriptor for the constructor.
+ */
+ static String getSignature(Constructor cons) {
+ StringBuffer sb = new StringBuffer();
+
+ sb.append("(");
+
+ Class<?>[] params = cons.getParameterTypes(); // avoid clone
+ for (int j = 0; j < params.length; j++) {
+ sb.append(getSignature(params[j]));
+ }
+ sb.append(")V");
+ return sb.toString();
+ }
+
+ /*
+ * Cache of Class -> ClassDescriptor Mappings.
+ */
+ static private ObjectStreamClassEntry[] descriptorFor = new ObjectStreamClassEntry[61];
+
+ /*
+ * findDescriptorFor a Class. This looks in the cache for a
+ * mapping from Class -> ObjectStreamClass mappings. The hashCode
+ * of the Class is used for the lookup since the Class is the key.
+ * The entries are extended from java.lang.ref.SoftReference so the
+ * gc will be able to free them if needed.
+ */
+ private static ObjectStreamClass_1_3_1 findDescriptorFor(Class<?> cl) {
+
+ int hash = cl.hashCode();
+ int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
+ ObjectStreamClassEntry e;
+ ObjectStreamClassEntry prev;
+
+ /* Free any initial entries whose refs have been cleared */
+ while ((e = descriptorFor[index]) != null && e.get() == null) {
+ descriptorFor[index] = e.next;
+ }
+
+ /* Traverse the chain looking for a descriptor with ofClass == cl.
+ * unlink entries that are unresolved.
+ */
+ prev = e;
+ while (e != null ) {
+ ObjectStreamClass_1_3_1 desc = (ObjectStreamClass_1_3_1)(e.get());
+ if (desc == null) {
+ // This entry has been cleared, unlink it
+ prev.next = e.next;
+ } else {
+ if (desc.ofClass == cl)
+ return desc;
+ prev = e;
+ }
+ e = e.next;
+ }
+ return null;
+ }
+
+ /*
+ * insertDescriptorFor a Class -> ObjectStreamClass_1_3_1 mapping.
+ */
+ private static void insertDescriptorFor(ObjectStreamClass_1_3_1 desc) {
+ // Make sure not already present
+ if (findDescriptorFor(desc.ofClass) != null) {
+ return;
+ }
+
+ int hash = desc.ofClass.hashCode();
+ int index = (hash & 0x7FFFFFFF) % descriptorFor.length;
+ ObjectStreamClassEntry e = new ObjectStreamClassEntry(desc);
+ e.next = descriptorFor[index];
+ descriptorFor[index] = e;
+ }
+
+ private static Field[] getDeclaredFields(final Class clz) {
+ return (Field[]) AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ return clz.getDeclaredFields();
+ }
+ });
+ }
+
+
+ /*
+ * The name of this descriptor
+ */
+ private String name;
+
+ /*
+ * The descriptor of the supertype.
+ */
+ private ObjectStreamClass_1_3_1 superclass;
+
+ /*
+ * Flags for Serializable and Externalizable.
+ */
+ private boolean serializable;
+ private boolean externalizable;
+
+ /*
+ * Array of persistent fields of this class, sorted by
+ * type and name.
+ */
+ private ObjectStreamField[] fields;
+
+ /*
+ * Class that is a descriptor for in this virtual machine.
+ */
+ private Class<?> ofClass;
+
+ /*
+ * True if descriptor for a proxy class.
+ */
+ boolean forProxyClass;
+
+
+ /*
+ * SerialVersionUID for this class.
+ */
+ private long suid = kDefaultUID;
+ private String suidStr = null;
+
+ /*
+ * Actual (computed) SerialVersionUID for this class.
+ */
+ private long actualSuid = kDefaultUID;
+ private String actualSuidStr = null;
+
+ /*
+ * The total number of bytes of primitive fields.
+ * The total number of object fields.
+ */
+ int primBytes;
+ int objFields;
+
+ /* Internal lock object. */
+ private Object lock = new Object();
+
+ /* True if this class has/had a writeObject method */
+ private boolean hasWriteObjectMethod;
+
+ /* 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
+ */
+ private boolean hasExternalizableBlockData;
+ Method writeObjectMethod;
+ Method readObjectMethod;
+ private transient Method writeReplaceObjectMethod;
+ private transient Method readResolveObjectMethod;
+
+ /*
+ * ObjectStreamClass_1_3_1 that this one was built from.
+ */
+ private ObjectStreamClass_1_3_1 localClassDesc;
+
+ /* Get the private static final field for serial version UID */
+ // private static native long getSerialVersionUIDField(Class cl);
+
+ /** use serialVersionUID from JDK 1.1. for interoperability */
+ private static final long serialVersionUID = -6120832682080437368L;
+
+ /**
+ * 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];
+
+ /*
+ * Entries held in the Cache of known ObjectStreamClass_1_3_1 objects.
+ * Entries are chained together with the same hash value (modulo array size).
+ */
+ private static class ObjectStreamClassEntry // extends java.lang.ref.SoftReference
+ {
+ ObjectStreamClassEntry(ObjectStreamClass_1_3_1 c) {
+ //super(c);
+ this.c = c;
+ }
+ ObjectStreamClassEntry next;
+
+ public Object get()
+ {
+ return c;
+ }
+ private ObjectStreamClass_1_3_1 c;
+ }
+
+ /*
+ * Comparator object for Classes and Interfaces
+ */
+ private static Comparator compareClassByName =
+ new CompareClassByName();
+
+ private static class CompareClassByName implements Comparator {
+ public int compare(Object o1, Object o2) {
+ Class<?> c1 = (Class)o1;
+ Class<?> c2 = (Class)o2;
+ return (c1.getName()).compareTo(c2.getName());
+ }
+ }
+
+ /*
+ * Comparator object for Members, Fields, and Methods
+ */
+ private static Comparator compareMemberByName =
+ new CompareMemberByName();
+
+ private static class CompareMemberByName implements Comparator {
+ public int compare(Object o1, Object o2) {
+ String s1 = ((Member)o1).getName();
+ String s2 = ((Member)o2).getName();
+
+ if (o1 instanceof Method) {
+ s1 += getSignature((Method)o1);
+ s2 += getSignature((Method)o2);
+ } else if (o1 instanceof Constructor) {
+ 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 {
+ Member member;
+ 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.*/
+ static MethodSignature[] removePrivateAndSort(Member[] m) {
+ int numNonPrivate = 0;
+ for (int i = 0; i < m.length; i++) {
+ 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())) {
+ cm[cmi] = new MethodSignature(m[i]);
+ cmi++;
+ }
+ }
+ if (cmi > 0)
+ Arrays.sort(cm, cm[0]);
+ return cm;
+ }
+
+ /* Assumes that o1 and o2 are either both methods
+ or both constructors.*/
+ public int compare(Object o1, Object o2) {
+ /* Arrays.sort calls compare when o1 and o2 are equal.*/
+ if (o1 == o2)
+ return 0;
+
+ MethodSignature c1 = (MethodSignature)o1;
+ MethodSignature c2 = (MethodSignature)o2;
+
+ int result;
+ if (isConstructor()) {
+ result = c1.signature.compareTo(c2.signature);
+ } else { // is a Method.
+ result = c1.member.getName().compareTo(c2.member.getName());
+ if (result == 0)
+ result = c1.signature.compareTo(c2.signature);
+ }
+ return result;
+ }
+
+ final private boolean isConstructor() {
+ return member instanceof Constructor;
+ }
+ private MethodSignature(Member m) {
+ member = m;
+ if (isConstructor()) {
+ signature = ObjectStreamClass_1_3_1.getSignature((Constructor)m);
+ } else {
+ signature = ObjectStreamClass_1_3_1.getSignature((Method)m);
+ }
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamField.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamField.java
new file mode 100644
index 0000000..e86b268
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectStreamField.java
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import java.lang.reflect.Field;
+import java.lang.Comparable;
+import java.util.Hashtable;
+
+/**
+ * This is duplicated here somewhat in haste since we can't
+ * expose this class outside of the com.sun.corba.se.impl.io
+ * package for security reasons.
+ */
+/**
+ * A description of a field in a serializable class.
+ * A array of these is used to declare the persistent fields of
+ * a class.
+ *
+ */
+class ObjectStreamField implements Comparable {
+ /**
+ * Create a named field with the specified type.
+ */
+ ObjectStreamField(String n, Class clazz) {
+ name = n;
+ this.clazz = clazz;
+
+ // Compute the typecode for easy switching
+ if (clazz.isPrimitive()) {
+ if (clazz == Integer.TYPE) {
+ type = 'I';
+ } else if (clazz == Byte.TYPE) {
+ type = 'B';
+ } else if (clazz == Long.TYPE) {
+ type = 'J';
+ } else if (clazz == Float.TYPE) {
+ type = 'F';
+ } else if (clazz == Double.TYPE) {
+ type = 'D';
+ } else if (clazz == Short.TYPE) {
+ type = 'S';
+ } else if (clazz == Character.TYPE) {
+ type = 'C';
+ } else if (clazz == Boolean.TYPE) {
+ type = 'Z';
+ }
+ } else if (clazz.isArray()) {
+ type = '[';
+ typeString = ObjectStreamClass_1_3_1.getSignature(clazz);
+ } else {
+ type = 'L';
+ typeString = ObjectStreamClass_1_3_1.getSignature(clazz);
+ }
+
+ if (typeString != null)
+ signature = typeString;
+ else
+ signature = String.valueOf(type);
+
+ }
+
+ ObjectStreamField(Field field) {
+ this(field.getName(), field.getType());
+ this.field = field;
+ }
+
+ /**
+ * Create an ObjectStreamField containing a reflected Field.
+ */
+ ObjectStreamField(String n, char t, Field f, String ts)
+ {
+ name = n;
+ type = t;
+ field = f;
+ typeString = ts;
+
+ if (typeString != null)
+ signature = typeString;
+ else
+ signature = String.valueOf(type);
+
+ }
+
+ /**
+ * Get the name of this field.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Get the type of the field.
+ */
+ public Class getType() {
+ if (clazz != null)
+ return clazz;
+ switch (type) {
+ case 'B': clazz = Byte.TYPE;
+ break;
+ case 'C': clazz = Character.TYPE;
+ break;
+ case 'S': clazz = Short.TYPE;
+ break;
+ case 'I': clazz = Integer.TYPE;
+ break;
+ case 'J': clazz = Long.TYPE;
+ break;
+ case 'F': clazz = Float.TYPE;
+ break;
+ case 'D': clazz = Double.TYPE;
+ break;
+ case 'Z': clazz = Boolean.TYPE;
+ break;
+ case '[':
+ case 'L':
+ clazz = Object.class;
+ break;
+ }
+
+ return clazz;
+ }
+
+ public char getTypeCode() {
+ return type;
+ }
+
+ public String getTypeString() {
+ return typeString;
+ }
+
+ Field getField() {
+ return field;
+ }
+
+ void setField(Field field) {
+ this.field = field;
+ this.fieldID = -1;
+ }
+
+ /*
+ * Default constructor creates an empty field.
+ * Usually used just to get to the sort functions.
+ */
+ ObjectStreamField() {
+ }
+
+ /**
+ * test if this field is a primitive or not.
+ */
+ public boolean isPrimitive() {
+ return (type != '[' && type != 'L');
+ }
+
+ /**
+ * 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.
+ */
+ public int compareTo(Object o) {
+ ObjectStreamField f2 = (ObjectStreamField)o;
+ boolean thisprim = (this.typeString == null);
+ boolean otherprim = (f2.typeString == null);
+
+ if (thisprim != otherprim) {
+ return (thisprim ? -1 : 1);
+ }
+ return this.name.compareTo(f2.name);
+ }
+
+ /**
+ * 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.
+ */
+ public boolean typeEquals(ObjectStreamField other) {
+ if (other == null || type != other.type)
+ return false;
+
+ /* Return true if the primitive types matched */
+ if (typeString == null && other.typeString == null)
+ return true;
+
+ return ObjectStreamClass_1_3_1.compareClassNames(typeString,
+ other.typeString,
+ '/');
+ }
+
+ /* Returns the signature of the Field.
+ *
+ */
+ public String getSignature() {
+
+ return signature;
+
+ }
+
+ /**
+ * Return a string describing this field.
+ */
+ public String toString() {
+ if (typeString != null)
+ return typeString + " " + name;
+ else
+ return type + " " + name;
+ }
+
+ public Class getClazz() {
+ return clazz;
+ }
+
+ /* Returns the Field ID
+ * NOT USED, since this class is used only in ObjectStreamClass_1_3_1,
+ * which is used only in RepositoryId_1_3_1.
+ public long getFieldID( Class cl ) {
+ if (fieldID == -1) {
+ if (typeString != null)
+ fieldID = getFieldIDNative( cl, getName(), typeString );
+ else
+ fieldID = getFieldIDNative( cl, getName(), getSignature() );
+ }
+ 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
+
+ // the next 3 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
+ // essentially we can use the java.io.ObjectStreamField as such.
+
+ private String signature; // the signature of the field
+ private long fieldID = -1;
+ // private static native long getFieldIDNative(Class c, String fieldName, String fieldSig);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java
new file mode 100644
index 0000000..237ef22
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectUtility.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Map;
+import java.util.List;
+import java.util.ListIterator;
+import java.util.Set;
+import java.util.Map.Entry;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Iterator;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.IdentityHashMap;
+import java.lang.reflect.Array;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.math.BigInteger ;
+import java.math.BigDecimal ;
+
+public final class ObjectUtility {
+ private ObjectUtility() {}
+
+
+ /** If arr1 and arr2 are both arrays of the same component type,
+ * return an array of that component type that consists of the
+ * elements of arr1 followed by the elements of arr2.
+ * Throws IllegalArgumentException otherwise.
+ */
+ public static Object concatenateArrays( Object arr1, Object arr2 )
+ {
+ Class comp1 = arr1.getClass().getComponentType() ;
+ Class comp2 = arr2.getClass().getComponentType() ;
+ int len1 = Array.getLength( arr1 ) ;
+ int len2 = Array.getLength( arr2 ) ;
+
+ if ((comp1 == null) || (comp2 == null))
+ throw new IllegalStateException( "Arguments must be arrays" ) ;
+ if (!comp1.equals( comp2 ))
+ throw new IllegalStateException(
+ "Arguments must be arrays with the same component type" ) ;
+
+ Object result = Array.newInstance( comp1, len1 + len2 ) ;
+
+ int index = 0 ;
+
+ for (int ctr=0; ctr<len1; ctr++)
+ Array.set( result, index++, Array.get( arr1, ctr ) ) ;
+
+ for (int ctr=0; ctr<len2; ctr++)
+ Array.set( result, index++, Array.get( arr2, ctr ) ) ;
+
+ return result ;
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectWriter.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectWriter.java
new file mode 100644
index 0000000..6115e08
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/ObjectWriter.java
@@ -0,0 +1,216 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil ;
+
+import java.util.Arrays ;
+
+public abstract class ObjectWriter {
+ public static ObjectWriter make( boolean isIndenting,
+ int initialLevel, int increment )
+ {
+ if (isIndenting)
+ return new IndentingObjectWriter( initialLevel, increment ) ;
+ else
+ return new SimpleObjectWriter() ;
+ }
+
+ public abstract void startObject( Object obj ) ;
+
+ public abstract void startElement() ;
+
+ public abstract void endElement() ;
+
+ public abstract void endObject( String str ) ;
+
+ public abstract void endObject() ;
+
+ public String toString() { return result.toString() ; }
+
+ public void append( boolean arg ) { result.append( arg ) ; }
+
+ public void append( char arg ) { result.append( arg ) ; }
+
+ public void append( short arg ) { result.append( arg ) ; }
+
+ public void append( int arg ) { result.append( arg ) ; }
+
+ public void append( long arg ) { result.append( arg ) ; }
+
+ public void append( float arg ) { result.append( arg ) ; }
+
+ public void append( double arg ) { result.append( arg ) ; }
+
+ public void append( String arg ) { result.append( arg ) ; }
+
+//=================================================================================================
+// Implementation
+//=================================================================================================
+
+ protected StringBuffer result ;
+
+ protected ObjectWriter()
+ {
+ result = new StringBuffer() ;
+ }
+
+ protected void appendObjectHeader( Object obj )
+ {
+ result.append( obj.getClass().getName() ) ;
+ result.append( "<" ) ;
+ result.append( System.identityHashCode( obj ) ) ;
+ result.append( ">" ) ;
+ Class compClass = obj.getClass().getComponentType() ;
+
+ if (compClass != null) {
+ result.append( "[" ) ;
+ if (compClass == boolean.class) {
+ boolean[] arr = (boolean[])obj ;
+ result.append( arr.length ) ;
+ result.append( "]" ) ;
+ } else if (compClass == byte.class) {
+ byte[] arr = (byte[])obj ;
+ result.append( arr.length ) ;
+ result.append( "]" ) ;
+ } else if (compClass == short.class) {
+ short[] arr = (short[])obj ;
+ result.append( arr.length ) ;
+ result.append( "]" ) ;
+ } else if (compClass == int.class) {
+ int[] arr = (int[])obj ;
+ result.append( arr.length ) ;
+ result.append( "]" ) ;
+ } else if (compClass == long.class) {
+ long[] arr = (long[])obj ;
+ result.append( arr.length ) ;
+ result.append( "]" ) ;
+ } else if (compClass == char.class) {
+ char[] arr = (char[])obj ;
+ result.append( arr.length ) ;
+ result.append( "]" ) ;
+ } else if (compClass == float.class) {
+ float[] arr = (float[])obj ;
+ result.append( arr.length ) ;
+ result.append( "]" ) ;
+ } else if (compClass == double.class) {
+ double[] arr = (double[])obj ;
+ result.append( arr.length ) ;
+ result.append( "]" ) ;
+ } else { // array of object
+ java.lang.Object[] arr = (java.lang.Object[])obj ;
+ result.append( arr.length ) ;
+ result.append( "]" ) ;
+ }
+ }
+
+ result.append( "(" ) ;
+ }
+
+ /** Expected patterns:
+ * startObject endObject( str )
+ * header( elem )\n
+ * startObject ( startElement append* endElement ) * endObject
+ * header(\n
+ * append*\n *
+ * )\n
+ */
+ private static class IndentingObjectWriter extends ObjectWriter {
+ private int level ;
+ private int increment ;
+
+ public IndentingObjectWriter( int initialLevel, int increment )
+ {
+ this.level = initialLevel ;
+ this.increment = increment ;
+ startLine() ;
+ }
+
+ private void startLine()
+ {
+ char[] fill = new char[ level * increment ] ;
+ Arrays.fill( fill, ' ' ) ;
+ result.append( fill ) ;
+ }
+
+ public void startObject( java.lang.Object obj )
+ {
+ appendObjectHeader( obj ) ;
+ level++ ;
+ }
+
+ public void startElement()
+ {
+ result.append( "\n" ) ;
+ startLine() ;
+ }
+
+ public void endElement()
+ {
+ }
+
+ public void endObject( String str )
+ {
+ level-- ;
+ result.append( str ) ;
+ result.append( ")" ) ;
+ }
+
+ public void endObject( )
+ {
+ level-- ;
+ result.append( "\n" ) ;
+ startLine() ;
+ result.append( ")" ) ;
+ }
+ }
+
+ private static class SimpleObjectWriter extends ObjectWriter {
+ public void startObject( java.lang.Object obj )
+ {
+ appendObjectHeader( obj ) ;
+ result.append( " " ) ;
+ }
+
+ public void startElement()
+ {
+ result.append( " " ) ;
+ }
+
+ public void endObject( String str )
+ {
+ result.append( str ) ;
+ result.append( ")" ) ;
+ }
+
+ public void endElement()
+ {
+ }
+
+ public void endObject()
+ {
+ result.append( ")" ) ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java
new file mode 100644
index 0000000..3251360
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepIdDelegator.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import org.omg.CORBA.ORB;
+import java.io.Serializable;
+import java.util.Hashtable;
+import com.sun.corba.se.impl.io.TypeMismatchException;
+import java.net.MalformedURLException;
+import com.sun.corba.se.impl.util.RepositoryId;
+
+/**
+ * Delegates to the current RepositoryId implementation in
+ * com.sun.corba.se.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
+{
+ // RepositoryIdFactory methods
+
+ public String createForAnyType(Class type) {
+ return RepositoryId.createForAnyType(type);
+ }
+
+ public String createForJavaType(Serializable ser)
+ throws TypeMismatchException
+ {
+ return RepositoryId.createForJavaType(ser);
+ }
+
+ public String createForJavaType(Class clz)
+ throws TypeMismatchException
+ {
+ return RepositoryId.createForJavaType(clz);
+ }
+
+ public String createSequenceRepID(java.lang.Object ser) {
+ return RepositoryId.createSequenceRepID(ser);
+ }
+
+ public String createSequenceRepID(Class clazz) {
+ return RepositoryId.createSequenceRepID(clazz);
+ }
+
+ public RepositoryIdInterface getFromString(String repIdString) {
+ return new RepIdDelegator(RepositoryId.cache.getId(repIdString));
+ }
+
+ // RepositoryIdUtility methods
+
+ public boolean isChunkedEncoding(int valueTag) {
+ return RepositoryId.isChunkedEncoding(valueTag);
+ }
+
+ public boolean isCodeBasePresent(int valueTag) {
+ return RepositoryId.isCodeBasePresent(valueTag);
+ }
+
+ public String getClassDescValueRepId() {
+ return RepositoryId.kClassDescValueRepID;
+ }
+
+ public String getWStringValueRepId() {
+ return RepositoryId.kWStringValueRepID;
+ }
+
+ public int getTypeInfo(int valueTag) {
+ return RepositoryId.getTypeInfo(valueTag);
+ }
+
+ public int getStandardRMIChunkedNoRepStrId() {
+ return RepositoryId.kPreComputed_StandardRMIChunked_NoRep;
+ }
+
+ public int getCodeBaseRMIChunkedNoRepStrId() {
+ return RepositoryId.kPreComputed_CodeBaseRMIChunked_NoRep;
+ }
+
+ public int getStandardRMIChunkedId() {
+ return RepositoryId.kPreComputed_StandardRMIChunked;
+ }
+
+ public int getCodeBaseRMIChunkedId() {
+ return RepositoryId.kPreComputed_CodeBaseRMIChunked;
+ }
+
+ public int getStandardRMIUnchunkedId() {
+ return RepositoryId.kPreComputed_StandardRMIUnchunked;
+ }
+
+ public int getCodeBaseRMIUnchunkedId() {
+ return RepositoryId.kPreComputed_CodeBaseRMIUnchunked;
+ }
+
+ public int getStandardRMIUnchunkedNoRepStrId() {
+ return RepositoryId.kPreComputed_StandardRMIUnchunked_NoRep;
+ }
+
+ public int getCodeBaseRMIUnchunkedNoRepStrId() {
+ return RepositoryId.kPreComputed_CodeBaseRMIUnchunked_NoRep;
+ }
+
+ // RepositoryIdInterface methods
+
+ public Class getClassFromType() throws ClassNotFoundException {
+ return delegate.getClassFromType();
+ }
+
+ public Class getClassFromType(String codebaseURL)
+ throws ClassNotFoundException, MalformedURLException
+ {
+ return delegate.getClassFromType(codebaseURL);
+ }
+
+ public Class getClassFromType(Class expectedType,
+ String codebaseURL)
+ throws ClassNotFoundException, MalformedURLException
+ {
+ return delegate.getClassFromType(expectedType, codebaseURL);
+ }
+
+ public String getClassName() {
+ return delegate.getClassName();
+ }
+
+ // Constructor used for factory/utility cases
+ public RepIdDelegator() {
+ this(null);
+ }
+
+ // Constructor used by getIdFromString. All non-static
+ // RepositoryId methods will use the provided delegate.
+ private RepIdDelegator(RepositoryId _delegate) {
+ this.delegate = _delegate;
+ }
+
+ private final RepositoryId delegate;
+
+ public String toString() {
+ if (delegate != null)
+ return delegate.toString();
+ else
+ return this.getClass().getName();
+ }
+
+ public boolean equals(Object obj) {
+ if (delegate != null)
+ return delegate.equals(obj);
+ else
+ return super.equals(obj);
+ }
+
+ public int hashCode() {
+ if (delegate != null) {
+ return delegate.hashCode();
+ } else {
+ return super.hashCode();
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java
new file mode 100644
index 0000000..5f3a237
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdFactory.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import com.sun.corba.se.spi.orb.ORBVersion;
+import com.sun.corba.se.spi.orb.ORB;
+
+public abstract class RepositoryIdFactory
+{
+ private static final RepIdDelegator currentDelegator
+ = new RepIdDelegator();
+
+ /**
+ * Returns the latest version RepositoryIdStrings instance
+ */
+ public static RepositoryIdStrings getRepIdStringsFactory()
+ {
+ return currentDelegator;
+ }
+
+ /**
+ * Returns the latest version RepositoryIdUtility instance
+ */
+ public static RepositoryIdUtility getRepIdUtility()
+ {
+ return currentDelegator;
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdInterface.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdInterface.java
new file mode 100644
index 0000000..eb34e06
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdInterface.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import org.omg.CORBA.ORB;
+import java.io.Serializable;
+import java.net.MalformedURLException;
+
+/**
+ * Methods on specific instances of RepositoryId. Hides
+ * versioning of our RepositoryId class.
+ */
+public interface RepositoryIdInterface
+{
+ Class getClassFromType() throws ClassNotFoundException;
+
+ Class getClassFromType(String codebaseURL)
+ throws ClassNotFoundException, MalformedURLException;
+
+ Class getClassFromType(Class expectedType,
+ String codebaseURL)
+ throws ClassNotFoundException, MalformedURLException;
+
+ String getClassName();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java
new file mode 100644
index 0000000..2337ab5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdStrings.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2000, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import java.io.Serializable;
+import com.sun.corba.se.impl.io.TypeMismatchException;
+
+/**
+ * Factory methods for creating various repository ID strings
+ * and instances.
+ */
+public interface RepositoryIdStrings
+{
+ String createForAnyType(Class type);
+
+ String createForJavaType(Serializable ser)
+ throws TypeMismatchException;
+
+ String createForJavaType(Class clz)
+ 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/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdUtility.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdUtility.java
new file mode 100644
index 0000000..4664347
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/RepositoryIdUtility.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil;
+
+import org.omg.CORBA.ORB;
+import com.sun.corba.se.impl.util.RepositoryId;
+
+/**
+ * Utility methods for working with repository IDs.
+ */
+public interface RepositoryIdUtility
+{
+ boolean isChunkedEncoding(int valueTag);
+ boolean isCodeBasePresent(int valueTag);
+
+ // These are currently the same in both RepositoryId and
+ // RepositoryId_1_3, but provide the constants again here
+ // to eliminate awkardness when using this interface.
+ int NO_TYPE_INFO = RepositoryId.kNoTypeInfo;
+ int SINGLE_REP_TYPE_INFO = RepositoryId.kSingleRepTypeInfo;
+ int PARTIAL_LIST_TYPE_INFO = RepositoryId.kPartialListTypeInfo;
+
+ // Determine how many (if any) repository IDs follow the value
+ // tag.
+ int getTypeInfo(int valueTag);
+
+ // Accessors for precomputed value tags
+ int getStandardRMIChunkedNoRepStrId();
+ int getCodeBaseRMIChunkedNoRepStrId();
+ int getStandardRMIChunkedId();
+ int getCodeBaseRMIChunkedId();
+ int getStandardRMIUnchunkedId();
+ int getCodeBaseRMIUnchunkedId();
+ int getStandardRMIUnchunkedNoRepStrId();
+ int getCodeBaseRMIUnchunkedNoRepStrId();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/StackImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/StackImpl.java
new file mode 100644
index 0000000..44228b3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/StackImpl.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil ;
+
+import java.util.EmptyStackException ;
+
+// We implement a Stack here instead of using java.util.Stack because
+// java.util.Stack is thread-safe, negatively impacting performance.
+// We use an ArrayList instead since it is not thread-safe.
+// RequestInfoStack is used quite frequently.
+public class StackImpl {
+ // The stack for RequestInfo objects.
+ private Object[] data = new Object[3] ;
+ private int top = -1 ;
+
+ // Tests if this stack is empty.
+ public final boolean empty() {
+ return top == -1;
+ }
+
+ // Looks at the object at the top of this stack without removing it
+ // from the stack.
+ public final Object peek() {
+ if (empty())
+ throw new EmptyStackException();
+
+ return data[ top ];
+ }
+
+ // Removes the object at the top of this stack and returns that
+ // object as the value of this function.
+ public final Object pop() {
+ Object obj = peek() ;
+ data[top] = null ;
+ top-- ;
+ return obj;
+ }
+
+ private void ensure()
+ {
+ if (top == (data.length-1)) {
+ int newSize = 2*data.length ;
+ Object[] newData = new Object[ newSize ] ;
+ System.arraycopy( data, 0, newData, 0, data.length ) ;
+ data = newData ;
+ }
+ }
+
+ // Pushes an item onto the top of the stack
+ public final Object push( Object item ) {
+ ensure() ;
+ top++ ;
+ data[top] = item;
+ return item;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Constant.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Constant.java
new file mode 100644
index 0000000..dbfb0eb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Constant.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.closure ;
+
+import com.sun.corba.se.spi.orbutil.closure.Closure ;
+
+public class Constant implements Closure {
+ private Object value ;
+
+ public Constant( Object value )
+ {
+ this.value = value ;
+ }
+
+ public Object evaluate()
+ {
+ return value ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Future.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Future.java
new file mode 100644
index 0000000..6527252
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/closure/Future.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.closure ;
+
+import com.sun.corba.se.spi.orbutil.closure.Closure ;
+
+public class Future implements Closure {
+ private boolean evaluated ;
+ private Closure closure ;
+ private Object value ;
+
+ public Future( Closure value )
+ {
+ this.evaluated = false ;
+ this.closure = (Closure)value ;
+ this.value = null ;
+ }
+
+ public synchronized Object evaluate()
+ {
+ if (!evaluated) {
+ evaluated = true ;
+ value = closure.evaluate() ;
+ }
+
+ return value ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/CondVar.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/CondVar.java
new file mode 100644
index 0000000..fb605b5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/CondVar.java
@@ -0,0 +1,340 @@
+/*
+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ File: ConditionVariable.java
+
+ Originally written by Doug Lea and released into the public domain.
+ This may be used for any purposes whatsoever without acknowledgment.
+ Thanks for the assistance and support of Sun Microsystems Labs,
+ and everyone contributing, testing, and using this code.
+
+ History:
+ Date Who What
+ 11Jun1998 dl Create public version
+ 08dec2001 kmc Added support for Reentrant Mutexes
+*/
+
+package com.sun.corba.se.impl.orbutil.concurrent;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+/**
+ * This class is designed for fans of POSIX pthreads programming.
+ * If you restrict yourself to Mutexes and CondVars, you can
+ * use most of your favorite constructions. Don't randomly mix them
+ * with synchronized methods or blocks though.
+ * <p>
+ * Method names and behavior are as close as is reasonable to
+ * those in POSIX.
+ * <p>
+ * <b>Sample Usage.</b> Here is a full version of a bounded buffer
+ * that implements the BoundedChannel interface, written in
+ * a style reminscent of that in POSIX programming books.
+ * <pre>
+ * class CVBuffer implements BoundedChannel {
+ * private final Mutex mutex;
+ * private final CondVar notFull;
+ * private final CondVar notEmpty;
+ * private int count = 0;
+ * private int takePtr = 0;
+ * private int putPtr = 0;
+ * private final Object[] array;
+ *
+ * public CVBuffer(int capacity) {
+ * array = new Object[capacity];
+ * mutex = new Mutex();
+ * notFull = new CondVar(mutex);
+ * notEmpty = new CondVar(mutex);
+ * }
+ *
+ * public int capacity() { return array.length; }
+ *
+ * public void put(Object x) throws InterruptedException {
+ * mutex.acquire();
+ * try {
+ * while (count == array.length) {
+ * notFull.await();
+ * }
+ * array[putPtr] = x;
+ * putPtr = (putPtr + 1) % array.length;
+ * ++count;
+ * notEmpty.signal();
+ * }
+ * finally {
+ * mutex.release();
+ * }
+ * }
+ *
+ * public Object take() throws InterruptedException {
+ * Object x = null;
+ * mutex.acquire();
+ * try {
+ * while (count == 0) {
+ * notEmpty.await();
+ * }
+ * x = array[takePtr];
+ * array[takePtr] = null;
+ * takePtr = (takePtr + 1) % array.length;
+ * --count;
+ * notFull.signal();
+ * }
+ * finally {
+ * mutex.release();
+ * }
+ * return x;
+ * }
+ *
+ * public boolean offer(Object x, long msecs) throws InterruptedException {
+ * mutex.acquire();
+ * try {
+ * if (count == array.length) {
+ * notFull.timedwait(msecs);
+ * if (count == array.length)
+ * return false;
+ * }
+ * array[putPtr] = x;
+ * putPtr = (putPtr + 1) % array.length;
+ * ++count;
+ * notEmpty.signal();
+ * return true;
+ * }
+ * finally {
+ * mutex.release();
+ * }
+ * }
+ *
+ * public Object poll(long msecs) throws InterruptedException {
+ * Object x = null;
+ * mutex.acquire();
+ * try {
+ * if (count == 0) {
+ * notEmpty.timedwait(msecs);
+ * if (count == 0)
+ * return null;
+ * }
+ * x = array[takePtr];
+ * array[takePtr] = null;
+ * takePtr = (takePtr + 1) % array.length;
+ * --count;
+ * notFull.signal();
+ * }
+ * finally {
+ * mutex.release();
+ * }
+ * return x;
+ * }
+ * }
+ *
+ * </pre>
+ * @see Mutex
+ * [<a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html"> Introduction to this package. </a>]
+ **/
+
+public class CondVar {
+
+ protected boolean debug_ ;
+
+ /** The mutex **/
+ protected final Sync mutex_;
+ protected final ReentrantMutex remutex_;
+
+ private int releaseMutex()
+ {
+ int count = 1 ;
+
+ if (remutex_!=null)
+ count = remutex_.releaseAll() ;
+ else
+ mutex_.release() ;
+
+ return count ;
+ }
+
+ private void acquireMutex( int count ) throws InterruptedException
+ {
+ if (remutex_!=null)
+ remutex_.acquireAll( count ) ;
+ else
+ mutex_.acquire() ;
+ }
+
+ /**
+ * Create a new CondVar that relies on the given mutual
+ * exclusion lock.
+ * @param mutex A mutual exclusion lock which must either be non-reentrant,
+ * or else be ReentrantMutex.
+ * Standard usage is to supply an instance of <code>Mutex</code>,
+ * but, for example, a Semaphore initialized to 1 also works.
+ * On the other hand, many other Sync implementations would not
+ * work here, so some care is required to supply a sensible
+ * synchronization object.
+ * In normal use, the mutex should be one that is used for <em>all</em>
+ * synchronization of the object using the CondVar. Generally,
+ * to prevent nested monitor lockouts, this
+ * object should not use any native Java synchronized blocks.
+ **/
+
+ public CondVar(Sync mutex, boolean debug) {
+ debug_ = debug ;
+ mutex_ = mutex;
+ if (mutex instanceof ReentrantMutex)
+ remutex_ = (ReentrantMutex)mutex;
+ else
+ remutex_ = null;
+ }
+
+ public CondVar( Sync mutex ) {
+ this( mutex, false ) ;
+ }
+
+ /**
+ * Wait for notification. This operation at least momentarily
+ * releases the mutex. The mutex is always held upon return,
+ * even if interrupted.
+ * @exception InterruptedException if the thread was interrupted
+ * before or during the wait. However, if the thread is interrupted
+ * after the wait but during mutex re-acquisition, the interruption
+ * is ignored, while still ensuring
+ * that the currentThread's interruption state stays true, so can
+ * be probed by callers.
+ **/
+ public void await() throws InterruptedException {
+ int count = 0 ;
+ if (Thread.interrupted())
+ throw new InterruptedException();
+
+ try {
+ if (debug_)
+ ORBUtility.dprintTrace( this, "await enter" ) ;
+
+ synchronized(this) {
+ count = releaseMutex() ;
+ try {
+ wait();
+ } catch (InterruptedException ex) {
+ notify();
+ throw ex;
+ }
+ }
+ } finally {
+ // Must ignore interrupt on re-acquire
+ boolean interrupted = false;
+ for (;;) {
+ try {
+ acquireMutex( count );
+ break;
+ } catch (InterruptedException ex) {
+ interrupted = true;
+ }
+ }
+
+ if (interrupted) {
+ Thread.currentThread().interrupt();
+ }
+
+ if (debug_)
+ ORBUtility.dprintTrace( this, "await exit" ) ;
+ }
+ }
+
+ /**
+ * Wait for at most msecs for notification.
+ * This operation at least momentarily
+ * releases the mutex. The mutex is always held upon return,
+ * even if interrupted.
+ * @param msecs The time to wait. A value less than or equal to zero
+ * causes a momentarily release
+ * and re-acquire of the mutex, and always returns false.
+ * @return false if at least msecs have elapsed
+ * upon resumption; else true. A
+ * false return does NOT necessarily imply that the thread was
+ * not notified. For example, it might have been notified
+ * after the time elapsed but just before resuming.
+ * @exception InterruptedException if the thread was interrupted
+ * before or during the wait.
+ **/
+
+ public boolean timedwait(long msecs) throws InterruptedException {
+
+ if (Thread.interrupted())
+ throw new InterruptedException();
+
+ boolean success = false;
+ int count = 0;
+
+ try {
+ if (debug_)
+ ORBUtility.dprintTrace( this, "timedwait enter" ) ;
+
+ synchronized(this) {
+ count = releaseMutex() ;
+ try {
+ if (msecs > 0) {
+ long start = System.currentTimeMillis();
+ wait(msecs);
+ success = System.currentTimeMillis() - start <= msecs;
+ }
+ } catch (InterruptedException ex) {
+ notify();
+ throw ex;
+ }
+ }
+ } finally {
+ // Must ignore interrupt on re-acquire
+ boolean interrupted = false;
+ for (;;) {
+ try {
+ acquireMutex( count ) ;
+ break;
+ } catch (InterruptedException ex) {
+ interrupted = true;
+ }
+ }
+
+ if (interrupted) {
+ Thread.currentThread().interrupt();
+ }
+
+ if (debug_)
+ ORBUtility.dprintTrace( this, "timedwait exit" ) ;
+ }
+ return success;
+ }
+
+ /**
+ * Notify a waiting thread.
+ * If one exists, a non-interrupted thread will return
+ * normally (i.e., not via InterruptedException) from await or timedwait.
+ **/
+ public synchronized void signal() {
+ notify();
+ }
+
+ /** Notify all waiting threads **/
+ public synchronized void broadcast() {
+ notifyAll();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/DebugMutex.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/DebugMutex.java
new file mode 100644
index 0000000..a35e6f8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/DebugMutex.java
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ File: Mutex.java
+
+ Originally written by Doug Lea and released into the public domain.
+ This may be used for any purposes whatsoever without acknowledgment.
+ Thanks for the assistance and support of Sun Microsystems Labs,
+ and everyone contributing, testing, and using this code.
+
+ History:
+ Date Who What
+ 11Jun1998 dl Create public version
+*/
+
+package com.sun.corba.se.impl.orbutil.concurrent;
+
+/**
+ * A simple non-reentrant mutual exclusion lock.
+ * The lock is free upon construction. Each acquire gets the
+ * lock, and each release frees it. Releasing a lock that
+ * is already free has no effect.
+ * <p>
+ * This implementation makes no attempt to provide any fairness
+ * or ordering guarantees. If you need them, consider using one of
+ * the Semaphore implementations as a locking mechanism.
+ * <p>
+ * <b>Sample usage</b><br>
+ * <p>
+ * Mutex can be useful in constructions that cannot be
+ * expressed using java synchronized blocks because the
+ * acquire/release pairs do not occur in the same method or
+ * code block. For example, you can use them for hand-over-hand
+ * locking across the nodes of a linked list. This allows
+ * extremely fine-grained locking, and so increases
+ * potential concurrency, at the cost of additional complexity and
+ * overhead that would normally make this worthwhile only in cases of
+ * extreme contention.
+ * <pre>
+ * class Node {
+ * Object item;
+ * Node next;
+ * Mutex lock = new Mutex(); // each node keeps its own lock
+ *
+ * Node(Object x, Node n) { item = x; next = n; }
+ * }
+ *
+ * class List {
+ * protected Node head; // pointer to first node of list
+ *
+ * // Use plain java synchronization to protect head field.
+ * // (We could instead use a Mutex here too but there is no
+ * // reason to do so.)
+ * protected synchronized Node getHead() { return head; }
+ *
+ * boolean search(Object x) throws InterruptedException {
+ * Node p = getHead();
+ * if (p == null) return false;
+ *
+ * // (This could be made more compact, but for clarity of illustration,
+ * // all of the cases that can arise are handled separately.)
+ *
+ * p.lock.acquire(); // Prime loop by acquiring first lock.
+ * // (If the acquire fails due to
+ * // interrupt, the method will throw
+ * // InterruptedException now,
+ * // so there is no need for any
+ * // further cleanup.)
+ * for (;;) {
+ * if (x.equals(p.item)) {
+ * p.lock.release(); // release current before return
+ * return true;
+ * }
+ * else {
+ * Node nextp = p.next;
+ * if (nextp == null) {
+ * p.lock.release(); // release final lock that was held
+ * return false;
+ * }
+ * else {
+ * try {
+ * nextp.lock.acquire(); // get next lock before releasing current
+ * }
+ * catch (InterruptedException ex) {
+ * p.lock.release(); // also release current if acquire fails
+ * throw ex;
+ * }
+ * p.lock.release(); // release old lock now that new one held
+ * p = nextp;
+ * }
+ * }
+ * }
+ * }
+ *
+ * synchronized void add(Object x) { // simple prepend
+ * // The use of `synchronized' here protects only head field.
+ * // The method does not need to wait out other traversers
+ * // who have already made it past head.
+ *
+ * head = new Node(x, head);
+ * }
+ *
+ * // ... other similar traversal and update methods ...
+ * }
+ * </pre>
+ * <p>
+ * <p>This version adds some debugging capability: it will detect an attempt by a thread
+ * that holds the lock to acquire it for a second time, and also an attempt by a thread that
+ * does not hold the mutex to release it.
+ * @see Semaphore
+ * <p>[<a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html"> Introduction to this package. </a>]
+**/
+
+import org.omg.CORBA.INTERNAL ;
+
+public class DebugMutex implements Sync {
+
+ /** The lock status **/
+ protected boolean inuse_ = false;
+ protected Thread holder_ = null;
+
+ public void acquire() throws InterruptedException {
+ if (Thread.interrupted()) throw new InterruptedException();
+ synchronized(this) {
+ Thread thr = Thread.currentThread();
+ if (holder_ == thr)
+ throw new INTERNAL(
+ "Attempt to acquire Mutex by thread holding the Mutex" ) ;
+
+ try {
+ while (inuse_) wait();
+ inuse_ = true;
+ holder_ = Thread.currentThread();
+ }
+ catch (InterruptedException ex) {
+ notify();
+ throw ex;
+ }
+ }
+ }
+
+ public synchronized void release() {
+ Thread thr = Thread.currentThread();
+ if (thr != holder_)
+ throw new INTERNAL(
+ "Attempt to release Mutex by thread not holding the Mutex" ) ;
+ holder_ = null;
+ inuse_ = false;
+ notify();
+ }
+
+
+ public boolean attempt(long msecs) throws InterruptedException {
+ if (Thread.interrupted()) throw new InterruptedException();
+ synchronized(this) {
+ Thread thr = Thread.currentThread() ;
+
+ if (!inuse_) {
+ inuse_ = true;
+ holder_ = thr;
+ return true;
+ } else if (msecs <= 0)
+ return false;
+ else {
+ long waitTime = msecs;
+ long start = System.currentTimeMillis();
+ try {
+ for (;;) {
+ wait(waitTime);
+ if (!inuse_) {
+ inuse_ = true;
+ holder_ = thr;
+ return true;
+ }
+ else {
+ waitTime = msecs - (System.currentTimeMillis() - start);
+ if (waitTime <= 0)
+ return false;
+ }
+ }
+ }
+ catch (InterruptedException ex) {
+ notify();
+ throw ex;
+ }
+ }
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Mutex.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Mutex.java
new file mode 100644
index 0000000..78d6611
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Mutex.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ File: Mutex.java
+
+ Originally written by Doug Lea and released into the public domain.
+ This may be used for any purposes whatsoever without acknowledgment.
+ Thanks for the assistance and support of Sun Microsystems Labs,
+ and everyone contributing, testing, and using this code.
+
+ History:
+ Date Who What
+ 11Jun1998 dl Create public version
+*/
+
+package com.sun.corba.se.impl.orbutil.concurrent;
+
+/**
+ * A simple non-reentrant mutual exclusion lock.
+ * The lock is free upon construction. Each acquire gets the
+ * lock, and each release frees it. Releasing a lock that
+ * is already free has no effect.
+ * <p>
+ * This implementation makes no attempt to provide any fairness
+ * or ordering guarantees. If you need them, consider using one of
+ * the Semaphore implementations as a locking mechanism.
+ * <p>
+ * <b>Sample usage</b><br>
+ * <p>
+ * Mutex can be useful in constructions that cannot be
+ * expressed using java synchronized blocks because the
+ * acquire/release pairs do not occur in the same method or
+ * code block. For example, you can use them for hand-over-hand
+ * locking across the nodes of a linked list. This allows
+ * extremely fine-grained locking, and so increases
+ * potential concurrency, at the cost of additional complexity and
+ * overhead that would normally make this worthwhile only in cases of
+ * extreme contention.
+ * <pre>
+ * class Node {
+ * Object item;
+ * Node next;
+ * Mutex lock = new Mutex(); // each node keeps its own lock
+ *
+ * Node(Object x, Node n) { item = x; next = n; }
+ * }
+ *
+ * class List {
+ * protected Node head; // pointer to first node of list
+ *
+ * // Use plain java synchronization to protect head field.
+ * // (We could instead use a Mutex here too but there is no
+ * // reason to do so.)
+ * protected synchronized Node getHead() { return head; }
+ *
+ * boolean search(Object x) throws InterruptedException {
+ * Node p = getHead();
+ * if (p == null) return false;
+ *
+ * // (This could be made more compact, but for clarity of illustration,
+ * // all of the cases that can arise are handled separately.)
+ *
+ * p.lock.acquire(); // Prime loop by acquiring first lock.
+ * // (If the acquire fails due to
+ * // interrupt, the method will throw
+ * // InterruptedException now,
+ * // so there is no need for any
+ * // further cleanup.)
+ * for (;;) {
+ * if (x.equals(p.item)) {
+ * p.lock.release(); // release current before return
+ * return true;
+ * }
+ * else {
+ * Node nextp = p.next;
+ * if (nextp == null) {
+ * p.lock.release(); // release final lock that was held
+ * return false;
+ * }
+ * else {
+ * try {
+ * nextp.lock.acquire(); // get next lock before releasing current
+ * }
+ * catch (InterruptedException ex) {
+ * p.lock.release(); // also release current if acquire fails
+ * throw ex;
+ * }
+ * p.lock.release(); // release old lock now that new one held
+ * p = nextp;
+ * }
+ * }
+ * }
+ * }
+ *
+ * synchronized void add(Object x) { // simple prepend
+ * // The use of `synchronized' here protects only head field.
+ * // The method does not need to wait out other traversers
+ * // who have already made it past head.
+ *
+ * head = new Node(x, head);
+ * }
+ *
+ * // ... other similar traversal and update methods ...
+ * }
+ * </pre>
+ * @see Semaphore
+ * <p>[<a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html"> Introduction to this package. </a>]
+**/
+
+public class Mutex implements Sync {
+
+ /** The lock status **/
+ protected boolean inuse_ = false;
+
+ public void acquire() throws InterruptedException {
+ if (Thread.interrupted()) throw new InterruptedException();
+ synchronized(this) {
+ try {
+ while (inuse_) wait();
+ inuse_ = true;
+ }
+ catch (InterruptedException ex) {
+ notify();
+ throw ex;
+ }
+ }
+ }
+
+ public synchronized void release() {
+ inuse_ = false;
+ notify();
+ }
+
+
+ public boolean attempt(long msecs) throws InterruptedException {
+ if (Thread.interrupted()) throw new InterruptedException();
+ synchronized(this) {
+ if (!inuse_) {
+ inuse_ = true;
+ return true;
+ }
+ else if (msecs <= 0)
+ return false;
+ else {
+ long waitTime = msecs;
+ long start = System.currentTimeMillis();
+ try {
+ for (;;) {
+ wait(waitTime);
+ if (!inuse_) {
+ inuse_ = true;
+ return true;
+ }
+ else {
+ waitTime = msecs - (System.currentTimeMillis() - start);
+ if (waitTime <= 0)
+ return false;
+ }
+ }
+ }
+ catch (InterruptedException ex) {
+ notify();
+ throw ex;
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/ReentrantMutex.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/ReentrantMutex.java
new file mode 100644
index 0000000..eaf4ff5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/ReentrantMutex.java
@@ -0,0 +1,350 @@
+/*
+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ File: Mutex.java
+
+ Originally written by Doug Lea and released into the public domain.
+ This may be used for any purposes whatsoever without acknowledgment.
+ Thanks for the assistance and support of Sun Microsystems Labs,
+ and everyone contributing, testing, and using this code.
+
+ History:
+ Date Who What
+ 11Jun1998 dl Create public version
+*/
+
+package com.sun.corba.se.impl.orbutil.concurrent;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+/**
+ * A simple reentrant mutual exclusion lock.
+ * The lock is free upon construction. Each acquire gets the
+ * lock, and each release frees it. Releasing a lock that
+ * is already free has no effect.
+ * <p>
+ * This implementation makes no attempt to provide any fairness
+ * or ordering guarantees. If you need them, consider using one of
+ * the Semaphore implementations as a locking mechanism.
+ * <p>
+ * <b>Sample usage</b><br>
+ * <p>
+ * Mutex can be useful in constructions that cannot be
+ * expressed using java synchronized blocks because the
+ * acquire/release pairs do not occur in the same method or
+ * code block. For example, you can use them for hand-over-hand
+ * locking across the nodes of a linked list. This allows
+ * extremely fine-grained locking, and so increases
+ * potential concurrency, at the cost of additional complexity and
+ * overhead that would normally make this worthwhile only in cases of
+ * extreme contention.
+ * <pre>
+ * class Node {
+ * Object item;
+ * Node next;
+ * Mutex lock = new Mutex(); // each node keeps its own lock
+ *
+ * Node(Object x, Node n) { item = x; next = n; }
+ * }
+ *
+ * class List {
+ * protected Node head; // pointer to first node of list
+ *
+ * // Use plain java synchronization to protect head field.
+ * // (We could instead use a Mutex here too but there is no
+ * // reason to do so.)
+ * protected synchronized Node getHead() { return head; }
+ *
+ * boolean search(Object x) throws InterruptedException {
+ * Node p = getHead();
+ * if (p == null) return false;
+ *
+ * // (This could be made more compact, but for clarity of illustration,
+ * // all of the cases that can arise are handled separately.)
+ *
+ * p.lock.acquire(); // Prime loop by acquiring first lock.
+ * // (If the acquire fails due to
+ * // interrupt, the method will throw
+ * // InterruptedException now,
+ * // so there is no need for any
+ * // further cleanup.)
+ * for (;;) {
+ * if (x.equals(p.item)) {
+ * p.lock.release(); // release current before return
+ * return true;
+ * }
+ * else {
+ * Node nextp = p.next;
+ * if (nextp == null) {
+ * p.lock.release(); // release final lock that was held
+ * return false;
+ * }
+ * else {
+ * try {
+ * nextp.lock.acquire(); // get next lock before releasing current
+ * }
+ * catch (InterruptedException ex) {
+ * p.lock.release(); // also release current if acquire fails
+ * throw ex;
+ * }
+ * p.lock.release(); // release old lock now that new one held
+ * p = nextp;
+ * }
+ * }
+ * }
+ * }
+ *
+ * synchronized void add(Object x) { // simple prepend
+ * // The use of `synchronized' here protects only head field.
+ * // The method does not need to wait out other traversers
+ * // who have already made it past head.
+ *
+ * head = new Node(x, head);
+ * }
+ *
+ * // ... other similar traversal and update methods ...
+ * }
+ * </pre>
+ * <p>
+ * <p>This version adds some debugging capability: it will detect
+ * an attempt by a thread that does not hold the mutex to release it.
+ * This version is reentrant: the same thread may acquire a mutex multiple
+ * times, in which case it must release the mutex the same number of times
+ * as it was acquired before another thread can acquire the mutex.
+ * @see Semaphore
+ * <p>[<a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html"> Introduction to this package. </a>]
+**/
+
+import org.omg.CORBA.INTERNAL ;
+
+public class ReentrantMutex implements Sync {
+
+ /** The thread holding the lock **/
+ protected Thread holder_ = null;
+
+ /** number of times thread has acquired the lock **/
+ protected int counter_ = 0 ;
+
+ protected boolean debug = false ;
+
+ public ReentrantMutex()
+ {
+ this( false ) ;
+ }
+
+ public ReentrantMutex( boolean debug )
+ {
+ this.debug = debug ;
+ }
+
+ public void acquire() throws InterruptedException {
+ if (Thread.interrupted())
+ throw new InterruptedException();
+
+ synchronized(this) {
+ try {
+ if (debug)
+ ORBUtility.dprintTrace( this,
+ "acquire enter: holder_=" +
+ ORBUtility.getThreadName(holder_) +
+ " counter_=" + counter_ ) ;
+
+ Thread thr = Thread.currentThread();
+ if (holder_ != thr) {
+ try {
+ while (counter_ > 0)
+ wait();
+
+ // This can't happen, but make sure anyway
+ if (counter_ != 0)
+ throw new INTERNAL(
+ "counter not 0 when first acquiring mutex" ) ;
+
+ holder_ = thr;
+ } catch (InterruptedException ex) {
+ notify();
+ throw ex;
+ }
+ }
+
+ counter_ ++ ;
+ } finally {
+ if (debug)
+ ORBUtility.dprintTrace( this, "acquire exit: holder_=" +
+ ORBUtility.getThreadName(holder_) + " counter_=" +
+ counter_ ) ;
+ }
+ }
+ }
+
+ void acquireAll( int count ) throws InterruptedException
+ {
+ if (Thread.interrupted())
+ throw new InterruptedException();
+
+ synchronized(this) {
+ try {
+ if (debug)
+ ORBUtility.dprintTrace( this,
+ "acquireAll enter: count=" + count + " holder_=" +
+ ORBUtility.getThreadName(holder_) + " counter_=" +
+ counter_ ) ;
+ Thread thr = Thread.currentThread();
+ if (holder_ == thr) {
+ throw new INTERNAL(
+ "Cannot acquireAll while holding the mutex" ) ;
+ } else {
+ try {
+ while (counter_ > 0)
+ wait();
+
+ // This can't happen, but make sure anyway
+ if (counter_ != 0)
+ throw new INTERNAL(
+ "counter not 0 when first acquiring mutex" ) ;
+
+ holder_ = thr;
+ } catch (InterruptedException ex) {
+ notify();
+ throw ex;
+ }
+ }
+
+ counter_ = count ;
+ } finally {
+ if (debug)
+ ORBUtility.dprintTrace( this, "acquireAll exit: count=" +
+ count + " holder_=" + ORBUtility.getThreadName(holder_) +
+ " counter_=" + counter_ ) ;
+ }
+ }
+ }
+
+ public synchronized void release()
+ {
+ try {
+ if (debug)
+ ORBUtility.dprintTrace( this, "release enter: " +
+ " holder_=" + ORBUtility.getThreadName(holder_) +
+ " counter_=" + counter_ ) ;
+
+ Thread thr = Thread.currentThread();
+ if (thr != holder_)
+ throw new INTERNAL(
+ "Attempt to release Mutex by thread not holding the Mutex" ) ;
+ else
+ counter_ -- ;
+
+ if (counter_ == 0) {
+ holder_ = null;
+ notify();
+ }
+ } finally {
+ if (debug)
+ ORBUtility.dprintTrace( this, "release exit: " +
+ " holder_=" + ORBUtility.getThreadName(holder_) +
+ " counter_=" + counter_ ) ;
+ }
+ }
+
+ synchronized int releaseAll()
+ {
+ try {
+ if (debug)
+ ORBUtility.dprintTrace( this, "releaseAll enter: " +
+ " holder_=" + ORBUtility.getThreadName(holder_) +
+ " counter_=" + counter_ ) ;
+
+ Thread thr = Thread.currentThread();
+ if (thr != holder_)
+ throw new INTERNAL(
+ "Attempt to releaseAll Mutex by thread not holding the Mutex" ) ;
+
+ int result = counter_ ;
+ counter_ = 0 ;
+ holder_ = null ;
+ notify() ;
+ return result ;
+ } finally {
+ if (debug)
+ ORBUtility.dprintTrace( this, "releaseAll exit: " +
+ " holder_=" + ORBUtility.getThreadName(holder_) +
+ " counter_=" + counter_ ) ;
+ }
+ }
+
+ public boolean attempt(long msecs) throws InterruptedException {
+ if (Thread.interrupted())
+ throw new InterruptedException();
+
+ synchronized(this) {
+ try {
+ if (debug)
+ ORBUtility.dprintTrace( this, "attempt enter: msecs=" +
+ msecs + " holder_=" +
+ ORBUtility.getThreadName(holder_) +
+ " counter_=" + counter_ ) ;
+
+ Thread thr = Thread.currentThread() ;
+
+ if (counter_==0) {
+ holder_ = thr;
+ counter_ = 1 ;
+ return true;
+ } else if (msecs <= 0) {
+ return false;
+ } else {
+ long waitTime = msecs;
+ long start = System.currentTimeMillis();
+ try {
+ for (;;) {
+ wait(waitTime);
+ if (counter_==0) {
+ holder_ = thr;
+ counter_ = 1 ;
+ return true;
+ } else {
+ waitTime = msecs -
+ (System.currentTimeMillis() - start);
+
+ if (waitTime <= 0)
+ return false;
+ }
+ }
+ } catch (InterruptedException ex) {
+ notify();
+ throw ex;
+ }
+ }
+ } finally {
+ if (debug)
+ ORBUtility.dprintTrace( this, "attempt exit: " +
+ " holder_=" + ORBUtility.getThreadName(holder_) +
+ " counter_=" + counter_ ) ;
+ }
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Sync.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Sync.java
new file mode 100644
index 0000000..c696b79
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/Sync.java
@@ -0,0 +1,362 @@
+/*
+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ File: Sync.java
+
+ Originally written by Doug Lea and released into the public domain.
+ This may be used for any purposes whatsoever without acknowledgment.
+ Thanks for the assistance and support of Sun Microsystems Labs,
+ and everyone contributing, testing, and using this code.
+
+ History:
+ Date Who What
+ 11Jun1998 dl Create public version
+ 5Aug1998 dl Added some convenient time constants
+*/
+
+package com.sun.corba.se.impl.orbutil.concurrent;
+
+/**
+ * Main interface for locks, gates, and conditions.
+ * <p>
+ * Sync objects isolate waiting and notification for particular
+ * logical states, resource availability, events, and the like that are
+ * shared across multiple threads. Use of Syncs sometimes
+ * (but by no means always) adds flexibility and efficiency
+ * compared to the use of plain java monitor methods
+ * and locking, and are sometimes (but by no means always)
+ * simpler to program with.
+ * <p>
+ *
+ * Most Syncs are intended to be used primarily (although
+ * not exclusively) in before/after constructions such as:
+ * <pre>
+ * class X {
+ * Sync gate;
+ * // ...
+ *
+ * public void m() {
+ * try {
+ * gate.acquire(); // block until condition holds
+ * try {
+ * // ... method body
+ * }
+ * finally {
+ * gate.release()
+ * }
+ * }
+ * catch (InterruptedException ex) {
+ * // ... evasive action
+ * }
+ * }
+ *
+ * public void m2(Sync cond) { // use supplied condition
+ * try {
+ * if (cond.attempt(10)) { // try the condition for 10 ms
+ * try {
+ * // ... method body
+ * }
+ * finally {
+ * cond.release()
+ * }
+ * }
+ * }
+ * catch (InterruptedException ex) {
+ * // ... evasive action
+ * }
+ * }
+ * }
+ * </pre>
+ * Syncs may be used in somewhat tedious but more flexible replacements
+ * for built-in Java synchronized blocks. For example:
+ * <pre>
+ * class HandSynched {
+ * private double state_ = 0.0;
+ * private final Sync lock; // use lock type supplied in constructor
+ * public HandSynched(Sync l) { lock = l; }
+ *
+ * public void changeState(double d) {
+ * try {
+ * lock.acquire();
+ * try { state_ = updateFunction(d); }
+ * finally { lock.release(); }
+ * }
+ * catch(InterruptedException ex) { }
+ * }
+ *
+ * public double getState() {
+ * double d = 0.0;
+ * try {
+ * lock.acquire();
+ * try { d = accessFunction(state_); }
+ * finally { lock.release(); }
+ * }
+ * catch(InterruptedException ex){}
+ * return d;
+ * }
+ * private double updateFunction(double d) { ... }
+ * private double accessFunction(double d) { ... }
+ * }
+ * </pre>
+ * If you have a lot of such methods, and they take a common
+ * form, you can standardize this using wrappers. Some of these
+ * wrappers are standardized in LockedExecutor, but you can make others.
+ * For example:
+ * <pre>
+ * class HandSynchedV2 {
+ * private double state_ = 0.0;
+ * private final Sync lock; // use lock type supplied in constructor
+ * public HandSynchedV2(Sync l) { lock = l; }
+ *
+ * protected void runSafely(Runnable r) {
+ * try {
+ * lock.acquire();
+ * try { r.run(); }
+ * finally { lock.release(); }
+ * }
+ * catch (InterruptedException ex) { // propagate without throwing
+ * Thread.currentThread().interrupt();
+ * }
+ * }
+ *
+ * public void changeState(double d) {
+ * runSafely(new Runnable() {
+ * public void run() { state_ = updateFunction(d); }
+ * });
+ * }
+ * // ...
+ * }
+ * </pre>
+ * <p>
+ * One reason to bother with such constructions is to use deadlock-
+ * avoiding back-offs when dealing with locks involving multiple objects.
+ * For example, here is a Cell class that uses attempt to back-off
+ * and retry if two Cells are trying to swap values with each other
+ * at the same time.
+ * <pre>
+ * class Cell {
+ * long value;
+ * Sync lock = ... // some sync implementation class
+ * void swapValue(Cell other) {
+ * for (;;) {
+ * try {
+ * lock.acquire();
+ * try {
+ * if (other.lock.attempt(100)) {
+ * try {
+ * long t = value;
+ * value = other.value;
+ * other.value = t;
+ * return;
+ * }
+ * finally { other.lock.release(); }
+ * }
+ * }
+ * finally { lock.release(); }
+ * }
+ * catch (InterruptedException ex) { return; }
+ * }
+ * }
+ * }
+ * </pre>
+ * <p>
+ * Here is an even fancier version, that uses lock re-ordering
+ * upon conflict:
+ * <pre>{@code
+ * class Cell {
+ * long value;
+ * Sync lock = ...;
+ * private static boolean trySwap(Cell a, Cell b) {
+ * a.lock.acquire();
+ * try {
+ * if (!b.lock.attempt(0))
+ * return false;
+ * try {
+ * long t = a.value;
+ * a.value = b.value;
+ * b.value = t;
+ * return true;
+ * }
+ * finally { other.lock.release(); }
+ * }
+ * finally { lock.release(); }
+ * return false;
+ * }
+ *
+ * void swapValue(Cell other) {
+ * try {
+ * while (!trySwap(this, other) &&
+ * !tryswap(other, this))
+ * Thread.sleep(1);
+ * }
+ * catch (InterruptedException ex) { return; }
+ * }
+ * }
+ * }</pre>
+ * <p>
+ * Interruptions are in general handled as early as possible.
+ * Normally, InterruptionExceptions are thrown
+ * in acquire and attempt(msec) if interruption
+ * is detected upon entry to the method, as well as in any
+ * later context surrounding waits.
+ * However, interruption status is ignored in release();
+ * <p>
+ * Timed versions of attempt report failure via return value.
+ * If so desired, you can transform such constructions to use exception
+ * throws via
+ * <pre>
+ * if (!c.attempt(timeval)) throw new TimeoutException(timeval);
+ * </pre>
+ * <p>
+ * The TimoutSync wrapper class can be used to automate such usages.
+ * <p>
+ * All time values are expressed in milliseconds as longs, which have a maximum
+ * value of Long.MAX_VALUE, or almost 300,000 centuries. It is not
+ * known whether JVMs actually deal correctly with such extreme values.
+ * For convenience, some useful time values are defined as static constants.
+ * <p>
+ * All implementations of the three Sync methods guarantee to
+ * somehow employ Java <code>synchronized</code> methods or blocks,
+ * and so entail the memory operations described in JLS
+ * chapter 17 which ensure that variables are loaded and flushed
+ * within before/after constructions.
+ * <p>
+ * Syncs may also be used in spinlock constructions. Although
+ * it is normally best to just use acquire(), various forms
+ * of busy waits can be implemented. For a simple example
+ * (but one that would probably never be preferable to using acquire()):
+ * <pre>{@code
+ * class X {
+ * Sync lock = ...
+ * void spinUntilAcquired() throws InterruptedException {
+ * // Two phase.
+ * // First spin without pausing.
+ * int purespins = 10;
+ * for (int i = 0; i < purespins; ++i) {
+ * if (lock.attempt(0))
+ * return true;
+ * }
+ * // Second phase - use timed waits
+ * long waitTime = 1; // 1 millisecond
+ * for (;;) {
+ * if (lock.attempt(waitTime))
+ * return true;
+ * else
+ * waitTime = waitTime * 3 / 2 + 1; // increase 50%
+ * }
+ * }
+ * }
+ * }</pre>
+ * <p>
+ * In addition pure synchronization control, Syncs
+ * may be useful in any context requiring before/after methods.
+ * For example, you can use an ObservableSync
+ * (perhaps as part of a LayeredSync) in order to obtain callbacks
+ * before and after each method invocation for a given class.
+ *
+ * [<a href="http://gee.cs.oswego.edu/dl/classes/EDU/oswego/cs/dl/util/concurrent/intro.html"> Introduction to this package. </a>]
+ **/
+
+
+public interface Sync {
+
+ /**
+ * Wait (possibly forever) until successful passage.
+ * Fail only upon interuption. Interruptions always result in
+ * `clean' failures. On failure, you can be sure that it has not
+ * been acquired, and that no
+ * corresponding release should be performed. Conversely,
+ * a normal return guarantees that the acquire was successful.
+ **/
+
+ public void acquire() throws InterruptedException;
+
+ /**
+ * Wait at most msecs to pass; report whether passed.
+ * <p>
+ * The method has best-effort semantics:
+ * The msecs bound cannot
+ * be guaranteed to be a precise upper bound on wait time in Java.
+ * Implementations generally can only attempt to return as soon as possible
+ * after the specified bound. Also, timers in Java do not stop during garbage
+ * collection, so timeouts can occur just because a GC intervened.
+ * So, msecs arguments should be used in
+ * a coarse-grained manner. Further,
+ * implementations cannot always guarantee that this method
+ * will return at all without blocking indefinitely when used in
+ * unintended ways. For example, deadlocks may be encountered
+ * when called in an unintended context.
+ * <p>
+ * @param msecs the number of milleseconds to wait.
+ * An argument less than or equal to zero means not to wait at all.
+ * However, this may still require
+ * access to a synchronization lock, which can impose unbounded
+ * delay if there is a lot of contention among threads.
+ * @return true if acquired
+ **/
+
+ public boolean attempt(long msecs) throws InterruptedException;
+
+ /**
+ * Potentially enable others to pass.
+ * <p>
+ * Because release does not raise exceptions,
+ * it can be used in `finally' clauses without requiring extra
+ * embedded try/catch blocks. But keep in mind that
+ * as with any java method, implementations may
+ * still throw unchecked exceptions such as Error or NullPointerException
+ * when faced with uncontinuable errors. However, these should normally
+ * only be caught by higher-level error handlers.
+ **/
+
+ public void release();
+
+ /** One second, in milliseconds; convenient as a time-out value **/
+ public static final long ONE_SECOND = 1000;
+
+ /** One minute, in milliseconds; convenient as a time-out value **/
+ public static final long ONE_MINUTE = 60 * ONE_SECOND;
+
+ /** One hour, in milliseconds; convenient as a time-out value **/
+ public static final long ONE_HOUR = 60 * ONE_MINUTE;
+
+ /** One day, in milliseconds; convenient as a time-out value **/
+ public static final long ONE_DAY = 24 * ONE_HOUR;
+
+ /** One week, in milliseconds; convenient as a time-out value **/
+ public static final long ONE_WEEK = 7 * ONE_DAY;
+
+ /** One year in milliseconds; convenient as a time-out value **/
+ // Not that it matters, but there is some variation across
+ // standard sources about value at msec precision.
+ // The value used is the same as in java.util.GregorianCalendar
+ public static final long ONE_YEAR = (long)(365.2425 * ONE_DAY);
+
+ /** One century in milliseconds; convenient as a time-out value **/
+ public static final long ONE_CENTURY = 100 * ONE_YEAR;
+
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/SyncUtil.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/SyncUtil.java
new file mode 100644
index 0000000..2daa322
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/concurrent/SyncUtil.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2001, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.concurrent;
+
+import com.sun.corba.se.impl.orbutil.concurrent.Sync ;
+
+public class SyncUtil {
+ private SyncUtil() {}
+
+ /** Method to acquire a Sync without ever throwing an
+ * InterruptedException. Useful when a mutex is being
+ * used in place of Java synchronization.
+ */
+ public static void acquire( Sync sync )
+ {
+ boolean held = false ;
+ while (!held) {
+ try {
+ sync.acquire() ;
+ held = true ;
+ } catch (InterruptedException exc) {
+ held = false ;
+ }
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/GuardedAction.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/GuardedAction.java
new file mode 100644
index 0000000..6c237e8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/GuardedAction.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.fsm ;
+
+import com.sun.corba.se.spi.orbutil.fsm.Guard ;
+import com.sun.corba.se.spi.orbutil.fsm.GuardBase ;
+import com.sun.corba.se.spi.orbutil.fsm.Input ;
+import com.sun.corba.se.spi.orbutil.fsm.Action ;
+import com.sun.corba.se.spi.orbutil.fsm.State ;
+import com.sun.corba.se.spi.orbutil.fsm.FSM ;
+
+public class GuardedAction {
+ private static Guard trueGuard = new GuardBase( "true" ) {
+ public Guard.Result evaluate( FSM fsm, Input in )
+ {
+ return Guard.Result.ENABLED ;
+ }
+ } ;
+
+ private Guard guard ;
+ private Action action ;
+ private State nextState ;
+
+ public GuardedAction( Action action, State nextState )
+ {
+ this.guard = trueGuard ;
+ this.action = action ;
+ this.nextState = nextState ;
+ }
+
+ public GuardedAction( Guard guard, Action action, State nextState )
+ {
+ this.guard = guard ;
+ this.action = action ;
+ this.nextState = nextState ;
+ }
+
+ public String toString()
+ {
+ return "GuardedAction[action=" + action + " guard=" + guard +
+ " nextState=" + nextState + "]" ;
+ }
+
+ public Action getAction() { return action ; }
+ public Guard getGuard() { return guard ; }
+ public State getNextState() { return nextState ; }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/NameBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/NameBase.java
new file mode 100644
index 0000000..bc1bd9f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/NameBase.java
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.fsm ;
+
+import com.sun.corba.se.spi.orbutil.fsm.Action ;
+import com.sun.corba.se.spi.orbutil.fsm.State ;
+import com.sun.corba.se.spi.orbutil.fsm.Guard ;
+import com.sun.corba.se.spi.orbutil.fsm.Input ;
+
+import java.util.StringTokenizer ;
+
+public class NameBase {
+ private String name ;
+ private String toStringName ;
+
+ // Return just the name of the class, not the full qualified name.
+ private String getClassName()
+ {
+ String fqn = this.getClass().getName() ;
+ StringTokenizer st = new StringTokenizer( fqn, "." ) ;
+ String token = st.nextToken() ;
+ while (st.hasMoreTokens())
+ token = st.nextToken() ;
+ return token ;
+ }
+
+ private String getPreferredClassName()
+ {
+ if (this instanceof Action)
+ return "Action" ;
+ if (this instanceof State)
+ return "State" ;
+ if (this instanceof Guard)
+ return "Guard" ;
+ if (this instanceof Input)
+ return "Input" ;
+ return getClassName() ;
+ }
+
+ public NameBase( String name )
+ {
+ this.name = name ;
+ toStringName = getPreferredClassName() + "[" + name + "]" ;
+ }
+
+ public String getName()
+ {
+ return name ;
+ }
+
+ public String toString() {
+ return toStringName ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/StateEngineImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/StateEngineImpl.java
new file mode 100644
index 0000000..8a272fb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/fsm/StateEngineImpl.java
@@ -0,0 +1,328 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.fsm ;
+
+import java.util.HashMap ;
+import java.util.HashSet ;
+import java.util.Set ;
+import java.util.Iterator ;
+
+import org.omg.CORBA.INTERNAL ;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+import com.sun.corba.se.spi.orbutil.fsm.Input ;
+import com.sun.corba.se.spi.orbutil.fsm.Guard ;
+import com.sun.corba.se.spi.orbutil.fsm.Action ;
+import com.sun.corba.se.spi.orbutil.fsm.ActionBase ;
+import com.sun.corba.se.spi.orbutil.fsm.State ;
+import com.sun.corba.se.spi.orbutil.fsm.StateEngine ;
+import com.sun.corba.se.spi.orbutil.fsm.StateImpl ;
+import com.sun.corba.se.spi.orbutil.fsm.FSM ;
+import com.sun.corba.se.spi.orbutil.fsm.FSMImpl ;
+
+import com.sun.corba.se.impl.orbutil.fsm.GuardedAction ;
+
+/**
+ * Encodes the state transition function for a finite state machine.
+ *
+ * @author Ken Cavanaugh
+ */
+public class StateEngineImpl implements StateEngine
+{
+ // An action that does nothing at all.
+ private static Action emptyAction = new ActionBase( "Empty" )
+ {
+ public void doIt( FSM fsm, Input in )
+ {
+ }
+ } ;
+
+ private boolean initializing ;
+ private Action defaultAction ;
+
+ public StateEngineImpl()
+ {
+ initializing = true ;
+ defaultAction = new ActionBase("Invalid Transition")
+ {
+ public void doIt( FSM fsm, Input in )
+ {
+ throw new INTERNAL(
+ "Invalid transition attempted from " +
+ fsm.getState() + " under " + in ) ;
+ }
+ } ;
+ }
+
+ public StateEngine add( State oldState, Input input, Guard guard, Action action,
+ State newState ) throws IllegalArgumentException,
+ IllegalStateException
+ {
+ mustBeInitializing() ;
+
+ StateImpl oldStateImpl = (StateImpl)oldState ;
+ GuardedAction ga = new GuardedAction( guard, action, newState ) ;
+ oldStateImpl.addGuardedAction( input, ga ) ;
+
+ return this ;
+ }
+
+ public StateEngine add( State oldState, Input input, Action action,
+ State newState ) throws IllegalArgumentException,
+ IllegalStateException
+ {
+ mustBeInitializing() ;
+
+ StateImpl oldStateImpl = (StateImpl)oldState ;
+ GuardedAction ta = new GuardedAction( action, newState ) ;
+ oldStateImpl.addGuardedAction( input, ta ) ;
+
+ return this ;
+ }
+
+ public StateEngine setDefault( State oldState, Action action, State newState )
+ throws IllegalArgumentException, IllegalStateException
+ {
+ mustBeInitializing() ;
+
+ StateImpl oldStateImpl = (StateImpl)oldState ;
+ oldStateImpl.setDefaultAction( action ) ;
+ oldStateImpl.setDefaultNextState( newState ) ;
+
+ return this ;
+ }
+
+ public StateEngine setDefault( State oldState, State newState )
+ throws IllegalArgumentException, IllegalStateException
+ {
+ return setDefault( oldState, emptyAction, newState ) ;
+ }
+
+ public StateEngine setDefault( State oldState )
+ throws IllegalArgumentException, IllegalStateException
+ {
+ return setDefault( oldState, oldState ) ;
+ }
+
+ public void done() throws IllegalStateException
+ {
+ mustBeInitializing() ;
+
+ // optimize FSM here if desired. For example,
+ // we could choose different strategies for implementing
+ // the state transition function based on the distribution
+ // of values for states and input labels.
+
+ initializing = false ;
+ }
+
+ public void setDefaultAction( Action act ) throws IllegalStateException
+ {
+ mustBeInitializing() ;
+ defaultAction = act ;
+ }
+
+ public void doIt( FSM fsm, Input in, boolean debug )
+ {
+ // This method is present only for debugging.
+ // innerDoIt does the actual transition.
+
+ if (debug)
+ ORBUtility.dprint( this, "doIt enter: currentState = " +
+ fsm.getState() + " in = " + in ) ;
+
+ try {
+ innerDoIt( fsm, in, debug ) ;
+ } finally {
+ if (debug)
+ ORBUtility.dprint( this, "doIt exit" ) ;
+ }
+ }
+
+ private StateImpl getDefaultNextState( StateImpl currentState )
+ {
+ // Use the currentState defaults if
+ // set, otherwise use the state engine default.
+ StateImpl nextState = (StateImpl)currentState.getDefaultNextState() ;
+ if (nextState == null)
+ // The state engine default never changes the state
+ nextState = currentState ;
+
+ return nextState ;
+ }
+
+ private Action getDefaultAction( StateImpl currentState )
+ {
+ Action action = currentState.getDefaultAction() ;
+ if (action == null)
+ action = defaultAction ;
+
+ return action ;
+ }
+
+ private void innerDoIt( FSM fsm, Input in, boolean debug )
+ {
+ if (debug) {
+ ORBUtility.dprint( this, "Calling innerDoIt with input " + in ) ;
+ }
+
+ // Locals needed for performing the state transition, once we determine
+ // the required transition.
+ StateImpl currentState = null ;
+ StateImpl nextState = null ;
+ Action action = null ;
+
+ // Do until no guard has deferred.
+ boolean deferral = false ;
+ do {
+ deferral = false ; // clear this after each deferral!
+ currentState = (StateImpl)fsm.getState() ;
+ nextState = getDefaultNextState( currentState ) ;
+ action = getDefaultAction( currentState ) ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "currentState = " + currentState ) ;
+ ORBUtility.dprint( this, "in = " + in ) ;
+ ORBUtility.dprint( this, "default nextState = " + nextState ) ;
+ ORBUtility.dprint( this, "default action = " + action ) ;
+ }
+
+ Set gas = currentState.getGuardedActions(in) ;
+ if (gas != null) {
+ Iterator iter = gas.iterator() ;
+
+ // Search for a guard that is not DISABLED.
+ // All DISABLED means use defaults.
+ while (iter.hasNext()) {
+ GuardedAction ga = (GuardedAction)iter.next() ;
+ Guard.Result gr = ga.getGuard().evaluate( fsm, in ) ;
+ if (debug)
+ ORBUtility.dprint( this,
+ "doIt: evaluated " + ga + " with result " + gr ) ;
+
+ if (gr == Guard.Result.ENABLED) {
+ // ga has the next state and action.
+ nextState = (StateImpl)ga.getNextState() ;
+ action = ga.getAction() ;
+ if (debug) {
+ ORBUtility.dprint( this, "nextState = " + nextState ) ;
+ ORBUtility.dprint( this, "action = " + action ) ;
+ }
+ break ;
+ } else if (gr == Guard.Result.DEFERED) {
+ deferral = true ;
+ break ;
+ }
+ }
+ }
+ } while (deferral) ;
+
+ performStateTransition( fsm, in, nextState, action, debug ) ;
+ }
+
+ private void performStateTransition( FSM fsm, Input in,
+ StateImpl nextState, Action action, boolean debug )
+ {
+ StateImpl currentState = (StateImpl)fsm.getState() ;
+
+ // Perform the state transition. Pre and post actions are only
+ // performed if the state changes (see UML hidden transitions).
+
+ boolean different = !currentState.equals( nextState ) ;
+
+ if (different) {
+ if (debug)
+ ORBUtility.dprint( this,
+ "doIt: executing postAction for state " + currentState ) ;
+ try {
+ currentState.postAction( fsm ) ;
+ } catch (Throwable thr) {
+ if (debug)
+ ORBUtility.dprint( this,
+ "doIt: postAction threw " + thr ) ;
+
+ if (thr instanceof ThreadDeath)
+ throw (ThreadDeath)thr ;
+ }
+ }
+
+ try {
+ // Note that action may be null in a transition, which simply
+ // means that no action is needed. Note that action.doIt may
+ // throw an exception, in which case the exception is
+ // propagated after making sure that the transition is properly
+ // completed.
+ if (action != null)
+ action.doIt( fsm, in ) ;
+ } finally {
+ if (different) {
+ if (debug)
+ ORBUtility.dprint( this,
+ "doIt: executing preAction for state " + nextState ) ;
+
+ try {
+ nextState.preAction( fsm ) ;
+ } catch (Throwable thr) {
+ if (debug)
+ ORBUtility.dprint( this,
+ "doIt: preAction threw " + thr ) ;
+
+ if (thr instanceof ThreadDeath)
+ throw (ThreadDeath)thr ;
+ }
+
+ ((FSMImpl)fsm).internalSetState( nextState ) ;
+ }
+
+ if (debug)
+ ORBUtility.dprint( this, "doIt: state is now " + nextState ) ;
+ }
+ }
+
+ public FSM makeFSM( State startState ) throws IllegalStateException
+ {
+ mustNotBeInitializing() ;
+
+ return new FSMImpl( this, startState ) ;
+ }
+
+ private void mustBeInitializing() throws IllegalStateException
+ {
+ if (!initializing)
+ throw new IllegalStateException(
+ "Invalid method call after initialization completed" ) ;
+ }
+
+ private void mustNotBeInitializing() throws IllegalStateException
+ {
+ if (initializing)
+ throw new IllegalStateException(
+ "Invalid method call before initialization completed" ) ;
+ }
+}
+
+// end of StateEngineImpl.java
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Graph.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Graph.java
new file mode 100644
index 0000000..d1ab1a0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Graph.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.graph ;
+
+import java.util.Set ;
+
+public interface Graph extends Set // Set<Node>
+{
+ NodeData getNodeData( Node node ) ;
+
+ Set /* Set<Node> */ getRoots() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/GraphImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/GraphImpl.java
new file mode 100644
index 0000000..fe75fbb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/GraphImpl.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.graph ;
+
+import java.util.Collection ;
+import java.util.AbstractSet ;
+import java.util.Iterator ;
+import java.util.Map ;
+import java.util.HashMap ;
+import java.util.Set ;
+import java.util.HashSet ;
+
+public class GraphImpl extends AbstractSet implements Graph
+{
+ private Map /* Map<Node,NodeData> */ nodeToData ;
+
+ public GraphImpl()
+ {
+ nodeToData = new HashMap() ;
+ }
+
+ public GraphImpl( Collection coll )
+ {
+ this() ;
+ addAll( coll ) ;
+ }
+
+/***********************************************************************************/
+/************ AbstractSet implementation *******************************************/
+/***********************************************************************************/
+
+ // Required for AbstractSet
+ public boolean add( Object obj ) // obj must be a Node
+ {
+ if (!(obj instanceof Node))
+ throw new IllegalArgumentException( "Graphs must contain only Node instances" ) ;
+
+ Node node = (Node)obj ;
+ boolean found = nodeToData.keySet().contains( obj ) ;
+
+ if (!found) {
+ NodeData nd = new NodeData() ;
+ nodeToData.put( node, nd ) ;
+ }
+
+ return !found ;
+ }
+
+ // Required for AbstractSet
+ public Iterator iterator()
+ {
+ return nodeToData.keySet().iterator() ;
+ }
+
+ // Required for AbstractSet
+ public int size()
+ {
+ return nodeToData.keySet().size() ;
+ }
+
+/***********************************************************************************/
+
+ public NodeData getNodeData( Node node )
+ {
+ return (NodeData)nodeToData.get( node ) ;
+ }
+
+ private void clearNodeData()
+ {
+ // Clear every node
+ Iterator iter = nodeToData.entrySet().iterator() ;
+ while (iter.hasNext()) {
+ Map.Entry entry = (Map.Entry)iter.next() ;
+ NodeData nd = (NodeData)(entry.getValue()) ;
+ nd.clear( ) ;
+ }
+ }
+
+ interface NodeVisitor
+ {
+ void visit( Graph graph, Node node, NodeData nd ) ;
+ }
+
+ // This visits every node in the graph exactly once. A
+ // visitor is allowed to modify the graph during the
+ // traversal.
+ void visitAll( NodeVisitor nv )
+ {
+ boolean done = false ;
+
+ // Repeat the traversal until every node has been visited. Since
+ // it takes one pass to determine whether or not each node has
+ // already been visited, this loop always runs at least once.
+ do {
+ done = true ;
+
+ // Copy entries to array to avoid concurrent modification
+ // problem with iterator if the visitor is updating the graph.
+ Map.Entry[] entries =
+ (Map.Entry[])nodeToData.entrySet().toArray( new Map.Entry[0] ) ;
+
+ // Visit each node in the graph that has not already been visited.
+ // If any node is visited in this pass, we must run at least one more
+ // pass.
+ for (int ctr=0; ctr<entries.length; ctr++) {
+ Map.Entry current = entries[ctr] ;
+ Node node = (Node)current.getKey() ;
+ NodeData nd = (NodeData)current.getValue() ;
+
+ if (!nd.isVisited()) {
+ nd.visited() ;
+ done = false ;
+
+ nv.visit( this, node, nd ) ;
+ }
+ }
+ } while (!done) ;
+ }
+
+ private void markNonRoots()
+ {
+ visitAll(
+ new NodeVisitor() {
+ public void visit( Graph graph, Node node, NodeData nd )
+ {
+ Iterator iter = node.getChildren().iterator() ; // Iterator<Node>
+ while (iter.hasNext()) {
+ Node child = (Node)iter.next() ;
+
+ // Make sure the child is in the graph so it can be
+ // visited later if necessary.
+ graph.add( child ) ;
+
+ // Mark the child as a non-root, since a child is never a root.
+ NodeData cnd = graph.getNodeData( child ) ;
+ cnd.notRoot() ;
+ }
+ }
+ } ) ;
+ }
+
+ private Set collectRootSet()
+ {
+ final Set result = new HashSet() ;
+
+ Iterator iter = nodeToData.entrySet().iterator() ;
+ while (iter.hasNext()) {
+ Map.Entry entry = (Map.Entry)iter.next() ;
+ Node node = (Node)entry.getKey() ;
+ NodeData nd = (NodeData)entry.getValue() ;
+ if (nd.isRoot())
+ result.add( node ) ;
+ }
+
+ return result ;
+ }
+
+ public Set /* Set<Node> */ getRoots()
+ {
+ clearNodeData() ;
+ markNonRoots() ;
+ return collectRootSet() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Node.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Node.java
new file mode 100644
index 0000000..e2aad00
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/Node.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.graph ;
+
+import java.util.Set ;
+
+/** Node in a graph.
+*/
+public interface Node
+{
+ /** Get all the children of this node.
+ */
+ Set /* Set<Node> */ getChildren() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/NodeData.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/NodeData.java
new file mode 100644
index 0000000..ecdf204
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/graph/NodeData.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.graph ;
+
+/** Data about a node in a graph.
+ */
+public class NodeData
+{
+ private boolean visited ;
+ private boolean root ;
+
+ public NodeData()
+ {
+ clear() ;
+ }
+
+ public void clear()
+ {
+ this.visited = false ;
+ this.root = true ;
+ }
+
+ /** Return whether this node has been visited in a traversal.
+ * Note that we only support a single traversal at a time.
+ */
+ boolean isVisited()
+ {
+ return visited ;
+ }
+
+ void visited()
+ {
+ visited = true ;
+ }
+
+ /** Return whether this node is a root.
+ */
+ boolean isRoot()
+ {
+ return root ;
+ }
+
+ void notRoot()
+ {
+ root = false ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb.properties
new file mode 100644
index 0000000..be50574
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb.properties
@@ -0,0 +1,193 @@
+#
+# Copyright (c) 2000, 2005, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=Usage: {0} <options> \
+\n\
+\nwhere <options> includes:\
+\n -port Activation Port where the ORBD should be started, default 1049 (optional)\
+\n -defaultdb Directory for ORBD files, default "./orb.db" (optional)\
+\n -serverid Server Id for ORBD, default 1 (optional)\
+\n -ORBInitialPort Initial Port (required)\
+\n -ORBInitialHost Initial HostName (required)\
+\n\
+
+
+servertool.usage=Usage: {0} <options> \
+\n\
+\nwhere <options> includes:\
+\n -ORBInitialPort Initial Port (required)\
+\n -ORBInitialHost Initial HostName (required)\
+\n\
+
+servertool.banner=\
+\n\
+\nWelcome to the Java IDL Server Tool \
+\nplease enter commands at the prompt \
+\n\
+
+servertool.shorthelp=\
+\n\
+\n\tAvailable Commands: \
+\n\t------------------- \
+\n\
+
+servertool.baddef=Bad server definition: {0}
+servertool.nosuchserver=\tno such server found.
+servertool.helddown=\tserver is held down.
+servertool.nosuchorb=\tinvalid ORB.
+servertool.serverup=\tserver is already up.
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tname - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targs - {0}
+servertool.vmargs=\tvmargs - {0}
+servertool.serverid=\tserver id - {0}
+servertool.servernotrunning=\tserver is not running.
+servertool.register=\
+\n\
+\n\tregister -server <server class name> \
+\n\t -applicationName <alternate server name> \
+\n\t -classpath <classpath to server> \
+\n\t -args <args to server> \
+\n\t -vmargs <args to server Java VM>\
+\n\
+
+servertool.register1=register an activatable server
+servertool.register2=\tserver registered (serverid = {0}).
+servertool.register3=\tserver registerd but held down (serverid = {0}).
+servertool.register4=\tserver already registered (serverid = {0}).
+
+servertool.unregister=\
+\n\tunregister [ -serverid <server id> | -applicationName <name> ] \
+\n\
+
+servertool.unregister1=unregister a registered server
+servertool.unregister2=\tserver unregistered.
+
+servertool.locate=\
+\n\tlocate [ -serverid <server id> | -applicationName <name> ] [ <-endpointType <endpointType> ] \
+\n\
+
+servertool.locate1=locate ports of specific type for a registered server
+servertool.locate2=\
+\n\
+\n\tHost Name {0} \
+\n\
+\n\t\tPort\t\tPort Type\t\tORB Id\
+\n\t\t----\t\t---------\t\t------\
+\n\
+
+servertool.locateorb=\
+\n\tlocateperorb [ -serverid <server id> | -applicationName <name> ] [ -orbid <ORB name> ]\
+\n\
+
+servertool.locateorb1=locate ports for a specific orb of registered server
+servertool.locateorb2=\
+\n\
+\n\tHost Name {0} \
+\n\
+\n\t\tPort\t\tPortType\t\tORB Id\
+\n\t\t----\t\t--------\t\t------\
+\n\
+
+servertool.getserverid=\n\tgetserverid [ -applicationName <name> ] \
+\n\
+
+servertool.getserverid1=return the server id for an applicationName
+servertool.getserverid2=\tServer ID for applicationName {0} is {1}
+
+servertool.list=\n\tlist\
+\n\
+
+servertool.list1=list all registered servers
+servertool.list2=\
+\n\tServer Id\tServer Class Name\t\tServer Application\
+\n\t---------\t-----------------\t\t------------------\
+\n\
+
+servertool.listactive=\n\tlistactive
+servertool.listactive1=list currently active servers
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=list applicationNames currently defined
+servertool.listappnames2=Currently defined server applicationNames:
+
+servertool.shutdown=\
+\n\tshutdown [ -serverid <server id> | -applicationName <name> ]\
+\n\
+
+servertool.shutdown1=shutdown a registered server
+servertool.shutdown2=\tserver sucessfully shutdown.
+servertool.startserver=\
+\n\tstartup [ -serverid <server id> | -applicationName <name> ]\
+\n\
+
+servertool.startserver1=start a registered server
+servertool.startserver2=\tserver sucessfully started up.
+
+servertool.quit=\n\tquit\n
+servertool.quit1=quit this tool
+
+servertool.help=\thelp\
+\n\tOR\
+\n\thelp <command name>\
+\n\
+
+servertool.help1=get help
+
+servertool.orbidmap=\tUsage: orblist [ -serverid <server id> | -applicationName <name> ]\
+\n\
+
+servertool.orbidmap1=list of orb names and their mapping
+servertool.orbidmap2=\
+\n\tORB Id\t\tORB Name\
+\n\t------\t\t--------\
+\n\
+
+pnameserv.success=Persistent NameServer Started Successfully
+
+
+bootstrap.usage=Usage: {0} <options> \
+\n\
+\nwhere <options> includes:\
+\n -ORBInitialPort Initial Port (required)\
+\n -InitialServicesFile File containing list of initial services (required)\
+\n\
+
+bootstrap.success=setting port to {0} and reading services from {1}
+bootstrap.filenotreadable=the file {0} is not readable
+bootstrap.filenotfound=the file {0} not found
+bootstrap.exception=caught exception while saving Properties to file {0}: Exception {1}
+
+tnameserv.exception=caught an exception while starting the bootstrap service on port {0}
+tnameserv.usage=try using a different port with commandline arguments -ORBInitialPort <portno>
+tnameserv.invalidhostoption=ORBInitialHost is not a valid option for NameService
+tnameserv.orbinitialport0=ORBInitialPort 0 is not valid option for NameService
+tnameserv.hs1=Initial Naming Context:\n{0}
+tnameserv.hs2=TransientNameServer: setting port for initial object references to: {0}
+tnameserv.hs3=Ready.
+
+orbd.commfailure=\nFailed to start ORBD because ORBinitialPort is already in use
+orbd.internalexception=\nFailed to start ORBD because of an Internal Exception. \nPossible Causes: \n1. Specified ORBInitialPort or ORBActivationPort is already in use \n2. No Write Permission to write orb.db
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties
new file mode 100644
index 0000000..edfff12
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_de.properties
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=Verwendung: {0} <Optionen> \n\nwobei folgende <Optionen> m\u00F6glich sind:\n -port Aktivierungsport, an dem der ORBD gestartet werden sollte, Standardwert 1049 (optional)\n -defaultdb Verzeichnis f\u00FCr ORBD-Dateien, Standardwert "./orb.db" (optional)\n -serverid Server-ID f\u00FCr ORBD, Standardwert 1 (optional)\n -ORBInitialPort Anfangsport (erforderlich)\n -ORBInitialHost Anf\u00E4nglicher HostName (erforderlich)\n
+
+servertool.usage=Verwendung: {0} <Optionen> \n\nwobei folgende <Optionen> m\u00F6glich sind:\n -ORBInitialPort Anfangsport (erforderlich)\n -ORBInitialHost Anf\u00E4nglicher HostName (erforderlich)\n
+servertool.banner=\n\nWillkommen beim Java IDL-Servertool \nGeben Sie die entsprechenden Befehle im Prompt ein \n
+servertool.shorthelp=\n\n\tVerf\u00FCgbare Befehle: \n\t------------------- \n
+servertool.baddef=Ung\u00FCltige Serverdefinition: {0}
+servertool.nosuchserver=\tServer wurde nicht gefunden.
+servertool.helddown=\tServer ist au\u00DFer Betrieb.
+servertool.nosuchorb=\tUng\u00FCltiger ORB.
+servertool.serverup=\tServer ist bereits hochgefahren.
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tName - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targs - {0}
+servertool.vmargs=\tvmargs - {0}
+servertool.serverid=\tServer-ID - {0}
+servertool.servernotrunning=\tServer wird nicht ausgef\u00FChrt.
+servertool.register=\n\n\tregister -server <Serverklassenname> \n\t -applicationName <alternativer Servername> \n\t -classpath <Classpath f\u00FCr Server> \n\t -args <Argumente f\u00FCr Server> \n\t -vmargs <Argumente f\u00FCr Server Java VM>\n
+servertool.register1=aktivierbaren Server registrieren
+servertool.register2=\tServer registriert (serverid = {0}).
+servertool.register3=\tServer registriert, aber au\u00DFer Betrieb (serverid = {0}).
+servertool.register4=\tServer bereits registriert (serverid = {0}).
+
+servertool.unregister=\n\tunregister [ -serverid <Server-ID> | -applicationName <Name> ] \n
+servertool.unregister1=Registrierung eines registrierten Servers aufheben
+servertool.unregister2=\tServerregistrierung aufgehoben.
+
+servertool.locate=\n\tlocate [ -serverid <Server-ID> | -applicationName <Name> ] [ <-endpointType <endpointType> ] \n
+servertool.locate1=Ports eines speziellen Typs f\u00FCr einen registrierten Server finden
+servertool.locate2=\n\n\tHostname {0} \n\n\t\tPort\t\tPorttyp\t\tORB-ID\n\t\t----\t\t-------\t\t------\n
+servertool.locateorb=\n\tlocateperorb [ -serverid <Server-ID> | -applicationName <Name> ] [ -orbid <ORB-Name> ]\n
+servertool.locateorb1=Ports f\u00FCr einen speziellen ORB bei einem registrierten Server finden
+servertool.locateorb2=\n\n\tHostname {0} \n\n\t\tPort\t\tPortType\t\tORB-ID\n\t\t----\t\t-------\t\t------\n
+servertool.getserverid=\n\tgetserverid [ -applicationName <Name> ] \n
+servertool.getserverid1=Server-ID f\u00FCr applicationName zur\u00FCckgeben
+servertool.getserverid2=\tServer-ID f\u00FCr applicationName {0} ist {1}
+
+servertool.list=\n\tlist\n
+servertool.list1=alle registrierten Server auflisten
+servertool.list2=\n\tServer-ID\tServerklassenname\t\tServeranwendung\n\t---------\t-----------------\t\t------------------\n
+servertool.listactive=\n\tlistactive
+servertool.listactive1=derzeit aktive Server auflisten
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=derzeit definierte applicationNames auflisten
+servertool.listappnames2=Derzeit definierte Server-applicationNames:
+
+servertool.shutdown=\n\tshutdown [ -serverid <Server-ID> | -applicationName <Name> ]\n
+servertool.shutdown1=registrierten Server herunterfahren
+servertool.shutdown2=\tServer erfolgreich heruntergefahren.
+servertool.startserver=\n\tstartup [ -serverid <Server-ID> | -applicationName <Name> ]\n
+servertool.startserver1=registrierten Server starten
+servertool.startserver2=\tServer erfolgreich hochgefahren.
+
+servertool.quit=\n\tquit\n
+servertool.quit1=dieses Tool beenden
+
+servertool.help=\thelp\n\tOR\n\thelp <Befehlsname>\n
+servertool.help1=Hilfe abrufen
+
+servertool.orbidmap=\\Verwendung: orblist [ -serverid <Server-ID> | -applicationName <Name> ]\n
+servertool.orbidmap1=Liste von ORB-Namen und ihren Zuordnungen
+servertool.orbidmap2=\n\tORB-ID\t\tORB-Name\n\t------\t\t--------\n
+pnameserv.success=Persistenter NameServer erfolgreich gestartet
+
+
+bootstrap.usage=Verwendung: {0} <Optionen> \n\nwobei folgende <Optionen> m\u00F6glich sind:\n -ORBInitialPort Anf\u00E4nglicher Port (erforderlich)\n -InitialServicesFile Datei mit Liste von anf\u00E4nglichen Services (erforderlich)\n
+bootstrap.success=Port wird auf {0} gesetzt, Services werden aus {1} gelesen
+bootstrap.filenotreadable=Datei {0} kann nicht gelesen werden
+bootstrap.filenotfound=Datei {0} wurde nicht gefunden
+bootstrap.exception=Beim Speichern von Eigenschaften in Datei {0} wurde eine Ausnahme abgefangen: Ausnahme {1}
+
+tnameserv.exception=Beim Hochfahren des Bootstrap-Services auf Port {0} wurde eine Ausnahme abgefangen
+tnameserv.usage=Verwenden Sie einen anderen Port mit den Befehlszeilenargumenten -ORBInitialPort <Portnummer>
+tnameserv.invalidhostoption=ORBInitialHost ist keine g\u00FCltige Option f\u00FCr NameService
+tnameserv.orbinitialport0=ORBInitialPort 0 ist keine g\u00FCltige Option f\u00FCr NameService
+tnameserv.hs1=Anf\u00E4nglicher Namenskontext:\n{0}
+tnameserv.hs2=TransientNameServer: Port f\u00FCr anf\u00E4ngliche Objektreferenzen wird auf {0} gesetzt
+tnameserv.hs3=Bereit.
+
+orbd.commfailure=\nStart von ORBD nicht erfolgreich, da ORBinitialPort bereits verwendet wird
+orbd.internalexception=\nStart von ORBD aufgrund einer internen Ausnahme nicht erfolgreich. \nM\u00F6gliche Ursachen: \n1. Der angegebene ORBInitialPort oder ORBActivationPort wird bereits verwendet \n2. Keine Berechtigung zum Schreiben von orb.db
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties
new file mode 100644
index 0000000..74c6b3a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_es.properties
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=Sintaxis: {0} <opciones> \n\ndonde <opciones> incluye:\n -port Puerto de activaci\u00F3n en el que se debe iniciar el ORBD, por defecto es el 1049 (opcional)\n -defaultdb Directorio para los archivos de ORBD, por defecto es "./orb.db" (opcional)\n -serverid Identificador de servidor para ORBD, por defecto es 1 (opcional)\n -ORBInitialPort Puerto inicial (necesario)\n -ORBInitialHost Nombre de host inicial (necesario)\n
+
+servertool.usage=Sintaxis: {0} <opciones> \n\ndonde <opciones> incluye:\n -ORBInitialPort Puerto inicial (necesario)\n -ORBInitialHost Nombre de host inicial (necesario)\n
+servertool.banner=\n\nBienvenido a Java IDL Server Tool \nescriba los comandos en la petici\u00F3n de datos \n
+servertool.shorthelp=\n\n\tComandos disponibles: \n\t------------------- \n
+servertool.baddef=Definici\u00F3n de servidor incorrecta: {0}
+servertool.nosuchserver=\tno se ha encontrado el servidor.
+servertool.helddown=\tel servidor se mantiene desconectado.
+servertool.nosuchorb=\tORB no v\u00E1lido.
+servertool.serverup=\tel servidor ya est\u00E1 conectado.
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tname - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targs - {0}
+servertool.vmargs=\tvmargs - {0}
+servertool.serverid=\tserver id - {0}
+servertool.servernotrunning=\tel servidor no se est\u00E1 ejecutando.
+servertool.register=\n\n\tregister -server <nombre de clase de servidor> \n\t -applicationName <nombre de servidor alternativo> \n\t -classpath <classpath al servidor> \n\t -args <argumentos para el servidor> \n\t -vmargs <argumentos para la MV Java del servidor>\n
+servertool.register1=registrar un servidor que se pueda activar
+servertool.register2=\tservidor registrado (identificador de servidor = {0}).
+servertool.register3=\tservidor registrado pero desconectado (identificador de servidor = {0}).
+servertool.register4=\tservidor ya registrado (identificador de servidor = {0}).
+
+servertool.unregister=\n\tunregister [ -serverid <identificador de servidor> | -applicationName <nombre> ] \n
+servertool.unregister1=anular el registro de un servidor registrado
+servertool.unregister2=\tanulado el registro del servidor.
+
+servertool.locate=\n\tlocate [ -serverid <identificador de servidor> | -applicationName <nombre> ] [ <-endpointType <tipo de punto final> ] \n
+servertool.locate1=localizar puertos de un tipo espec\u00EDfico para un servidor registrado
+servertool.locate2=\n\n\tNombre de host {0} \n\n\t\tPuerto\t\tTipo de puerto\t\tIdentificador ORB\n\t\t----\t\t---------\t\t------\n
+servertool.locateorb=\n\tlocateperorb [ -serverid <identificador de servidor> | -applicationName <nombre> ] [ -orbid <nombre de ORB> ]\n
+servertool.locateorb1=localizar puertos para un ORB espec\u00EDfico del servidor registrado
+servertool.locateorb2=\n\n\tNombre de host {0} \n\n\t\tPuerto\t\tTipo de puerto\t\tIdentificador de ORB\n\t\t----\t\t--------\t\t------\n
+servertool.getserverid=\n\tgetserverid [ -applicationName <nombre> ] \n
+servertool.getserverid1=devolver el identificador de servidor para un valor de applicationName
+servertool.getserverid2=\tEl identificador de servidor para applicationName {0} es {1}
+
+servertool.list=\n\tlist\n
+servertool.list1=enumerar todos los servidores registrados
+servertool.list2=\n\tIdentificador de servidor\tNombre de clase del servidor\t\tAplicaci\u00F3n de servidor\n\t-------------------------\t----------------------------\t\t----------------------\n
+servertool.listactive=\n\tlistactive
+servertool.listactive1=enumerar los servidores actualmente activos
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=enumerar los nombres de aplicaci\u00F3n actualmente definidos
+servertool.listappnames2=Nombres de aplicaci\u00F3n de servidor actualmente definidos:
+
+servertool.shutdown=\n\tshutdown [ -serverid <identificador de servidor> | -applicationName <nombre> ]\n
+servertool.shutdown1=apagar un servidor registrado
+servertool.shutdown2=\tservidor apagado correctamente.
+servertool.startserver=\n\tstartup [ -serverid <identificador de servidor> | -applicationName <nombre> ]\n
+servertool.startserver1=iniciar un servidor registrado
+servertool.startserver2=\tservidor iniciado correctamente.
+
+servertool.quit=\n\tquit\n
+servertool.quit1=salir de esta herramienta
+
+servertool.help=\thelp\n\tO\n\thelp <nombre de comando>\n
+servertool.help1=obtener ayuda
+
+servertool.orbidmap=\tSintaxis: orblist [ -serverid <identificador de servidor> | -applicationName <nombre> ]\n
+servertool.orbidmap1=lista de nombres de ORB y su asignaci\u00F3n
+servertool.orbidmap2=\n\tIdentificador de ORB\t\tNombre de ORB\n\t------\t\t--------\n
+pnameserv.success=NameServer constante iniciado correctamente
+
+
+bootstrap.usage=Sintaxis: {0} <opciones> \n\ndonde <opciones> incluye:\n -ORBInitialPort Puerto inicial (necesario)\n -InitialServicesFile Archivo que contiene una lista de los servicios iniciales (necesario)\n
+bootstrap.success=definiendo puerto en {0} y leyendo servicios de {1}
+bootstrap.filenotreadable=el archivo {0} no se puede leer
+bootstrap.filenotfound=no se ha encontrado el archivo {0}
+bootstrap.exception=se ha obtenido una excepci\u00F3n al guardar las propiedades en el archivo {0}: Excepci\u00F3n {1}
+
+tnameserv.exception=se ha obtenido una excepci\u00F3n al iniciar el servicio de inicializaci\u00F3n de datos en el puerto {0}
+tnameserv.usage=intente utilizar un puerto distinto con argumentos de l\u00EDnea de comandos -ORBInitialPort <n.\u00BA de puerto>
+tnameserv.invalidhostoption=ORBInitialHost no es una opci\u00F3n v\u00E1lida para NameService
+tnameserv.orbinitialport0=ORBInitialPort 0 no es una opci\u00F3n v\u00E1lida para NameService
+tnameserv.hs1=Contexto de Nomenclatura Inicial:\n{0}
+tnameserv.hs2=TransientNameServer: definiendo puerto para referencias a objeto iniciales en: {0}
+tnameserv.hs3=Listo.
+
+orbd.commfailure=\nORBD no puede iniciarse porque ORBinitialPort ya est\u00E1 en uso
+orbd.internalexception=\nORBD no puede iniciarse debido a una excepci\u00F3n interna. \nCausas posibles: \n1. El ORBInitialPort o el ORBActivationPort especificado ya est\u00E1 en uso \n2. No tiene permiso de escritura para orb.db
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties
new file mode 100644
index 0000000..6071d09
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_fr.properties
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=Syntaxe : {0} <options> \n\no\u00F9 <options> comprend :\n -port Port d''activation o\u00F9 l''ORBD doit \u00EAtre d\u00E9marr\u00E9, 1049 par d\u00E9faut (facultatif)\n -defaultdb R\u00E9pertoire des fichiers ORBD, par d\u00E9faut "./orb.db" (facultatif)\n -serverid ID de serveur pour ORBD, 1 par d\u00E9faut (facultatif)\n -ORBInitialPort Port initial (obligatoire)\n -ORBInitialHost Nom d''h\u00F4te initial (obligatoire)\n
+
+servertool.usage=Syntaxe : {0} <options> \n\no\u00F9 <options> comprend :\n -ORBInitialPort Port initial (obligatoire)\n -ORBInitialHost Nom d''h\u00F4te initial (obligatoire)\n
+servertool.banner=\n\nBienvenue dans l'outil Java IDL Server Tool \nSp\u00E9cifiez des commandes \u00E0 l'invite \n
+servertool.shorthelp=\n\n\tCommandes disponibles : \n\t------------------- \n
+servertool.baddef=D\u00E9finition de serveur incorrecte : {0}
+servertool.nosuchserver=\tce serveur est introuvable.
+servertool.helddown=\tserveur interrompu.
+servertool.nosuchorb=\tORB non valide.
+servertool.serverup=\tle serveur fonctionne d\u00E9j\u00E0.
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tname - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targs - {0}
+servertool.vmargs=\tvmargs - {0}
+servertool.serverid=\tID de serveur - {0}
+servertool.servernotrunning=\tle serveur ne fonctionne pas.
+servertool.register=\n\n\tregister -server <nom de classe de serveur> \n\t -applicationName <deuxi\u00E8me nom de serveur> \n\t -classpath <variable d'environnement CLASSPATH du serveur> \n\t -args <arguments au serveur> \n\t -vmargs <arguments au serveur Java VM>\n
+servertool.register1=inscrire un serveur activable
+servertool.register2=\tserveur inscrit (ID serveur = {0}).
+servertool.register3=\tserveur inscrit mais interrompu (ID serveur = {0}).
+servertool.register4=\tserveur d\u00E9j\u00E0 inscrit (ID serveur = {0}).
+
+servertool.unregister=\n\tunregister [ -serverid <ID serveur> | -applicationName <nom> ] \n
+servertool.unregister1=d\u00E9sinscrire un serveur inscrit
+servertool.unregister2=\tserveur d\u00E9sinscrit.
+
+servertool.locate=\n\tlocate [ -serverid <ID serveur> | -applicationName <nom> ] [ <-endpointType <type de point d'extr\u00E9mit\u00E9> ] \n
+servertool.locate1=rep\u00E9rer des ports de type sp\u00E9cifique d'un serveur inscrit
+servertool.locate2=\n\n\tNom d''h\u00F4te {0} \n\n\t\tPort\t\tType de port\t\tID ORB\n\t\t----\t\t---------\t\t------\n
+servertool.locateorb=\n\tlocateperorb [ -serverid <ID serveur> | -applicationName <nom> ] [ -orbid <nom ORB> ]\n
+servertool.locateorb1=rep\u00E9rer les ports d'un ORB sp\u00E9cifique de serveur inscrit
+servertool.locateorb2=\n\n\tNom d''h\u00F4te {0} \n\n\t\tPort\t\tType de port\t\tID ORB\n\t\t----\t\t--------\t\t------\n
+servertool.getserverid=\n\tgetserverid [ -applicationName <nom> ] \n
+servertool.getserverid1=renvoyer l'ID serveur pour un nom d'application
+servertool.getserverid2=\tL''ID serveur du nom d''application {0} est {1}
+
+servertool.list=\n\tlist\n
+servertool.list1=lister tous les serveurs inscrits
+servertool.list2=\n\tID serveur\tNom de classe serveur\t\tApplication serveur\n\t---------\t-----------------\t\t------------------\n
+servertool.listactive=\n\tlistactive
+servertool.listactive1=lister les serveurs actifs
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=lister les noms d'application d\u00E9finis
+servertool.listappnames2=Noms d'application du serveur d\u00E9finis :
+
+servertool.shutdown=\n\tshutdown [ -serverid <ID serveur> | -applicationName <nom> ]\n
+servertool.shutdown1=arr\u00EAter un serveur inscrit
+servertool.shutdown2=\tserveur arr\u00EAt\u00E9.
+servertool.startserver=\n\tstartup [ -serverid <ID serveur> | -applicationName <nom> ]\n
+servertool.startserver1=d\u00E9marrer un serveur inscrit
+servertool.startserver2=\tserveur d\u00E9marr\u00E9.
+
+servertool.quit=\n\tquit\n
+servertool.quit1=fermer cet outil
+
+servertool.help=\thelp\n\tOR\n\thelp <commande>\n
+servertool.help1=afficher l'aide
+
+servertool.orbidmap=\tSyntaxe : orblist [ -serverid <ID serveur> | -applicationName <nom> ]\n
+servertool.orbidmap1=liste des noms ORB et de leur mappage
+servertool.orbidmap2=\n\tID ORB\t\tNom ORB\n\t------\t\t--------\n
+pnameserv.success=NameServer persistant d\u00E9marr\u00E9
+
+
+bootstrap.usage=Syntaxe : {0} <options> \n\no\u00F9 <options> comprend :\n -ORBInitialPort Port initial (obligatoire)\n -InitialServicesFile Fichier contenant la liste des services initiaux (obligatoire)\n
+bootstrap.success=configuration du port sur {0} et lecture des services de {1}
+bootstrap.filenotreadable=le fichier {0} n''est pas lisible
+bootstrap.filenotfound=fichier {0} introuvable
+bootstrap.exception=exception d\u00E9tect\u00E9e lors de l''enregistrement des propri\u00E9t\u00E9s dans le fichier {0}. Exception : {1}
+
+tnameserv.exception=exception d\u00E9tect\u00E9e lors du d\u00E9marrage du service bootstrap sur le port {0}
+tnameserv.usage=essayez un autre port avec les arguments de ligne de commande -ORBInitialPort <num\u00E9ro de port>
+tnameserv.invalidhostoption=ORBInitialHost n'est pas une option valide pour NameService
+tnameserv.orbinitialport0=ORBInitialPort 0 n'est pas une option valide pour NameService
+tnameserv.hs1=Contexte de d\u00E9nomination initial :\n{0}
+tnameserv.hs2=TransientNameServer : configuration du port pour des r\u00E9f\u00E9rences d''objet initial sur {0}
+tnameserv.hs3=Pr\u00EAt.
+
+orbd.commfailure=\nLe d\u00E9marrage d'ORBD a \u00E9chou\u00E9 car ORBinitialPort est d\u00E9j\u00E0 utilis\u00E9
+orbd.internalexception=\nLe d\u00E9marrage d'ORBD a \u00E9chou\u00E9 en raison d'une exception interne. \nCauses possibles\u00A0: \n1. L'\u00E9l\u00E9ment ORBInitialPort ou ORBActivationPort sp\u00E9cifi\u00E9 est d\u00E9j\u00E0 utilis\u00E9 \n2. Aucune autorisation en \u00E9criture permettant d'\u00E9crire orb.db
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties
new file mode 100644
index 0000000..02f0f21
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_it.properties
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=Uso: {0} <opzioni> \n\ndove <opzioni> include:\n -port Porta di attivazione da cui avviare ORBD, valore predefinito 1049 (opzionale)\n -defaultdb Directory per i file ORBD, valore predefinito "./orb.db" (opzionale)\n -serverid ID server per ORBD, valore predefinito 1 (opzionale)\n -ORBInitialPort Porta iniziale (richiesta)\n -ORBInitialHost HostName iniziale (richiesto)\n
+
+servertool.usage=Uso: {0} <opzioni> \n\ndove <opzioni> include:\n -ORBInitialPort Porta iniziale (richiesta)\n -ORBInitialHost HostName iniziale (richiesto)\n
+servertool.banner=\n\nBenvenuti in Java IDL Server Tool \nimmettere i comandi quando richiesto \n
+servertool.shorthelp=\n\n\tComandi disponibili:\n\t-------------------- \n
+servertool.baddef=Definizione server errata: {0}
+servertool.nosuchserver=\timpossibile trovare il server indicato.
+servertool.helddown=\til server \u00E8 mantenuto inattivo.
+servertool.nosuchorb=\tORB non valido.
+servertool.serverup=\til server \u00E8 gi\u00E0 attivo.
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tnome - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targom - {0}
+servertool.vmargs=\targomvm - {0}
+servertool.serverid=\tID server - {0}
+servertool.servernotrunning=\til server non \u00E8 in funzione.
+servertool.register=\n\n\tregister -server <nome classe server> \n\t -applicationName <nome server alternativo> \n\t -classpath <classpath per il server> \n\t -args <argom per il server> \n\t -vmargs <argom per la Java VM del server>\n
+servertool.register1=registra un server attivabile
+servertool.register2=\tserver registrato (idserver = {0}).
+servertool.register3=\tserver registrato ma mantenuto inattivo (idserver = {0}).
+servertool.register4=\tserver gi\u00E0 registrato (idserver = {0}).
+
+servertool.unregister=\n\tunregister [ -serverid <id server> | -applicationName <nome> ] \n
+servertool.unregister1=rimuovi un server registrato.
+servertool.unregister2=\tserver rimosso dal registro.
+
+servertool.locate=\n\tlocate [ -serverid <id server> | -applicationName <nome> ] [ <-endpointType <endpointType> ] \n
+servertool.locate1=individua le porte di un tipo specifico per un server registrato
+servertool.locate2=\n\n\tNome host {0} \n\n\t\tPorta\t\tTipo porta\t\tId ORB\n\t\t-----\t\t----------\t\t------\n
+servertool.locateorb=\n\tlocateperorb [ -serverid <id server> | -applicationName <nome> ] [ -orbid <nome ORB> ]\n
+servertool.locateorb1=individua le porte per un orb specifico di un server registrato
+servertool.locateorb2=\n\n\tNome host {0} \n\n\t\tPorta\t\tPortType\t\tId ORB\n\t\t-----\t\t---------\t\t------\n
+servertool.getserverid=\n\tgetserverid [ -applicationName <nome> ] \n
+servertool.getserverid1=restituisce l'id server per un applicationName
+servertool.getserverid2=\tL''ID server per applicationName {0} \u00E8 {1}
+
+servertool.list=\n\tlista\n
+servertool.list1=elenca tutti i server registrati
+servertool.list2=\n\tID server\tNome classe server\t\tApplicazione server\n\t---------\t------------------\t\t-------------------\n
+servertool.listactive=\n\tlistactive
+servertool.listactive1=elenca i server attivi al momento
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=elenca applicationNames definiti al momento
+servertool.listappnames2=applicationNames del server definiti al momento:
+
+servertool.shutdown=\n\tshutdown [ -serverid <id server> | -applicationName <nome> ]\n
+servertool.shutdown1=arresta un server registrato
+servertool.shutdown2=\tserver arrestato correttamente
+servertool.startserver=\n\tstartup [ -serverid <id server> | -applicationName <nome> ]\n
+servertool.startserver1=avvia un server registrato
+servertool.startserver2=\tserver avviato correttamente.
+
+servertool.quit=\n\tesci\n
+servertool.quit1=esci dall'applicazione corrente
+
+servertool.help=\thelp\n\tOR\n\thelp <nome comando>\n
+servertool.help1=Guida
+
+servertool.orbidmap=\tUso: orblist [ -serverid <id server> | -applicationName <nome> ]\n
+servertool.orbidmap1=lista nomi orb e relativa mappatura
+servertool.orbidmap2=\n\tId ORB\t\tNome ORB\n\t------\t\t--------\n
+pnameserv.success=NameServer persistente avviato correttamente
+
+
+bootstrap.usage=Uso: {0} <opzioni> \n\ndove <opzioni> include:\n -ORBInitialPort Porta iniziale (richiesta)\n -InitialServicesFile File contenente la lista dei servizi iniziali (richiesto)\n
+bootstrap.success=impostazione porta su {0} e lettura servizi da {1} in corso
+bootstrap.filenotreadable=il file {0} non \u00E8 leggibile
+bootstrap.filenotfound=impossibile trovare il file {0}
+bootstrap.exception=rilevata un''eccezione durante il salvataggio delle propriet\u00E0 nel file {0}: eccezione {1}
+
+tnameserv.exception=rilevata un''eccezione durante l''avvio del servizio di bootstrap sulla porta {0}
+tnameserv.usage=utilizzare un'altra porta con gli argomenti di riga di comando -ORBInitialPort <n.porta>
+tnameserv.invalidhostoption=ORBInitialHost non \u00E8 un'opzione valida per NameService
+tnameserv.orbinitialport0=ORBInitialPort 0 non \u00E8 un'opzione valida per NameService
+tnameserv.hs1=Contesto di denominazione iniziale:\n{0}
+tnameserv.hs2=TransientNameServer: impostazione della porta per i riferimenti degli oggetti iniziali a: {0}
+tnameserv.hs3=Pronto.
+
+orbd.commfailure=\nImpossibile avviare ORBD perch\u00E9 ORBinitialPort \u00E8 gi\u00E0 in uso
+orbd.internalexception=\nImpossibile avviare ORBD a causa di un'eccezione interna. \neCause possibili: \n1. ORBInitialPort o ORBActivationPort specificato gi\u00E0 in uso \n2. Non esistono autorizzazioni per scrivere orb.db
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties
new file mode 100644
index 0000000..0ccd2ec
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ja.properties
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=\u4F7F\u7528\u65B9\u6CD5: {0} <options> \n\n<options>\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n -port ORBD\u306E\u8D77\u52D5\u30DD\u30FC\u30C8\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F1049(\u30AA\u30D7\u30B7\u30E7\u30F3)\n -defaultdb ORBD\u30D5\u30A1\u30A4\u30EB\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F"./orb.db"(\u30AA\u30D7\u30B7\u30E7\u30F3)\n -serverid ORBD\u306E\u30B5\u30FC\u30D0\u30FCId\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F1(\u30AA\u30D7\u30B7\u30E7\u30F3)\n -ORBInitialPort \u521D\u671F\u30DD\u30FC\u30C8(\u5FC5\u9808)\n -ORBInitialHost \u521D\u671F\u30DB\u30B9\u30C8\u540D(\u5FC5\u9808)\n
+
+servertool.usage=\u4F7F\u7528\u65B9\u6CD5: {0} <options> \n\n<options>\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n -ORBInitialPort \u521D\u671F\u30DD\u30FC\u30C8(\u5FC5\u9808)\n -ORBInitialHost \u521D\u671F\u30DB\u30B9\u30C8\u540D(\u5FC5\u9808)\n
+servertool.banner=\n\nJava IDL Server Tool\u3078\u3088\u3046\u3053\u305D\n\u30D7\u30ED\u30F3\u30D7\u30C8\u306B\u30B3\u30DE\u30F3\u30C9\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\n
+servertool.shorthelp=\n\n\t\u4F7F\u7528\u53EF\u80FD\u306A\u30B3\u30DE\u30F3\u30C9: \n\t------------------- \n
+servertool.baddef=\u4E0D\u6B63\u306A\u30B5\u30FC\u30D0\u30FC\u5B9A\u7FA9: {0}
+servertool.nosuchserver=\t\u6307\u5B9A\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+servertool.helddown=\t\u30B5\u30FC\u30D0\u30FC\u306F\u505C\u6B62\u3057\u3066\u3044\u307E\u3059\u3002
+servertool.nosuchorb=\tORB\u304C\u7121\u52B9\u3067\u3059\u3002
+servertool.serverup=\t\u30B5\u30FC\u30D0\u30FC\u306F\u8D77\u52D5\u3057\u3066\u3044\u307E\u3059\u3002
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tname - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targs - {0}
+servertool.vmargs=\tvmargs - {0}
+servertool.serverid=\tserver id - {0}
+servertool.servernotrunning=\t\u30B5\u30FC\u30D0\u30FC\u306F\u7A3C\u50CD\u3057\u3066\u3044\u307E\u305B\u3093\u3002
+servertool.register=\n\n\tregister -server <server class name> \n\t -applicationName <alternate server name> \n\t -classpath <classpath to server> \n\t -args <args to server> \n\t -vmargs <args to server Java VM>\n
+servertool.register1=\u8D77\u52D5\u53EF\u80FD\u306A\u30B5\u30FC\u30D0\u30FC\u3092\u767B\u9332\u3057\u307E\u3059
+servertool.register2=\t\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC(serverid={0})\u3002
+servertool.register3=\t\u767B\u9332\u3055\u308C\u3066\u3044\u308B\u304C\u8D77\u52D5\u3057\u3066\u3044\u306A\u3044\u30B5\u30FC\u30D0\u30FC(serverid={0})\u3002
+servertool.register4=\t\u767B\u9332\u6E08\u306E\u30B5\u30FC\u30D0\u30FC(serverid={0})\u3002
+
+servertool.unregister=\n\tunregister [ -serverid <server id> | -applicationName <name> ]\n
+servertool.unregister1=\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u306E\u767B\u9332\u3092\u89E3\u9664\u3057\u307E\u3059
+servertool.unregister2=\t\u30B5\u30FC\u30D0\u30FC\u306E\u767B\u9332\u304C\u89E3\u9664\u3055\u308C\u307E\u3057\u305F\u3002
+
+servertool.locate=\n\tlocate [ -serverid <server id> | -applicationName <name> ] [ <-endpointType <endpointType> ]\n
+servertool.locate1=\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u306E\u7279\u5B9A\u30BF\u30A4\u30D7\u306E\u30DD\u30FC\u30C8\u3092\u691C\u51FA\u3057\u307E\u3059
+servertool.locate2=\n\n\t\u30DB\u30B9\u30C8\u540D{0}\n\n\t\t\u30DD\u30FC\u30C8\t\t\u30DD\u30FC\u30C8\u30FB\u30BF\u30A4\u30D7\t\tORB ID\n\t\t------\t\t------------\t\t------\n
+servertool.locateorb=\n\tlocateperorb [ -serverid <server id> | -applicationName <name> ] [ -orbid <ORB name> ]\n
+servertool.locateorb1=\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u306E\u7279\u5B9AORB\u306E\u30DD\u30FC\u30C8\u3092\u691C\u51FA\u3057\u307E\u3059
+servertool.locateorb2=\n\n\t\u30DB\u30B9\u30C8\u540D{0}\n\n\t\t\u30DD\u30FC\u30C8\t\t\u30DD\u30FC\u30C8\u30FB\u30BF\u30A4\u30D7\t\tORB ID\n\t\t------\t\t------------\t\t------\n
+servertool.getserverid=\n\tgetserverid [ -applicationName <name> ]\n
+servertool.getserverid1=applicationName\u306E\u30B5\u30FC\u30D0\u30FCID\u3092\u8FD4\u3057\u307E\u3059
+servertool.getserverid2=\tapplicationName {0}\u306E\u30B5\u30FC\u30D0\u30FCID\u306F{1}\u3067\u3059
+
+servertool.list=\n\tlist\n
+servertool.list1=\u767B\u9332\u3055\u308C\u305F\u3059\u3079\u3066\u306E\u30B5\u30FC\u30D0\u30FC\u306E\u30EA\u30B9\u30C8\u3092\u8868\u793A\u3057\u307E\u3059
+servertool.list2=\n\t\u30B5\u30FC\u30D0\u30FCID\t\u30B5\u30FC\u30D0\u30FC\u306E\u30AF\u30E9\u30B9\u540D\t\t\u30B5\u30FC\u30D0\u30FC\u30FB\u30A2\u30D7\u30EA\u30B1\u30FC\u30B7\u30E7\u30F3\n\t---------\t----------------\t\t----------------------\n
+servertool.listactive=\n\tlistactive
+servertool.listactive1=\u73FE\u5728\u30A2\u30AF\u30C6\u30A3\u30D6\u306A\u30B5\u30FC\u30D0\u30FC\u306E\u30EA\u30B9\u30C8\u3092\u8868\u793A\u3057\u307E\u3059
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=\u73FE\u5728\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u308BapplicationNames\u306E\u30EA\u30B9\u30C8\u3092\u8868\u793A\u3057\u307E\u3059
+servertool.listappnames2=\u73FE\u5728\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u308B\u30B5\u30FC\u30D0\u30FCapplicationNames:
+
+servertool.shutdown=\n\tshutdown [ -serverid <server id> | -applicationName <name> ]\n
+servertool.shutdown1=\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u3092\u505C\u6B62\u3057\u307E\u3059
+servertool.shutdown2=\t\u30B5\u30FC\u30D0\u30FC\u306E\u505C\u6B62\u306B\u6210\u529F\u3057\u307E\u3057\u305F\u3002
+servertool.startserver=\n\tstartup [ -serverid <server id> | -applicationName <name> ]\n
+servertool.startserver1=\u767B\u9332\u3055\u308C\u305F\u30B5\u30FC\u30D0\u30FC\u3092\u8D77\u52D5\u3057\u307E\u3059
+servertool.startserver2=\t\u30B5\u30FC\u30D0\u30FC\u306E\u8D77\u52D5\u306B\u6210\u529F\u3057\u307E\u3057\u305F\u3002
+
+servertool.quit=\n\tquit\n
+servertool.quit1=\u3053\u306E\u30C4\u30FC\u30EB\u3092\u7D42\u4E86\u3057\u307E\u3059
+
+servertool.help=\thelp\n\t\u307E\u305F\u306F\n\thelp <command name>\n
+servertool.help1=\u30D8\u30EB\u30D7\u3092\u8868\u793A\u3057\u307E\u3059
+
+servertool.orbidmap=\t\u4F7F\u7528\u65B9\u6CD5: orblist [ -serverid <server id> | -applicationName <name> ]\n
+servertool.orbidmap1=ORB\u540D\u304A\u3088\u3073\u305D\u306E\u30DE\u30C3\u30D4\u30F3\u30B0\u306E\u30EA\u30B9\u30C8
+servertool.orbidmap2=\n\tORB ID\t\tORB\u540D\n\t------\t\t--------\n
+pnameserv.success=\u6301\u7D9ANameServer\u306E\u8D77\u52D5\u306B\u6210\u529F\u3057\u307E\u3057\u305F
+
+
+bootstrap.usage=\u4F7F\u7528\u65B9\u6CD5: {0} <options> \n\n<options>\u306B\u306F\u6B21\u306E\u3082\u306E\u304C\u3042\u308A\u307E\u3059\u3002\n -ORBInitialPort \u521D\u671F\u30DD\u30FC\u30C8(\u5FC5\u9808)\n -InitialServicesFile \u521D\u671F\u30B5\u30FC\u30D3\u30B9\u30FB\u30EA\u30B9\u30C8\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB(\u5FC5\u9808)\n
+bootstrap.success=\u30DD\u30FC\u30C8\u3092{0}\u306B\u8A2D\u5B9A\u3057\u3001{1}\u304B\u3089\u30B5\u30FC\u30D3\u30B9\u3092\u8AAD\u307F\u8FBC\u307F\u307E\u3059
+bootstrap.filenotreadable=\u30D5\u30A1\u30A4\u30EB{0}\u3092\u8AAD\u307F\u8FBC\u3081\u307E\u305B\u3093
+bootstrap.filenotfound=\u30D5\u30A1\u30A4\u30EB{0}\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093
+bootstrap.exception=\u30D7\u30ED\u30D1\u30C6\u30A3\u3092\u30D5\u30A1\u30A4\u30EB{0}\u306B\u4FDD\u5B58\u4E2D\u306B\u4F8B\u5916\u3092\u6355\u6349\u3057\u307E\u3057\u305F: \u4F8B\u5916{1}
+
+tnameserv.exception=\u30DD\u30FC\u30C8{0}\u3067\u30D6\u30FC\u30C8\u30B9\u30C8\u30E9\u30C3\u30D7\u30FB\u30B5\u30FC\u30D3\u30B9\u3092\u8D77\u52D5\u4E2D\u306B\u4F8B\u5916\u3092\u6355\u6349\u3057\u307E\u3057\u305F
+tnameserv.usage=\u30B3\u30DE\u30F3\u30C9\u884C\u5F15\u6570-ORBInitialPort<portno>\u3092\u4F7F\u7528\u3057\u3066\u5225\u306E\u30DD\u30FC\u30C8\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044
+tnameserv.invalidhostoption=ORBInitialHost\u306FNameService\u306B\u6709\u52B9\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u306F\u3042\u308A\u307E\u305B\u3093
+tnameserv.orbinitialport0=ORBInitialPort 0\u306FNameService\u306B\u6709\u52B9\u306A\u30AA\u30D7\u30B7\u30E7\u30F3\u3067\u306F\u3042\u308A\u307E\u305B\u3093
+tnameserv.hs1=\u521D\u671F\u30CD\u30FC\u30DF\u30F3\u30B0\u30FB\u30B3\u30F3\u30C6\u30AD\u30B9\u30C8:\n{0}
+tnameserv.hs2=TransientNameServer: \u521D\u671F\u30AA\u30D6\u30B8\u30A7\u30AF\u30C8\u53C2\u7167\u306E\u30DD\u30FC\u30C8\u3092{0}\u306B\u8A2D\u5B9A\u3057\u307E\u3059
+tnameserv.hs3=\u6E96\u5099\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F\u3002
+
+orbd.commfailure=\nORBinitialPort\u304C\u4F7F\u7528\u4E2D\u3067\u3042\u308B\u305F\u3081\u3001ORBD\u306E\u8D77\u52D5\u306B\u5931\u6557\u3057\u307E\u3057\u305F
+orbd.internalexception=\n\u5185\u90E8\u4F8B\u5916\u306E\u305F\u3081\u306BORBD\u306E\u8D77\u52D5\u306B\u5931\u6557\u3057\u307E\u3057\u305F\u3002\n\u8003\u3048\u3089\u308C\u308B\u539F\u56E0: \n1. \u6307\u5B9A\u3055\u308C\u305FORBInitialPort\u307E\u305F\u306FORBActivationPort\u304C\u4F7F\u7528\u4E2D\n2. orb.db\u3078\u306E\u66F8\u8FBC\u307F\u6A29\u9650\u304C\u306A\u3044
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties
new file mode 100644
index 0000000..9fde7fe
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_ko.properties
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=\uC0AC\uC6A9\uBC95: {0} <options> \n\n\uC5EC\uAE30\uC11C <options>\uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n -port ORBD\uAC00 \uC2DC\uC791\uB418\uC5B4\uC57C \uD558\uB294 \uD65C\uC131 \uD3EC\uD2B8\uB85C, \uAE30\uBCF8\uAC12\uC740 1049\uC785\uB2C8\uB2E4(\uC120\uD0DD\uC0AC\uD56D).\n -defaultdb ORBD \uD30C\uC77C\uC758 \uB514\uB809\uD1A0\uB9AC\uB85C, \uAE30\uBCF8\uAC12\uC740 "./orb.db"\uC785\uB2C8\uB2E4(\uC120\uD0DD\uC0AC\uD56D).\n -serverid ORBD\uC758 \uC11C\uBC84 ID\uB85C, \uAE30\uBCF8\uAC12\uC740 1 \uC785\uB2C8\uB2E4(\uC120\uD0DD\uC0AC\uD56D).\n -ORBInitialPort \uCD08\uAE30 \uD3EC\uD2B8\uC785\uB2C8\uB2E4(\uD544\uC218).\n -ORBInitialHost \uCD08\uAE30 HostName\uC785\uB2C8\uB2E4(\uD544\uC218).\n
+
+servertool.usage=\uC0AC\uC6A9\uBC95: {0} <options> \n\n\uC5EC\uAE30\uC11C <options>\uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n -ORBInitialPort \uCD08\uAE30 \uD3EC\uD2B8\uC785\uB2C8\uB2E4(\uD544\uC218).\n -ORBInitialHost \uCD08\uAE30 HostName\uC785\uB2C8\uB2E4(\uD544\uC218).\n
+servertool.banner=\n\nJava IDL \uC11C\uBC84 \uD234 \uC2DC\uC791 \n\uD504\uB86C\uD504\uD2B8\uC5D0 \uBA85\uB839\uC744 \uC785\uB825\uD558\uC2ED\uC2DC\uC624. \n
+servertool.shorthelp=\n\n\t\uC0AC\uC6A9 \uAC00\uB2A5\uD55C \uBA85\uB839: \n\t------------------- \n
+servertool.baddef=\uC798\uBABB\uB41C \uC11C\uBC84 \uC815\uC758: {0}
+servertool.nosuchserver=\t\uD574\uB2F9 \uC11C\uBC84\uB97C \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+servertool.helddown=\t\uC11C\uBC84\uC758 \uC791\uB3D9\uC774 \uC911\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+servertool.nosuchorb=\tORB\uAC00 \uBD80\uC801\uD569\uD569\uB2C8\uB2E4.
+servertool.serverup=\t\uC11C\uBC84\uAC00 \uC774\uBBF8 \uC791\uB3D9 \uC911\uC785\uB2C8\uB2E4.
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tname - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targs - {0}
+servertool.vmargs=\tvmargs - {0}
+servertool.serverid=\tserver id - {0}
+servertool.servernotrunning=\t\uC11C\uBC84\uAC00 \uC2E4\uD589 \uC911\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+servertool.register=\n\n\tregister -server <server class name> \n\t -applicationName <alternate server name> \n\t -classpath <classpath to server> \n\t -args <args to server> \n\t -vmargs <args to server Java VM>\n
+servertool.register1=\uD65C\uC131 \uAC00\uB2A5 \uC11C\uBC84 \uB4F1\uB85D
+servertool.register2=\t\uC11C\uBC84\uAC00 \uB4F1\uB85D\uB418\uC5C8\uC2B5\uB2C8\uB2E4(serverid = {0}).
+servertool.register3=\t\uC11C\uBC84\uAC00 \uB4F1\uB85D\uB418\uC5C8\uC9C0\uB9CC \uC791\uB3D9\uC774 \uC911\uC9C0\uB418\uC5C8\uC2B5\uB2C8\uB2E4(serverid = {0}).
+servertool.register4=\t\uC11C\uBC84\uAC00 \uC774\uBBF8 \uB4F1\uB85D\uB418\uC5C8\uC2B5\uB2C8\uB2E4(serverid = {0}).
+
+servertool.unregister=\n\tunregister [ -serverid <server id> | -applicationName <name> ] \n
+servertool.unregister1=\uB4F1\uB85D\uB41C \uC11C\uBC84\uC758 \uB4F1\uB85D \uD574\uC81C
+servertool.unregister2=\t\uC11C\uBC84\uC758 \uB4F1\uB85D\uC774 \uD574\uC81C\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+
+servertool.locate=\n\tlocate [ -serverid <server id> | -applicationName <name> ] [ <-endpointType <endpointType> ] \n
+servertool.locate1=\uB4F1\uB85D\uB41C \uC11C\uBC84\uC5D0 \uB300\uD55C \uD2B9\uC815 \uC720\uD615\uC758 \uD3EC\uD2B8 \uCC3E\uAE30
+servertool.locate2=\n\n\t\uD638\uC2A4\uD2B8 \uC774\uB984 {0} \n\n\t\t\uD3EC\uD2B8\t\t\uD3EC\uD2B8 \uC720\uD615\t\tORB ID\n\t\t----\t\t---------\t\t------\n
+servertool.locateorb=\n\tlocateperorb [ -serverid <server id> | -applicationName <name> ] [ -orbid <ORB name> ]\n
+servertool.locateorb1=\uB4F1\uB85D\uB41C \uC11C\uBC84\uC5D0 \uB300\uD55C \uD2B9\uC815 ORB\uC758 \uD3EC\uD2B8 \uCC3E\uAE30
+servertool.locateorb2=\n\n\t\uD638\uC2A4\uD2B8 \uC774\uB984 {0} \n\n\t\t\uD3EC\uD2B8\t\tPortType\t\tORB ID\n\t\t----\t\t--------\t\t------\n
+servertool.getserverid=\n\tgetserverid [ -applicationName <name> ] \n
+servertool.getserverid1=applicationName\uC5D0 \uB300\uD55C \uC11C\uBC84 ID \uBC18\uD658
+servertool.getserverid2=\tapplicationName {0}\uC5D0 \uB300\uD55C \uC11C\uBC84 ID\uB294 {1}\uC785\uB2C8\uB2E4.
+
+servertool.list=\n\t\uBAA9\uB85D\n
+servertool.list1=\uB4F1\uB85D\uB41C \uC11C\uBC84 \uBAA8\uB450 \uB098\uC5F4
+servertool.list2=\n\t\uC11C\uBC84 ID\t\uC11C\uBC84 \uD074\uB798\uC2A4 \uC774\uB984\t\t\uC11C\uBC84 \uC560\uD50C\uB9AC\uCF00\uC774\uC158\n\t---------\t-----------------\t\t------------------\n
+servertool.listactive=\n\tlistactive
+servertool.listactive1=\uD604\uC7AC \uD65C\uC131 \uC11C\uBC84 \uB098\uC5F4
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=\uD604\uC7AC \uC815\uC758\uB41C applicationNames \uB098\uC5F4
+servertool.listappnames2=\uD604\uC7AC \uC815\uC758\uB41C \uC11C\uBC84 applicationNames:
+
+servertool.shutdown=\n\tshutdown [ -serverid <server id> | -applicationName <name> ]\n
+servertool.shutdown1=\uB4F1\uB85D\uB41C \uC11C\uBC84 \uC885\uB8CC
+servertool.shutdown2=\t\uC11C\uBC84\uAC00 \uC131\uACF5\uC801\uC73C\uB85C \uC885\uB8CC\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+servertool.startserver=\n\tstartup [ -serverid <server id> | -applicationName <name> ]\n
+servertool.startserver1=\uB4F1\uB85D\uB41C \uC11C\uBC84 \uC2DC\uC791
+servertool.startserver2=\t\uC11C\uBC84\uAC00 \uC131\uACF5\uC801\uC73C\uB85C \uC2DC\uC791\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+
+servertool.quit=\n\tquit\n
+servertool.quit1=\uC774 \uD234 \uC885\uB8CC
+
+servertool.help=\thelp\n\tOR\n\thelp <command name>\n
+servertool.help1=\uB3C4\uC6C0\uB9D0 \uD45C\uC2DC
+
+servertool.orbidmap=\t\uC0AC\uC6A9\uBC95: orblist [ -serverid <server id> | -applicationName <name> ]\n
+servertool.orbidmap1=ORB \uC774\uB984\uACFC \uD574\uB2F9 \uB9E4\uD551 \uB098\uC5F4
+servertool.orbidmap2=\n\tORB ID\t\tORB \uC774\uB984\n\t------\t\t--------\n
+pnameserv.success=\uC9C0\uC18D NameServer\uAC00 \uC131\uACF5\uC801\uC73C\uB85C \uC2DC\uC791\uB428
+
+
+bootstrap.usage=\uC0AC\uC6A9\uBC95: {0} <options> \n\n\uC5EC\uAE30\uC11C <options>\uB294 \uB2E4\uC74C\uACFC \uAC19\uC2B5\uB2C8\uB2E4.\n -ORBInitialPort \uCD08\uAE30 \uD3EC\uD2B8\uC785\uB2C8\uB2E4(\uD544\uC218).\n -InitialServicesFile \uCD08\uAE30 \uC11C\uBE44\uC2A4 \uBAA9\uB85D\uC774 \uB4E4\uC5B4 \uC788\uB294 \uD30C\uC77C\uC785\uB2C8\uB2E4(\uD544\uC218).\n
+bootstrap.success=\uD3EC\uD2B8\uB97C {0}(\uC73C)\uB85C \uC124\uC815\uD558\uACE0 {1}\uC5D0\uC11C \uC11C\uBE44\uC2A4\uB97C \uC77D\uB294 \uC911
+bootstrap.filenotreadable={0} \uD30C\uC77C\uC744 \uC77D\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+bootstrap.filenotfound={0} \uD30C\uC77C\uC744 \uCC3E\uC744 \uC218 \uC5C6\uC2B5\uB2C8\uB2E4.
+bootstrap.exception={0} \uD30C\uC77C\uC5D0 \uC18D\uC131\uC744 \uC800\uC7A5\uD558\uB294 \uC911 \uC608\uC678\uC0AC\uD56D \uBC1C\uC0DD: {1} \uC608\uC678\uC0AC\uD56D
+
+tnameserv.exception={0} \uD3EC\uD2B8\uC5D0\uC11C \uBD80\uD2B8\uC2A4\uD2B8\uB7A9 \uC11C\uBE44\uC2A4\uB97C \uC2DC\uC791\uD558\uB294 \uC911 \uC608\uC678\uC0AC\uD56D\uC774 \uBC1C\uC0DD\uD588\uC2B5\uB2C8\uB2E4.
+tnameserv.usage=-ORBInitialPort <portno> \uBA85\uB839\uD589 \uC778\uC218\uB85C \uB2E4\uB978 \uD3EC\uD2B8 \uC0AC\uC6A9 \uC2DC\uB3C4
+tnameserv.invalidhostoption=ORBInitialHost\uB294 NameService\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uC635\uC158\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+tnameserv.orbinitialport0=ORBInitialPort 0\uC740 NameService\uC5D0 \uB300\uD574 \uC801\uD569\uD55C \uC635\uC158\uC774 \uC544\uB2D9\uB2C8\uB2E4.
+tnameserv.hs1=\uCD08\uAE30 \uC774\uB984 \uC9C0\uC815 \uCEE8\uD14D\uC2A4\uD2B8:\n{0}
+tnameserv.hs2=TransientNameServer: \uCD08\uAE30 \uAC1D\uCCB4 \uCC38\uC870\uB97C \uC704\uD55C \uD3EC\uD2B8\uB97C {0}(\uC73C)\uB85C \uC124\uC815\uD558\uB294 \uC911
+tnameserv.hs3=\uC900\uBE44\uB418\uC5C8\uC2B5\uB2C8\uB2E4.
+
+orbd.commfailure=\nORBinitialPort\uAC00 \uC774\uBBF8 \uC0AC\uC6A9 \uC911\uC774\uC5B4\uC11C ORBD \uC2DC\uC791\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4.
+orbd.internalexception=\n\uB0B4\uBD80 \uC608\uC678\uC0AC\uD56D\uC73C\uB85C \uC778\uD574 ORBD \uC2DC\uC791\uC744 \uC2E4\uD328\uD588\uC2B5\uB2C8\uB2E4. \n\uAC00\uB2A5\uD55C \uC6D0\uC778: \n1. \uC9C0\uC815\uB41C ORBInitialPort \uB610\uB294 ORBActivationPort\uAC00 \uC774\uBBF8 \uC0AC\uC6A9 \uC911\uC785\uB2C8\uB2E4.\n2. orb.db\uB97C \uC4F8 \uC218 \uC788\uB294 \uC4F0\uAE30 \uAD8C\uD55C\uC774 \uC5C6\uC2B5\uB2C8\uB2E4.
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties
new file mode 100644
index 0000000..c87e4c3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_pt_BR.properties
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=Uso: {0} <op\u00E7\u00F5es> \n\nem que <op\u00E7\u00F5es> inclui:\n -port porta de ativa\u00E7\u00E3o na qual o ORBD deve ser iniciado, padr\u00E3o 1049 (opcional)\n -defaultdb diret\u00F3rio dos arquivos ORBD, padr\u00E3o "./orb.db" (opcional)\n -serverid id do servidor para ORBD, padr\u00E3o 1 (opcional)\n -ORBInitialPort porta inicial (obrigat\u00F3rio)\n -ORBInitialHost nome de host inicial (obrigat\u00F3rio)\n
+
+servertool.usage=Uso: {0} <op\u00E7\u00F5es> \n\nem que <op\u00E7\u00F5es> inclui:\n -ORBInitialPort porta inicial (obrigat\u00F3rio)\n -ORBInitialHost nome de host inicial (obrigat\u00F3rio)\n
+servertool.banner=\n\nBem-vindo \u00E0 Ferramenta de Servidor IDL Java \ninsira os comandos no prompt \n
+servertool.shorthelp=\n\n\tComandos Dispon\u00EDveis: \n\t------------------- \n
+servertool.baddef=Defini\u00E7\u00E3o do servidor inv\u00E1lida: {0}
+servertool.nosuchserver=\tservidor n\u00E3o encontrado.
+servertool.helddown=\to servidor est\u00E1 em espera.
+servertool.nosuchorb=\tORB inv\u00E1lido.
+servertool.serverup=\to servidor j\u00E1 est\u00E1 ativo.
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tname - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targs - {0}
+servertool.vmargs=\tvmargs - {0}
+servertool.serverid=\tserver id - {0}
+servertool.servernotrunning=\to servidor n\u00E3o est\u00E1 em execu\u00E7\u00E3o.
+servertool.register=\n\n\tregister -server <nome da classe do servidor> \n\t -applicationName <nome do servidor alternativo> \n\t -classpath <classpath para o servidor> \n\t -args <args para o servidor> \n\t -vmargs <args para a VM Java do servidor>\n
+servertool.register1=registra um servidor ativ\u00E1vel
+servertool.register2=\tservidor registrado (serverid = {0}).
+servertool.register3=\tservidor registrado, mas em espera (serverid = {0}).
+servertool.register4=\tservidor j\u00E1 registrado (serverid = {0}).
+
+servertool.unregister=\n\tunregister [ -serverid <id do servidor> | -applicationName <nome> ] \n
+servertool.unregister1=cancela o registro de um servidor registrado
+servertool.unregister2=\tservidor n\u00E3o registrado.
+
+servertool.locate=\n\tlocate [ -serverid <id do servidor> | -applicationName <nome> ] [ <-endpointType <endpointType> ] \n
+servertool.locate1=localiza portas de tipo espec\u00EDfico para um servidor registrado
+servertool.locate2=\n\n\tNome do Host {0} \n\n\t\tPorta\t\tTipo de Porta\t\tId do ORB\n\t\t----\t\t---------\t\t------\n
+servertool.locateorb=\n\tlocateperorb [ -serverid <id do servidor> | -applicationName <nome> ] [ -orbid <nome ORB> ]\n
+servertool.locateorb1=localiza portas para um orb espec\u00EDfico de servidor registrado
+servertool.locateorb2=\n\n\tNome do Host {0} \n\n\t\tPorta\t\tTipo de Porta\t\tId do ORB\n\t\t----\t\t--------\t\t------\n
+servertool.getserverid=\n\tgetserverid [ -applicationName <nome> ] \n
+servertool.getserverid1=retorna o id do servidor de um applicationName
+servertool.getserverid2=\tID do Servidor de applicationName {0} \u00E9 {1}
+
+servertool.list=\n\tlist\n
+servertool.list1=lista todos os servidores registrados
+servertool.list2=\n\tId do Servidor\tNome de Classe do Servidor\t\tAplicativo do Servidor\n\t---------\t-----------------\t\t------------------\n
+servertool.listactive=\n\tlistactive
+servertool.listactive1=lista os servidores atualmente ativos
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=lista os applicationNames atualmente definidos
+servertool.listappnames2=applicationNames do servidor definidos atualmente:
+
+servertool.shutdown=\n\tshutdown [ -serverid <id do servidor> | -applicationName <nome> ]\n
+servertool.shutdown1=faz shutdown de um servidor registrado
+servertool.shutdown2=\tshutdown do servidor bem-sucedido.
+servertool.startserver=\n\tstartup [ -serverid <id do servidor> | -applicationName <nome> ]\n
+servertool.startserver1=inicia um servidor registrado
+servertool.startserver2=\tservidor iniciado com \u00EAxito.
+
+servertool.quit=\n\tquit\n
+servertool.quit1=sai desta ferramenta
+
+servertool.help=\thelp\n\tOR\n\thelp <nome do comando>\n
+servertool.help1=obt\u00E9m ajuda
+
+servertool.orbidmap=\tUso: orblist [ -serverid <id do servidor> | -applicationName <nome> ]\n
+servertool.orbidmap1=lista de nomes de orb e seus mapeamentos
+servertool.orbidmap2=\n\tId de ORB\t\tNome de ORB\n\t------\t\t--------\n
+pnameserv.success=NameServer Persistente Iniciado com \u00CAxito
+
+
+bootstrap.usage=Uso: {0} <op\u00E7\u00F5es> \n\nem que <op\u00E7\u00F5es> inclui:\n -ORBInitialPort porta inicial (obrigat\u00F3rio)\n -InitialServicesFile arquivo que cont\u00E9m a lista de servi\u00E7os iniciais (obrigat\u00F3rio)\n
+bootstrap.success=definindo porta para {0} e lendo servi\u00E7os de {1}
+bootstrap.filenotreadable=o arquivo {0} n\u00E3o \u00E9 leg\u00EDvel
+bootstrap.filenotfound=arquivo {0} n\u00E3o encontrado
+bootstrap.exception=exce\u00E7\u00E3o capturada ao salvar as propriedades no Arquivo {0}: exce\u00E7\u00E3o {1}
+
+tnameserv.exception=uma exce\u00E7\u00E3o capturada ao iniciar o servi\u00E7o de inicializa\u00E7\u00E3o na porta {0}
+tnameserv.usage=tente usar outra porta com os argumentos de linha de comandos -ORBInitialPort <n\u00BA da porta>
+tnameserv.invalidhostoption=ORBInitialHost n\u00E3o \u00E9 uma op\u00E7\u00E3o v\u00E1lida para NameService
+tnameserv.orbinitialport0=ORBInitialPort 0 n\u00E3o \u00E9 uma op\u00E7\u00E3o v\u00E1lida para NameService
+tnameserv.hs1=Contexto de Nomea\u00E7\u00E3o Inicial:\n{0}
+tnameserv.hs2=TransientNameServer: definindo porta para as refer\u00EAncias de objeto iniciais: {0}
+tnameserv.hs3=Pronto.
+
+orbd.commfailure=\nFalha ao iniciar ORBD porque ORBinitialPort j\u00E1 est\u00E1 em uso
+orbd.internalexception=\nFalha ao iniciar ORBD devido a uma exce\u00E7\u00E3o interna. \nPoss\u00EDveis causas: \n1. ORBInitialPort especificado ou ORBActivationPort j\u00E1 em uso \n2. Sem permiss\u00E3o de grava\u00E7\u00E3o para gravar orb.db
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties
new file mode 100644
index 0000000..677407a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_sv.properties
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=Syntax: {0} <alternativ> \n\nd\u00E4r <alternativ> inkluderar:\n -port Aktiveringsport d\u00E4r ORBD ska startas, standard 1049 (valfritt)\n -defaultdb Katalog f\u00F6r ORBD-filer, standard "./orb.db" (valfritt)\n -serverid Server-id f\u00F6r ORBD, standard 1 (valfritt)\n -ORBInitialPort Ursprunglig port (obligatoriskt)\n -ORBInitialHost Ursprungligt v\u00E4rdnamn (obligatoriskt)\n
+
+servertool.usage=Syntax: {0} <alternativ> \n\nd\u00E4r <alternativ> inkluderar:\n -ORBInitialPort Ursprunglig port (obligatoriskt)\n -ORBInitialHost Ursprungligt v\u00E4rdnamn (obligatoriskt)\n
+servertool.banner=\n\nV\u00E4lkommen till Java IDL Server Tool \nange kommandona vid kommandoraden \n
+servertool.shorthelp=\n\n\tTillg\u00E4ngliga kommandon: \n\t------------------- \n
+servertool.baddef=Felaktig serverdefinition: {0}
+servertool.nosuchserver=\tn\u00E5gon s\u00E5dan server kan inte hittas.
+servertool.helddown=\tservern h\u00E5lls avst\u00E4ngd.
+servertool.nosuchorb=\togiltig ORB.
+servertool.serverup=\tserver \u00E4r redan startad
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tnamn - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targs - {0}
+servertool.vmargs=\tvmargs - {0}
+servertool.serverid=\tserver id - {0}
+servertool.servernotrunning=\tserver k\u00F6rs inte.
+servertool.register=\n\n\tregister -server <serverklassnamn> \n\t -applicationName <alternativt servernamn> \n\t -classpath <klass\u00F6kv\u00E4g till server> \n\t -args <argument till server> \n\t -vmargs <argument till server-JVM>\n
+servertool.register1=registrera en aktiverbar server
+servertool.register2=\tserver registrerad (serverid = {0}).
+servertool.register3=\tserver registrerad men h\u00E5lls avst\u00E4ngd(serverid = {0}).
+servertool.register4=\tserver har redan registrerats (serverid = {0}).
+
+servertool.unregister=\n\tunregister [ -serverid <server-id> | -applicationName <namn> ] \n
+servertool.unregister1=avregistrera en registrerad server
+servertool.unregister2=\tserver avregistrerad.
+
+servertool.locate=\n\tlocate [ -serverid <server-id> | -applicationName <namn> ] [ <-endpointType <slutpunktstyp> ] \n
+servertool.locate1=hitta portar av en viss typ f\u00F6r en registrerad server
+servertool.locate2=\n\n\tV\u00E4rdnamn {0} \n\n\t\tPort\t\tPorttyp\t\tORB-id\n\t\t----\t\t---------\t\t------\n
+servertool.locateorb=\n\tlocateperorb [ -serverid <server-id> | -applicationName <namn> ] [ -orbid <ORB-namn> ]\n
+servertool.locateorb1=hitta portar f\u00F6r en viss ORB f\u00F6r en registrerad server
+servertool.locateorb2=\n\n\tV\u00E4rdnamn {0} \n\n\t\tPort\t\tPorttyp\t\tORB-id\n\t\t----\t\t--------\t\t------\n
+servertool.getserverid=\n\tgetserverid [ -applicationName <namn> ] \n
+servertool.getserverid1=returnerar server-id f\u00F6r ett applicationName
+servertool.getserverid2=\tServer-id f\u00F6r applicationName {0} \u00E4r {1}
+
+servertool.list=\n\tlist_\n
+servertool.list1=listar alla registrerade servrar
+servertool.list2=\n\tServer-id\tServerklassnamn\t\tServerapplikation\n\t---------\t-----------------\t\t------------------\n
+servertool.listactive=\n\tlistactive
+servertool.listactive1=listar alla f\u00F6r tillf\u00E4llet aktiva servrar
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=listar de applicationNames som f\u00F6r tillf\u00E4llet \u00E4r definierade
+servertool.listappnames2=Definierade applikationsnamn f\u00F6r servern:
+
+servertool.shutdown=\n\tshutdown [ -serverid <server-id> | -applicationName <namn> ]\n
+servertool.shutdown1=st\u00E4nger av en registrerad server
+servertool.shutdown2=\tserver har st\u00E4ngts av.
+servertool.startserver=\n\tstartup [ -serverid <server-id> | -applicationName <namn> ]\n
+servertool.startserver1=startar en registrerad server
+servertool.startserver2=\tserver har startats.
+
+servertool.quit=\n\tquit\n
+servertool.quit1=avsluta det h\u00E4r verktyget
+
+servertool.help=\thelp\n\tELLER\n\thelp <kommandonamn>\n
+servertool.help1=f\u00E5 hj\u00E4lp
+
+servertool.orbidmap=\tSyntax: orblist [ -serverid <server-id> | -applicationName <namn> ]\n
+servertool.orbidmap1=lista \u00F6ver ORB-namn och deras mappning
+servertool.orbidmap2=\n\tORB-id\t\tORB-namn\n\t------\t\t--------\n
+pnameserv.success=Den best\u00E4ndiga namnservern har startats
+
+
+bootstrap.usage=Syntax: {0} <alternativ> \n\nd\u00E4r <alternativ> inkluderar:\n -ORBInitialPort Ursprunglig port (obligatoriskt)\n -InitialServicesFile En fil som inneh\u00E5ller en lista \u00F6ver ursprungliga tj\u00E4nster (obligatoriskt)\n
+bootstrap.success=st\u00E4ller in porten till {0} och l\u00E4ser tj\u00E4nster fr\u00E5n {1}
+bootstrap.filenotreadable=filen {0} kan inte l\u00E4sas
+bootstrap.filenotfound=filen {0} hittas inte
+bootstrap.exception=p\u00E5tr\u00E4ffade undantag medan egenskaper sparades i filen {0}: Undantag {1}
+
+tnameserv.exception=p\u00E5tr\u00E4ffade ett undantag n\u00E4r starttj\u00E4nsten startades vid porten {0}
+tnameserv.usage=f\u00F6rs\u00F6k att anv\u00E4nda en annan port med kommandoradsargument -ORBInitialPort <portnr>
+tnameserv.invalidhostoption=ORBInitialHost \u00E4r inte ett giltigt alternativ f\u00F6r NameService
+tnameserv.orbinitialport0=ORBInitialPort 0 \u00E4r inte ett giltigt alternativ f\u00F6r NameService
+tnameserv.hs1=Ursprunglig namngivningskontext:\n{0}
+tnameserv.hs2=TransientNameServer: st\u00E4ller in port f\u00F6r ursprungliga objektreferenser till: {0}
+tnameserv.hs3=Klar.
+
+orbd.commfailure=\nKunde inte starta ORBD eftersom ORBinitialport redan anv\u00E4nds
+orbd.internalexception=\nKunde inte starta ORBD p\u00E5 grund av internt undantag. \nM\u00F6jliga orsaker: \n1. Angivet ORBInitialPort eller ORBActivationPort anv\u00E4ndas redan \n2. Ingen beh\u00F6righet att skriva till orb.db
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties
new file mode 100644
index 0000000..7743117
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_CN.properties
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=\u7528\u6CD5: {0} <\u9009\u9879> \n\n\u5176\u4E2D, <\u9009\u9879> \u5305\u62EC: \n -port \u6FC0\u6D3B\u542F\u52A8 ORBD \u7684\u7AEF\u53E3, \u9ED8\u8BA4\u503C\u4E3A 1049 (\u53EF\u9009)\n -defaultdb ORBD \u6587\u4EF6\u7684\u76EE\u5F55, \u9ED8\u8BA4\u503C\u4E3A "./orb.db" (\u53EF\u9009)\n -serverid ORBD \u7684\u670D\u52A1\u5668 ID, \u9ED8\u8BA4\u503C\u4E3A 1 (\u53EF\u9009)\n -ORBInitialPort \u521D\u59CB\u7AEF\u53E3 (\u5FC5\u9700)\n -ORBInitialHost \u521D\u59CB HostName (\u5FC5\u9700)\n
+
+servertool.usage=\u7528\u6CD5: {0} <\u9009\u9879> \n\n\u5176\u4E2D, <\u9009\u9879> \u5305\u62EC: \n -ORBInitialPort \u521D\u59CB\u7AEF\u53E3 (\u5FC5\u9700)\n -ORBInitialHost \u521D\u59CB HostName (\u5FC5\u9700)\n
+servertool.banner=\n\n\u6B22\u8FCE\u4F7F\u7528 Java IDL \u670D\u52A1\u5668\u5DE5\u5177 \n\u8BF7\u5728\u63D0\u793A\u5904\u8F93\u5165\u547D\u4EE4 \n
+servertool.shorthelp=\n\n\t\u53EF\u7528\u547D\u4EE4: \n\t------------------- \n
+servertool.baddef=\u9519\u8BEF\u7684\u670D\u52A1\u5668\u5B9A\u4E49: {0}
+servertool.nosuchserver=\t\u627E\u4E0D\u5230\u8FD9\u79CD\u670D\u52A1\u5668\u3002
+servertool.helddown=\t\u670D\u52A1\u5668\u5DF2\u88AB\u5173\u95ED\u3002
+servertool.nosuchorb=\t\u65E0\u6548\u7684\u5BF9\u8C61\u8BF7\u6C42\u4EE3\u7406\u7A0B\u5E8F (ORB)\u3002
+servertool.serverup=\t\u670D\u52A1\u5668\u5DF2\u5728\u8FD0\u884C\u3002
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tname - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targs - {0}
+servertool.vmargs=\tvmargs - {0}
+servertool.serverid=\t\u670D\u52A1\u5668 ID - {0}
+servertool.servernotrunning=\t\u670D\u52A1\u5668\u6CA1\u6709\u8FD0\u884C\u3002
+servertool.register=\n\n\tregister -server<\u670D\u52A1\u5668\u7C7B\u540D\u79F0> \n\t -applicationName <\u5907\u7528\u670D\u52A1\u5668\u540D\u79F0> \n\t -classpath <\u670D\u52A1\u5668\u7684\u7C7B\u8DEF\u5F84> \n\t -args <\u670D\u52A1\u5668\u7684\u53C2\u6570> \n\t -vmargs <\u670D\u52A1\u5668 Java VM \u7684\u53C2\u6570>\n
+servertool.register1=\u6CE8\u518C\u4E00\u4E2A\u53EF\u6FC0\u6D3B\u7684\u670D\u52A1\u5668
+servertool.register2=\t\u5DF2\u6CE8\u518C\u670D\u52A1\u5668 (serverid = {0})\u3002
+servertool.register3=\t\u5DF2\u6CE8\u518C\u670D\u52A1\u5668, \u4F46\u5DF2\u88AB\u5173\u95ED (serverid = {0})\u3002
+servertool.register4=\t\u670D\u52A1\u5668\u5DF2\u6CE8\u518C (serverid = {0})\u3002
+
+servertool.unregister=\n\tunregister [ -serverid <server id> | -applicationName <name> ] \n
+servertool.unregister1=\u6CE8\u9500\u5DF2\u6CE8\u518C\u7684\u670D\u52A1\u5668
+servertool.unregister2=\t\u670D\u52A1\u5668\u5DF2\u6CE8\u9500\u3002
+
+servertool.locate=\n\tlocate [ -serverid <server id> | -applicationName <name> ] [ <-endpointType <endpointType> ] \n
+servertool.locate1=\u4E3A\u5DF2\u6CE8\u518C\u670D\u52A1\u5668\u5B9A\u4F4D\u7279\u5B9A\u7C7B\u578B\u7684\u7AEF\u53E3
+servertool.locate2=\n\n\t\u4E3B\u673A\u540D\u79F0 {0} \n\n\t\t\u7AEF\u53E3\t\t\u7AEF\u53E3\u7C7B\u578B\t\tORB \u6807\u8BC6\n\t\t----\t\t---------\t\t------\n
+servertool.locateorb=\n\tlocateperorb [ -serverid <server id> | -applicationName <name> ] [ -orbid <ORB name> ]\n
+servertool.locateorb1=\u4E3A\u5DF2\u6CE8\u518C\u670D\u52A1\u5668\u7684\u7279\u5B9A\u5BF9\u8C61\u8BF7\u6C42\u4EE3\u7406\u7A0B\u5E8F\u5B9A\u4F4D\u7AEF\u53E3\u3002
+servertool.locateorb2=\n\n\t\u4E3B\u673A\u540D\u79F0 {0} \n\n\t\t\u7AEF\u53E3\t\t\u7AEF\u53E3\u7C7B\u578B\t\tORB \u6807\u8BC6\n\t\t----\t\t--------\t\t------\n
+servertool.getserverid=\n\tgetserverid [ -applicationName <name> ] \n
+servertool.getserverid1=\u8FD4\u56DE applicationName \u7684\u670D\u52A1\u5668 ID
+servertool.getserverid2=\tapplicationName {0} \u7684\u670D\u52A1\u5668 ID \u662F {1}
+
+servertool.list=\n\t\u5217\u8868\n
+servertool.list1=\u5217\u51FA\u6240\u6709\u5DF2\u6CE8\u518C\u670D\u52A1\u5668
+servertool.list2=\n\t\u670D\u52A1\u5668 ID\t\u670D\u52A1\u5668\u7C7B\u540D\u79F0\t\t\u670D\u52A1\u5668\u5E94\u7528\u7A0B\u5E8F\n\t---------\t-----------------\t\t------------------\n
+servertool.listactive=\n\tlistactive
+servertool.listactive1=\u5217\u51FA\u5F53\u524D\u6D3B\u52A8\u7684\u670D\u52A1\u5668
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=\u5217\u51FA\u5F53\u524D\u5B9A\u4E49\u7684 applicationName
+servertool.listappnames2=\u5F53\u524D\u5B9A\u4E49\u7684\u670D\u52A1\u5668 applicationName:
+
+servertool.shutdown=\n\tshutdown [ -serverid <server id> | -applicationName <name> ]\n
+servertool.shutdown1=\u5173\u95ED\u4E00\u4E2A\u5DF2\u6CE8\u518C\u670D\u52A1\u5668
+servertool.shutdown2=\t\u670D\u52A1\u5668\u6210\u529F\u5173\u95ED\u3002
+servertool.startserver=\n\tstartup [ -serverid <server id> | -applicationName <name> ]\n
+servertool.startserver1=\u542F\u52A8\u4E00\u4E2A\u5DF2\u6CE8\u518C\u670D\u52A1\u5668
+servertool.startserver2=\t\u670D\u52A1\u5668\u6210\u529F\u542F\u52A8\u3002
+
+servertool.quit=\n\t\u9000\u51FA\n
+servertool.quit1=\u9000\u51FA\u6B64\u5DE5\u5177
+
+servertool.help=\thelp\n\t\u6216\n\thelp <command name>\n
+servertool.help1=\u83B7\u53D6\u5E2E\u52A9
+
+servertool.orbidmap=\t\u7528\u6CD5: orblist [ -serverid <server id> | -applicationName <name> ]\n
+servertool.orbidmap1=\u5BF9\u8C61\u8BF7\u6C42\u4EE3\u7406\u7A0B\u5E8F (orb) \u540D\u79F0\u53CA\u5176\u6620\u5C04\u5217\u8868
+servertool.orbidmap2=\n\tORB \u6807\u8BC6\t\tORB \u540D\u79F0\n\t------\t\t--------\n
+pnameserv.success=\u6301\u4E45\u6027\u540D\u79F0\u670D\u52A1\u5668\u6210\u529F\u542F\u52A8
+
+
+bootstrap.usage=\u7528\u6CD5: {0} <\u9009\u9879> \n\n\u5176\u4E2D, <\u9009\u9879> \u5305\u62EC: \n -ORBInitialPort \u521D\u59CB\u7AEF\u53E3 (\u5FC5\u9700)\n -InitialServicesFile \u5305\u542B\u521D\u59CB\u670D\u52A1\u5217\u8868\u7684\u6587\u4EF6 (\u5FC5\u9700)\n
+bootstrap.success=\u5C06\u7AEF\u53E3\u8BBE\u7F6E\u4E3A{0}\u5E76\u4ECE{1}\u8BFB\u53D6\u670D\u52A1
+bootstrap.filenotreadable=\u6587\u4EF6{0}\u4E0D\u53EF\u8BFB\u53D6
+bootstrap.filenotfound=\u6CA1\u6709\u627E\u5230\u6587\u4EF6{0}
+bootstrap.exception=\u5C06\u5C5E\u6027\u4FDD\u5B58\u5230\u6587\u4EF6{0}\u65F6\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF: \u5F02\u5E38\u9519\u8BEF{1}
+
+tnameserv.exception=\u542F\u52A8{0}\u7AEF\u53E3\u4E0A\u7684\u5F15\u5BFC\u7A0B\u5E8F\u670D\u52A1\u65F6\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF
+tnameserv.usage=\u5C1D\u8BD5\u5229\u7528\u547D\u4EE4\u884C\u53C2\u6570 -ORBInitialPort <portno> \u4F7F\u7528\u4E0D\u540C\u7684\u7AEF\u53E3
+tnameserv.invalidhostoption=ORBInitialHost \u4E0D\u662F NameService \u7684\u6709\u6548\u9009\u9879
+tnameserv.orbinitialport0=ORBInitialPort 0 \u4E0D\u662F NameService \u7684\u6709\u6548\u9009\u9879
+tnameserv.hs1=\u521D\u59CB\u7684\u547D\u540D\u4E0A\u4E0B\u6587: \n{0}
+tnameserv.hs2=TransientNameServer: \u5C06\u521D\u59CB\u5BF9\u8C61\u5F15\u7528\u7AEF\u53E3\u8BBE\u7F6E\u4E3A: {0}
+tnameserv.hs3=\u51C6\u5907\u5C31\u7EEA\u3002
+
+orbd.commfailure=\n\u7531\u4E8E ORBinitialPort \u5DF2\u5728\u4F7F\u7528\u4E2D, \u65E0\u6CD5\u542F\u52A8 ORBD
+orbd.internalexception=\n\u7531\u4E8E\u5185\u90E8\u5F02\u5E38\u9519\u8BEF, \u65E0\u6CD5\u542F\u52A8 ORBD\u3002\n\u53EF\u80FD\u539F\u56E0: \n1. \u6307\u5B9A\u7684 ORBInitialPort \u6216 ORBActivationPort \u5DF2\u5728\u4F7F\u7528\u4E2D \n2. \u6CA1\u6709\u5199\u5165 orb.db \u7684\u6743\u9650
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
new file mode 100644
index 0000000..84ada02
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/resources/sunorb_zh_TW.properties
@@ -0,0 +1,107 @@
+#
+# Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+orbd.usage=\u7528\u6CD5: {0} <options> \n\n\u5176\u4E2D <options> \u5305\u62EC: \n -port ORBD \u61C9\u88AB\u555F\u52D5\u7684\u555F\u52D5\u9023\u63A5\u57E0\u6240\u5728\uFF0C\u9810\u8A2D\u70BA 1049 (\u53EF\u9078)\n -defaultdb ORBD \u6A94\u6848\u7684\u76EE\u9304\uFF0C\u9810\u8A2D "./orb.db" (\u53EF\u9078)\n -serverid ORBD \u4F3A\u670D\u5668 Id\uFF0C\u9810\u8A2D\u70BA 1 (\u53EF\u9078)\n -ORBInitialPort \u8D77\u59CB\u9023\u63A5\u57E0 (\u5FC5\u8981)\n -ORBInitialHost \u8D77\u59CB\u4E3B\u6A5F\u540D\u7A31 (\u5FC5\u8981)\n
+
+servertool.usage=\u7528\u6CD5: {0} <options> \n\nwhere <options> \u5305\u62EC:\n -ORBInitialPort \u8D77\u59CB\u9023\u63A5\u57E0 (\u5FC5\u8981)\n -ORBInitialHost \u8D77\u59CB\u4E3B\u6A5F\u540D\u7A31 (\u5FC5\u8981)\n
+servertool.banner=\n\n\u6B61\u8FCE\u4F7F\u7528 Java IDL \u4F3A\u670D\u5668\u5DE5\u5177 \n\u8ACB\u5728\u63D0\u793A\u8655\u8F38\u5165\u547D\u4EE4 \n
+servertool.shorthelp=\n\n\t\u53EF\u7528\u7684\u547D\u4EE4: \n\t------------------- \n
+servertool.baddef=\u932F\u8AA4\u7684\u4F3A\u670D\u5668\u5B9A\u7FA9: {0}
+servertool.nosuchserver=\t\u627E\u4E0D\u5230\u9019\u500B\u4F3A\u670D\u5668\u3002
+servertool.helddown=\t\u4F3A\u670D\u5668\u4E0D\u5728\u5DE5\u4F5C\u72C0\u614B\u3002
+servertool.nosuchorb=\t\u7121\u6548\u7684 ORB.
+servertool.serverup=\t\u4F3A\u670D\u5668\u5DF2\u5728\u5DE5\u4F5C\u72C0\u614B\u3002
+servertool.appname=\tapplicationName - {0}
+servertool.name=\tname - {0}
+servertool.classpath=\tclasspath - {0}
+servertool.args=\targs - {0}
+servertool.vmargs=\tvmargs - {0}
+servertool.serverid=\tserver id - {0}
+servertool.servernotrunning=\t\u4F3A\u670D\u5668\u672A\u57F7\u884C\u3002
+servertool.register=\n\n\tregister -server <server class name> \n\t -applicationName <alternate server name> \n\t -classpath <classpath to server> \n\t -args <args to server> \n\t -vmargs <args to server Java VM>\n
+servertool.register1=\u8A3B\u518A\u4E00\u500B\u53EF\u555F\u52D5\u7684\u4F3A\u670D\u5668
+servertool.register2=\t\u5DF2\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668 (serverid = {0})\u3002
+servertool.register3=\t\u5DF2\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668\uFF0C\u4F46\u4E0D\u5728\u5DE5\u4F5C\u72C0\u614B (serverid = {0})\u3002
+servertool.register4=\t\u4F3A\u670D\u5668\u5DF2\u8A3B\u518A (serverid = {0})\u3002
+
+servertool.unregister=\n\tunregister [ -serverid <server id> | -applicationName <name> ] \n
+servertool.unregister1=\u5C07\u5DF2\u8A3B\u518A\u7684\u4F3A\u670D\u5668\u53D6\u6D88\u8A3B\u518A
+servertool.unregister2=\t\u4F3A\u670D\u5668\u5DF2\u53D6\u6D88\u8A3B\u518A\u3002
+
+servertool.locate=\n\tlocate [ -serverid <server id> | -applicationName <name> ] [ <-endpointType <endpointType> ] \n
+servertool.locate1=\u91DD\u5C0D\u4E00\u500B\u5DF2\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668\u5C0B\u627E\u7279\u5B9A\u985E\u578B\u7684\u9023\u63A5\u57E0
+servertool.locate2=\n\n\t\u4E3B\u6A5F\u540D\u7A31 {0} \n\n\t\t\u9023\u63A5\u57E0\t\t\u9023\u63A5\u57E0\u985E\u578B\t\tORB Id\n\t\t----\t\t---------\t\t------\n
+servertool.locateorb=\n\tlocateperorb [ -serverid <server id> | -applicationName <name> ] [ -orbid <ORB name> ]\n
+servertool.locateorb1=\u91DD\u5C0D\u5DF2\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668\u7684\u7279\u5B9A orb \u5C0B\u627E\u9023\u63A5\u57E0\u3002
+servertool.locateorb2=\n\n\t\u4E3B\u6A5F\u540D\u7A31 {0} \n\n\t\t\u9023\u63A5\u57E0\t\t\u9023\u63A5\u57E0\u985E\u578B\t\tORB Id\n\t\t----\t\t--------\t\t------\n
+servertool.getserverid=\n\tgetserverid [ -applicationName <name> ] \n
+servertool.getserverid1=\u50B3\u56DE applicationName \u7684\u4F3A\u670D\u5668\u8B58\u5225\u78BC
+servertool.getserverid2=\tapplicationName \u7684\u4F3A\u670D\u5668\u8B58\u5225\u78BC {0} \u70BA {1}
+
+servertool.list=\n\tlist\n
+servertool.list1=\u5217\u51FA\u6240\u6709\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668
+servertool.list2=\n\t\u4F3A\u670D\u5668\u8B58\u5225\u78BC\t\u4F3A\u670D\u5668\u985E\u5225\u540D\u7A31\t\t\u4F3A\u670D\u5668\u61C9\u7528\u7A0B\u5F0F\n\t---------\t-----------------\t\t------------------\n
+servertool.listactive=\n\tlistactive
+servertool.listactive1=\u5217\u51FA\u76EE\u524D\u4F7F\u7528\u4E2D\u7684\u4F3A\u670D\u5668
+servertool.listappnames=\tlistappnames\n
+servertool.listappnames1=\u5217\u51FA\u76EE\u524D\u5B9A\u7FA9\u7684 applicationNames
+servertool.listappnames2=\u76EE\u524D\u5B9A\u7FA9\u7684\u4F3A\u670D\u5668 applicationNames:
+
+servertool.shutdown=\n\tshutdown [ -serverid <server id> | -applicationName <name> ]\n
+servertool.shutdown1=\u95DC\u9589\u4E00\u500B\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668
+servertool.shutdown2=\t\u4F3A\u670D\u5668\u95DC\u9589\u6210\u529F\u3002
+servertool.startserver=\n\tstartup [ -serverid <server id> | -applicationName <name> ]\n
+servertool.startserver1=\u555F\u52D5\u4E00\u500B\u8A3B\u518A\u904E\u7684\u4F3A\u670D\u5668
+servertool.startserver2=\t\u4F3A\u670D\u5668\u555F\u52D5\u6210\u529F\u3002
+
+servertool.quit=\n\tquit\n
+servertool.quit1=\u96E2\u958B\u9019\u500B\u5DE5\u5177
+
+servertool.help=\thelp\n\t\u6216\n\thelp <command name>\n
+servertool.help1=\u53D6\u5F97\u8AAA\u660E
+
+servertool.orbidmap=\t\u7528\u6CD5: orblist [ -serverid <server id> | -applicationName <name> ]\n
+servertool.orbidmap1=orb \u540D\u7A31\u53CA\u5176\u5C0D\u6620\u6E05\u55AE
+servertool.orbidmap2=\n\tORB Id\t\tORB \u540D\u7A31\n\t------\t\t--------\n
+pnameserv.success=\u6C38\u4E45\u6027 NameServer \u555F\u52D5\u6210\u529F
+
+
+bootstrap.usage=\u7528\u6CD5: {0} <options> \n\n\u5176\u4E2D <options> \u5305\u62EC: \n -ORBInitialPort \u8D77\u59CB\u9023\u63A5\u57E0 (\u5FC5\u8981)\n -InitialServicesFile \u542B\u6709\u8D77\u59CB\u670D\u52D9\u6E05\u55AE\u7684\u6A94\u6848 (\u5FC5\u8981)\n
+bootstrap.success=\u8A2D\u5B9A\u9023\u63A5\u57E0\u81F3 {0} \u4E26\u5F9E {1} \u8B80\u53D6\u670D\u52D9
+bootstrap.filenotreadable=\u6A94\u6848 {0} \u7121\u6CD5\u8B80\u53D6
+bootstrap.filenotfound=\u627E\u4E0D\u5230\u6A94\u6848 {0}
+bootstrap.exception=\u5C07\u5C6C\u6027\u5132\u5B58\u81F3\u6A94\u6848 {0} \u6642\u767C\u751F\u7570\u5E38\u72C0\u6CC1: \u7570\u5E38\u72C0\u6CC1 {1}
+
+tnameserv.exception=\u958B\u555F {0} \u9023\u63A5\u57E0\u4E0A\u7684\u555F\u52D5\u5B89\u88DD\u670D\u52D9\u6642\uFF0C\u767C\u751F\u7570\u5E38\u72C0\u6CC1
+tnameserv.usage=\u5617\u8A66\u4EE5\u547D\u4EE4\u884C\u5F15\u6578\u4F86\u4F7F\u7528\u4E0D\u540C\u9023\u63A5\u57E0 -ORBInitialPort <portno>
+tnameserv.invalidhostoption=ORBInitialHost \u4E0D\u662F NameService \u7684\u6709\u6548\u9078\u9805
+tnameserv.orbinitialport0=ORBInitialPort 0 \u4E0D\u662F NameService \u7684\u6709\u6548\u9078\u9805
+tnameserv.hs1=\u8D77\u59CB\u547D\u540D\u76F8\u95DC\u8CC7\u8A0A\u74B0\u5883: \n{0}
+tnameserv.hs2=TransientNameServer: \u91DD\u5C0D\u8D77\u59CB\u7269\u4EF6\u53C3\u7167\uFF0C\u8A2D\u5B9A\u9023\u63A5\u57E0\u81F3: {0}
+tnameserv.hs3=\u5C31\u7DD2\u3002
+
+orbd.commfailure=\n\u56E0\u70BA ORBinitialPort \u5728\u4F7F\u7528\u4E2D\uFF0C\u6240\u4EE5\u7121\u6CD5\u555F\u52D5 ORBD\u3002
+orbd.internalexception=\n\u56E0\u70BA\u5167\u90E8\u767C\u751F\u7570\u5E38\uFF0C\u6240\u4EE5\u7121\u6CD5\u555F\u52D5 ORBD\u3002\n\u53EF\u80FD\u7684\u539F\u56E0: \n1. \u6307\u5B9A\u7684 ORBInitialPort \u6216 ORBActivationPort \u5728\u4F7F\u7528\u4E2D\u3002\n2. \u6C92\u6709\u5BEB\u5165 orb.db \u7684\u6B0A\u9650\u3002
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolImpl.java
new file mode 100644
index 0000000..7f3ad89
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolImpl.java
@@ -0,0 +1,547 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.threadpool;
+
+import java.io.IOException;
+import java.io.Closeable;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import java.util.List;
+import java.util.ArrayList;
+
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.AtomicLong;
+
+import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException;
+import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool;
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
+import com.sun.corba.se.spi.orbutil.threadpool.WorkQueue;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.threadpool.WorkQueueImpl;
+
+import com.sun.corba.se.spi.monitoring.MonitoringConstants;
+import com.sun.corba.se.spi.monitoring.MonitoredObject;
+import com.sun.corba.se.spi.monitoring.MonitoringFactories;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+public class ThreadPoolImpl implements ThreadPool
+{
+ // serial counter useful for debugging
+ private static AtomicInteger threadCounter = new AtomicInteger(0);
+ private static final ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get(CORBALogDomains.RPC_TRANSPORT);
+
+
+ // Any time currentThreadCount and/or availableWorkerThreads is updated
+ // or accessed this ThreadPool's WorkQueue must be locked. And, it is
+ // expected that this ThreadPool's WorkQueue is the only object that
+ // updates and accesses these values directly and indirectly though a
+ // call to a method in this ThreadPool. If any call to update or access
+ // those values must synchronized on this ThreadPool's WorkQueue.
+ private WorkQueue workQueue;
+
+ // Stores the number of available worker threads
+ private int availableWorkerThreads = 0;
+
+ // Stores the number of threads in the threadpool currently
+ private int currentThreadCount = 0;
+
+ // Minimum number of worker threads created at instantiation of the threadpool
+ private int minWorkerThreads = 0;
+
+ // Maximum number of worker threads in the threadpool
+ private int maxWorkerThreads = 0;
+
+ // Inactivity timeout value for worker threads to exit and stop running
+ private long inactivityTimeout;
+
+ // Indicates if the threadpool is bounded or unbounded
+ private boolean boundedThreadPool = false;
+
+ // Running count of the work items processed
+ // Set the value to 1 so that divide by zero is avoided in
+ // averageWorkCompletionTime()
+ private AtomicLong processedCount = new AtomicLong(1);
+
+ // Running aggregate of the time taken in millis to execute work items
+ // processed by the threads in the threadpool
+ private AtomicLong totalTimeTaken = new AtomicLong(0);
+
+ // Name of the ThreadPool
+ private String name;
+
+ // MonitoredObject for ThreadPool
+ private MonitoredObject threadpoolMonitoredObject;
+
+ // ThreadGroup in which threads should be created
+ private ThreadGroup threadGroup;
+
+ Object workersLock = new Object();
+ List<WorkerThread> workers = new ArrayList<>();
+
+ /**
+ * This constructor is used to create an unbounded threadpool
+ */
+ public ThreadPoolImpl(ThreadGroup tg, String threadpoolName) {
+ inactivityTimeout = ORBConstants.DEFAULT_INACTIVITY_TIMEOUT;
+ maxWorkerThreads = Integer.MAX_VALUE;
+ workQueue = new WorkQueueImpl(this);
+ threadGroup = tg;
+ name = threadpoolName;
+ initializeMonitoring();
+ }
+
+ /**
+ * This constructor is used to create an unbounded threadpool
+ * in the ThreadGroup of the current thread
+ */
+ public ThreadPoolImpl(String threadpoolName) {
+ this( Thread.currentThread().getThreadGroup(), threadpoolName ) ;
+ }
+
+ /**
+ * This constructor is used to create bounded threadpool
+ */
+ public ThreadPoolImpl(int minSize, int maxSize, long timeout,
+ String threadpoolName)
+ {
+ minWorkerThreads = minSize;
+ maxWorkerThreads = maxSize;
+ inactivityTimeout = timeout;
+ boundedThreadPool = true;
+ workQueue = new WorkQueueImpl(this);
+ name = threadpoolName;
+ for (int i = 0; i < minWorkerThreads; i++) {
+ createWorkerThread();
+ }
+ initializeMonitoring();
+ }
+
+ // Note that this method should not return until AFTER all threads have died.
+ public void close() throws IOException {
+
+ // Copy to avoid concurrent modification problems.
+ List<WorkerThread> copy = null;
+ synchronized (workersLock) {
+ copy = new ArrayList<>(workers);
+ }
+
+ for (WorkerThread wt : copy) {
+ wt.close();
+ while (wt.getState() != Thread.State.TERMINATED) {
+ try {
+ wt.join();
+ } catch (InterruptedException exc) {
+ wrapper.interruptedJoinCallWhileClosingThreadPool(exc, wt, this);
+ }
+ }
+ }
+
+ threadGroup = null;
+ }
+
+
+ // Setup monitoring for this threadpool
+ private void initializeMonitoring() {
+ // Get root monitored object
+ MonitoredObject root = MonitoringFactories.getMonitoringManagerFactory().
+ createMonitoringManager(MonitoringConstants.DEFAULT_MONITORING_ROOT, null).
+ getRootMonitoredObject();
+
+ // Create the threadpool monitoring root
+ MonitoredObject threadPoolMonitoringObjectRoot = root.getChild(
+ MonitoringConstants.THREADPOOL_MONITORING_ROOT);
+ if (threadPoolMonitoringObjectRoot == null) {
+ threadPoolMonitoringObjectRoot = MonitoringFactories.
+ getMonitoredObjectFactory().createMonitoredObject(
+ MonitoringConstants.THREADPOOL_MONITORING_ROOT,
+ MonitoringConstants.THREADPOOL_MONITORING_ROOT_DESCRIPTION);
+ root.addChild(threadPoolMonitoringObjectRoot);
+ }
+ threadpoolMonitoredObject = MonitoringFactories.
+ getMonitoredObjectFactory().
+ createMonitoredObject(name,
+ MonitoringConstants.THREADPOOL_MONITORING_DESCRIPTION);
+
+ threadPoolMonitoringObjectRoot.addChild(threadpoolMonitoredObject);
+
+ LongMonitoredAttributeBase b1 = new
+ LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS,
+ MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
+ public Object getValue() {
+ return new Long(ThreadPoolImpl.this.currentNumberOfThreads());
+ }
+ };
+ threadpoolMonitoredObject.addAttribute(b1);
+ LongMonitoredAttributeBase b2 = new
+ LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_AVAILABLE_THREADS,
+ MonitoringConstants.THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION) {
+ public Object getValue() {
+ return new Long(ThreadPoolImpl.this.numberOfAvailableThreads());
+ }
+ };
+ threadpoolMonitoredObject.addAttribute(b2);
+ LongMonitoredAttributeBase b3 = new
+ LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS,
+ MonitoringConstants.THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION) {
+ public Object getValue() {
+ return new Long(ThreadPoolImpl.this.numberOfBusyThreads());
+ }
+ };
+ threadpoolMonitoredObject.addAttribute(b3);
+ LongMonitoredAttributeBase b4 = new
+ LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME,
+ MonitoringConstants.THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION) {
+ public Object getValue() {
+ return new Long(ThreadPoolImpl.this.averageWorkCompletionTime());
+ }
+ };
+ threadpoolMonitoredObject.addAttribute(b4);
+ LongMonitoredAttributeBase b5 = new
+ LongMonitoredAttributeBase(MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT,
+ MonitoringConstants.THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION) {
+ public Object getValue() {
+ return new Long(ThreadPoolImpl.this.currentProcessedCount());
+ }
+ };
+ threadpoolMonitoredObject.addAttribute(b5);
+
+ // Add the monitored object for the WorkQueue
+
+ threadpoolMonitoredObject.addChild(
+ ((WorkQueueImpl)workQueue).getMonitoredObject());
+ }
+
+ // Package private method to get the monitored object for this
+ // class
+ MonitoredObject getMonitoredObject() {
+ return threadpoolMonitoredObject;
+ }
+
+ public WorkQueue getAnyWorkQueue()
+ {
+ return workQueue;
+ }
+
+ public WorkQueue getWorkQueue(int queueId)
+ throws NoSuchWorkQueueException
+ {
+ if (queueId != 0)
+ throw new NoSuchWorkQueueException();
+ return workQueue;
+ }
+
+ /**
+ * To be called from the workqueue when work is added to the
+ * workQueue. This method would create new threads if required
+ * or notify waiting threads on the queue for available work
+ */
+ void notifyForAvailableWork(WorkQueue aWorkQueue) {
+ synchronized (aWorkQueue) {
+ if (availableWorkerThreads < aWorkQueue.workItemsInQueue()) {
+ createWorkerThread();
+ } else {
+ aWorkQueue.notify();
+ }
+ }
+ }
+
+
+ private Thread createWorkerThreadHelper( String name ) {
+ // Thread creation needs to be in a doPrivileged block
+ // if there is a non-null security manager for two reasons:
+ // 1. The creation of a thread in a specific ThreadGroup
+ // is a privileged operation. Lack of a doPrivileged
+ // block here causes an AccessControlException
+ // (see bug 6268145).
+ // 2. We want to make sure that the permissions associated
+ // with this thread do NOT include the permissions of
+ // the current thread that is calling this method.
+ // This leads to problems in the app server where
+ // some threads in the ThreadPool randomly get
+ // bad permissions, leading to unpredictable
+ // permission errors (see bug 6021011).
+ //
+ // A Java thread contains a stack of call frames,
+ // one for each method called that has not yet returned.
+ // Each method comes from a particular class. The class
+ // was loaded by a ClassLoader which has an associated
+ // CodeSource, and this determines the Permissions
+ // for all methods in that class. The current
+ // Permissions for the thread are the intersection of
+ // all Permissions for the methods on the stack.
+ // This is part of the Security Context of the thread.
+ //
+ // When a thread creates a new thread, the new thread
+ // inherits the security context of the old thread.
+ // This is bad in a ThreadPool, because different
+ // creators of threads may have different security contexts.
+ // This leads to occasional unpredictable errors when
+ // a thread is re-used in a different security context.
+ //
+ // Avoiding this problem is simple: just do the thread
+ // creation in a doPrivileged block. This sets the
+ // inherited security context to that of the code source
+ // for the ORB code itself, which contains all permissions
+ // in either Java SE or Java EE.
+ WorkerThread thread = new WorkerThread(threadGroup, name);
+ synchronized (workersLock) {
+ workers.add(thread);
+ }
+
+ // The thread must be set to a daemon thread so the
+ // VM can exit if the only threads left are PooledThreads
+ // or other daemons. We don't want to rely on the
+ // calling thread always being a daemon.
+ // Note that no exception is possible here since we
+ // are inside the doPrivileged block.
+ thread.setDaemon(true);
+
+ wrapper.workerThreadCreated(thread, thread.getContextClassLoader());
+
+ thread.start();
+ return null;
+ }
+
+
+ /**
+ * To be called from the workqueue to create worker threads when none
+ * available.
+ */
+ void createWorkerThread() {
+ final String name = getName();
+ synchronized (workQueue) {
+ try {
+ if (System.getSecurityManager() == null) {
+ createWorkerThreadHelper(name);
+ } else {
+ // If we get here, we need to create a thread.
+ AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ return createWorkerThreadHelper(name);
+ }
+ }
+ );
+ }
+ } catch (Throwable t) {
+ // Decrementing the count of current worker threads.
+ // But, it will be increased in the finally block.
+ decrementCurrentNumberOfThreads();
+ wrapper.workerThreadCreationFailure(t);
+ } finally {
+ incrementCurrentNumberOfThreads();
+ }
+ }
+ }
+
+ public int minimumNumberOfThreads() {
+ return minWorkerThreads;
+ }
+
+ public int maximumNumberOfThreads() {
+ return maxWorkerThreads;
+ }
+
+ public long idleTimeoutForThreads() {
+ return inactivityTimeout;
+ }
+
+ public int currentNumberOfThreads() {
+ synchronized (workQueue) {
+ return currentThreadCount;
+ }
+ }
+
+ void decrementCurrentNumberOfThreads() {
+ synchronized (workQueue) {
+ currentThreadCount--;
+ }
+ }
+
+ void incrementCurrentNumberOfThreads() {
+ synchronized (workQueue) {
+ currentThreadCount++;
+ }
+ }
+
+ public int numberOfAvailableThreads() {
+ synchronized (workQueue) {
+ return availableWorkerThreads;
+ }
+ }
+
+ public int numberOfBusyThreads() {
+ synchronized (workQueue) {
+ return (currentThreadCount - availableWorkerThreads);
+ }
+ }
+
+ public long averageWorkCompletionTime() {
+ synchronized (workQueue) {
+ return (totalTimeTaken.get() / processedCount.get());
+ }
+ }
+
+ public long currentProcessedCount() {
+ synchronized (workQueue) {
+ return processedCount.get();
+ }
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * This method will return the number of WorkQueues serviced by the threadpool.
+ */
+ public int numberOfWorkQueues() {
+ return 1;
+ }
+
+
+ private static synchronized int getUniqueThreadId() {
+ return ThreadPoolImpl.threadCounter.incrementAndGet();
+ }
+
+ /**
+ * This method will decrement the number of available threads
+ * in the threadpool which are waiting for work. Called from
+ * WorkQueueImpl.requestWork()
+ */
+ void decrementNumberOfAvailableThreads() {
+ synchronized (workQueue) {
+ availableWorkerThreads--;
+ }
+ }
+
+ /**
+ * This method will increment the number of available threads
+ * in the threadpool which are waiting for work. Called from
+ * WorkQueueImpl.requestWork()
+ */
+ void incrementNumberOfAvailableThreads() {
+ synchronized (workQueue) {
+ availableWorkerThreads++;
+ }
+ }
+
+
+ private class WorkerThread extends Thread implements Closeable
+ {
+ private Work currentWork;
+ private int threadId = 0; // unique id for the thread
+ private volatile boolean closeCalled = false;
+ private String threadPoolName;
+ // name seen by Thread.getName()
+ private StringBuffer workerThreadName = new StringBuffer();
+
+ WorkerThread(ThreadGroup tg, String threadPoolName) {
+ super(tg, null, "Idle", 0, false);
+ this.threadId = ThreadPoolImpl.getUniqueThreadId();
+ this.threadPoolName = threadPoolName;
+ setName(composeWorkerThreadName(threadPoolName, "Idle"));
+ }
+
+ public synchronized void close() {
+ closeCalled = true;
+ interrupt();
+ }
+
+ private void resetClassLoader() {
+
+ }
+
+ private void performWork() {
+ long start = System.currentTimeMillis();
+ try {
+ currentWork.doWork();
+ } catch (Throwable t) {
+ wrapper.workerThreadDoWorkThrowable(this, t);
+ }
+ long elapsedTime = System.currentTimeMillis() - start;
+ totalTimeTaken.addAndGet(elapsedTime);
+ processedCount.incrementAndGet();
+ }
+
+ public void run() {
+ try {
+ while (!closeCalled) {
+ try {
+ currentWork = ((WorkQueueImpl)workQueue).requestWork(
+ inactivityTimeout);
+ if (currentWork == null)
+ continue;
+ } catch (InterruptedException exc) {
+ wrapper.workQueueThreadInterrupted( exc, getName(),
+ Boolean.valueOf(closeCalled));
+
+ continue ;
+ } catch (Throwable t) {
+ wrapper.workerThreadThrowableFromRequestWork(this, t,
+ workQueue.getName());
+
+ continue;
+ }
+
+ performWork();
+
+ // set currentWork to null so that the work item can be
+ // garbage collected without waiting for the next work item.
+ currentWork = null;
+
+ resetClassLoader();
+ }
+ } catch (Throwable e) {
+ // This should not be possible
+ wrapper.workerThreadCaughtUnexpectedThrowable(this,e);
+ } finally {
+ synchronized (workersLock) {
+ workers.remove(this);
+ }
+ }
+ }
+
+ private String composeWorkerThreadName(String poolName, String workerName) {
+ workerThreadName.setLength(0);
+ workerThreadName.append("p: ").append(poolName);
+ workerThreadName.append("; w: ").append(workerName);
+ return workerThreadName.toString();
+ }
+ } // End of WorkerThread class
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolManagerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolManagerImpl.java
new file mode 100644
index 0000000..40214e8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/ThreadPoolManagerImpl.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.threadpool;
+
+import java.io.IOException;
+
+import java.security.PrivilegedAction;
+import java.security.AccessController;
+
+import java.util.concurrent.atomic.AtomicInteger;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException;
+import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool;
+import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;
+import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolChooser;
+
+import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+
+public class ThreadPoolManagerImpl implements ThreadPoolManager
+{
+ private ThreadPool threadPool;
+ private ThreadGroup threadGroup;
+
+ private static final ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get(CORBALogDomains.RPC_TRANSPORT);
+
+ public ThreadPoolManagerImpl() {
+ threadGroup = getThreadGroup();
+ threadPool = new ThreadPoolImpl(threadGroup,
+ ORBConstants.THREADPOOL_DEFAULT_NAME);
+ }
+
+ private static AtomicInteger tgCount = new AtomicInteger();
+
+
+ private ThreadGroup getThreadGroup() {
+ ThreadGroup tg;
+
+ // See bugs 4916766 and 4936203
+ // We intend to create new threads in a reliable thread group.
+ // This avoids problems if the application/applet
+ // creates a thread group, makes JavaIDL calls which create a new
+ // connection and ReaderThread, and then destroys the thread
+ // group. If our ReaderThreads were to be part of such destroyed thread
+ // group then it might get killed and cause other invoking threads
+ // sharing the same connection to get a non-restartable
+ // CommunicationFailure. We'd like to avoid that.
+ //
+ // Our solution is to create all of our threads in the highest thread
+ // group that we have access to, given our own security clearance.
+ //
+ try {
+ // try to get a thread group that's as high in the threadgroup
+ // parent-child hierarchy, as we can get to.
+ // this will prevent an ORB thread created during applet-init from
+ // being killed when an applet dies.
+ tg = AccessController.doPrivileged(
+ new PrivilegedAction<ThreadGroup>() {
+ public ThreadGroup run() {
+ ThreadGroup tg = Thread.currentThread().getThreadGroup();
+ ThreadGroup ptg = tg;
+ try {
+ while (ptg != null) {
+ tg = ptg;
+ ptg = tg.getParent();
+ }
+ } catch (SecurityException se) {
+ // Discontinue going higher on a security exception.
+ }
+ return new ThreadGroup(tg, "ORB ThreadGroup " + tgCount.getAndIncrement());
+ }
+ }
+ );
+ } catch (SecurityException e) {
+ // something wrong, we go back to the original code
+ tg = Thread.currentThread().getThreadGroup();
+ }
+
+ return tg;
+ }
+
+ public void close() {
+ try {
+ threadPool.close();
+ } catch (IOException exc) {
+ wrapper.threadPoolCloseError();
+ }
+
+ try {
+ boolean isDestroyed = threadGroup.isDestroyed();
+ int numThreads = threadGroup.activeCount();
+ int numGroups = threadGroup.activeGroupCount();
+
+ if (isDestroyed) {
+ wrapper.threadGroupIsDestroyed(threadGroup);
+ } else {
+ if (numThreads > 0)
+ wrapper.threadGroupHasActiveThreadsInClose(threadGroup, numThreads);
+
+ if (numGroups > 0)
+ wrapper.threadGroupHasSubGroupsInClose(threadGroup, numGroups);
+
+ threadGroup.destroy();
+ }
+ } catch (IllegalThreadStateException exc) {
+ wrapper.threadGroupDestroyFailed(exc, threadGroup);
+ }
+
+ threadGroup = null;
+ }
+
+ /**
+ * This method will return an instance of the threadpool given a threadpoolId,
+ * that can be used by any component in the app. server.
+ *
+ * @throws NoSuchThreadPoolException thrown when invalid threadpoolId is passed
+ * as a parameter
+ */
+ public ThreadPool getThreadPool(String threadpoolId)
+ throws NoSuchThreadPoolException {
+
+ return threadPool;
+ }
+
+ /**
+ * This method will return an instance of the threadpool given a numeric threadpoolId.
+ * This method will be used by the ORB to support the functionality of
+ * dedicated threadpool for EJB beans
+ *
+ * @throws NoSuchThreadPoolException thrown when invalidnumericIdForThreadpool is passed
+ * as a parameter
+ */
+ public ThreadPool getThreadPool(int numericIdForThreadpool)
+ throws NoSuchThreadPoolException {
+
+ return threadPool;
+ }
+
+ /**
+ * This method is used to return the numeric id of the threadpool, given a String
+ * threadpoolId. This is used by the POA interceptors to add the numeric threadpool
+ * Id, as a tagged component in the IOR. This is used to provide the functionality of
+ * dedicated threadpool for EJB beans
+ */
+ public int getThreadPoolNumericId(String threadpoolId) {
+ return 0;
+ }
+
+ /**
+ * Return a String Id for a numericId of a threadpool managed by the threadpool
+ * manager
+ */
+ public String getThreadPoolStringId(int numericIdForThreadpool) {
+ return "";
+ }
+
+ /**
+ * Returns the first instance of ThreadPool in the ThreadPoolManager
+ */
+ public ThreadPool getDefaultThreadPool() {
+ return threadPool;
+ }
+
+ /**
+ * Return an instance of ThreadPoolChooser based on the componentId that was
+ * passed as argument
+ */
+ public ThreadPoolChooser getThreadPoolChooser(String componentId) {
+ //FIXME: This method is not used, but should be fixed once
+ //nio select starts working and we start using ThreadPoolChooser
+ return null;
+ }
+ /**
+ * Return an instance of ThreadPoolChooser based on the componentIndex that was
+ * passed as argument. This is added for improved performance so that the caller
+ * does not have to pay the cost of computing hashcode for the componentId
+ */
+ public ThreadPoolChooser getThreadPoolChooser(int componentIndex) {
+ //FIXME: This method is not used, but should be fixed once
+ //nio select starts working and we start using ThreadPoolChooser
+ return null;
+ }
+
+ /**
+ * Sets a ThreadPoolChooser for a particular componentId in the ThreadPoolManager. This
+ * would enable any component to add a ThreadPoolChooser for their specific use
+ */
+ public void setThreadPoolChooser(String componentId, ThreadPoolChooser aThreadPoolChooser) {
+ //FIXME: This method is not used, but should be fixed once
+ //nio select starts working and we start using ThreadPoolChooser
+ }
+
+ /**
+ * Gets the numeric index associated with the componentId specified for a
+ * ThreadPoolChooser. This method would help the component call the more
+ * efficient implementation i.e. getThreadPoolChooser(int componentIndex)
+ */
+ public int getThreadPoolChooserNumericId(String componentId) {
+ //FIXME: This method is not used, but should be fixed once
+ //nio select starts working and we start using ThreadPoolChooser
+ return 0;
+ }
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/TimeoutException.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/TimeoutException.java
new file mode 100644
index 0000000..2c6476e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/TimeoutException.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.threadpool;
+
+public class TimeoutException extends Exception
+{
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java
new file mode 100644
index 0000000..6e2320e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/orbutil/threadpool/WorkQueueImpl.java
@@ -0,0 +1,199 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.orbutil.threadpool;
+
+import java.util.LinkedList;
+
+import com.sun.corba.se.spi.orbutil.threadpool.ThreadPool;
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
+import com.sun.corba.se.spi.orbutil.threadpool.WorkQueue;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.threadpool.ThreadPoolImpl;
+
+import com.sun.corba.se.spi.monitoring.MonitoringConstants;
+import com.sun.corba.se.spi.monitoring.MonitoringFactories;
+import com.sun.corba.se.spi.monitoring.MonitoredObject;
+import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase;
+
+public class WorkQueueImpl implements WorkQueue
+{
+ private ThreadPool workerThreadPool;
+ private LinkedList theWorkQueue = new LinkedList();
+ private long workItemsAdded = 0;
+
+ // Initialized to 1 to avoid divide by zero in averageTimeInQueue()
+ private long workItemsDequeued = 1;
+
+ private long totalTimeInQueue = 0;
+
+ // Name of the work queue
+ private String name;
+
+ // MonitoredObject for work queue
+ private MonitoredObject workqueueMonitoredObject;
+
+ public WorkQueueImpl() {
+ name=ORBConstants.WORKQUEUE_DEFAULT_NAME;
+ initializeMonitoring();
+ }
+
+ public WorkQueueImpl(ThreadPool workerThreadPool) {
+ this(workerThreadPool, ORBConstants.WORKQUEUE_DEFAULT_NAME);
+ }
+
+ public WorkQueueImpl(ThreadPool workerThreadPool, String name) {
+ this.workerThreadPool = workerThreadPool;
+ this.name = name;
+ initializeMonitoring();
+ }
+
+ // Setup monitoring for this workqueue
+ private void initializeMonitoring() {
+ workqueueMonitoredObject = MonitoringFactories.
+ getMonitoredObjectFactory().
+ createMonitoredObject(name,
+ MonitoringConstants.WORKQUEUE_MONITORING_DESCRIPTION);
+
+ LongMonitoredAttributeBase b1 = new
+ LongMonitoredAttributeBase(MonitoringConstants.WORKQUEUE_TOTAL_WORK_ITEMS_ADDED,
+ MonitoringConstants.WORKQUEUE_TOTAL_WORK_ITEMS_ADDED_DESCRIPTION) {
+ public Object getValue() {
+ return new Long(WorkQueueImpl.this.totalWorkItemsAdded());
+ }
+ };
+ workqueueMonitoredObject.addAttribute(b1);
+ LongMonitoredAttributeBase b2 = new
+ LongMonitoredAttributeBase(MonitoringConstants.WORKQUEUE_WORK_ITEMS_IN_QUEUE,
+ MonitoringConstants.WORKQUEUE_WORK_ITEMS_IN_QUEUE_DESCRIPTION) {
+ public Object getValue() {
+ return new Long(WorkQueueImpl.this.workItemsInQueue());
+ }
+ };
+ workqueueMonitoredObject.addAttribute(b2);
+ LongMonitoredAttributeBase b3 = new
+ LongMonitoredAttributeBase(MonitoringConstants.WORKQUEUE_AVERAGE_TIME_IN_QUEUE,
+ MonitoringConstants.WORKQUEUE_AVERAGE_TIME_IN_QUEUE_DESCRIPTION) {
+ public Object getValue() {
+ return new Long(WorkQueueImpl.this.averageTimeInQueue());
+ }
+ };
+ workqueueMonitoredObject.addAttribute(b3);
+ }
+
+
+ // Package private method to get the monitored object for this
+ // class
+ MonitoredObject getMonitoredObject() {
+ return workqueueMonitoredObject;
+ }
+
+ public synchronized void addWork(Work work) {
+ workItemsAdded++;
+ work.setEnqueueTime(System.currentTimeMillis());
+ theWorkQueue.addLast(work);
+ ((ThreadPoolImpl)workerThreadPool).notifyForAvailableWork(this);
+ }
+
+ synchronized Work requestWork(long waitTime) throws TimeoutException, InterruptedException
+ {
+ Work workItem;
+ ((ThreadPoolImpl)workerThreadPool).incrementNumberOfAvailableThreads();
+
+ if (theWorkQueue.size() != 0) {
+ workItem = (Work)theWorkQueue.removeFirst();
+ totalTimeInQueue += System.currentTimeMillis() - workItem.getEnqueueTime();
+ workItemsDequeued++;
+ ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads();
+ return workItem;
+ }
+
+ try {
+
+ long remainingWaitTime = waitTime;
+ long finishTime = System.currentTimeMillis() + waitTime;
+
+ do {
+
+ this.wait(remainingWaitTime);
+
+ if (theWorkQueue.size() != 0) {
+ workItem = (Work)theWorkQueue.removeFirst();
+ totalTimeInQueue += System.currentTimeMillis() - workItem.getEnqueueTime();
+ workItemsDequeued++;
+ ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads();
+ return workItem;
+ }
+
+ remainingWaitTime = finishTime - System.currentTimeMillis();
+
+ } while (remainingWaitTime > 0);
+
+ ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads();
+ throw new TimeoutException();
+
+ } catch (InterruptedException ie) {
+ ((ThreadPoolImpl)workerThreadPool).decrementNumberOfAvailableThreads();
+ throw ie;
+ }
+ }
+
+ public void setThreadPool(ThreadPool workerThreadPool) {
+ this.workerThreadPool = workerThreadPool;
+ }
+
+ public ThreadPool getThreadPool() {
+ return workerThreadPool;
+ }
+
+ /**
+ * Returns the total number of Work items added to the Queue.
+ * This method is unsynchronized and only gives a snapshot of the
+ * state when it is called
+ */
+ public long totalWorkItemsAdded() {
+ return workItemsAdded;
+ }
+
+ /**
+ * Returns the total number of Work items in the Queue to be processed
+ * This method is unsynchronized and only gives a snapshot of the
+ * state when it is called
+ */
+ public int workItemsInQueue() {
+ return theWorkQueue.size();
+ }
+
+ public synchronized long averageTimeInQueue() {
+ return (totalTimeInQueue/workItemsDequeued);
+ }
+
+ public String getName() {
+ return name;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicAccessPermission.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicAccessPermission.java
new file mode 100644
index 0000000..2879ebf
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicAccessPermission.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi;
+
+import java.security.*;
+
+/**
+ * This class controls the use of dynamic proxies.
+ * A DynamicAccessPermission contains a name (also referred to as a "target name") but
+ * no actions list; you either have the named permission
+ * or you don't.
+ *
+ */
+
+public final class DynamicAccessPermission extends BasicPermission {
+ //private static final long serialVersionUID = -8343910153355041693L;
+
+ /**
+ * Creates a new DynamicAccessPermission with the specified name.
+ * @param name the name of the DynamicAccessPermission.
+ */
+ public DynamicAccessPermission(String name)
+ {
+ super(name);
+ }
+
+ /**
+ * Creates a new DynamicAccessPermission object with the specified name.
+ * The name is the symbolic name of the DynamicAccessPermission, and the
+ * actions String is currently unused and should be null.
+ *
+ * @param name the name of the DynamicAccessPermission.
+ * @param actions should be null.
+ */
+ public DynamicAccessPermission(String name, String actions)
+ {
+ super(name, actions);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicMethodMarshallerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicMethodMarshallerImpl.java
new file mode 100644
index 0000000..c4ef287
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicMethodMarshallerImpl.java
@@ -0,0 +1,465 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.io.Serializable ;
+import java.io.Externalizable ;
+
+import javax.rmi.PortableRemoteObject ;
+import javax.rmi.CORBA.Util ;
+
+import org.omg.CORBA.portable.IDLEntity ;
+
+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.rmi.RemoteException ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.presentation.rmi.DynamicMethodMarshaller ;
+
+public class DynamicMethodMarshallerImpl implements DynamicMethodMarshaller
+{
+ Method method ;
+ ExceptionHandler ehandler ;
+ boolean hasArguments = true ;
+ boolean hasVoidResult = true ;
+ boolean needsArgumentCopy ; // true if copyObjects call needs for args
+ boolean needsResultCopy ; // true if copyObject call needs for result
+ ReaderWriter[] argRWs = null ;
+ ReaderWriter resultRW = null ;
+
+ private static boolean isAnyClass( Class cls )
+ {
+ return cls.equals( Object.class ) || cls.equals( Serializable.class ) ||
+ cls.equals( Externalizable.class ) ;
+ }
+
+ // Assume that cls is not Remote, !isAnyClass(cls), and
+ // !org.omg.CORBA.Object.class.isAssignableFrom( cls ).
+ // Then return whether cls is an RMI-IIOP abstract interface.
+ private static boolean isAbstractInterface( Class cls )
+ {
+ // Either cls is an interface that extends IDLEntity, or else
+ // cls does not extend java.rmi.Remote and all of its methods
+ // throw RemoteException.
+ if (IDLEntity.class.isAssignableFrom( cls ))
+ return cls.isInterface() ;
+ else
+ return cls.isInterface() && allMethodsThrowRemoteException( cls ) ;
+ }
+
+ private static boolean allMethodsThrowRemoteException( Class cls )
+ {
+ Method[] methods = cls.getMethods() ;
+
+ // Check that all methods (other than those declared in java.lang.Object)
+ // throw an exception that is a subclass of RemoteException.
+ for (int ctr=0; ctr<methods.length; ctr++) {
+ Method method = methods[ctr] ;
+ if (method.getDeclaringClass() != Object.class)
+ if (!throwsRemote( method ))
+ return false ;
+ }
+
+ return true ;
+ }
+
+ private static boolean throwsRemote( Method method )
+ {
+ Class[] exceptionTypes = method.getExceptionTypes() ;
+
+ // Check that some exceptionType is a subclass of RemoteException
+ for (int ctr=0; ctr<exceptionTypes.length; ctr++) {
+ Class exceptionType = exceptionTypes[ctr] ;
+ if (java.rmi.RemoteException.class.isAssignableFrom( exceptionType ))
+ return true ;
+ }
+
+ return false ;
+ }
+
+ public interface ReaderWriter
+ {
+ Object read( InputStream is ) ;
+
+ void write( OutputStream os, Object value ) ;
+ }
+
+ abstract static class ReaderWriterBase implements ReaderWriter
+ {
+ String name ;
+
+ public ReaderWriterBase( String name )
+ {
+ this.name = name ;
+ }
+
+ public String toString()
+ {
+ return "ReaderWriter[" + name + "]" ;
+ }
+ }
+
+ private static ReaderWriter booleanRW = new ReaderWriterBase( "boolean" )
+ {
+ public Object read( InputStream is )
+ {
+ boolean value = is.read_boolean() ;
+ return new Boolean( value ) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Boolean val = (Boolean)value ;
+ os.write_boolean( val.booleanValue() ) ;
+ }
+ } ;
+
+ private static ReaderWriter byteRW = new ReaderWriterBase( "byte" )
+ {
+ public Object read( InputStream is )
+ {
+ byte value = is.read_octet() ;
+ return new Byte( value ) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Byte val = (Byte)value ;
+ os.write_octet( val.byteValue() ) ;
+ }
+ } ;
+
+ private static ReaderWriter charRW = new ReaderWriterBase( "char" )
+ {
+ public Object read( InputStream is )
+ {
+ char value = is.read_wchar() ;
+ return new Character( value ) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Character val = (Character)value ;
+ os.write_wchar( val.charValue() ) ;
+ }
+ } ;
+
+ private static ReaderWriter shortRW = new ReaderWriterBase( "short" )
+ {
+ public Object read( InputStream is )
+ {
+ short value = is.read_short() ;
+ return new Short( value ) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Short val = (Short)value ;
+ os.write_short( val.shortValue() ) ;
+ }
+ } ;
+
+ private static ReaderWriter intRW = new ReaderWriterBase( "int" )
+ {
+ public Object read( InputStream is )
+ {
+ int value = is.read_long() ;
+ return new Integer( value ) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Integer val = (Integer)value ;
+ os.write_long( val.intValue() ) ;
+ }
+ } ;
+
+ private static ReaderWriter longRW = new ReaderWriterBase( "long" )
+ {
+ public Object read( InputStream is )
+ {
+ long value = is.read_longlong() ;
+ return new Long( value ) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Long val = (Long)value ;
+ os.write_longlong( val.longValue() ) ;
+ }
+ } ;
+
+ private static ReaderWriter floatRW = new ReaderWriterBase( "float" )
+ {
+ public Object read( InputStream is )
+ {
+ float value = is.read_float() ;
+ return new Float( value ) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Float val = (Float)value ;
+ os.write_float( val.floatValue() ) ;
+ }
+ } ;
+
+ private static ReaderWriter doubleRW = new ReaderWriterBase( "double" )
+ {
+ public Object read( InputStream is )
+ {
+ double value = is.read_double() ;
+ return new Double( value ) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Double val = (Double)value ;
+ os.write_double( val.doubleValue() ) ;
+ }
+ } ;
+
+ private static ReaderWriter corbaObjectRW = new ReaderWriterBase(
+ "org.omg.CORBA.Object" )
+ {
+ public Object read( InputStream is )
+ {
+ return is.read_Object() ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ os.write_Object( (org.omg.CORBA.Object)value ) ;
+ }
+ } ;
+
+ private static ReaderWriter anyRW = new ReaderWriterBase( "any" )
+ {
+ public Object read( InputStream is )
+ {
+ return Util.readAny(is) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Util.writeAny( os, value ) ;
+ }
+ } ;
+
+ private static ReaderWriter abstractInterfaceRW = new ReaderWriterBase(
+ "abstract_interface" )
+ {
+ public Object read( InputStream is )
+ {
+ return is.read_abstract_interface() ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Util.writeAbstractObject( os, value ) ;
+ }
+ } ;
+
+
+ public static ReaderWriter makeReaderWriter( final Class cls )
+ {
+ if (cls.equals( boolean.class ))
+ return booleanRW ;
+ else if (cls.equals( byte.class ))
+ return byteRW ;
+ else if (cls.equals( char.class ))
+ return charRW ;
+ else if (cls.equals( short.class ))
+ return shortRW ;
+ else if (cls.equals( int.class ))
+ return intRW ;
+ else if (cls.equals( long.class ))
+ return longRW ;
+ else if (cls.equals( float.class ))
+ return floatRW ;
+ else if (cls.equals( double.class ))
+ return doubleRW ;
+ else if (java.rmi.Remote.class.isAssignableFrom( cls ))
+ return new ReaderWriterBase( "remote(" + cls.getName() + ")" )
+ {
+ public Object read( InputStream is )
+ {
+ return PortableRemoteObject.narrow( is.read_Object(),
+ cls ) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ Util.writeRemoteObject( os, value ) ;
+ }
+ } ;
+ else if (cls.equals(org.omg.CORBA.Object.class))
+ return corbaObjectRW ;
+ else if (org.omg.CORBA.Object.class.isAssignableFrom( cls ))
+ return new ReaderWriterBase( "org.omg.CORBA.Object(" +
+ cls.getName() + ")" )
+ {
+ public Object read( InputStream is )
+ {
+ return is.read_Object(cls) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ os.write_Object( (org.omg.CORBA.Object)value ) ;
+ }
+ } ;
+ else if (isAnyClass(cls))
+ return anyRW ;
+ else if (isAbstractInterface(cls))
+ return abstractInterfaceRW ;
+
+ // For anything else, just read it as a value type.
+ return new ReaderWriterBase( "value(" + cls.getName() + ")" )
+ {
+ public Object read( InputStream is )
+ {
+ return is.read_value(cls) ;
+ }
+
+ public void write( OutputStream os, Object value )
+ {
+ os.write_value( (Serializable)value, cls ) ;
+ }
+ } ;
+ }
+
+ 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<argTypes.length; ctr++ ) {
+ // This could be further optimized to avoid
+ // copying if argTypes contains at most one
+ // immutable object type.
+ if (!argTypes[ctr].isPrimitive())
+ needsArgumentCopy = true ;
+ argRWs[ctr] = makeReaderWriter( argTypes[ctr] ) ;
+ }
+ }
+
+ Class resultType = method.getReturnType() ;
+ needsResultCopy = false ;
+ hasVoidResult = resultType.equals( void.class ) ;
+ if (!hasVoidResult) {
+ needsResultCopy = !resultType.isPrimitive() ;
+ resultRW = makeReaderWriter( resultType ) ;
+ }
+ }
+
+ public Method getMethod()
+ {
+ return method ;
+ }
+
+ public Object[] copyArguments( Object[] args,
+ ORB orb ) throws RemoteException
+ {
+ if (needsArgumentCopy)
+ return Util.copyObjects( args, orb ) ;
+ else
+ return args ;
+ }
+
+ public Object[] readArguments( InputStream is )
+ {
+ Object[] result = null ;
+
+ if (hasArguments) {
+ result = new Object[ argRWs.length ] ;
+ for (int ctr=0; ctr<argRWs.length; ctr++ )
+ result[ctr] = argRWs[ctr].read( is ) ;
+ }
+
+ return result ;
+ }
+
+ public void writeArguments( OutputStream os, Object[] args )
+ {
+ if (hasArguments) {
+ if (args.length != argRWs.length)
+ throw new IllegalArgumentException( "Expected " + argRWs.length +
+ " arguments, but got " + args.length + " arguments." ) ;
+
+ for (int ctr=0; ctr<argRWs.length; ctr++ )
+ argRWs[ctr].write( os, args[ctr] ) ;
+ }
+ }
+
+ public Object copyResult( Object result, ORB orb ) throws RemoteException
+ {
+ if (needsResultCopy)
+ return Util.copyObject( result, orb ) ;
+ else
+ return result ;
+ }
+
+ public Object readResult( InputStream is )
+ {
+ if (hasVoidResult)
+ return null ;
+ else
+ return resultRW.read( is ) ;
+ }
+
+ public void writeResult( OutputStream os, Object result )
+ {
+ if (!hasVoidResult)
+ resultRW.write( os, result ) ;
+ }
+
+ public boolean isDeclaredException( Throwable thr )
+ {
+ return ehandler.isDeclaredException( thr.getClass() ) ;
+ }
+
+ public void writeException( OutputStream os, Exception ex )
+ {
+ ehandler.writeException( os, ex ) ;
+ }
+
+ public Exception readException( ApplicationException ae )
+ {
+ return ehandler.readException( ae ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicStubImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicStubImpl.java
new file mode 100644
index 0000000..4c155ed
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/DynamicStubImpl.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.io.ObjectInputStream ;
+import java.io.ObjectOutputStream ;
+import java.io.IOException ;
+import java.io.Serializable ;
+
+import java.rmi.RemoteException ;
+
+import javax.rmi.CORBA.Tie ;
+
+import org.omg.CORBA_2_3.portable.ObjectImpl ;
+
+import org.omg.CORBA.portable.Delegate ;
+import org.omg.CORBA.portable.OutputStream ;
+
+import org.omg.CORBA.SystemException ;
+import org.omg.CORBA.ORB ;
+
+import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ;
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
+import com.sun.corba.se.spi.presentation.rmi.DynamicStub ;
+import com.sun.corba.se.impl.presentation.rmi.StubConnectImpl ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.UtilSystemException ;
+import com.sun.corba.se.impl.ior.StubIORImpl ;
+import com.sun.corba.se.impl.util.RepositoryId ;
+import com.sun.corba.se.impl.util.JDKBridge ;
+import com.sun.corba.se.impl.util.Utility ;
+
+// XXX Do we need _get_codebase?
+public class DynamicStubImpl extends ObjectImpl
+ implements DynamicStub, Serializable
+{
+ private static final long serialVersionUID = 4852612040012087675L;
+
+ private String[] typeIds ;
+ private StubIORImpl ior ;
+ private DynamicStub self = null ; // The actual DynamicProxy for this stub.
+
+ public void setSelf( DynamicStub self )
+ {
+ // XXX Should probably only allow this once.
+ this.self = self ;
+ }
+
+ public DynamicStub getSelf()
+ {
+ return self ;
+ }
+
+ public DynamicStubImpl( String[] typeIds )
+ {
+ this.typeIds = typeIds ;
+ ior = null ;
+ }
+
+ public void setDelegate( Delegate delegate )
+ {
+ _set_delegate( delegate ) ;
+ }
+
+ public Delegate getDelegate()
+ {
+ return _get_delegate() ;
+ }
+
+ public ORB getORB()
+ {
+ return (ORB)_orb() ;
+ }
+
+ public String[] _ids()
+ {
+ return typeIds ;
+ }
+
+ public String[] getTypeIds()
+ {
+ return _ids() ;
+ }
+
+ public void connect( ORB orb ) throws RemoteException
+ {
+ ior = StubConnectImpl.connect( ior, self, this, orb ) ;
+ }
+
+ public boolean isLocal()
+ {
+ return _is_local() ;
+ }
+
+ public OutputStream request( String operation,
+ boolean responseExpected )
+ {
+ return _request( operation, responseExpected ) ;
+ }
+
+ private void readObject( ObjectInputStream stream ) throws
+ IOException, ClassNotFoundException
+ {
+ ior = new StubIORImpl() ;
+ ior.doRead( stream ) ;
+ }
+
+ private void writeObject( ObjectOutputStream stream ) throws
+ IOException
+ {
+ if (ior == null)
+ ior = new StubIORImpl( this ) ;
+ ior.doWrite( stream ) ;
+ }
+
+ public Object readResolve()
+ {
+ String repositoryId = ior.getRepositoryId() ;
+ String cname = RepositoryId.cache.getId( repositoryId ).getClassName() ;
+
+ Class cls = null ;
+
+ try {
+ cls = JDKBridge.loadClass( cname, null, null ) ;
+ } catch (ClassNotFoundException exc) {
+ // XXX log this
+ }
+
+ PresentationManager pm =
+ com.sun.corba.se.spi.orb.ORB.getPresentationManager() ;
+ PresentationManager.ClassData classData = pm.getClassData( cls ) ;
+ InvocationHandlerFactoryImpl ihfactory =
+ (InvocationHandlerFactoryImpl)classData.getInvocationHandlerFactory() ;
+ return ihfactory.getInvocationHandler( this ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandler.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandler.java
new file mode 100644
index 0000000..9bac986
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandler.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+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.
+ */
+ 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.
+ */
+ 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.
+ */
+ Exception readException( ApplicationException ae ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java
new file mode 100644
index 0000000..f6b08ea
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ExceptionHandlerImpl.java
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.io.Serializable ;
+import java.io.Externalizable ;
+
+import javax.rmi.PortableRemoteObject ;
+import javax.rmi.CORBA.Util ;
+
+import java.rmi.RemoteException ;
+import java.rmi.UnexpectedException ;
+
+import org.omg.CORBA.UserException ;
+
+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 com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class ExceptionHandlerImpl implements ExceptionHandler
+{
+ private ExceptionRW[] rws ;
+
+ private final ORBUtilSystemException wrapper ;
+
+///////////////////////////////////////////////////////////////////////////////
+// ExceptionRW interface and implementations.
+// Used to read and write exceptions.
+///////////////////////////////////////////////////////////////////////////////
+
+ public interface ExceptionRW
+ {
+ Class getExceptionClass() ;
+
+ String getId() ;
+
+ void write( OutputStream os, Exception ex ) ;
+
+ Exception read( InputStream is ) ;
+ }
+
+ public abstract class ExceptionRWBase implements ExceptionRW
+ {
+ private Class cls ;
+ private String id ;
+
+ public ExceptionRWBase( Class cls )
+ {
+ this.cls = cls ;
+ }
+
+ public Class getExceptionClass()
+ {
+ return cls ;
+ }
+
+ public String getId()
+ {
+ return id ;
+ }
+
+ void setId( String id )
+ {
+ this.id = id ;
+ }
+ }
+
+ public class ExceptionRWIDLImpl extends ExceptionRWBase
+ {
+ private Method readMethod ;
+ private Method writeMethod ;
+
+ public ExceptionRWIDLImpl( Class cls )
+ {
+ super( cls ) ;
+
+ String helperName = cls.getName() + "Helper" ;
+ ClassLoader loader = cls.getClassLoader() ;
+ Class helperClass ;
+
+ try {
+ helperClass = Class.forName( helperName, true, loader ) ;
+ Method idMethod = helperClass.getDeclaredMethod( "id", (Class[])null ) ;
+ setId( (String)idMethod.invoke( null, (Object[])null ) ) ;
+ } catch (Exception ex) {
+ throw wrapper.badHelperIdMethod( ex, helperName ) ;
+ }
+
+ try {
+ Class[] argTypes = new Class[] {
+ org.omg.CORBA.portable.OutputStream.class, cls } ;
+ writeMethod = helperClass.getDeclaredMethod( "write",
+ argTypes ) ;
+ } catch (Exception ex) {
+ throw wrapper.badHelperWriteMethod( ex, helperName ) ;
+ }
+
+ try {
+ Class[] argTypes = new Class[] {
+ org.omg.CORBA.portable.InputStream.class } ;
+ readMethod = helperClass.getDeclaredMethod( "read", argTypes ) ;
+ } catch (Exception ex) {
+ throw wrapper.badHelperReadMethod( ex, helperName ) ;
+ }
+ }
+
+ public void write( OutputStream os, Exception ex )
+ {
+ try {
+ Object[] args = new Object[] { os, ex } ;
+ writeMethod.invoke( null, args ) ;
+ } catch (Exception exc) {
+ throw wrapper.badHelperWriteMethod( exc,
+ writeMethod.getDeclaringClass().getName() ) ;
+ }
+ }
+
+ public Exception read( InputStream is )
+ {
+ try {
+ Object[] args = new Object[] { is } ;
+ return (Exception)readMethod.invoke( null, args ) ;
+ } catch (Exception ex) {
+ throw wrapper.badHelperReadMethod( ex,
+ readMethod.getDeclaringClass().getName() ) ;
+ }
+ }
+ }
+
+ 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 Exception read( InputStream is )
+ {
+ is.read_string() ; // read and ignore!
+ return (Exception)is.read_value( getExceptionClass() ) ;
+ }
+ }
+
+///////////////////////////////////////////////////////////////////////////////
+
+ public ExceptionHandlerImpl( Class[] exceptions )
+ {
+ wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PRESENTATION ) ;
+
+ int count = 0 ;
+ for (int ctr=0; ctr<exceptions.length; ctr++) {
+ Class cls = exceptions[ctr] ;
+ if (!RemoteException.class.isAssignableFrom(cls))
+ count++ ;
+ }
+
+ rws = new ExceptionRW[count] ;
+
+ int index = 0 ;
+ for (int ctr=0; ctr<exceptions.length; ctr++) {
+ Class cls = exceptions[ctr] ;
+ if (!RemoteException.class.isAssignableFrom(cls)) {
+ ExceptionRW erw = null ;
+ if (UserException.class.isAssignableFrom(cls))
+ erw = new ExceptionRWIDLImpl( cls ) ;
+ else
+ 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 )
+ {
+ for (int ctr = 0; ctr < rws.length; ctr++) {
+ Class next = rws[ctr].getExceptionClass() ;
+ if (next.isAssignableFrom(cls))
+ return ctr ;
+ }
+
+ return -1 ;
+ }
+
+ private int findDeclaredException( String repositoryId )
+ {
+ for (int ctr=0; ctr<rws.length; ctr++) {
+ // This may occur when rws has not been fully
+ // populated, in which case the search should just fail.
+ if (rws[ctr]==null)
+ return -1 ;
+
+ String rid = rws[ctr].getId() ;
+ if (repositoryId.equals( rid ))
+ return ctr ;
+ }
+
+ return -1 ;
+ }
+
+ public boolean isDeclaredException( Class cls )
+ {
+ return findDeclaredException( cls ) >= 0 ;
+ }
+
+ public void writeException( OutputStream os, Exception ex )
+ {
+ int index = findDeclaredException( ex.getClass() ) ;
+ if (index < 0)
+ throw wrapper.writeUndeclaredException( ex,
+ ex.getClass().getName() ) ;
+
+ 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
+ // reader must actually read the exception ID from
+ // the stream.
+ 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 ;
+ }
+
+ return rws[index].read( is ) ;
+ }
+
+ // This is here just for the dynamicrmiiiop test
+ public ExceptionRW getRMIExceptionRW( Class cls )
+ {
+ return new ExceptionRWRMIImpl( cls ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java
new file mode 100644
index 0000000..a9f1dd2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLNameTranslatorImpl.java
@@ -0,0 +1,908 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import java.lang.reflect.Method;
+
+import java.math.BigInteger;
+
+import java.util.Map;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.StringTokenizer;
+
+import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ;
+
+import com.sun.corba.se.impl.presentation.rmi.IDLType ;
+import com.sun.corba.se.impl.presentation.rmi.IDLTypeException ;
+import com.sun.corba.se.impl.presentation.rmi.IDLTypesUtil ;
+import com.sun.corba.se.impl.orbutil.ObjectUtility ;
+
+/**
+ * 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
+ // 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"
+
+ };
+
+ 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;
+
+ // 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_ELEMENT_TYPE = "seq";
+
+ // used to mangling java identifiers that have a leading underscore
+ private static final String LEADING_UNDERSCORE_CHAR = "J";
+ 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;
+
+ // string appended to attribute if it clashes with a method name
+ 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 Set idlKeywords_;
+
+ static {
+
+ idlKeywords_ = new HashSet();
+ for(int i = 0; i < IDL_KEYWORDS.length; i++) {
+ String next = (String) IDL_KEYWORDS[i];
+ // Convert keyword to all caps to ease equality
+ // check.
+ String keywordAllCaps = next.toUpperCase();
+ idlKeywords_.add(keywordAllCaps);
+ }
+
+ }
+
+ //
+ // Instance state
+ //
+
+ // Remote interface for name translation.
+ private Class[] interf_;
+
+ // 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 Method[] methods_;
+
+ /**
+ * Return an IDLNameTranslator for the given interface.
+ *
+ * @throws IllegalStateException if given class is not a valid
+ * RMI/IIOP Remote Interface
+ */
+ public static IDLNameTranslator get( Class interf )
+ {
+
+ return new IDLNameTranslatorImpl(new Class[] { interf } );
+
+ }
+
+ /**
+ * Return an IDLNameTranslator for the given interfacex.
+ *
+ * @throws IllegalStateException if given classes are not valid
+ * RMI/IIOP Remote Interfaces
+ */
+ public static IDLNameTranslator get( Class[] interfaces )
+ {
+
+ return new IDLNameTranslatorImpl(interfaces );
+
+ }
+
+ 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).
+ // 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() ;
+ }
+
+ public Class[] getInterfaces()
+ {
+ return interf_;
+ }
+
+ public Method[] getMethods()
+ {
+ return methods_ ;
+ }
+
+ public Method getMethod( String idlName )
+ {
+ return (Method) IDLNameToMethodMap_.get(idlName);
+ }
+
+ public String getIDLName( Method method )
+ {
+ return (String) methodToIDLNameMap_.get(method);
+ }
+
+ /**
+ * Initialize an IDLNameTranslator for the given interface.
+ *
+ * @throws IllegalStateException if given class is not a valid
+ * RMI/IIOP Remote Interface
+ */
+ private IDLNameTranslatorImpl(Class[] interfaces)
+ {
+
+ SecurityManager s = System.getSecurityManager();
+ if (s != null) {
+ s.checkPermission(new DynamicAccessPermission("access"));
+ }
+ try {
+ IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
+ for (int ctr=0; ctr<interfaces.length; ctr++)
+ idlTypesUtil.validateRemoteInterface(interfaces[ctr]);
+ interf_ = interfaces;
+ buildNameTranslation();
+ } catch( IDLTypeException ite) {
+ String msg = ite.getMessage();
+ IllegalStateException ise = new IllegalStateException(msg);
+ ise.initCause(ite);
+ throw ise;
+ }
+ }
+
+ private void buildNameTranslation()
+ {
+ // holds method info, keyed by method
+ Map allMethodInfo = new HashMap() ;
+
+ for (int ctr=0; ctr<interf_.length; ctr++) {
+ Class interf = interf_[ctr] ;
+
+ IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
+ final Method[] methods = interf.getMethods();
+ // Handle the case of a non-public interface!
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ 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
+ // transformation.
+ for(int i = 0; i < methods.length; i++) {
+
+ Method nextMethod = methods[i];
+
+ IDLMethodInfo methodInfo = new IDLMethodInfo();
+
+ methodInfo.method = nextMethod;
+
+ if (idlTypesUtil.isPropertyAccessorMethod(nextMethod, interf)) {
+ methodInfo.isProperty = true;
+ String attributeName = idlTypesUtil.
+ getAttributeNameForProperty(nextMethod.getName());
+ methodInfo.originalName = attributeName;
+ methodInfo.mangledName = attributeName;
+ } else {
+ methodInfo.isProperty = false;
+ methodInfo.originalName = 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
+ // 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.
+ //
+ for(Iterator outerIter=allMethodInfo.values().iterator();
+ outerIter.hasNext();) {
+ IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
+ for(Iterator innerIter = allMethodInfo.values().iterator();
+ innerIter.hasNext();) {
+ IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
+
+ if( (outer != inner) &&
+ (!outer.originalName.equals(inner.originalName)) &&
+ outer.originalName.equalsIgnoreCase(inner.originalName) ) {
+ outer.mangledName =
+ mangleCaseSensitiveCollision(outer.originalName);
+ break;
+ }
+
+ }
+ }
+
+ for(Iterator iter = allMethodInfo.values().iterator();
+ iter.hasNext();) {
+ IDLMethodInfo next = (IDLMethodInfo) iter.next();
+ next.mangledName =
+ mangleIdentifier(next.mangledName, next.isProperty);
+ }
+
+ //
+ // Now check for overloaded method names and apply 1.3.2.6.
+ //
+ for(Iterator outerIter=allMethodInfo.values().iterator();
+ outerIter.hasNext();) {
+ IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
+ if( outer.isProperty ) {
+ continue;
+ }
+ for(Iterator innerIter = allMethodInfo.values().iterator();
+ innerIter.hasNext();) {
+ IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
+
+ 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(Iterator outerIter=allMethodInfo.values().iterator();
+ outerIter.hasNext();) {
+ IDLMethodInfo outer = (IDLMethodInfo) outerIter.next();
+ if( !outer.isProperty ) {
+ continue;
+ }
+ for(Iterator innerIter = allMethodInfo.values().iterator();
+ innerIter.hasNext();) {
+ IDLMethodInfo inner = (IDLMethodInfo) innerIter.next();
+ if( (outer != inner) &&
+ !inner.isProperty &&
+ outer.mangledName.equals(inner.mangledName) ) {
+ outer.mangledName = outer.mangledName +
+ ATTRIBUTE_METHOD_CLASH_MANGLE_CHARS;
+ break;
+ }
+ }
+ }
+
+ //
+ // Ensure that no mapped method names clash with mapped name
+ // of container(1.3.2.9). This is a case insensitive comparison.
+ //
+ for (int ctr=0; ctr<interf_.length; ctr++ ) {
+ Class interf = interf_[ctr] ;
+ String mappedContainerName = getMappedContainerName(interf);
+ for(Iterator iter = allMethodInfo.values().iterator();
+ iter.hasNext();) {
+ IDLMethodInfo next = (IDLMethodInfo) iter.next();
+ if( !next.isProperty &&
+ identifierClashesWithContainer(mappedContainerName,
+ next.mangledName)) {
+ next.mangledName = mangleContainerClash(next.mangledName);
+ }
+ }
+ }
+
+ //
+ // Populate name translation maps.
+ //
+ methodToIDLNameMap_ = new HashMap();
+ IDLNameToMethodMap_ = new HashMap();
+ methods_ = (Method[])allMethodInfo.keySet().toArray(
+ new Method[0] ) ;
+
+ for(Iterator iter = allMethodInfo.values().iterator();
+ iter.hasNext();) {
+ IDLMethodInfo next = (IDLMethodInfo) iter.next();
+ String idlName = next.mangledName;
+ if( next.isProperty ) {
+ String origMethodName = next.method.getName();
+ String prefix = "";
+
+ if( origMethodName.startsWith("get") ) {
+ prefix = GET_ATTRIBUTE_PREFIX;
+ } else if( origMethodName.startsWith("set") ) {
+ prefix = SET_ATTRIBUTE_PREFIX;
+ } else {
+ prefix = IS_ATTRIBUTE_PREFIX;
+ }
+
+ 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.
+ // @@@ Shouldn't this be a case-insensitive check?
+ if( IDLNameToMethodMap_.containsKey(idlName) ) {
+ // @@@ I18N
+ Method clash = (Method) IDLNameToMethodMap_.get(idlName);
+ throw new IllegalStateException("Error : methods " +
+ clash + " and " + next.method +
+ " both result in IDL name '" + idlName + "'");
+ } else {
+ IDLNameToMethodMap_.put(idlName, next.method);
+ }
+ }
+
+ return;
+
+ }
+
+
+ /**
+ * 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) {
+ return mangleIdentifier(identifier, false);
+ }
+
+ 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
+ // IDL keywords are mangled by adding a leading underscore.
+ //
+ 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
+ // name is composed it cannot clash with an IDL keyword.
+ // (Also, rmic doesn't do it.)
+ //
+
+ if( !attribute && isIDLKeyword(mangledName) ) {
+ mangledName = mangleIDLKeywordClash(mangledName);
+ }
+
+ //
+ // Replace illegal IDL identifier characters (1.3.2.4)
+ // for all method names and attributes.
+ //
+ if( !isIDLIdentifier(mangledName) ) {
+ mangledName = mangleUnicodeChars(mangledName);
+ }
+
+ return mangledName;
+ }
+
+ // isIDLKeyword and mangleIDLKeywordClash are exposed here so that
+ // IDLType can use them.
+ //
+ // XXX refactoring needed:
+ // 1. Split off isIDLKeywork and mangleIDLKeywordClash (and possibly
+ // other methods) into a utility class.
+ // 2. Move all of classToIDLType to a constructor inside IDLType.
+ //
+ // The problem appears to be that we need all of the code that
+ // performs various checks for name problems and the corresponding
+ // fixes into a utility class. Then we need to see what other
+ // refactorings present themselves.
+
+ /**
+ * 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);
+ }
+
+ static String mangleIDLKeywordClash(String identifier) {
+ return UNDERSCORE + identifier;
+ }
+
+ private static String mangleLeadingUnderscore(String identifier) {
+ return LEADING_UNDERSCORE_CHAR + identifier;
+ }
+
+ /**
+ * 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.
+ */
+ static String mangleUnicodeChars(String identifier) {
+ StringBuffer mangledIdentifier = new StringBuffer();
+
+ for(int i = 0; i < identifier.length(); i++) {
+ char nextChar = identifier.charAt(i);
+ 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.
+ *
+ *
+ * "...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) {
+
+ StringBuffer mangledIdentifier = new StringBuffer(identifier);
+
+ // 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++) {
+ char next = identifier.charAt(i);
+ 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
+ // one uppercase letter, we always put an undercore before
+ // printing the next one.
+ if( needUnderscore ) {
+ mangledIdentifier.append(UNDERSCORE);
+ }
+ mangledIdentifier.append(i);
+ needUnderscore = true;
+ }
+ }
+
+ return mangledIdentifier.toString();
+ }
+
+ private static String mangleContainerClash(String identifier) {
+ return identifier + ID_CONTAINER_CLASH_CHAR;
+ }
+
+ /**
+ * 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) {
+
+ return identifier.equalsIgnoreCase(mappedContainerName);
+ }
+
+ /**
+ * 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."
+ */
+ public static String charToUnicodeRepresentation(char c) {
+
+ int orig = (int) c;
+ StringBuffer hexString = new StringBuffer();
+
+ int value = orig;
+
+ while( value > 0 ) {
+ int div = value / 16;
+ int mod = value % 16;
+ hexString.insert(0, HEX_DIGITS[mod]);
+ value = div;
+ }
+
+ int numZerosToAdd = 4 - hexString.length();
+ for(int i = 0; i < numZerosToAdd; i++) {
+ hexString.insert(0, "0");
+ }
+
+ hexString.insert(0, "U");
+ return hexString.toString();
+ }
+
+ private static boolean isIDLIdentifier(String identifier) {
+
+ boolean isIdentifier = true;
+
+ 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 ) {
+ break;
+ }
+ }
+
+ return isIdentifier;
+
+ }
+
+ private static boolean isIDLIdentifierChar(char 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.
+ */
+ 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
+ // 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)));
+
+ return alphaChar;
+ }
+
+ /**
+ * 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) );
+ }
+
+ private static boolean isUnderscore(char c) {
+ 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.
+ */
+ private static String mangleOverloadedMethod(String mangledName, Method m) {
+
+ IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
+
+ // Start by appending the separator string
+ String newMangledName = mangledName + OVERLOADED_TYPE_SEPARATOR;
+
+ Class[] parameterTypes = m.getParameterTypes();
+
+ for(int i = 0; i < parameterTypes.length; i++) {
+ Class nextParamType = parameterTypes[i];
+
+ if( i > 0 ) {
+ newMangledName = 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) ) {
+ typeName = mangleIDLKeywordClash(typeName);
+ }
+
+ typeName = mangleUnicodeChars(typeName);
+
+ newMangledName = newMangledName + typeName;
+ }
+
+ return newMangledName;
+ }
+
+
+ private static IDLType classToIDLType(Class c) {
+
+ IDLType idlType = null;
+ IDLTypesUtil idlTypesUtil = new IDLTypesUtil();
+
+ if( idlTypesUtil.isPrimitive(c) ) {
+
+ idlType = idlTypesUtil.getPrimitiveIDLTypeMapping(c);
+
+ } else if( c.isArray() ) {
+
+ // Calculate array depth, as well as base element type.
+ Class componentType = c.getComponentType();
+ int numArrayDimensions = 1;
+ while(componentType.isArray()) {
+ componentType = componentType.getComponentType();
+ numArrayDimensions++;
+ }
+ IDLType componentIdlType = classToIDLType(componentType);
+
+ String[] modules = BASE_IDL_ARRAY_MODULE_TYPE;
+ if( componentIdlType.hasModule() ) {
+ modules = (String[])ObjectUtility.concatenateArrays( modules,
+ componentIdlType.getModules() ) ;
+ }
+
+ String memberName = BASE_IDL_ARRAY_ELEMENT_TYPE +
+ numArrayDimensions + UNDERSCORE +
+ componentIdlType.getMemberName();
+
+ idlType = new IDLType(c, modules, memberName);
+
+ } else {
+ idlType = idlTypesUtil.getSpecialCaseIDLTypeMapping(c);
+
+ if (idlType == null) {
+ // Section 1.3.2.5 of Java2IDL spec defines mangling rules for
+ // inner classes.
+ String memberName = getUnmappedContainerName(c);
+
+ // replace inner class separator with double underscore
+ memberName = memberName.replaceAll("\\$",
+ INNER_CLASS_SEPARATOR);
+
+ if( hasLeadingUnderscore(memberName) ) {
+ memberName = mangleLeadingUnderscore(memberName);
+ }
+
+ // 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);
+
+ if (packageName == null) {
+ 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 ;
+ }
+
+ // 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 ;
+ while (tokenizer.hasMoreElements()) {
+ String next = tokenizer.nextToken();
+ String moreMangled = hasLeadingUnderscore( next ) ?
+ mangleLeadingUnderscore( next ) : next;
+
+ modules[index++] = moreMangled ;
+ }
+
+ idlType = new IDLType(c, modules, memberName);
+ }
+ }
+ }
+
+ return idlType;
+ }
+
+ /**
+ * Return Class' package name or null if there is no package.
+ */
+ private static String getPackageName(Class c) {
+ Package thePackage = c.getPackage();
+ String packageName = null;
+
+ // Try to get package name by introspection. Some classloaders might
+ // not provide this information, so check for 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);
+ }
+ return packageName;
+ }
+
+ private static String getMappedContainerName(Class c) {
+ String unmappedName = getUnmappedContainerName(c);
+
+ return mangleIdentifier(unmappedName);
+ }
+
+ /**
+ * Return portion of class name excluding package name.
+ */
+ private static String getUnmappedContainerName(Class c) {
+
+ String memberName = null;
+ String packageName = getPackageName(c);
+
+ String fullyQualifiedClassName = c.getName();
+
+ if( packageName != null ) {
+ int packageLength = packageName.length();
+ memberName = fullyQualifiedClassName.substring(packageLength + 1);
+ } else {
+ memberName = fullyQualifiedClassName;
+
+ }
+
+ return memberName;
+ }
+
+ /**
+ * Internal helper class for tracking information related to each
+ * interface method while we're building the name translation table.
+ */
+ private static class IDLMethodInfo
+ {
+ public Method method;
+ public boolean isProperty;
+
+ // 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;
+
+ }
+
+ public String toString() {
+
+ StringBuffer contents = new StringBuffer();
+ contents.append("IDLNameTranslator[" );
+ for( int ctr=0; ctr<interf_.length; ctr++) {
+ if (ctr != 0)
+ contents.append( " " ) ;
+ contents.append( interf_[ctr].getName() ) ;
+ }
+ contents.append("]\n");
+ for(Iterator iter = methodToIDLNameMap_.keySet().iterator();
+ iter.hasNext();) {
+
+ Method method = (Method) iter.next();
+ String idlName = (String) methodToIDLNameMap_.get(method);
+
+ contents.append(idlName + ":" + method + "\n");
+
+ }
+
+ return contents.toString();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLType.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLType.java
new file mode 100644
index 0000000..5354a14
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLType.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+/**
+ * Holds information about the OMG IDL mapping of a Java type.
+ */
+public class IDLType {
+
+ private Class cl_;
+
+ // terminology for OMG IDL type package name
+ private String[] modules_;
+
+ // name of element within module
+ private String memberName_;
+
+
+ public IDLType(Class cl, String[] modules, String memberName) {
+ cl_ = cl;
+ modules_ = modules;
+ memberName_ = memberName;
+ }
+
+ public IDLType(Class cl, String memberName) {
+ this( cl, new String[0], memberName ) ;
+ }
+
+ public Class getJavaClass() {
+ return cl_;
+ }
+
+ public String[] getModules()
+ {
+ return modules_ ;
+ }
+
+ public String makeConcatenatedName( char separator, boolean fixIDLKeywords ) {
+ StringBuffer sbuff = new StringBuffer() ;
+ 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 ) ;
+
+ sbuff.append( mod ) ;
+ }
+
+ 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 )
+ // will get an IDL name of foo__bar_typedef_Baz instead of
+ // foo__bar__typedef_Baz (note the extra _ before typedef).
+ return makeConcatenatedName( '_', false ) ;
+ }
+
+ public String getExceptionName() {
+ // Here we will check for IDL keyword collisions (see bug 5010332).
+ // 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 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" ;
+
+ if (modName.length() == 0)
+ return "IDL:" + excName + ":1.0" ;
+ else
+ 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
+ * or a primitive.
+ */
+ public boolean hasModule() {
+ return (modules_.length > 0) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypeException.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypeException.java
new file mode 100644
index 0000000..b741d96
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypeException.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+/**
+ * Checked exception containing information about an
+ * an IDL type validation.
+ */
+public class IDLTypeException extends Exception {
+
+ public IDLTypeException() {}
+
+ public IDLTypeException(String message) {
+ super(message);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil.java
new file mode 100644
index 0000000..f72e4fb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/IDLTypesUtil.java
@@ -0,0 +1,598 @@
+/*
+ * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Field;
+import java.util.Set;
+import java.util.HashSet;
+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.
+ */
+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";
+
+ 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<NAME>/get<NAME> conflicts. The spec says that
+ * is<NAME> is the property and get<NAME> 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 ;
+
+ /**
+ * Validate a class to ensure it conforms to the rules for a
+ * Java RMI/IIOP interface.
+ *
+ * @throws IDLTypeException if not a valid RMI/IIOP interface.
+ */
+ public void validateRemoteInterface(Class c) throws IDLTypeException
+ {
+ if( c == null ) {
+ throw new IllegalArgumentException();
+ }
+
+ 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.";
+ throw new IDLTypeException(msg);
+ }
+
+ // Get all methods, including super-interface methods.
+ Method[] methods = c.getMethods();
+
+ for(int i = 0; i < methods.length; i++) {
+ Method next = methods[i];
+ validateExceptions(next);
+ }
+
+ // Removed because of bug 4989053
+ // validateDirectInterfaces(c);
+ validateConstants(c);
+
+ return;
+ }
+
+ public boolean isRemoteInterface(Class c)
+ {
+ boolean remoteInterface = true;
+ try {
+ validateRemoteInterface(c);
+ } catch(IDLTypeException ite) {
+ remoteInterface = false;
+ }
+
+ return remoteInterface;
+ }
+
+ /**
+ * Section 1.2.2 Primitive Types
+ */
+ public boolean isPrimitive(Class c)
+ {
+ if( c == null ) {
+ throw new IllegalArgumentException();
+ }
+
+ return c.isPrimitive();
+ }
+
+ /**
+ * Section 1.2.4
+ */
+ 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));
+ }
+
+ /**
+ * Section 1.2.5
+ */
+ public boolean isArray(Class c)
+ {
+ boolean arrayType = false;
+
+ if( c == null ) {
+ throw new IllegalArgumentException();
+ }
+
+ if( c.isArray() ) {
+ Class componentType = c.getComponentType();
+ arrayType =
+ (isPrimitive(componentType) || isRemoteInterface(componentType) ||
+ isEntity(componentType) || isException(componentType) ||
+ isValue(componentType) || isObjectReference(componentType) );
+ }
+
+ return arrayType;
+ }
+
+ /**
+ * Section 1.2.6
+ */
+ 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 ) {
+ throw new IllegalArgumentException();
+ }
+
+ return java.rmi.RemoteException.class.isAssignableFrom(c) ;
+ }
+
+ public boolean isCheckedException(Class c)
+ {
+ if( c == null ) {
+ throw new IllegalArgumentException();
+ }
+
+ return Throwable.class.isAssignableFrom(c) &&
+ !RuntimeException.class.isAssignableFrom(c) &&
+ !Error.class.isAssignableFrom(c) ;
+ }
+
+ /**
+ * Section 1.2.7
+ */
+ public boolean isObjectReference(Class c)
+ {
+ if( c == null ) {
+ throw new IllegalArgumentException();
+ }
+
+ return (c.isInterface() &&
+ org.omg.CORBA.Object.class.isAssignableFrom(c));
+ }
+
+ /**
+ * Section 1.2.8
+ */
+ 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 true if given method is legal property accessor as defined in
+ * Section 1.3.4.3 of Java2IDL spec.
+ */
+ public boolean isPropertyAccessorMethod(Method m, Class c) {
+
+ String methodName = m.getName();
+ Class returnType = m.getReturnType();
+ Class[] parameters = m.getParameterTypes();
+ Class[] exceptionTypes = m.getExceptionTypes();
+ String propertyType = null;
+
+ if( methodName.startsWith(GET_PROPERTY_PREFIX) ) {
+
+ if((parameters.length == 0) && (returnType != Void.TYPE) &&
+ !readHasCorrespondingIsProperty(m, c)) {
+ propertyType = GET_PROPERTY_PREFIX;
+ }
+
+ } else if( methodName.startsWith(SET_PROPERTY_PREFIX) ) {
+
+ if((returnType == Void.TYPE) && (parameters.length == 1)) {
+ if (hasCorrespondingReadProperty(m, c, GET_PROPERTY_PREFIX) ||
+ hasCorrespondingReadProperty(m, c, IS_PROPERTY_PREFIX)) {
+ propertyType = SET_PROPERTY_PREFIX;
+ }
+ }
+
+ } else if( methodName.startsWith(IS_PROPERTY_PREFIX) ) {
+ if((parameters.length == 0) && (returnType == Boolean.TYPE) &&
+ !isHasCorrespondingReadProperty(m, c)) {
+ propertyType = IS_PROPERTY_PREFIX;
+ }
+ }
+
+ // Some final checks that apply to all properties.
+ if( propertyType != null ) {
+ if(!validPropertyExceptions(m) ||
+ (methodName.length() <= propertyType.length())) {
+ propertyType = null;
+ }
+ }
+
+ return (propertyType != null);
+ }
+
+ private boolean hasCorrespondingReadProperty
+ (Method writeProperty, Class c, String readPropertyPrefix)
+ {
+ String writePropertyMethodName = writeProperty.getName();
+ Class[] writePropertyParameters = writeProperty.getParameterTypes();
+ boolean foundReadProperty = false;
+
+ 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) {
+ // ignore. this means we didn't find a corresponding get property.
+ }
+
+ return foundReadProperty;
+ }
+
+ private boolean readHasCorrespondingIsProperty(Method readProperty,
+ Class c)
+ {
+ if (FOLLOW_RMIC)
+ return false ;
+
+ String readPropertyMethodName = readProperty.getName();
+ boolean foundIsProperty = false;
+
+ 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) {
+ // ignore. this means we didn't find a corresponding Is property.
+ }
+
+ return foundIsProperty;
+ }
+
+ private boolean isHasCorrespondingReadProperty(Method readProperty,
+ Class c)
+ {
+ if (!FOLLOW_RMIC)
+ return false ;
+
+ String readPropertyMethodName = readProperty.getName();
+ boolean foundIsProperty = false;
+
+ 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) {
+ // ignore. this means we didn't find a corresponding read property.
+ }
+
+ return foundIsProperty;
+ }
+
+ 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) ) {
+ prefix = SET_PROPERTY_PREFIX;
+ } else if( propertyName.startsWith(IS_PROPERTY_PREFIX) ) {
+ prefix = IS_PROPERTY_PREFIX;
+ }
+
+ 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
+ // first two are upper-case
+ attributeName = remainder;
+ } else {
+ attributeName = Character.toLowerCase(remainder.charAt(0)) +
+ remainder.substring(1);
+ }
+ }
+
+ return attributeName;
+ }
+
+ /**
+ * Return IDL Type name for primitive types as defined in
+ * Section 1.3.3 of Java2IDL spec or null if not a primitive type.
+ */
+ public IDLType getPrimitiveIDLTypeMapping(Class c) {
+
+ 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" ) ;
+ }
+ }
+
+ 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.
+ */
+ public IDLType getSpecialCaseIDLTypeMapping(Class c) {
+
+ 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" ) ;
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * 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++) {
+ Class exception = exceptions[eIndex];
+ 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";
+ throw new IDLTypeException(msg);
+ }
+
+ // Section 1.2.3, #4
+ // See also bug 4972402
+ // For all exceptions E in exceptions,
+ // (isCheckedException(E) => (isValue(E) || RemoteException.isAssignableFrom( E ) )
+ 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";
+ throw new IDLTypeException(msg);
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * 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)
+ {
+ Class[] exceptions = method.getExceptionTypes();
+
+ for(int eIndex = 0; eIndex < exceptions.length; eIndex++) {
+ Class exception = exceptions[eIndex];
+
+ if (isCheckedException(exception) && !isRemoteException(exception))
+ return false ;
+ }
+
+ return true;
+ }
+
+ /**
+ * 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));
+ }
+
+ /**
+ * Implements Section 1.2.3, #5.
+ */
+ private void validateDirectInterfaces(Class c) throws IDLTypeException {
+
+ Class[] directInterfaces = c.getInterfaces();
+
+ if( directInterfaces.length < 2 ) {
+ return;
+ }
+
+ Set allMethodNames = new HashSet();
+ Set currentMethodNames = new HashSet();
+
+ 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
+ // all methods from current interface, eliminating duplicate
+ // names.
+ currentMethodNames.clear();
+ 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();) {
+ String methodName = (String) iter.next();
+ if( allMethodNames.contains(methodName) ) {
+ String msg = "Class " + c + " inherits method " +
+ methodName + " from multiple direct interfaces.";
+ throw new IDLTypeException(msg);
+ } else {
+ allMethodNames.add(methodName);
+ }
+ }
+ }
+
+ return;
+ }
+
+ /**
+ * Implements 1.2.3 #6
+ */
+ 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) {
+ IDLTypeException ite = new IDLTypeException();
+ ite.initCause(pae);
+ throw ite;
+ }
+
+ 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.";
+ throw new IDLTypeException(msg);
+ }
+ }
+
+
+ return;
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java
new file mode 100644
index 0000000..f0e25d3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/InvocationHandlerFactoryImpl.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.lang.reflect.InvocationHandler ;
+import java.lang.reflect.Proxy ;
+import java.lang.reflect.Method ;
+
+import org.omg.CORBA.portable.ObjectImpl ;
+
+import java.io.ObjectStreamException ;
+import java.io.Serializable ;
+
+import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ;
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+import com.sun.corba.se.spi.presentation.rmi.DynamicStub ;
+
+import com.sun.corba.se.spi.orbutil.proxy.LinkedInvocationHandler ;
+import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ;
+import com.sun.corba.se.spi.orbutil.proxy.DelegateInvocationHandlerImpl ;
+import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandler ;
+import com.sun.corba.se.spi.orbutil.proxy.CompositeInvocationHandlerImpl ;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+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 ] ;
+ for (int ctr=0; ctr<remoteInterfaces.length; ctr++)
+ proxyInterfaces[ctr] = remoteInterfaces[ctr] ;
+
+ proxyInterfaces[remoteInterfaces.length] = DynamicStub.class ;
+ }
+
+ private class CustomCompositeInvocationHandlerImpl extends
+ CompositeInvocationHandlerImpl implements LinkedInvocationHandler,
+ Serializable
+ {
+ private transient DynamicStub stub ;
+
+ public void setProxy( Proxy proxy )
+ {
+ ((DynamicStubImpl)stub).setSelf( (DynamicStub)proxy ) ;
+ }
+
+ public Proxy getProxy()
+ {
+ return (Proxy)((DynamicStubImpl)stub).getSelf() ;
+ }
+
+ public CustomCompositeInvocationHandlerImpl( DynamicStub stub )
+ {
+ this.stub = stub ;
+ }
+
+ /** Return the stub, which will actually be written to the stream.
+ * It will be custom marshalled, 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 InvocationHandler getInvocationHandler()
+ {
+ final DynamicStub stub = new DynamicStubImpl(
+ classData.getTypeIds() ) ;
+
+ return getInvocationHandler( stub ) ;
+ }
+
+ // This is also used in DynamicStubImpl to implement readResolve.
+ 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
+ // org.omg.CORBA.portable.ObjectImpl.
+ final InvocationHandler dynamicStubHandler =
+ DelegateInvocationHandlerImpl.create( stub ) ;
+
+ // Create an invocation handler that handles any remote interface
+ // methods.
+ final 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 ) ;
+
+ AccessController.doPrivileged(new PrivilegedAction<Void>() {
+ @Override
+ public Void run() {
+ handler.addInvocationHandler( DynamicStub.class,
+ dynamicStubHandler ) ;
+ handler.addInvocationHandler( org.omg.CORBA.Object.class,
+ dynamicStubHandler ) ;
+ handler.addInvocationHandler( Object.class,
+ dynamicStubHandler ) ;
+ return null;
+ }
+ });
+
+
+ // 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
+ // 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
+ // 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 ) ;
+
+ return handler ;
+ }
+
+ public Class[] getProxyInterfaces()
+ {
+ return proxyInterfaces ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java
new file mode 100644
index 0000000..5181627
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/JNDIStateFactoryImpl.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.lang.reflect.Field ;
+
+import java.util.Hashtable;
+
+import javax.naming.*;
+import javax.naming.spi.StateFactory;
+
+import java.security.AccessController ;
+import java.security.PrivilegedAction ;
+
+import javax.rmi.PortableRemoteObject ;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import java.rmi.Remote;
+import java.rmi.server.ExportException;
+
+// XXX This creates a dependendcy on the implementation
+// of the CosNaming service provider.
+import com.sun.jndi.cosnaming.CNCtx ;
+
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
+
+/**
+ * StateFactory that turns java.rmi.Remote objects to org.omg.CORBA.Object.
+ * This version works either with standard RMI-IIOP or Dynamic RMI-IIOP.
+ * Based on the original com.sun.jndi.cosnaming.RemoteToCorba and
+ * com.sun.jndi.toolkit.corba.CorbaUtils.
+ *
+ * @author Ken Cavanaugh
+ */
+
+public class JNDIStateFactoryImpl implements StateFactory
+{
+ private static final Field orbField ;
+
+ static {
+ orbField = (Field) AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public Object run() {
+ Field fld = null ;
+ try {
+ Class cls = CNCtx.class ;
+ fld = cls.getDeclaredField( "_orb" ) ;
+ fld.setAccessible( true ) ;
+ } catch (Exception exc) {
+ // XXX log exception at FINE
+ }
+ return fld ;
+ }
+ }
+ ) ;
+ }
+
+ 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.
+ *
+ * @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
+ * @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
+ {
+ if (orig instanceof org.omg.CORBA.Object)
+ return orig ;
+
+ if (!(orig instanceof Remote))
+ // Not for this StateFactory
+ return null ;
+
+ 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 ;
+
+ Remote stub = null;
+
+ try {
+ stub = PortableRemoteObject.toStub( (Remote)orig ) ;
+ } catch (Exception exc) {
+ // XXX log at FINE level?
+ // Wrong sort of object: just return null to allow another StateFactory
+ // to handle this. This can happen easily because this StateFactory
+ // is specified for the application, not the service context provider.
+ return null ;
+ }
+
+ if (StubAdapter.isStub( stub )) {
+ try {
+ StubAdapter.connect( stub, orb ) ;
+ } catch (Exception exc) {
+ if (!(exc instanceof java.rmi.RemoteException)) {
+ // XXX log at FINE level?
+ // Wrong sort of object: just return null to allow another StateFactory
+ // to handle this call.
+ return null ;
+ }
+
+ // ignore RemoteException because stub might have already
+ // been connected
+ }
+ }
+
+ return stub ;
+ }
+
+ // 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
+ // other vendors may use the CosNaming provider with a different ORB
+ // entirely.
+ private ORB getORB( Context ctx )
+ {
+ ORB orb = null ;
+
+ try {
+ orb = (ORB)orbField.get( ctx ) ;
+ } catch (Exception exc) {
+ // XXX log this exception at FINE level
+ // ignore the exception and return null.
+ // Note that the exception may be because ctx
+ // is not a CosNaming context.
+ }
+
+ return orb ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/PresentationManagerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/PresentationManagerImpl.java
new file mode 100644
index 0000000..6423936
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/PresentationManagerImpl.java
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+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.Iterator ;
+
+import java.lang.reflect.Method ;
+
+import java.rmi.Remote ;
+
+import javax.rmi.CORBA.Tie ;
+
+import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ;
+
+import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ;
+import com.sun.corba.se.spi.presentation.rmi.DynamicMethodMarshaller ;
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+import com.sun.corba.se.impl.presentation.rmi.IDLNameTranslatorImpl ;
+import com.sun.corba.se.impl.presentation.rmi.StubFactoryProxyImpl ;
+
+import com.sun.corba.se.impl.orbutil.graph.Node ;
+import com.sun.corba.se.impl.orbutil.graph.Graph ;
+import com.sun.corba.se.impl.orbutil.graph.GraphImpl ;
+
+public final class PresentationManagerImpl implements PresentationManager
+{
+ private Map classToClassData ;
+ private Map methodToDMM ;
+ private PresentationManager.StubFactoryFactory staticStubFactoryFactory ;
+ private PresentationManager.StubFactoryFactory dynamicStubFactoryFactory ;
+ private ORBUtilSystemException wrapper = null ;
+ private boolean useDynamicStubs ;
+
+ public PresentationManagerImpl( boolean useDynamicStubs )
+ {
+ this.useDynamicStubs = useDynamicStubs ;
+ wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PRESENTATION ) ;
+
+ // XXX these should probably be WeakHashMaps.
+ classToClassData = new HashMap() ;
+ methodToDMM = new HashMap() ;
+ }
+
+////////////////////////////////////////////////////////////////////////////////
+// PresentationManager interface
+////////////////////////////////////////////////////////////////////////////////
+
+ public synchronized DynamicMethodMarshaller getDynamicMethodMarshaller(
+ Method method )
+ {
+ if (method == null)
+ return null ;
+
+ DynamicMethodMarshaller result =
+ (DynamicMethodMarshaller)methodToDMM.get( method ) ;
+ if (result == null) {
+ result = new DynamicMethodMarshallerImpl( method ) ;
+ methodToDMM.put( method, result ) ;
+ }
+
+ return result ;
+ }
+
+ public synchronized ClassData getClassData( Class cls )
+ {
+ ClassData result = (ClassData)classToClassData.get( cls ) ;
+ if (result == null) {
+ result = new ClassDataImpl( cls ) ;
+ classToClassData.put( cls, result ) ;
+ }
+
+ return result ;
+ }
+
+ private class ClassDataImpl implements PresentationManager.ClassData
+ {
+ private Class cls ;
+ private IDLNameTranslator nameTranslator ;
+ private String[] typeIds ;
+ private PresentationManager.StubFactory sfactory ;
+ private InvocationHandlerFactory ihfactory ;
+ private Map dictionary ;
+
+ public 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() ;
+ }
+
+ public Class getMyClass()
+ {
+ return cls ;
+ }
+
+ public IDLNameTranslator getIDLNameTranslator()
+ {
+ return nameTranslator ;
+ }
+
+ public String[] getTypeIds()
+ {
+ return typeIds ;
+ }
+
+ public InvocationHandlerFactory getInvocationHandlerFactory()
+ {
+ return ihfactory ;
+ }
+
+ public Map getDictionary()
+ {
+ return dictionary ;
+ }
+ }
+
+ public PresentationManager.StubFactoryFactory getStubFactoryFactory(
+ boolean isDynamic )
+ {
+ if (isDynamic)
+ return dynamicStubFactoryFactory ;
+ else
+ return staticStubFactoryFactory ;
+ }
+
+ public void setStubFactoryFactory( boolean isDynamic,
+ PresentationManager.StubFactoryFactory sff )
+ {
+ if (isDynamic)
+ dynamicStubFactoryFactory = sff ;
+ else
+ staticStubFactoryFactory = sff ;
+ }
+
+ public Tie getTie()
+ {
+ return dynamicStubFactoryFactory.getTie( null ) ;
+ }
+
+ public boolean useDynamicStubs()
+ {
+ return useDynamicStubs ;
+ }
+
+////////////////////////////////////////////////////////////////////////////////
+// Graph computations
+////////////////////////////////////////////////////////////////////////////////
+
+ private Set getRootSet( Class target, NodeImpl root, Graph gr )
+ {
+ Set rootSet = null ;
+
+ if (target.isInterface()) {
+ 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 )) {
+ Node node = new NodeImpl( superclass ) ;
+ gr.add( node ) ;
+ initialRootSet.add( node ) ;
+ superclass = superclass.getSuperclass() ;
+ }
+
+ // Expand all nodes into the graph
+ gr.getRoots() ;
+
+ // remove the roots and find roots again
+ gr.removeAll( initialRootSet ) ;
+ rootSet = gr.getRoots() ;
+ }
+
+ return rootSet ;
+ }
+
+ private Class[] getInterfaces( Set roots )
+ {
+ Class[] classes = new Class[ roots.size() ] ;
+ Iterator iter = roots.iterator() ;
+ int ctr = 0 ;
+ while (iter.hasNext()) {
+ NodeImpl node = (NodeImpl)iter.next() ;
+ classes[ctr++] = node.getInterface() ;
+ }
+
+ return classes ;
+ }
+
+ private String[] makeTypeIds( NodeImpl root, Graph gr, Set rootSet )
+ {
+ Set nonRootSet = new HashSet( gr ) ;
+ nonRootSet.removeAll( rootSet ) ;
+
+ // List<String> for the typeids
+ 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() ) ;
+ }
+
+ addNodes( result, rootSet ) ;
+ addNodes( result, nonRootSet ) ;
+
+ return (String[])result.toArray( new String[result.size()] ) ;
+ }
+
+ private void addNodes( List resultList, Set nodeSet )
+ {
+ Iterator iter = nodeSet.iterator() ;
+ while (iter.hasNext()) {
+ NodeImpl node = (NodeImpl)iter.next() ;
+ String typeId = node.getTypeId() ;
+ resultList.add( typeId ) ;
+ }
+ }
+
+ private static class NodeImpl implements Node
+ {
+ private Class interf ;
+
+ public Class getInterface()
+ {
+ return interf ;
+ }
+
+ public NodeImpl( Class interf )
+ {
+ this.interf = interf ;
+ }
+
+ public String getTypeId()
+ {
+ return "RMI:" + interf.getName() + ":0000000000000000" ;
+ }
+
+ public Set getChildren()
+ {
+ Set result = new HashSet() ;
+ Class[] interfaces = interf.getInterfaces() ;
+ for (int ctr=0; ctr<interfaces.length; ctr++) {
+ Class cls = interfaces[ctr] ;
+ if (Remote.class.isAssignableFrom(cls) &&
+ !Remote.class.equals(cls))
+ result.add( new NodeImpl( cls ) ) ;
+ }
+
+ return result ;
+ }
+
+ public String toString()
+ {
+ return "NodeImpl[" + interf + "]" ;
+ }
+
+ public int hashCode()
+ {
+ return interf.hashCode() ;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if (this == obj)
+ return true ;
+
+ if (!(obj instanceof NodeImpl))
+ return false ;
+
+ NodeImpl other = (NodeImpl)obj ;
+
+ return other.interf.equals( interf ) ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ReflectiveTie.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ReflectiveTie.java
new file mode 100644
index 0000000..7883c20
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/ReflectiveTie.java
@@ -0,0 +1,176 @@
+/*
+ * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+import javax.rmi.CORBA.Tie;
+
+import java.lang.reflect.Method ;
+import java.lang.reflect.InvocationTargetException ;
+
+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.portable.ResponseHandler;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POA;
+import org.omg.PortableServer.POAManager;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ;
+import com.sun.corba.se.spi.presentation.rmi.DynamicMethodMarshaller ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+import com.sun.corba.se.impl.oa.poa.POAManagerImpl ;
+
+public final class ReflectiveTie extends Servant implements Tie
+{
+ private Remote target = null ;
+ private PresentationManager pm ;
+ private PresentationManager.ClassData classData = null ;
+ private ORBUtilSystemException wrapper = null ;
+
+ public ReflectiveTie( PresentationManager pm, ORBUtilSystemException wrapper )
+ {
+ SecurityManager s = System.getSecurityManager();
+ if (s != null) {
+ s.checkPermission(new DynamicAccessPermission("access"));
+ }
+ this.pm = pm ;
+ this.wrapper = wrapper ;
+ }
+
+ public String[] _all_interfaces(org.omg.PortableServer.POA poa,
+ byte[] objectId)
+ {
+ return classData.getTypeIds() ;
+ }
+
+ public void setTarget(Remote target)
+ {
+ this.target = target;
+
+ if (target == null) {
+ classData = null ;
+ } else {
+ Class targetClass = target.getClass() ;
+ classData = pm.getClassData( targetClass ) ;
+ }
+ }
+
+ public Remote getTarget()
+ {
+ return target;
+ }
+
+ public org.omg.CORBA.Object thisObject()
+ {
+ return _this_object();
+ }
+
+ 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
+ }
+ }
+
+ public org.omg.CORBA.ORB orb() {
+ return _orb();
+ }
+
+ public void orb(org.omg.CORBA.ORB orb) {
+ try {
+ ORB myORB = (ORB)orb ;
+
+ ((org.omg.CORBA_2_3.ORB)orb).set_delegate(this);
+ } catch (ClassCastException e) {
+ throw wrapper.badOrbForServant( e ) ;
+ }
+ }
+
+ 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 ) ;
+ if (javaMethod == null)
+ throw wrapper.methodNotFoundInTie( method,
+ target.getClass().getName() ) ;
+
+ dmm = pm.getDynamicMethodMarshaller( javaMethod ) ;
+
+ Object[] args = dmm.readArguments( in ) ;
+
+ Object result = javaMethod.invoke( target, args ) ;
+
+ OutputStream os = (OutputStream)reply.createReply() ;
+
+ dmm.writeResult( os, result ) ;
+
+ return os ;
+ } catch (IllegalAccessException ex) {
+ throw wrapper.invocationErrorInReflectiveTie( ex,
+ javaMethod.getName(),
+ javaMethod.getDeclaringClass().getName() ) ;
+ } catch (IllegalArgumentException ex) {
+ throw wrapper.invocationErrorInReflectiveTie( ex,
+ javaMethod.getName(),
+ javaMethod.getDeclaringClass().getName() ) ;
+ } 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() ;
+ 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 ;
+ } else
+ throw new UnknownException( thr ) ;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubConnectImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubConnectImpl.java
new file mode 100644
index 0000000..e00facc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubConnectImpl.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.rmi.RemoteException;
+
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_INV_ORDER;
+
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.Delegate;
+
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.util.Utility;
+
+import com.sun.corba.se.impl.ior.StubIORImpl ;
+
+import com.sun.corba.se.impl.logging.UtilSystemException ;
+
+import com.sun.corba.se.impl.corba.CORBAObjectImpl ;
+
+public abstract class StubConnectImpl
+{
+ static UtilSystemException wrapper = UtilSystemException.get(
+ CORBALogDomains.RMIIIOP ) ;
+
+ /** 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.
+ */
+ 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) {
+ 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() ;
+
+ // Is the tie already connected? If it is, check that it's
+ // connected to the same ORB, otherwise connect it.
+ ORB existingOrb = orb ;
+ try {
+ existingOrb = tie.orb();
+ } catch (BAD_OPERATION exc) {
+ // Thrown when tie is an ObjectImpl and its delegate is not set.
+ tie.orb(orb);
+ } 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() ;
+
+ // 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 ) ;
+ } else {
+ // ior is initialized, so convert ior to an object, extract
+ // the delegate, and set it on ourself
+ del = ior.getDelegate( orb ) ;
+ }
+
+ StubAdapter.setDelegate( stub, del ) ;
+ }
+ } catch (SystemException exc) {
+ throw new RemoteException("CORBA SystemException", exc );
+ }
+
+ return ior ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryBase.java
new file mode 100644
index 0000000..354724b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryBase.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import javax.rmi.CORBA.Tie ;
+
+import java.lang.reflect.InvocationHandler ;
+import java.lang.reflect.Proxy ;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+import com.sun.corba.se.spi.presentation.rmi.DynamicStub ;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
+
+import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ;
+import com.sun.corba.se.spi.orbutil.proxy.LinkedInvocationHandler ;
+
+public abstract class StubFactoryBase implements PresentationManager.StubFactory
+{
+ private String[] typeIds = null ;
+
+ protected final PresentationManager.ClassData classData ;
+
+ protected StubFactoryBase( PresentationManager.ClassData classData )
+ {
+ this.classData = classData ;
+ }
+
+ public synchronized String[] getTypeIds()
+ {
+ if (typeIds == null) {
+ if (classData == null) {
+ org.omg.CORBA.Object stub = makeStub() ;
+ typeIds = StubAdapter.getTypeIds( stub ) ;
+ } else {
+ typeIds = classData.getTypeIds() ;
+ }
+ }
+
+ return typeIds ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java
new file mode 100644
index 0000000..c71eb5d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryDynamicBase.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.io.SerializablePermission;
+import java.lang.reflect.InvocationHandler ;
+import java.lang.reflect.Proxy ;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+import com.sun.corba.se.spi.presentation.rmi.DynamicStub ;
+
+import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ;
+import com.sun.corba.se.spi.orbutil.proxy.LinkedInvocationHandler ;
+
+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"));
+ }
+ return null;
+ }
+
+ private StubFactoryDynamicBase(Void unused,
+ PresentationManager.ClassData classData, ClassLoader loader) {
+ super(classData);
+ // this.loader must not be null, or the newProxyInstance call
+ // will fail.
+ if (loader == null) {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null)
+ cl = ClassLoader.getSystemClassLoader();
+ this.loader = cl ;
+ } else {
+ this.loader = loader ;
+ }
+ }
+
+ public StubFactoryDynamicBase( PresentationManager.ClassData classData,
+ ClassLoader loader )
+ {
+ this (checkPermission(), classData, loader);
+ }
+
+ public abstract org.omg.CORBA.Object makeStub() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryBase.java
new file mode 100644
index 0000000..0e04c3f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryBase.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
+
+import com.sun.corba.se.impl.util.Utility ;
+
+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 ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryDynamicBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryDynamicBase.java
new file mode 100644
index 0000000..b3c5fdd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryDynamicBase.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi;
+
+import java.rmi.Remote ;
+import javax.rmi.CORBA.Tie ;
+
+import javax.rmi.CORBA.Util;
+
+import org.omg.CORBA.CompletionStatus;
+
+import org.omg.CORBA.portable.IDLEntity ;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
+import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public abstract class StubFactoryFactoryDynamicBase extends
+ StubFactoryFactoryBase
+{
+ protected final ORBUtilSystemException wrapper ;
+
+ public StubFactoryFactoryDynamicBase()
+ {
+ wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PRESENTATION ) ;
+ }
+
+ public PresentationManager.StubFactory createStubFactory(
+ String className, boolean isIDLStub, String remoteCodeBase,
+ Class expectedClass, ClassLoader classLoader)
+ {
+ Class cls = null ;
+
+ try {
+ cls = Util.loadClass( className, remoteCodeBase, classLoader ) ;
+ } catch (ClassNotFoundException exc) {
+ throw wrapper.classNotFound3(
+ CompletionStatus.COMPLETED_MAYBE, exc, className ) ;
+ }
+
+ PresentationManager pm = ORB.getPresentationManager() ;
+
+ if (IDLEntity.class.isAssignableFrom( cls ) &&
+ !Remote.class.isAssignableFrom( cls )) {
+ // IDL stubs must always use static factories.
+ PresentationManager.StubFactoryFactory sff =
+ pm.getStubFactoryFactory( false ) ;
+ PresentationManager.StubFactory sf =
+ sff.createStubFactory( className, true, remoteCodeBase,
+ expectedClass, classLoader ) ;
+ return sf ;
+ } else {
+ PresentationManager.ClassData classData = pm.getClassData( cls ) ;
+ return makeDynamicStubFactory( pm, classData, 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, wrapper ) ;
+ }
+
+ public boolean createsDynamicStubs()
+ {
+ return true ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java
new file mode 100644
index 0000000..ae0587f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryProxyImpl.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+
+public class StubFactoryFactoryProxyImpl extends StubFactoryFactoryDynamicBase
+{
+ public PresentationManager.StubFactory makeDynamicStubFactory(
+ PresentationManager pm, final PresentationManager.ClassData classData,
+ final ClassLoader classLoader )
+ {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<StubFactoryProxyImpl>() {
+ @Override
+ public StubFactoryProxyImpl run() {
+ return new StubFactoryProxyImpl(classData, classLoader);
+ }
+ });
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryStaticImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryStaticImpl.java
new file mode 100644
index 0000000..476f47b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryFactoryStaticImpl.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi;
+
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.Tie ;
+
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
+
+import com.sun.corba.se.impl.util.PackagePrefixChecker;
+import com.sun.corba.se.impl.util.Utility;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class StubFactoryFactoryStaticImpl extends
+ StubFactoryFactoryBase
+{
+ private ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PRESENTATION ) ;
+
+ 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 ) ;
+
+ 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:
+ // 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 ;
+
+ if (PackagePrefixChecker.hasOffendingPrefix(stubName))
+ firstStubName = PackagePrefixChecker.packagePrefix() + stubName ;
+ else
+ secondStubName = PackagePrefixChecker.packagePrefix() + stubName ;
+
+ Class clz = null;
+
+ try {
+ clz = Util.loadClass( firstStubName, remoteCodeBase,
+ expectedTypeClassLoader ) ;
+ } catch (ClassNotFoundException e1) {
+ // log only at FINE level
+ wrapper.classNotFound1( CompletionStatus.COMPLETED_MAYBE,
+ e1, firstStubName ) ;
+ try {
+ clz = Util.loadClass( secondStubName, remoteCodeBase,
+ expectedTypeClassLoader ) ;
+ } catch (ClassNotFoundException e2) {
+ throw wrapper.classNotFound2(
+ CompletionStatus.COMPLETED_MAYBE, e2, secondStubName ) ;
+ }
+ }
+
+ // XXX 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 ((clz == null) ||
+ ((expectedClass != null) && !expectedClass.isAssignableFrom(clz))) {
+ try {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null)
+ cl = ClassLoader.getSystemClassLoader();
+
+ clz = cl.loadClass(className);
+ } catch (Exception exc) {
+ // XXX make this a system exception
+ IllegalStateException ise = new IllegalStateException(
+ "Could not load class " + stubName ) ;
+ ise.initCause( exc ) ;
+ throw ise ;
+ }
+ }
+
+ return new StubFactoryStaticImpl( clz ) ;
+ }
+
+ 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.getCodebase(cls),
+ null, cls, cls.getClassLoader());
+ return (Tie) tieClass.newInstance();
+ } catch (Exception err) {
+ tieClass = Utility.loadClassForClass(
+ PackagePrefixChecker.packagePrefix() + className,
+ Util.getCodebase(cls), null, cls, cls.getClassLoader());
+ return (Tie) tieClass.newInstance();
+ }
+ } catch (Exception err) {
+ return null;
+ }
+
+ }
+
+ public boolean createsDynamicStubs()
+ {
+ return false ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryProxyImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryProxyImpl.java
new file mode 100644
index 0000000..02e7c92
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryProxyImpl.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.lang.reflect.Proxy ;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+import com.sun.corba.se.spi.presentation.rmi.DynamicStub ;
+
+import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ;
+import com.sun.corba.se.spi.orbutil.proxy.LinkedInvocationHandler ;
+
+public class StubFactoryProxyImpl extends StubFactoryDynamicBase
+{
+ public StubFactoryProxyImpl( PresentationManager.ClassData classData,
+ ClassLoader loader )
+ {
+ super( classData, loader ) ;
+ }
+
+ 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 ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryStaticImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryStaticImpl.java
new file mode 100644
index 0000000..e9fbd3a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubFactoryStaticImpl.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi;
+
+import java.lang.reflect.InvocationHandler ;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
+
+public class StubFactoryStaticImpl extends StubFactoryBase
+{
+ private Class stubClass ;
+
+ public StubFactoryStaticImpl(Class cls)
+ {
+ super( null ) ;
+ this.stubClass = cls;
+ }
+
+ public org.omg.CORBA.Object makeStub()
+ {
+ org.omg.CORBA.Object stub = null;
+ try {
+ stub = (org.omg.CORBA.Object) stubClass.newInstance();
+ } catch (InstantiationException e) {
+ throw new RuntimeException(e);
+ } catch (IllegalAccessException e) {
+ throw new RuntimeException(e);
+ }
+ return stub ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubInvocationHandlerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubInvocationHandlerImpl.java
new file mode 100644
index 0000000..028580b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/StubInvocationHandlerImpl.java
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.presentation.rmi ;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import java.lang.reflect.Method ;
+import java.lang.reflect.InvocationHandler ;
+import java.lang.reflect.Proxy ;
+import java.lang.reflect.InvocationTargetException ;
+
+import java.io.ObjectInputStream ;
+import java.io.ObjectOutputStream ;
+import java.io.IOException ;
+
+import java.rmi.Remote ;
+
+import javax.rmi.CORBA.Util ;
+
+import org.omg.CORBA.portable.ObjectImpl ;
+import org.omg.CORBA.portable.Delegate ;
+import org.omg.CORBA.portable.ServantObject ;
+import org.omg.CORBA.portable.ApplicationException ;
+import org.omg.CORBA.portable.RemarshalException ;
+
+import org.omg.CORBA.SystemException ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.pept.transport.ContactInfoList ;
+
+import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
+
+import com.sun.corba.se.spi.protocol.CorbaClientDelegate ;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
+
+import com.sun.corba.se.spi.presentation.rmi.IDLNameTranslator ;
+import com.sun.corba.se.spi.presentation.rmi.DynamicMethodMarshaller ;
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
+
+import com.sun.corba.se.spi.orbutil.proxy.InvocationHandlerFactory ;
+import com.sun.corba.se.spi.orbutil.proxy.LinkedInvocationHandler ;
+
+import com.sun.corba.se.impl.corba.CORBAObjectImpl ;
+
+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 StubInvocationHandlerImpl( PresentationManager pm,
+ PresentationManager.ClassData classData, org.omg.CORBA.Object stub )
+ {
+ SecurityManager s = System.getSecurityManager();
+ if (s != null) {
+ s.checkPermission(new DynamicAccessPermission("access"));
+ }
+ this.classData = classData ;
+ this.pm = pm ;
+ this.stub = stub ;
+ }
+
+ private boolean isLocal()
+ {
+ boolean result = false ;
+ Delegate delegate = StubAdapter.getDelegate( stub ) ;
+
+ if (delegate instanceof CorbaClientDelegate) {
+ CorbaClientDelegate cdel = (CorbaClientDelegate)delegate ;
+ ContactInfoList cil = cdel.getContactInfoList() ;
+ if (cil instanceof CorbaContactInfoList) {
+ CorbaContactInfoList ccil = (CorbaContactInfoList)cil ;
+ LocalClientRequestDispatcher lcrd =
+ ccil.getLocalClientRequestDispatcher() ;
+ result = lcrd.useLocalInvocation( null ) ;
+ }
+ }
+
+ return result ;
+ }
+
+ /** 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)
+ */
+ public Object invoke( Object proxy, final Method method,
+ Object[] args ) throws Throwable
+ {
+ String giopMethodName = classData.getIDLNameTranslator().
+ getIDLName( method ) ;
+ DynamicMethodMarshaller dmm =
+ pm.getDynamicMethodMarshaller( method ) ;
+
+ Delegate delegate = null ;
+ try {
+ delegate = StubAdapter.getDelegate( stub ) ;
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex) ;
+ }
+
+ if (!isLocal()) {
+ try {
+ 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);
+
+ // marshal arguments
+ dmm.writeArguments( out, args ) ;
+
+ // finish invocation
+ in = (org.omg.CORBA_2_3.portable.InputStream)
+ delegate.invoke( stub, out);
+
+ // unmarshal result
+ return dmm.readResult( in ) ;
+ } catch (ApplicationException ex) {
+ throw dmm.readException( ex ) ;
+ } catch (RemarshalException ex) {
+ return invoke( proxy, method, args ) ;
+ } finally {
+ delegate.releaseReply( stub, in );
+ }
+ } catch (SystemException ex) {
+ throw Util.mapSystemException(ex) ;
+ }
+ } else {
+ // local branch
+ ORB orb = (ORB)delegate.orb( stub ) ;
+ ServantObject so = delegate.servant_preinvoke( stub, giopMethodName,
+ method.getDeclaringClass() );
+ if (so == null) {
+ return invoke( stub, method, args ) ;
+ }
+ try {
+ Object[] copies = dmm.copyArguments( args, orb ) ;
+
+ 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 ;
+ }
+ } ) ;
+ }
+
+ Object result = method.invoke( so.servant, copies ) ;
+
+ return dmm.copyResult( result, orb ) ;
+ } catch (InvocationTargetException ex) {
+ Throwable mex = ex.getCause() ;
+ // mex should never be null, as null cannot be thrown
+ Throwable exCopy = (Throwable)Util.copyObject(mex,orb);
+ if (dmm.isDeclaredException( exCopy ))
+ throw exCopy ;
+ else
+ throw Util.wrapException(exCopy);
+ } catch (Throwable thr) {
+ if (thr instanceof ThreadDeath)
+ throw (ThreadDeath)thr ;
+
+ // This is not a user thrown exception from the
+ // method call, so don't copy it. This is either
+ // an error or a reflective invoke exception.
+ throw Util.wrapException( thr ) ;
+ } finally {
+ delegate.servant_postinvoke( stub, so);
+ }
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/jndi.properties b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/jndi.properties
new file mode 100644
index 0000000..00cabf7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/presentation/rmi/jndi.properties
@@ -0,0 +1,3 @@
+# Required to add a javax.naming.spi.StateFactory for CosNaming that
+# supports dynamic RMI-IIOP.
+java.naming.factory.state=com.sun.corba.se.impl.presentation.rmi.JNDIStateFactoryImpl
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/AddressingDispositionException.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/AddressingDispositionException.java
new file mode 100644
index 0000000..111fb7c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/AddressingDispositionException.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import com.sun.corba.se.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.
+ *
+ * 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.
+ *
+ */
+public class AddressingDispositionException extends RuntimeException {
+
+ private short expectedAddrDisp = KeyAddr.value;
+
+ public AddressingDispositionException(short expectedAddrDisp) {
+ this.expectedAddrDisp = expectedAddrDisp;
+ }
+
+ public short expectedAddrDisp() {
+ return this.expectedAddrDisp;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/BootstrapServerRequestDispatcher.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/BootstrapServerRequestDispatcher.java
new file mode 100644
index 0000000..2f417bd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/BootstrapServerRequestDispatcher.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol ;
+
+import java.util.Iterator ;
+
+import org.omg.CORBA.SystemException ;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.ObjectKey ;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import com.sun.corba.se.impl.encoding.MarshalInputStream ;
+import com.sun.corba.se.impl.encoding.MarshalOutputStream ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.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.
+ * <p>
+ * 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 CorbaServerRequestDispatcher
+{
+ private ORB orb;
+
+ ORBUtilSystemException wrapper ;
+
+ private static final boolean debug = false;
+
+ public BootstrapServerRequestDispatcher(ORB orb )
+ {
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ /**
+ * Dispatch is called by the ORB and will serve get(key) and list()
+ * invocations on the initial object key.
+ */
+ public void dispatch(MessageMediator messageMediator)
+ {
+ CorbaMessageMediator request = (CorbaMessageMediator) messageMediator;
+ CorbaMessageMediator response = null;
+
+ try {
+ MarshalInputStream is = (MarshalInputStream)
+ request.getInputObject();
+ String method = request.getOperationName();
+ response = request.getProtocolHandler().createResponse(request, null);
+ 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 ) ;
+
+ // 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() ;
+ while (iter.hasNext()) {
+ String obj = (String)iter.next() ;
+ os.write_string( obj ) ;
+ }
+ } else {
+ throw wrapper.illegalBootstrapOperation( method ) ;
+ }
+
+ } catch (org.omg.CORBA.SystemException ex) {
+ // Marshal the exception thrown
+ 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 ) ;
+ } catch (java.lang.Exception ex) {
+ // Unknown exception
+ 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.
+ */
+ public IOR locate( ObjectKey objectKey) {
+ return null;
+ }
+
+ /**
+ * Not implemented
+ */
+ public int getId() {
+ throw wrapper.genericNoImpl() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaClientDelegateImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaClientDelegateImpl.java
new file mode 100644
index 0000000..c6f9e94
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaClientDelegateImpl.java
@@ -0,0 +1,443 @@
+/*
+ * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import java.util.Iterator;
+import java.util.HashMap;
+
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.TypeCode;
+
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA.portable.ServantObject;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.ClientInvocationInfo;
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.ContactInfoList;
+import com.sun.corba.se.pept.transport.ContactInfoListIterator;
+
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.protocol.CorbaClientDelegate ;
+import com.sun.corba.se.spi.transport.CorbaContactInfo;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator;
+
+import com.sun.corba.se.impl.corba.RequestImpl;
+import com.sun.corba.se.impl.protocol.CorbaInvocationInfo;
+import com.sun.corba.se.impl.transport.CorbaContactInfoListImpl;
+import com.sun.corba.se.impl.util.JDKBridge;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+// implements com.sun.corba.se.impl.core.ClientRequestDispatcher
+// so RMI-IIOP Util.isLocal can call ClientRequestDispatcher.useLocalInvocation.
+
+/**
+ * @author Harold Carr
+ */
+public class CorbaClientDelegateImpl extends CorbaClientDelegate
+{
+ private ORB orb;
+ private ORBUtilSystemException wrapper ;
+
+ private CorbaContactInfoList contactInfoList;
+
+ public CorbaClientDelegateImpl(ORB orb,
+ CorbaContactInfoList contactInfoList)
+ {
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ this.contactInfoList = contactInfoList;
+ }
+
+ //
+ // framework.subcontract.Delegate
+ //
+
+ public Broker getBroker()
+ {
+ return orb;
+ }
+
+ public ContactInfoList getContactInfoList()
+ {
+ return contactInfoList;
+ }
+
+ //
+ // CORBA_2_3.portable.Delegate
+ //
+
+ public OutputStream request(org.omg.CORBA.Object self,
+ String operation,
+ boolean responseExpected)
+ {
+ ClientInvocationInfo invocationInfo =
+ orb.createOrIncrementInvocationInfo();
+ Iterator contactInfoListIterator =
+ invocationInfo.getContactInfoListIterator();
+ if (contactInfoListIterator == null) {
+ contactInfoListIterator = contactInfoList.iterator();
+ invocationInfo.setContactInfoListIterator(contactInfoListIterator);
+ }
+ if (! contactInfoListIterator.hasNext()) {
+ throw ((CorbaContactInfoListIterator)contactInfoListIterator)
+ .getFailureException();
+ }
+ CorbaContactInfo contactInfo = (CorbaContactInfo) contactInfoListIterator.next();
+ 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);
+ return (OutputStream)
+ subcontract.beginRequest(self, operation,
+ !responseExpected, contactInfo);
+ }
+
+ public InputStream invoke(org.omg.CORBA.Object self, OutputStream output)
+ throws
+ ApplicationException,
+ RemarshalException
+ {
+ ClientRequestDispatcher subcontract = getClientRequestDispatcher();
+ return (InputStream)
+ subcontract.marshalingComplete((Object)self, (OutputObject)output);
+ }
+
+ public void releaseReply(org.omg.CORBA.Object self, InputStream input)
+ {
+ // NOTE: InputStream may be null (e.g., exception request from PI).
+ ClientRequestDispatcher subcontract = getClientRequestDispatcher();
+ subcontract.endRequest(orb, self, (InputObject)input);
+ orb.releaseOrDecrementInvocationInfo();
+ }
+
+ private ClientRequestDispatcher getClientRequestDispatcher()
+ {
+ return (ClientRequestDispatcher)
+ ((CorbaInvocationInfo)orb.getInvocationInfo())
+ .getClientRequestDispatcher();
+ }
+
+ 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 ;
+
+ try {
+ OutputStream os = request(null, "_interface", true);
+ is = (InputStream) invoke((org.omg.CORBA.Object)null, os);
+
+ org.omg.CORBA.Object objimpl =
+ (org.omg.CORBA.Object) is.read_Object();
+
+ // check if returned object is of correct type
+ if ( !objimpl._is_a("IDL:omg.org/CORBA/InterfaceDef:1.0") )
+ throw wrapper.wrongInterfaceDef(CompletionStatus.COMPLETED_MAYBE);
+
+ try {
+ stub = (org.omg.CORBA.Object)
+ JDKBridge.loadClass("org.omg.CORBA._InterfaceDefStub").
+ newInstance();
+ } catch (Exception ex) {
+ throw wrapper.noInterfaceDefStub( ex ) ;
+ }
+
+ org.omg.CORBA.portable.Delegate del =
+ StubAdapter.getDelegate( objimpl ) ;
+ StubAdapter.setDelegate( stub, del ) ;
+ } catch (ApplicationException e) {
+ // This cannot happen.
+ throw wrapper.applicationExceptionInSpecialMethod( e ) ;
+ } catch (RemarshalException e) {
+ return get_interface_def(obj);
+ } finally {
+ releaseReply((org.omg.CORBA.Object)null, (InputStream)is);
+ }
+
+ return stub;
+ }
+
+ public boolean is_a(org.omg.CORBA.Object obj, String dest)
+ {
+ // dest is the typeId of the interface to compare against.
+ // 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 myid = contactInfoList.getTargetIOR().getTypeId();
+ if ( dest.equals(myid) ) {
+ return true;
+ }
+ for ( int i=0; i<repositoryIds.length; i++ ) {
+ if ( dest.equals(repositoryIds[i]) ) {
+ return true;
+ }
+ }
+
+ // But repositoryIds may not be complete, so it may be necessary to
+ // go to server.
+
+ InputStream is = null;
+ try {
+ OutputStream os = request(null, "_is_a", true);
+ os.write_string(dest);
+ is = (InputStream) invoke((org.omg.CORBA.Object) null, os);
+
+ return is.read_boolean();
+
+ } catch (ApplicationException e) {
+ // This cannot happen.
+ throw wrapper.applicationExceptionInSpecialMethod( e ) ;
+ } catch (RemarshalException e) {
+ return is_a(obj, dest);
+ } finally {
+ releaseReply((org.omg.CORBA.Object)null, (InputStream)is);
+ }
+ }
+
+ public boolean non_existent(org.omg.CORBA.Object obj)
+ {
+ InputStream is = null;
+ try {
+ OutputStream os = request(null, "_non_existent", true);
+ is = (InputStream) invoke((org.omg.CORBA.Object)null, os);
+
+ return is.read_boolean();
+
+ } catch (ApplicationException e) {
+ // This cannot happen.
+ throw wrapper.applicationExceptionInSpecialMethod( e ) ;
+ } catch (RemarshalException e) {
+ return non_existent(obj);
+ } finally {
+ releaseReply((org.omg.CORBA.Object)null, (InputStream)is);
+ }
+ }
+
+ public org.omg.CORBA.Object duplicate(org.omg.CORBA.Object obj)
+ {
+ return obj;
+ }
+
+ public void release(org.omg.CORBA.Object obj)
+ {
+ // DO NOT clear out internal variables to release memory
+ // This delegate may be pointed-to by other objrefs.
+ }
+
+ // obj._get_delegate() == this due to the argument passing conventions in
+ // portable.ObjectImpl, so we just ignore obj here.
+ public boolean is_equivalent(org.omg.CORBA.Object obj,
+ org.omg.CORBA.Object ref)
+ {
+ if ( ref == null )
+ return false;
+
+ // If ref is a local object, it is not a Stub!
+ if (!StubAdapter.isStub(ref))
+ return false ;
+
+ Delegate del = StubAdapter.getDelegate(ref) ;
+ if (del == null)
+ return false ;
+
+ // Optimize the x.is_equivalent( x ) case
+ if (del == this)
+ return true;
+
+ // If delegate was created by a different ORB, return false
+ if (!(del instanceof CorbaClientDelegateImpl))
+ return false ;
+
+ CorbaClientDelegateImpl corbaDelegate = (CorbaClientDelegateImpl)del ;
+ CorbaContactInfoList ccil =
+ (CorbaContactInfoList)corbaDelegate.getContactInfoList() ;
+ return this.contactInfoList.getTargetIOR().isEquivalent(
+ ccil.getTargetIOR() );
+ }
+
+ /**
+ * This method overrides the org.omg.CORBA.portable.Delegate.equals method,
+ * and does the equality check based on IOR equality.
+ */
+ public boolean equals(org.omg.CORBA.Object self, java.lang.Object other)
+ {
+ if (other == null)
+ return false ;
+
+ if (!StubAdapter.isStub(other)) {
+ return false;
+ }
+
+ Delegate delegate = StubAdapter.getDelegate( other ) ;
+ if (delegate == null)
+ return false ;
+
+ if (delegate instanceof CorbaClientDelegateImpl) {
+ CorbaClientDelegateImpl otherDel = (CorbaClientDelegateImpl)
+ delegate ;
+ IOR otherIor = otherDel.contactInfoList.getTargetIOR();
+ return this.contactInfoList.getTargetIOR().equals(otherIor);
+ }
+
+ // Come here if other is not implemented by our ORB.
+ return false;
+ }
+
+ public int hashCode(org.omg.CORBA.Object obj)
+ {
+ return this.hashCode() ;
+ }
+
+ public int hash(org.omg.CORBA.Object obj, int maximum)
+ {
+ int h = this.hashCode();
+ 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);
+ }
+
+ 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).
+ *
+ * @param self The object reference which delegated to this delegate.
+ * @return true only if the servant incarnating this object is located in
+ * this ORB.
+ */
+ public boolean is_local(org.omg.CORBA.Object self)
+ {
+ // XXX this need to check isNextCallValid
+ return contactInfoList.getEffectiveTargetIOR().getProfile().
+ isLocal();
+ }
+
+ public ServantObject servant_preinvoke(org.omg.CORBA.Object self,
+ String operation,
+ Class expectedType)
+ {
+ return
+ contactInfoList.getLocalClientRequestDispatcher()
+ .servant_preinvoke(self, operation, expectedType);
+ }
+
+ public void servant_postinvoke(org.omg.CORBA.Object self,
+ ServantObject servant)
+ {
+ contactInfoList.getLocalClientRequestDispatcher()
+ .servant_postinvoke(self, servant);
+ }
+
+ // XXX Should this be public?
+ /* 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.
+ */
+ public String get_codebase(org.omg.CORBA.Object self)
+ {
+ if (contactInfoList.getTargetIOR() != null) {
+ return contactInfoList.getTargetIOR().getProfile().getCodebase();
+ }
+ return null;
+ }
+
+ public String toString(org.omg.CORBA.Object self)
+ {
+ return contactInfoList.getTargetIOR().stringify();
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // java.lang.Object
+ //
+
+ public int hashCode()
+ {
+ return this.contactInfoList.hashCode();
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java
new file mode 100644
index 0000000..5c669dd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaClientRequestDispatcherImpl.java
@@ -0,0 +1,1053 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.rmi.RemoteException;
+
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ServantObject;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.IOP.ExceptionDetailMessage;
+import org.omg.IOP.TAG_CODE_SETS;
+
+import com.sun.org.omg.SendingContext.CodeBase;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.OutboundConnectionCache;
+import com.sun.corba.se.pept.transport.ContactInfo;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate;
+import com.sun.corba.se.spi.ior.iiop.CodeSetsComponent;
+import com.sun.corba.se.spi.oa.OAInvocationInfo;
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersion;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
+import com.sun.corba.se.spi.transport.CorbaContactInfo ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator ;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext;
+import com.sun.corba.se.spi.servicecontext.ServiceContext;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext;
+import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext;
+import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext;
+import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext;
+import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext;
+import com.sun.corba.se.spi.servicecontext.UnknownServiceContext;
+
+import com.sun.corba.se.impl.encoding.CDRInputObject;
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.EncapsInputStream;
+import com.sun.corba.se.impl.encoding.MarshalOutputStream;
+import com.sun.corba.se.impl.encoding.MarshalInputStream;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr;
+import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
+import com.sun.corba.se.impl.util.JDKBridge;
+
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+import sun.corba.EncapsInputStreamFactory;
+
+/**
+ * ClientDelegate is the RMI client-side subcontract or representation
+ * It implements RMI delegate as well as our internal ClientRequestDispatcher
+ * interface.
+ */
+public class CorbaClientRequestDispatcherImpl
+ implements
+ ClientRequestDispatcher
+{
+ private ConcurrentMap<ContactInfo, Object> locks =
+ new ConcurrentHashMap<ContactInfo, Object>();
+
+ public OutputObject beginRequest(Object self, String opName,
+ boolean isOneWay, ContactInfo contactInfo)
+ {
+ ORB orb = null;
+ try {
+ CorbaContactInfo corbaContactInfo = (CorbaContactInfo) contactInfo;
+ orb = (ORB)contactInfo.getBroker();
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".beginRequest->: op/" + opName);
+ }
+
+ //
+ // Portable Interceptor initialization.
+ //
+
+ orb.getPIHandler().initiateClientPIRequest( false );
+
+ //
+ // Connection.
+ //
+
+ CorbaConnection connection = null;
+
+ // This locking is done so that multiple connections are not created
+ // for the same endpoint
+ // 7046238 - Synchronization on a single monitor for contactInfo parameters
+ // with identical hashCode(), so we lock on same monitor for equal parameters
+ // (which can refer to equal (in terms of equals()) but not the same objects)
+
+ Object lock = locks.get(contactInfo);
+
+ if (lock == null) {
+ Object newLock = new Object();
+ lock = locks.putIfAbsent(contactInfo, newLock);
+ if (lock == null) {
+ lock = newLock;
+ }
+ }
+
+ synchronized (lock) {
+ if (contactInfo.isConnectionBased()) {
+ if (contactInfo.shouldCacheConnection()) {
+ connection = (CorbaConnection)
+ orb.getTransportManager()
+ .getOutboundConnectionCache(contactInfo).get(contactInfo);
+ }
+ if (connection != null) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".beginRequest: op/" + opName
+ + ": Using cached connection: " + connection);
+ }
+ } else {
+ try {
+ connection = (CorbaConnection)
+ contactInfo.createConnection();
+ if (orb.subcontractDebugFlag) {
+ dprint(".beginRequest: op/" + opName
+ + ": Using created connection: " + connection);
+ }
+ } catch (RuntimeException e) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".beginRequest: op/" + opName
+ + ": failed to create connection: " + e);
+ }
+ // REVISIT: this part similar to marshalingComplete below.
+ boolean retry = getContactInfoListIterator(orb)
+ .reportException(contactInfo, e);
+ // REVISIT:
+ // this part similar to Remarshal in this method below
+ if (retry) {
+ if(getContactInfoListIterator(orb).hasNext()) {
+ contactInfo = (ContactInfo)
+ getContactInfoListIterator(orb).next();
+ unregisterWaiter(orb);
+ return beginRequest(self, opName,
+ isOneWay, contactInfo);
+ } else {
+ throw e;
+ }
+ } else {
+ throw e;
+ }
+ }
+ if (connection.shouldRegisterReadEvent()) {
+ // REVISIT: cast
+ orb.getTransportManager().getSelector(0)
+ .registerForEvent(connection.getEventHandler());
+ connection.setState("ESTABLISHED");
+ }
+ // 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);
+ connectionCache.stampTime(connection);
+ connectionCache.put(contactInfo, connection);
+ // connectionCache.reclaim();
+ }
+ }
+ }
+ }
+
+ CorbaMessageMediator messageMediator = (CorbaMessageMediator)
+ contactInfo.createMessageMediator(
+ orb, contactInfo, connection, opName, isOneWay);
+ if (orb.subcontractDebugFlag) {
+ dprint(".beginRequest: " + opAndId(messageMediator)
+ + ": created message mediator: " + messageMediator);
+ }
+
+ // NOTE: Thread data so we can get the mediator in release reply
+ // in order to remove the waiter in CorbaConnection.
+ // We cannot depend on obtaining information in releaseReply
+ // via its InputStream argument since, on certain errors
+ // (e.g., client marshaling errors), the stream may be null.
+ // Likewise for releaseReply "self".
+ // NOTE: This must be done before initializing the message since
+ // that may start sending fragments which may end up in "early"
+ // replies or client marshaling exceptions.
+
+ orb.getInvocationInfo().setMessageMediator(messageMediator);
+
+ if (connection != null && connection.getCodeSetContext() == null) {
+ performCodeSetNegotiation(messageMediator);
+ }
+
+ addServiceContexts(messageMediator);
+
+ OutputObject outputObject =
+ contactInfo.createOutputObject(messageMediator);
+ if (orb.subcontractDebugFlag) {
+ dprint(".beginRequest: " + opAndId(messageMediator)
+ + ": created output object: " + outputObject);
+ }
+
+
+ // NOTE: Not necessary for oneways, but useful for debugging.
+ // This must be done BEFORE message initialization since fragments
+ // may be sent at that time.
+ registerWaiter(messageMediator);
+
+ // Do connection reclaim now
+ synchronized (lock) {
+ if (contactInfo.isConnectionBased()) {
+ if (contactInfo.shouldCacheConnection()) {
+ OutboundConnectionCache connectionCache =
+ orb.getTransportManager()
+ .getOutboundConnectionCache(contactInfo);
+ connectionCache.reclaim();
+ }
+ }
+ }
+
+ orb.getPIHandler().setClientPIInfo(messageMediator);
+ try {
+ // This MUST come before message is initialized so
+ // service contexts may be added by PI because
+ // initial fragments may be sent during message initialization.
+ orb.getPIHandler().invokeClientPIStartingPoint();
+ } catch( RemarshalException e ) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".beginRequest: " + opAndId(messageMediator)
+ + ": Remarshal");
+ }
+
+ // NOTE: We get here because an interceptor raised ForwardRequest
+ // 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
+ // client code.
+
+ // REVISIT:
+ // This assumes that interceptors update
+ // ContactInfoList outside of subcontract.
+ // Want to move that update to here.
+ if (getContactInfoListIterator(orb).hasNext()) {
+ contactInfo = (ContactInfo)getContactInfoListIterator(orb).next();
+ if (orb.subcontractDebugFlag) {
+ dprint( "RemarshalException: hasNext true\ncontact info " + contactInfo );
+ }
+
+ // Fix for 6763340: Complete the first attempt before starting another.
+ orb.getPIHandler().makeCompletedClientRequest(
+ ReplyMessage.LOCATION_FORWARD, null ) ;
+ unregisterWaiter(orb);
+ orb.getPIHandler().cleanupClientPIRequest() ;
+
+ return beginRequest(self, opName, isOneWay, contactInfo);
+ } else {
+ if (orb.subcontractDebugFlag) {
+ dprint( "RemarshalException: hasNext false" );
+ }
+ ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get(orb,
+ CORBALogDomains.RPC_PROTOCOL);
+ throw wrapper.remarshalWithNowhereToGo();
+ }
+ }
+
+ messageMediator.initializeMessage();
+ if (orb.subcontractDebugFlag) {
+ dprint(".beginRequest: " + opAndId(messageMediator)
+ + ": initialized message");
+ }
+
+ return outputObject;
+
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".beginRequest<-: op/" + opName);
+ }
+ }
+ }
+
+ public InputObject marshalingComplete(java.lang.Object self,
+ OutputObject outputObject)
+ throws
+ ApplicationException,
+ org.omg.CORBA.portable.RemarshalException
+ {
+ ORB orb = null;
+ CorbaMessageMediator messageMediator = null;
+ try {
+ messageMediator = (CorbaMessageMediator)
+ outputObject.getMessageMediator();
+
+ orb = (ORB) messageMediator.getBroker();
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".marshalingComplete->: " + opAndId(messageMediator));
+ }
+
+ InputObject inputObject =
+ marshalingComplete1(orb, messageMediator);
+
+ return processResponse(orb, messageMediator, inputObject);
+
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".marshalingComplete<-: " + opAndId(messageMediator));
+ }
+ }
+ }
+
+ public InputObject marshalingComplete1(
+ ORB orb, CorbaMessageMediator messageMediator)
+ throws
+ ApplicationException,
+ org.omg.CORBA.portable.RemarshalException
+ {
+ try {
+ messageMediator.finishSendingRequest();
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".marshalingComplete: " + opAndId(messageMediator)
+ + ": finished sending request");
+ }
+
+ return messageMediator.waitForResponse();
+
+ } catch (RuntimeException e) {
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".marshalingComplete: " + opAndId(messageMediator)
+ + ": exception: " + e.toString());
+ }
+
+ 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);
+
+ if (retry) {
+ if (newException == e) {
+ continueOrThrowSystemOrRemarshal(messageMediator,
+ new RemarshalException());
+ } else {
+ continueOrThrowSystemOrRemarshal(messageMediator,
+ newException);
+ }
+ } else {
+ if (newException instanceof RuntimeException){
+ throw (RuntimeException)newException;
+ }
+ else if (newException instanceof RemarshalException)
+ {
+ throw (RemarshalException)newException;
+ }
+
+ // NOTE: Interceptor ending point will run in releaseReply.
+ throw e;
+ }
+ return null; // for compiler
+ }
+ }
+
+ protected InputObject processResponse(ORB orb,
+ CorbaMessageMediator messageMediator,
+ InputObject inputObject)
+ throws
+ ApplicationException,
+ org.omg.CORBA.portable.RemarshalException
+ {
+ ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".processResponse: " + opAndId(messageMediator)
+ + ": response received");
+ }
+
+ // We know for sure now that we've sent a message.
+ // So OK to not send initial again.
+ if (messageMediator.getConnection() != null) {
+ ((CorbaConnection)messageMediator.getConnection())
+ .setPostInitialContexts();
+ }
+
+ // NOTE: not necessary to set MessageMediator for PI.
+ // It already has it.
+
+ // Process the response.
+
+ Exception exception = null;
+
+ if (messageMediator.isOneWay()) {
+ getContactInfoListIterator(orb)
+ .reportSuccess(messageMediator.getContactInfo());
+ // Invoke Portable Interceptors with receive_other
+ exception = orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.NO_EXCEPTION, exception );
+ continueOrThrowSystemOrRemarshal(messageMediator, exception);
+ return null;
+ }
+
+ consumeServiceContexts(orb, messageMediator);
+
+ // Now that we have the service contexts processed and the
+ // correct ORBVersion set, we must finish initializing the stream.
+ // REVISIT - need interface for this operation.
+ ((CDRInputObject)inputObject).performORBVersionSpecificInit();
+
+ if (messageMediator.isSystemExceptionReply()) {
+
+ SystemException se = messageMediator.getSystemExceptionReply();
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".processResponse: " + opAndId(messageMediator)
+ + ": received system exception: " + se);
+ }
+
+ boolean doRemarshal =
+ getContactInfoListIterator(orb)
+ .reportException(messageMediator.getContactInfo(), se);
+
+ if (doRemarshal) {
+
+ // Invoke Portable Interceptors with receive_exception:
+ exception = orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.SYSTEM_EXCEPTION, se );
+
+ // If PI did not change the exception, throw a
+ // Remarshal.
+ if( se == exception ) {
+ // exception = null is to maintain symmetry with
+ // GenericPOAClientSC.
+ exception = null;
+ continueOrThrowSystemOrRemarshal(messageMediator,
+ new RemarshalException());
+ throw wrapper.statementNotReachable1() ;
+ } else {
+ // Otherwise, throw the exception PI wants thrown.
+ continueOrThrowSystemOrRemarshal(messageMediator,
+ exception);
+ throw wrapper.statementNotReachable2() ;
+ }
+ }
+
+ // No retry, so see if was unknown.
+
+ ServiceContexts contexts =
+ messageMediator.getReplyServiceContexts();
+ if (contexts != null) {
+ UEInfoServiceContext usc =
+ (UEInfoServiceContext)
+ contexts.get(UEInfoServiceContext.SERVICE_CONTEXT_ID);
+
+ if (usc != null) {
+ Throwable unknown = usc.getUE() ;
+ UnknownException ue = new UnknownException(unknown);
+
+ // Invoke Portable Interceptors with receive_exception:
+ exception = orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.SYSTEM_EXCEPTION, ue );
+
+ continueOrThrowSystemOrRemarshal(messageMediator, exception);
+ throw wrapper.statementNotReachable3() ;
+ }
+ }
+
+ // It was not a comm failure nor unknown.
+ // This is the general case.
+
+ // Invoke Portable Interceptors with receive_exception:
+ exception = orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.SYSTEM_EXCEPTION, se );
+
+ 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() ;
+ } else if (messageMediator.isUserExceptionReply()) {
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".processResponse: " + opAndId(messageMediator)
+ + ": received user exception");
+ }
+
+ getContactInfoListIterator(orb)
+ .reportSuccess(messageMediator.getContactInfo());
+
+ String exceptionRepoId = peekUserExceptionId(inputObject);
+ Exception newException = null;
+
+ if (messageMediator.isDIIRequest()) {
+ exception = messageMediator.unmarshalDIIUserException(
+ exceptionRepoId, (InputStream)inputObject);
+ newException = orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.USER_EXCEPTION, exception );
+ messageMediator.setDIIException(newException);
+
+ } else {
+ ApplicationException appException =
+ new ApplicationException(
+ exceptionRepoId,
+ (org.omg.CORBA.portable.InputStream)inputObject);
+ exception = appException;
+ newException = orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.USER_EXCEPTION, appException );
+ }
+
+ if (newException != exception) {
+ continueOrThrowSystemOrRemarshal(messageMediator,newException);
+ }
+
+ if (newException instanceof ApplicationException) {
+ throw (ApplicationException)newException;
+ }
+ // For DII:
+ // This return will be ignored - already unmarshaled above.
+ return inputObject;
+
+ } else if (messageMediator.isLocationForwardReply()) {
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".processResponse: " + opAndId(messageMediator)
+ + ": received location forward");
+ }
+
+ // NOTE: Expects iterator to update target IOR
+ getContactInfoListIterator(orb).reportRedirect(
+ (CorbaContactInfo)messageMediator.getContactInfo(),
+ messageMediator.getForwardedIOR());
+
+ // Invoke Portable Interceptors with receive_other:
+ Exception newException = orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.LOCATION_FORWARD, null );
+
+ 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 ) {
+ continueOrThrowSystemOrRemarshal(messageMediator, exception);
+ }
+ continueOrThrowSystemOrRemarshal(messageMediator,
+ new RemarshalException());
+ throw wrapper.statementNotReachable5() ;
+
+ } else if (messageMediator.isDifferentAddrDispositionRequestedReply()){
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".processResponse: " + opAndId(messageMediator)
+ + ": received different addressing dispostion request");
+ }
+
+ // Set the desired target addressing disposition.
+ getContactInfoListIterator(orb).reportAddrDispositionRetry(
+ (CorbaContactInfo)messageMediator.getContactInfo(),
+ messageMediator.getAddrDispositionReply());
+
+ // Invoke Portable Interceptors with receive_other:
+ Exception newException = orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.NEEDS_ADDRESSING_MODE, null);
+
+ // For consistency with corresponding code in GenericPOAClientSC:
+ 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 ) {
+ continueOrThrowSystemOrRemarshal(messageMediator, exception);
+ }
+ continueOrThrowSystemOrRemarshal(messageMediator,
+ new RemarshalException());
+ throw wrapper.statementNotReachable6() ;
+ } else /* normal response */ {
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".processResponse: " + opAndId(messageMediator)
+ + ": received normal response");
+ }
+
+ getContactInfoListIterator(orb)
+ .reportSuccess(messageMediator.getContactInfo());
+
+ messageMediator.handleDIIReply((InputStream)inputObject);
+
+ // Invoke Portable Interceptors with receive_reply:
+ exception = orb.getPIHandler().invokeClientPIEndingPoint(
+ ReplyMessage.NO_EXCEPTION, null );
+
+ // Remember: not thrown if exception is null.
+ continueOrThrowSystemOrRemarshal(messageMediator, exception);
+
+ return inputObject;
+ }
+ }
+
+ // 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
+ // 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
+ protected void continueOrThrowSystemOrRemarshal(
+ CorbaMessageMediator messageMediator, Exception exception)
+ throws
+ SystemException, RemarshalException
+ {
+
+ ORB orb = (ORB) messageMediator.getBroker();
+
+ if( exception == null ) {
+
+ // do nothing.
+
+ } 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
+ // the old request id would be lost and we would have a memory
+ // leak in the responseWaitingRoom.
+ unregisterWaiter(orb);
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".continueOrThrowSystemOrRemarshal: "
+ + opAndId(messageMediator)
+ + ": throwing Remarshal");
+ }
+
+ throw (RemarshalException)exception;
+
+ } else {
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".continueOrThrowSystemOrRemarshal: "
+ + opAndId(messageMediator)
+ + ": throwing sex:"
+ + exception);
+ }
+
+ throw (SystemException)exception;
+ }
+ }
+
+ protected CorbaContactInfoListIterator getContactInfoListIterator(ORB orb)
+ {
+ return (CorbaContactInfoListIterator)
+ ((CorbaInvocationInfo)orb.getInvocationInfo())
+ .getContactInfoListIterator();
+ }
+
+ protected void registerWaiter(CorbaMessageMediator messageMediator)
+ {
+ if (messageMediator.getConnection() != null) {
+ messageMediator.getConnection().registerWaiter(messageMediator);
+ }
+ }
+
+ protected void unregisterWaiter(ORB orb)
+ {
+ MessageMediator messageMediator =
+ orb.getInvocationInfo().getMessageMediator();
+ if (messageMediator!=null && messageMediator.getConnection() != null) {
+ // REVISIT:
+ // The messageMediator may be null if COMM_FAILURE before
+ // it is created.
+ messageMediator.getConnection().unregisterWaiter(messageMediator);
+ }
+ }
+
+ protected void addServiceContexts(CorbaMessageMediator messageMediator)
+ {
+ ORB orb = (ORB)messageMediator.getBroker();
+ CorbaConnection c = (CorbaConnection) messageMediator.getConnection();
+ GIOPVersion giopVersion = messageMediator.getGIOPVersion();
+
+ ServiceContexts 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,
+ // we could skip it since we now support version 2, but
+ // probably safer to always send it.
+ contexts.put(MaxStreamFormatVersionServiceContext.singleton);
+
+ // ORBVersion servicecontext needs to be sent
+ ORBVersionServiceContext ovsc = new ORBVersionServiceContext(
+ ORBVersionFactory.getORBVersion() ) ;
+ contexts.put( ovsc ) ;
+
+ // NOTE : We only want to send the runtime context the first time
+ if ((c != null) && !c.isPostInitialContexts()) {
+ // Do not do c.setPostInitialContexts() here.
+ // 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 =
+ new SendingContextServiceContext( orb.getFVDCodeBaseIOR() ) ; //d11638
+ contexts.put( scsc ) ;
+ }
+ }
+
+ protected void consumeServiceContexts(ORB orb,
+ CorbaMessageMediator messageMediator)
+ {
+ ServiceContexts ctxts = messageMediator.getReplyServiceContexts();
+ ServiceContext sc ;
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+
+ if (ctxts == null) {
+ return; // no service context available, return gracefully.
+ }
+
+ sc = ctxts.get( SendingContextServiceContext.SERVICE_CONTEXT_ID ) ;
+
+ if (sc != null) {
+ SendingContextServiceContext scsc =
+ (SendingContextServiceContext)sc ;
+ IOR ior = scsc.getIOR() ;
+
+ try {
+ // set the codebase returned by the server
+ if (messageMediator.getConnection() != null) {
+ ((CorbaConnection)messageMediator.getConnection()).setCodeBaseIOR(ior);
+ }
+ } catch (ThreadDeath td) {
+ throw td ;
+ } catch (Throwable 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 ) ;
+
+ if (sc != null) {
+ ORBVersionServiceContext ovsc =
+ (ORBVersionServiceContext) sc;
+
+ ORBVersion version = ovsc.getVersion();
+ orb.setORBVersion( version ) ;
+ }
+
+ getExceptionDetailMessage(messageMediator, wrapper);
+ }
+
+ protected void getExceptionDetailMessage(
+ CorbaMessageMediator messageMediator,
+ ORBUtilSystemException wrapper)
+ {
+ ServiceContext sc = messageMediator.getReplyServiceContexts()
+ .get(ExceptionDetailMessage.value);
+ if (sc == null)
+ return ;
+
+ if (! (sc instanceof UnknownServiceContext)) {
+ throw wrapper.badExceptionDetailMessageServiceContextType();
+ }
+ byte[] data = ((UnknownServiceContext)sc).getData();
+ EncapsInputStream in =
+ EncapsInputStreamFactory.newEncapsInputStream((ORB)messageMediator.getBroker(),
+ data, data.length);
+ in.consumeEndian();
+
+ String msg =
+ "----------BEGIN server-side stack trace----------\n"
+ + in.read_wstring() + "\n"
+ + "----------END server-side stack trace----------";
+
+ messageMediator.setReplyExceptionDetailMessage(msg);
+ }
+
+ public void endRequest(Broker broker, Object self, InputObject inputObject)
+ {
+ ORB orb = (ORB)broker ;
+
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".endRequest->");
+ }
+
+ // Note: the inputObject may be null if an error occurs
+ // in request or before _invoke returns.
+ // Note: self may be null also (e.g., compiler generates null in stub).
+
+ MessageMediator messageMediator =
+ orb.getInvocationInfo().getMessageMediator();
+ if (messageMediator != null)
+ {
+ if (messageMediator.getConnection() != null)
+ {
+ ((CorbaMessageMediator)messageMediator)
+ .sendCancelRequestIfFinalFragmentNotSent();
+ }
+
+ // Release any outstanding NIO ByteBuffers to the ByteBufferPool
+
+ InputObject inputObj = messageMediator.getInputObject();
+ if (inputObj != null) {
+ inputObj.close();
+ }
+
+ OutputObject outputObj = messageMediator.getOutputObject();
+ if (outputObj != null) {
+ outputObj.close();
+ }
+
+ }
+
+ // 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.
+
+ // 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
+ // noops.
+ unregisterWaiter(orb);
+
+ // 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) {
+ // See CDRInput/OutputObject.close() for more info.
+ // This won't result in a Corba error if an IOException happens.
+ if (orb.subcontractDebugFlag)
+ {
+ dprint(".endRequest: ignoring IOException - " + ex.toString());
+ }
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".endRequest<-");
+ }
+ }
+ }
+
+
+ protected void performCodeSetNegotiation(CorbaMessageMediator messageMediator)
+ {
+ CorbaConnection conn =
+ (CorbaConnection) messageMediator.getConnection();
+ IOR ior =
+ ((CorbaContactInfo)messageMediator.getContactInfo())
+ .getEffectiveTargetIOR();
+ GIOPVersion giopVersion = messageMediator.getGIOPVersion();
+
+ // XXX This seems to be a broken double checked locking idiom: FIX IT!
+
+ // conn.getCodeSetContext() is null when no other requests have
+ // been made on this connection to trigger code set negotation.
+ if (conn != null &&
+ conn.getCodeSetContext() == null &&
+ !giopVersion.equals(GIOPVersion.V1_0)) {
+
+ synchronized(conn) {
+ // Double checking. Don't let any other
+ // threads use this connection until the
+ // code sets are straight.
+ if (conn.getCodeSetContext() != null)
+ return;
+
+ // 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();
+ Iterator iter = temp.iteratorById(TAG_CODE_SETS.value);
+ if (!iter.hasNext()) {
+ // 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;
+ }
+
+ // Get the native and conversion code sets the
+ // server specified in its IOR
+ 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);
+
+ conn.setCodeSetContext(result);
+ }
+ }
+ }
+
+ protected void addCodeSetServiceContext(CorbaConnection conn,
+ ServiceContexts ctxs,
+ GIOPVersion giopVersion) {
+
+ // 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:
+ //
+ // 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
+ // 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
+ // encapsulation streams.
+ //
+ // Also, there will be no negotiation or service context
+ // 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()) {
+
+ // 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
+ // ISO8859-1 for char and makes wchar/wstring illegal.
+ if (codeSetCtx == null)
+ return;
+
+ CodeSetServiceContext cssc = new CodeSetServiceContext(codeSetCtx);
+ ctxs.put(cssc);
+ }
+
+ protected String peekUserExceptionId(InputObject inputObject)
+ {
+ CDRInputObject cdrInputObject = (CDRInputObject) inputObject;
+ // REVISIT - need interface for mark/reset
+ cdrInputObject.mark(Integer.MAX_VALUE);
+ String result = cdrInputObject.read_string();
+ cdrInputObject.reset();
+ return result;
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("CorbaClientRequestDispatcherImpl", msg);
+ }
+
+ protected String opAndId(CorbaMessageMediator mediator)
+ {
+ return ORBUtility.operationNameAndRequestId(mediator);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaInvocationInfo.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaInvocationInfo.java
new file mode 100644
index 0000000..7304706
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaInvocationInfo.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import java.util.Iterator;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.pept.protocol.ClientInvocationInfo;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
+
+/**
+ * @author Harold Carr
+ */
+public class CorbaInvocationInfo implements ClientInvocationInfo
+{
+ // REVISIT - these needs to be an interface-based impl.
+
+ private boolean isRetryInvocation;
+ private int entryCount;
+ private ORB orb;
+ private Iterator contactInfoListIterator;
+ private ClientRequestDispatcher clientRequestDispatcher;
+ private MessageMediator messageMediator;
+
+ private CorbaInvocationInfo()
+ {
+ }
+
+ public CorbaInvocationInfo(ORB orb)
+ {
+ this.orb = orb;
+ isRetryInvocation = false;
+ entryCount = 0;
+ }
+
+ public Iterator getContactInfoListIterator()
+ {
+ return contactInfoListIterator;
+ }
+
+ public void setContactInfoListIterator(Iterator contactInfoListIterator)
+ {
+ this.contactInfoListIterator = contactInfoListIterator;
+ }
+
+ public boolean isRetryInvocation()
+ {
+ return isRetryInvocation;
+ }
+
+ public void setIsRetryInvocation(boolean isRetryInvocation)
+ {
+ this.isRetryInvocation = isRetryInvocation;
+ }
+
+ public int getEntryCount()
+ {
+ return entryCount;
+ }
+
+ public void incrementEntryCount()
+ {
+ entryCount++;
+ }
+
+ public void decrementEntryCount()
+ {
+ entryCount--;
+ }
+
+ public void setClientRequestDispatcher(ClientRequestDispatcher clientRequestDispatcher)
+ {
+ this.clientRequestDispatcher = clientRequestDispatcher;
+ }
+
+ public ClientRequestDispatcher getClientRequestDispatcher()
+ {
+ return clientRequestDispatcher;
+ }
+
+ public void setMessageMediator(MessageMediator messageMediator)
+ {
+ this.messageMediator = messageMediator;
+ }
+
+ public MessageMediator getMessageMediator()
+ {
+ return messageMediator;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java
new file mode 100644
index 0000000..9badc18
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaMessageMediatorImpl.java
@@ -0,0 +1,2370 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.nio.ByteBuffer;
+import java.nio.channels.SelectionKey;
+import java.util.EmptyStackException;
+import java.util.Iterator;
+
+import org.omg.CORBA.Any;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.UnknownUserException;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import org.omg.IOP.ExceptionDetailMessage;
+import org.omg.IOP.TAG_RMI_CUSTOM_MAX_STREAM_FORMAT;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.protocol.ProtocolHandler;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.EventHandler;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.ObjectKey;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile;
+import com.sun.corba.se.spi.ior.iiop.MaxStreamFormatVersionComponent;
+import com.sun.corba.se.spi.oa.OAInvocationInfo;
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.protocol.CorbaProtocolHandler;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher;
+import com.sun.corba.se.spi.protocol.ForwardException;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.transport.CorbaContactInfo;
+import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext;
+import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext;
+import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext;
+import com.sun.corba.se.spi.servicecontext.UnknownServiceContext;
+
+import com.sun.corba.se.impl.corba.RequestImpl;
+import com.sun.corba.se.impl.encoding.BufferManagerFactory;
+import com.sun.corba.se.impl.encoding.BufferManagerReadStream;
+import com.sun.corba.se.impl.encoding.CDRInputObject;
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.logging.InterceptorsSystemException;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.ior.iiop.JavaSerializationComponent;
+import com.sun.corba.se.impl.protocol.AddressingDispositionException;
+import com.sun.corba.se.impl.protocol.RequestCanceledException;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.AddressingDispositionHelper;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.CancelRequestMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage_1_1;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.FragmentMessage_1_2;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateRequestMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateRequestMessage_1_0;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateRequestMessage_1_1;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateRequestMessage_1_2;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyOrReplyMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyMessage_1_0;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyMessage_1_1;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyMessage_1_2;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageHandler;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_0;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_1;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_2;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage_1_0 ;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage_1_1 ;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage_1_2 ;
+
+// REVISIT: make sure no memory leaks in client/server request/reply maps.
+// REVISIT: normalize requestHeader, replyHeader, messageHeader.
+
+/**
+ * @author Harold Carr
+ */
+public class CorbaMessageMediatorImpl
+ implements
+ CorbaMessageMediator,
+ CorbaProtocolHandler,
+ MessageHandler
+{
+ protected ORB orb;
+ protected ORBUtilSystemException wrapper ;
+ protected InterceptorsSystemException interceptorWrapper ;
+ protected CorbaContactInfo contactInfo;
+ protected CorbaConnection connection;
+ protected short addrDisposition;
+ protected CDROutputObject outputObject;
+ protected CDRInputObject inputObject;
+ protected Message messageHeader;
+ protected RequestMessage requestHeader;
+ protected LocateReplyOrReplyMessage replyHeader;
+ protected String replyExceptionDetailMessage;
+ protected IOR replyIOR;
+ protected Integer requestIdInteger;
+ protected Message dispatchHeader;
+ protected ByteBuffer dispatchByteBuffer;
+ protected byte streamFormatVersion;
+ protected boolean streamFormatVersionSet = false;
+
+ protected org.omg.CORBA.Request diiRequest;
+
+ protected boolean cancelRequestAlreadySent = false;
+
+ protected ProtocolHandler protocolHandler;
+ protected boolean _executeReturnServantInResponseConstructor = false;
+ protected boolean _executeRemoveThreadInfoInResponseConstructor = false;
+ protected boolean _executePIInResponseConstructor = false;
+
+ //
+ // Client-side constructor.
+ //
+
+ public CorbaMessageMediatorImpl(ORB orb,
+ ContactInfo contactInfo,
+ Connection connection,
+ GIOPVersion giopVersion,
+ IOR ior,
+ int requestId,
+ short addrDisposition,
+ String operationName,
+ boolean isOneWay)
+ {
+ this( orb, connection ) ;
+
+ this.contactInfo = (CorbaContactInfo) contactInfo;
+ this.addrDisposition = addrDisposition;
+
+ streamFormatVersion =
+ getStreamFormatVersionForThisRequest(
+ ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
+ giopVersion);
+ streamFormatVersionSet = true;
+
+ requestHeader = (RequestMessage) MessageBase.createRequest(
+ this.orb,
+ giopVersion,
+ ORBUtility.getEncodingVersion(orb, ior),
+ requestId,
+ !isOneWay,
+ ((CorbaContactInfo)this.contactInfo).getEffectiveTargetIOR(),
+ this.addrDisposition,
+ operationName,
+ new ServiceContexts(orb),
+ null);
+ }
+
+ //
+ // Acceptor constructor.
+ //
+
+ public CorbaMessageMediatorImpl(ORB orb,
+ Connection connection)
+ {
+ this.orb = orb;
+ this.connection = (CorbaConnection)connection;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ this.interceptorWrapper = InterceptorsSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ //
+ // 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 CorbaMessageMediatorImpl(ORB orb,
+ CorbaConnection connection,
+ Message dispatchHeader,
+ ByteBuffer byteBuffer)
+ {
+ this( orb, connection ) ;
+ this.dispatchHeader = dispatchHeader;
+ this.dispatchByteBuffer = byteBuffer;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // MessageMediator
+ //
+
+ public Broker getBroker()
+ {
+ return orb;
+ }
+
+ public ContactInfo getContactInfo()
+ {
+ return contactInfo;
+ }
+
+ public Connection getConnection()
+ {
+ return connection;
+ }
+
+ public void initializeMessage()
+ {
+ getRequestHeader().write(outputObject);
+ }
+
+ public void finishSendingRequest()
+ {
+ // REVISIT: probably move logic in outputObject to here.
+ outputObject.finishSendingMessage();
+ }
+
+ public InputObject waitForResponse()
+ {
+ if (getRequestHeader().isResponseExpected()) {
+ return connection.waitForResponse(this);
+ }
+ return null;
+ }
+
+ public void setOutputObject(OutputObject outputObject)
+ {
+ this.outputObject = (CDROutputObject) outputObject;
+ }
+
+ public OutputObject getOutputObject()
+ {
+ return outputObject;
+ }
+
+ public void setInputObject(InputObject inputObject)
+ {
+ this.inputObject = (CDRInputObject) inputObject;
+ }
+
+ public InputObject getInputObject()
+ {
+ return inputObject;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // CorbaMessageMediator
+ //
+
+ public void setReplyHeader(LocateReplyOrReplyMessage header)
+ {
+ this.replyHeader = header;
+ this.replyIOR = header.getIOR(); // REVISIT - need separate field?
+ }
+
+ public LocateReplyMessage getLocateReplyHeader()
+ {
+ return (LocateReplyMessage) replyHeader;
+ }
+
+ public ReplyMessage getReplyHeader()
+ {
+ return (ReplyMessage) replyHeader;
+ }
+
+ public void setReplyExceptionDetailMessage(String message)
+ {
+ replyExceptionDetailMessage = message;
+ }
+
+ public RequestMessage getRequestHeader()
+ {
+ return requestHeader;
+ }
+
+ public GIOPVersion getGIOPVersion()
+ {
+ if (messageHeader != null) {
+ return messageHeader.getGIOPVersion();
+ }
+ return getRequestHeader().getGIOPVersion();
+ }
+
+ public byte getEncodingVersion() {
+ if (messageHeader != null) {
+ return messageHeader.getEncodingVersion();
+ }
+ return getRequestHeader().getEncodingVersion();
+ }
+
+ public int getRequestId()
+ {
+ return getRequestHeader().getRequestId();
+ }
+
+ public Integer getRequestIdInteger()
+ {
+ if (requestIdInteger == null) {
+ requestIdInteger = new Integer(getRequestHeader().getRequestId());
+ }
+ return requestIdInteger;
+ }
+
+ public boolean isOneWay()
+ {
+ return ! getRequestHeader().isResponseExpected();
+ }
+
+ public short getAddrDisposition()
+ {
+ return addrDisposition;
+ }
+
+ public String getOperationName()
+ {
+ return getRequestHeader().getOperation();
+ }
+
+ public ServiceContexts getRequestServiceContexts()
+ {
+ return getRequestHeader().getServiceContexts();
+ }
+
+ public ServiceContexts getReplyServiceContexts()
+ {
+ return getReplyHeader().getServiceContexts();
+ }
+
+ public void sendCancelRequestIfFinalFragmentNotSent()
+ {
+ if ((!sentFullMessage()) && sentFragment() &&
+ (!cancelRequestAlreadySent))
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".sendCancelRequestIfFinalFragmentNotSent->: "
+ + opAndId(this));
+ }
+ 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 (IOException e) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".sendCancelRequestIfFinalFragmentNotSent: !ERROR : " + opAndId(this),
+ e);
+ }
+
+ // REVISIT: we could attempt to send a final incomplete
+ // fragment in this case.
+ throw interceptorWrapper.ioexceptionDuringCancelRequest(
+ CompletionStatus.COMPLETED_MAYBE, e );
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".sendCancelRequestIfFinalFragmentNotSent<-: "
+ + opAndId(this));
+ }
+ }
+ }
+ }
+
+ public boolean sentFullMessage()
+ {
+ return outputObject.getBufferManager().sentFullMessage();
+ }
+
+ public boolean sentFragment()
+ {
+ return outputObject.getBufferManager().sentFragment();
+ }
+
+ public void setDIIInfo(org.omg.CORBA.Request diiRequest)
+ {
+ this.diiRequest = diiRequest;
+ }
+
+ public boolean isDIIRequest()
+ {
+ return diiRequest != null;
+ }
+
+ public Exception unmarshalDIIUserException(String repoId, InputStream is)
+ {
+ if (! isDIIRequest()) {
+ return null;
+ }
+
+ ExceptionList _exceptions = diiRequest.exceptions();
+
+ try {
+ // Find the typecode for the exception
+ for (int i=0; i<_exceptions.count() ; i++) {
+ TypeCode tc = _exceptions.item(i);
+ 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
+ // environment.
+ Any eany = orb.create_any();
+ eany.read_value(is, (TypeCode)tc);
+
+ return new UnknownUserException(eany);
+ }
+ }
+ } catch (Exception b) {
+ throw wrapper.unexpectedDiiException(b);
+ }
+
+ // must be a truly unknown exception
+ return wrapper.unknownCorbaExc( CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ public void setDIIException(Exception exception)
+ {
+ diiRequest.env().exception(exception);
+ }
+
+ public void handleDIIReply(InputStream inputStream)
+ {
+ if (! isDIIRequest()) {
+ return;
+ }
+ ((RequestImpl)diiRequest).unmarshalReply(inputStream);
+ }
+
+ public Message getDispatchHeader()
+ {
+ return dispatchHeader;
+ }
+
+ public void setDispatchHeader(Message msg)
+ {
+ dispatchHeader = msg;
+ }
+
+ public ByteBuffer getDispatchBuffer()
+ {
+ return dispatchByteBuffer;
+ }
+
+ public void setDispatchBuffer(ByteBuffer byteBuffer)
+ {
+ dispatchByteBuffer = byteBuffer;
+ }
+
+ public int getThreadPoolToUse() {
+ int poolToUse = 0;
+ Message msg = getDispatchHeader();
+ // A null msg should never happen. But, we'll be
+ // defensive just in case.
+ if (msg != null) {
+ poolToUse = msg.getThreadPoolToUse();
+ }
+ return poolToUse;
+ }
+
+ public byte getStreamFormatVersion()
+ {
+ // REVISIT: ContactInfo/Acceptor output object factories
+ // just use this. Maybe need to distinguish:
+ // createOutputObjectForRequest
+ // createOutputObjectForReply
+ // then do getStreamFormatVersionForRequest/ForReply here.
+ if (streamFormatVersionSet) {
+ return streamFormatVersion;
+ }
+ return getStreamFormatVersionForReply();
+ }
+
+ /**
+ * 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.
+ */
+ public byte getStreamFormatVersionForReply() {
+
+ // NOTE: The request service contexts may indicate the max.
+ ServiceContexts svc = getRequestServiceContexts();
+
+ MaxStreamFormatVersionServiceContext msfvsc
+ = (MaxStreamFormatVersionServiceContext)svc.get(
+ MaxStreamFormatVersionServiceContext.SERVICE_CONTEXT_ID);
+
+ if (msfvsc != null) {
+ byte localMaxVersion = ORBUtility.getMaxStreamFormatVersion();
+ byte remoteMaxVersion = msfvsc.getMaximumStreamFormatVersion();
+
+ return (byte)Math.min(localMaxVersion, remoteMaxVersion);
+ } else {
+ // Defaults to 1 for GIOP 1.2 or less, 2 for
+ // GIOP 1.3 or higher.
+ if (getGIOPVersion().lessThan(GIOPVersion.V1_3))
+ return ORBConstants.STREAM_FORMAT_VERSION_1;
+ else
+ return ORBConstants.STREAM_FORMAT_VERSION_2;
+ }
+ }
+
+ public boolean isSystemExceptionReply()
+ {
+ return replyHeader.getReplyStatus() == ReplyMessage.SYSTEM_EXCEPTION;
+ }
+
+ public boolean isUserExceptionReply()
+ {
+ return replyHeader.getReplyStatus() == ReplyMessage.USER_EXCEPTION;
+ }
+
+ public boolean isLocationForwardReply()
+ {
+ 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();
+ }
+
+ public SystemException getSystemExceptionReply()
+ {
+ return replyHeader.getSystemException(replyExceptionDetailMessage);
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Used by server side.
+ //
+
+ public ObjectKey getObjectKey()
+ {
+ return getRequestHeader().getObjectKey();
+ }
+
+ public void setProtocolHandler(CorbaProtocolHandler protocolHandler)
+ {
+ throw wrapper.methodShouldNotBeCalled() ;
+ }
+
+ public CorbaProtocolHandler getProtocolHandler()
+ {
+ // REVISIT: should look up in orb registry.
+ return this;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // ResponseHandler
+ //
+
+ public org.omg.CORBA.portable.OutputStream createReply()
+ {
+ // Note: relies on side-effect of setting mediator output field.
+ // REVISIT - cast - need interface
+ getProtocolHandler().createResponse(this, (ServiceContexts) null);
+ return (OutputStream) getOutputObject();
+ }
+
+ public org.omg.CORBA.portable.OutputStream createExceptionReply()
+ {
+ // Note: relies on side-effect of setting mediator output field.
+ // REVISIT - cast - need interface
+ getProtocolHandler().createUserExceptionResponse(this, (ServiceContexts) null);
+ return (OutputStream) getOutputObject();
+ }
+
+ public boolean executeReturnServantInResponseConstructor()
+ {
+ return _executeReturnServantInResponseConstructor;
+
+ }
+
+ public void setExecuteReturnServantInResponseConstructor(boolean b)
+ {
+ _executeReturnServantInResponseConstructor = b;
+ }
+
+ public boolean executeRemoveThreadInfoInResponseConstructor()
+ {
+ return _executeRemoveThreadInfoInResponseConstructor;
+ }
+
+ public void setExecuteRemoveThreadInfoInResponseConstructor(boolean b)
+ {
+ _executeRemoveThreadInfoInResponseConstructor = b;
+ }
+
+ public boolean executePIInResponseConstructor()
+ {
+ return _executePIInResponseConstructor;
+ }
+
+ public void setExecutePIInResponseConstructor( boolean b )
+ {
+ _executePIInResponseConstructor = b;
+ }
+
+ private byte getStreamFormatVersionForThisRequest(IOR ior,
+ GIOPVersion giopVersion)
+ {
+
+ byte localMaxVersion
+ = ORBUtility.getMaxStreamFormatVersion();
+
+ IOR effectiveTargetIOR =
+ ((CorbaContactInfo)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
+ // component.
+ if (giopVersion.lessThan(GIOPVersion.V1_3))
+ return ORBConstants.STREAM_FORMAT_VERSION_1;
+ else
+ return ORBConstants.STREAM_FORMAT_VERSION_2;
+ }
+
+ byte remoteMaxVersion
+ = ((MaxStreamFormatVersionComponent)iter.next()).getMaxStreamFormatVersion();
+
+ return (byte)Math.min(localMaxVersion, remoteMaxVersion);
+ }
+
+ ////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+ ////////////////////////////////////////////////////////////////////////
+
+ // REVISIT - This could be a separate implementation object looked
+ // up in a registry. However it needs some state in the message
+ // mediator so combine for now.
+
+
+ protected boolean isThreadDone = false;
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.protocol.ProtocolHandler
+ //
+
+ public boolean handleRequest(MessageMediator messageMediator)
+ {
+ try {
+ dispatchHeader.callback(this);
+ } catch (IOException e) {
+ // REVISIT - this should be handled internally.
+ ;
+ }
+ return isThreadDone;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // iiop.messages.MessageHandler
+ //
+
+ private void setWorkThenPoolOrResumeSelect(Message header)
+ {
+ if (getConnection().getEventHandler().shouldUseSelectThreadToWait()) {
+ resumeSelect(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());
+ // Have another thread become the reader.
+ orb.getTransportManager().getSelector(0)
+ .registerForEvent(getConnection().getEventHandler());
+ }
+ }
+
+ private void setWorkThenReadOrResumeSelect(Message header)
+ {
+ if (getConnection().getEventHandler().shouldUseSelectThreadToWait()) {
+ resumeSelect(header);
+ } else {
+ // When using reader thread then wen this thread is
+ // done working it will continue reading.
+ isThreadDone = false;
+ }
+ }
+
+ private void resumeSelect(Message header)
+ {
+ // NOTE: VERY IMPORTANT:
+ // Only participate in select after getting to the point
+ // that proper serialization of fragments is ensured.
+
+ if (transportDebug()) {
+ dprint(".resumeSelect:->");
+ // REVISIT: not-OO:
+ String requestId = "?";
+ if (header instanceof RequestMessage) {
+ requestId =
+ new Integer(((RequestMessage)header)
+ .getRequestId()).toString();
+ } else if (header instanceof ReplyMessage) {
+ requestId =
+ new Integer(((ReplyMessage)header)
+ .getRequestId()).toString();
+ } else if (header instanceof FragmentMessage_1_2) {
+ requestId =
+ new Integer(((FragmentMessage_1_2)header)
+ .getRequestId()).toString();
+ }
+ dprint(".resumeSelect: id/"
+ + requestId
+ + " " + getConnection()
+ );
+
+ }
+
+ // IMPORTANT: To avoid bug (4953599), we force the Thread that does the NIO select
+ // to also do the enable/disable of Ops using SelectionKey.interestOps(Ops of Interest).
+ // Otherwise, the SelectionKey.interestOps(Ops of Interest) may block indefinitely in
+ // this thread.
+ EventHandler eventHandler = getConnection().getEventHandler();
+ orb.getTransportManager().getSelector(0).registerInterestOps(eventHandler);
+
+ if (transportDebug()) {
+ dprint(".resumeSelect:<-");
+ }
+ }
+
+ private void setInputObject()
+ {
+ // REVISIT: refactor createInputObject (and createMessageMediator)
+ // into base PlugInFactory. Get via connection (either ContactInfo
+ // or Acceptor).
+ if (getConnection().getContactInfo() != null) {
+ inputObject = (CDRInputObject)
+ getConnection().getContactInfo()
+ .createInputObject(orb, this);
+ } else if (getConnection().getAcceptor() != null) {
+ inputObject = (CDRInputObject)
+ getConnection().getAcceptor()
+ .createInputObject(orb, this);
+ } else {
+ throw new RuntimeException("CorbaMessageMediatorImpl.setInputObject");
+ }
+ inputObject.setMessageMediator(this);
+ setInputObject(inputObject);
+ }
+
+ 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)inputObject);
+ }
+
+ // This handles message types for which we don't create classes.
+ public void handleInput(Message header) throws IOException
+ {
+ try {
+ messageHeader = header;
+
+ if (transportDebug())
+ dprint(".handleInput->: "
+ + MessageBase.typeToString(header.getType()));
+
+ setWorkThenReadOrResumeSelect(header);
+
+ switch(header.getType())
+ {
+ case Message.GIOPCloseConnection:
+ if (transportDebug()) {
+ dprint(".handleInput: CloseConnection: purging");
+ }
+ connection.purgeCalls(wrapper.connectionRebind(), true, false);
+ break;
+ case Message.GIOPMessageError:
+ if (transportDebug()) {
+ dprint(".handleInput: MessageError: purging");
+ }
+ connection.purgeCalls(wrapper.recvMsgError(), true, false);
+ break;
+ default:
+ if (transportDebug()) {
+ dprint(".handleInput: ERROR: "
+ + MessageBase.typeToString(header.getType()));
+ }
+ throw wrapper.badGiopRequestType() ;
+ }
+ releaseByteBufferToPool();
+ } finally {
+ if (transportDebug()) {
+ dprint(".handleInput<-: "
+ + MessageBase.typeToString(header.getType()));
+ }
+ }
+ }
+
+ public void handleInput(RequestMessage_1_0 header) throws IOException
+ {
+ try {
+ if (transportDebug()) dprint(".REQUEST 1.0->: " + header);
+ try {
+ messageHeader = requestHeader = (RequestMessage) header;
+ setInputObject();
+ } finally {
+ setWorkThenPoolOrResumeSelect(header);
+ }
+ getProtocolHandler().handleRequest(header, this);
+ } catch (Throwable t) {
+ if (transportDebug())
+ dprint(".REQUEST 1.0: !!ERROR!!: " + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug()) dprint(".REQUEST 1.0<-: " + header);
+ }
+ }
+
+ public void handleInput(RequestMessage_1_1 header) throws IOException
+ {
+ try {
+ if (transportDebug()) dprint(".REQUEST 1.1->: " + header);
+ try {
+ messageHeader = requestHeader = (RequestMessage) header;
+ setInputObject();
+ connection.serverRequest_1_1_Put(this);
+ } finally {
+ setWorkThenPoolOrResumeSelect(header);
+ }
+ getProtocolHandler().handleRequest(header, this);
+ } catch (Throwable t) {
+ if (transportDebug())
+ dprint(".REQUEST 1.1: !!ERROR!!: " + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug()) dprint(".REQUEST 1.1<-: " + header);
+ }
+ }
+
+ // REVISIT: this is identical to 1_0 except for fragment part.
+ public void handleInput(RequestMessage_1_2 header) throws IOException
+ {
+ try {
+ try {
+
+ messageHeader = requestHeader = (RequestMessage) header;
+
+ header.unmarshalRequestID(dispatchByteBuffer);
+ setInputObject();
+
+ if (transportDebug()) dprint(".REQUEST 1.2->: id/"
+ + header.getRequestId()
+ + ": "
+ + header);
+
+ // NOTE: in the old code this used to be done conditionally:
+ // if (header.moreFragmentsToFollow()).
+ // Now we always put it in. We take it out when
+ // the response is done.
+ // This must happen now so if a header is fragmented the stream
+ // may be found.
+ connection.serverRequestMapPut(header.getRequestId(), this);
+ } finally {
+ // Leader/Follower.
+ // Note: This *MUST* come after putting stream in above map
+ // since the header may be fragmented and you do not want to
+ // start reading again until the map above is set.
+ setWorkThenPoolOrResumeSelect(header);
+ }
+ //inputObject.unmarshalHeader(); // done in subcontract.
+ getProtocolHandler().handleRequest(header, this);
+ } catch (Throwable t) {
+ if (transportDebug()) dprint(".REQUEST 1.2: id/"
+ + header.getRequestId()
+ + ": !!ERROR!!: "
+ + header,
+ t);
+ // Mask the exception from thread.;
+ } finally {
+ connection.serverRequestMapRemove(header.getRequestId());
+
+ if (transportDebug()) dprint(".REQUEST 1.2<-: id/"
+ + header.getRequestId()
+ + ": "
+ + header);
+ }
+ }
+
+ public void handleInput(ReplyMessage_1_0 header) throws IOException
+ {
+ try {
+ try {
+ if (transportDebug()) dprint(".REPLY 1.0->: " + header);
+ messageHeader = replyHeader = (ReplyMessage) header;
+ setInputObject();
+
+ // REVISIT: this should be done by waiting thread.
+ inputObject.unmarshalHeader();
+
+ signalResponseReceived();
+ } finally{
+ setWorkThenReadOrResumeSelect(header);
+ }
+ } catch (Throwable t) {
+ if (transportDebug())dprint(".REPLY 1.0: !!ERROR!!: " + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug()) dprint(".REPLY 1.0<-: " + header);
+ }
+ }
+
+ public void handleInput(ReplyMessage_1_1 header) throws IOException
+ {
+ try {
+ if (transportDebug()) dprint(".REPLY 1.1->: " + header);
+ messageHeader = replyHeader = (ReplyMessage) header;
+ setInputObject();
+
+ if (header.moreFragmentsToFollow()) {
+
+ // 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
+ // to be the reader while this thread unmarshals
+ // the extended header and wakes up the client thread.
+ setWorkThenPoolOrResumeSelect(header);
+
+ // REVISIT - error handling.
+ // This must be done now.
+ inputObject.unmarshalHeader();
+
+ signalResponseReceived();
+
+ } else {
+
+ // Not fragmented, therefore we know the request
+ // ID is here. Thus, we can unmarshal the extended header
+ // and wake up the client thread without using a third
+ // thread as above.
+
+ // REVISIT - error handling during unmarshal.
+ // This must be done now to get the request id.
+ inputObject.unmarshalHeader();
+
+ signalResponseReceived();
+
+ setWorkThenReadOrResumeSelect(header);
+ }
+ } catch (Throwable t) {
+ if (transportDebug()) dprint(".REPLY 1.1: !!ERROR!!: " + header);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug()) dprint(".REPLY 1.1<-: " + header);
+ }
+ }
+
+ public void handleInput(ReplyMessage_1_2 header) throws IOException
+ {
+ try {
+ try {
+ messageHeader = replyHeader = (ReplyMessage) header;
+
+ // We know that the request ID is in the first fragment
+ header.unmarshalRequestID(dispatchByteBuffer);
+
+ if (transportDebug()) {
+ dprint(".REPLY 1.2->: id/"
+ + + header.getRequestId()
+ + ": more?: " + header.moreFragmentsToFollow()
+ + ": " + header);
+ }
+
+ setInputObject();
+
+ signalResponseReceived();
+ } finally {
+ setWorkThenReadOrResumeSelect(header);
+ }
+ } catch (Throwable t) {
+ if (transportDebug()) dprint(".REPLY 1.2: id/"
+ + header.getRequestId()
+ + ": !!ERROR!!: "
+ + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug()) dprint(".REPLY 1.2<-: id/"
+ + header.getRequestId()
+ + ": "
+ + header);
+ }
+ }
+
+ public void handleInput(LocateRequestMessage_1_0 header) throws IOException
+ {
+ try {
+ if (transportDebug())
+ dprint(".LOCATE_REQUEST 1.0->: " + header);
+ try {
+ messageHeader = header;
+ setInputObject();
+ } finally {
+ setWorkThenPoolOrResumeSelect(header);
+ }
+ getProtocolHandler().handleRequest(header, this);
+ } catch (Throwable t) {
+ if (transportDebug())
+ dprint(".LOCATE_REQUEST 1.0: !!ERROR!!: " + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug())
+ dprint(".LOCATE_REQUEST 1.0<-: " + header);
+ }
+
+ }
+
+ public void handleInput(LocateRequestMessage_1_1 header) throws IOException
+ {
+ try {
+ if (transportDebug())
+ dprint(".LOCATE_REQUEST 1.1->: " + header);
+ try {
+ messageHeader = header;
+ setInputObject();
+ } finally {
+ setWorkThenPoolOrResumeSelect(header);
+ }
+ getProtocolHandler().handleRequest(header, this);
+ } catch (Throwable t) {
+ if (transportDebug())
+ dprint(".LOCATE_REQUEST 1.1: !!ERROR!!: " + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug())
+ dprint(".LOCATE_REQUEST 1.1<-:" + header);
+ }
+ }
+
+ public void handleInput(LocateRequestMessage_1_2 header) throws IOException
+ {
+ try {
+ try {
+ messageHeader = header;
+
+ header.unmarshalRequestID(dispatchByteBuffer);
+ setInputObject();
+
+ if (transportDebug())
+ dprint(".LOCATE_REQUEST 1.2->: id/"
+ + header.getRequestId()
+ + ": "
+ + header);
+
+ if (header.moreFragmentsToFollow()) {
+ connection.serverRequestMapPut(header.getRequestId(),this);
+ }
+ } finally {
+ setWorkThenPoolOrResumeSelect(header);
+ }
+ getProtocolHandler().handleRequest(header, this);
+ } catch (Throwable t) {
+ if (transportDebug())
+ dprint(".LOCATE_REQUEST 1.2: id/"
+ + header.getRequestId()
+ + ": !!ERROR!!: "
+ + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug())
+ dprint(".LOCATE_REQUEST 1.2<-: id/"
+ + header.getRequestId()
+ + ": "
+ + header);
+ }
+ }
+
+ public void handleInput(LocateReplyMessage_1_0 header) throws IOException
+ {
+ try {
+ if (transportDebug())
+ dprint(".LOCATE_REPLY 1.0->:" + header);
+ try {
+ messageHeader = header;
+ setInputObject();
+ inputObject.unmarshalHeader(); // REVISIT Put in subcontract.
+ signalResponseReceived();
+ } finally {
+ setWorkThenReadOrResumeSelect(header);
+ }
+ } catch (Throwable t) {
+ if (transportDebug())
+ dprint(".LOCATE_REPLY 1.0: !!ERROR!!: " + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug())
+ dprint(".LOCATE_REPLY 1.0<-: " + header);
+ }
+ }
+
+ public void handleInput(LocateReplyMessage_1_1 header) throws IOException
+ {
+ try {
+ if (transportDebug()) dprint(".LOCATE_REPLY 1.1->: " + header);
+ try {
+ messageHeader = header;
+ setInputObject();
+ // Fragmented LocateReplies are not allowed in 1.1.
+ inputObject.unmarshalHeader();
+ signalResponseReceived();
+ } finally {
+ setWorkThenReadOrResumeSelect(header);
+ }
+ } catch (Throwable t) {
+ if (transportDebug())
+ dprint(".LOCATE_REPLY 1.1: !!ERROR!!: " + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug()) dprint(".LOCATE_REPLY 1.1<-: " + header);
+ }
+ }
+
+ public void handleInput(LocateReplyMessage_1_2 header) throws IOException
+ {
+ try {
+ try {
+ messageHeader = header;
+
+ // No need to put in client reply map - already there.
+ header.unmarshalRequestID(dispatchByteBuffer);
+
+ setInputObject();
+
+ if (transportDebug()) dprint(".LOCATE_REPLY 1.2->: id/"
+ + header.getRequestId()
+ + ": "
+ + header);
+
+ signalResponseReceived();
+ } finally {
+ setWorkThenPoolOrResumeSelect(header); // REVISIT
+ }
+ } catch (Throwable t) {
+ if (transportDebug())
+ dprint(".LOCATE_REPLY 1.2: id/"
+ + header.getRequestId()
+ + ": !!ERROR!!: "
+ + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug()) dprint(".LOCATE_REPLY 1.2<-: id/"
+ + header.getRequestId()
+ + ": "
+ + header);
+ }
+ }
+
+ public void handleInput(FragmentMessage_1_1 header) throws IOException
+ {
+ try {
+ if (transportDebug()) {
+ dprint(".FRAGMENT 1.1->: "
+ + "more?: " + header.moreFragmentsToFollow()
+ + ": " + header);
+ }
+ try {
+ messageHeader = header;
+ MessageMediator mediator = null;
+ CDRInputObject inputObject = null;
+
+ if (connection.isServer()) {
+ mediator = connection.serverRequest_1_1_Get();
+ } else {
+ mediator = connection.clientReply_1_1_Get();
+ }
+ if (mediator != null) {
+ inputObject = (CDRInputObject) mediator.getInputObject();
+ }
+
+ // 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.
+ // 2. if a fragment message is received after the
+ // 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 (inputObject == null) {
+ if (transportDebug())
+ dprint(".FRAGMENT 1.1: ++++DISCARDING++++: " + header);
+ // need to release dispatchByteBuffer to pool if
+ // we are discarding
+ releaseByteBufferToPool();
+ return;
+ }
+
+ inputObject.getBufferManager()
+ .processFragment(dispatchByteBuffer, header);
+
+ if (! header.moreFragmentsToFollow()) {
+ if (connection.isServer()) {
+ connection.serverRequest_1_1_Remove();
+ } else {
+ connection.clientReply_1_1_Remove();
+ }
+ }
+ } finally {
+ // NOTE: This *must* come after queing the fragment
+ // when using the selector to ensure fragments stay in order.
+ setWorkThenReadOrResumeSelect(header);
+ }
+ } catch (Throwable t) {
+ if (transportDebug())
+ dprint(".FRAGMENT 1.1: !!ERROR!!: " + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug()) dprint(".FRAGMENT 1.1<-: " + header);
+ }
+ }
+
+ public void handleInput(FragmentMessage_1_2 header) throws IOException
+ {
+ try {
+ try {
+ messageHeader = header;
+
+ // 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.
+
+ header.unmarshalRequestID(dispatchByteBuffer);
+
+ if (transportDebug()) {
+ dprint(".FRAGMENT 1.2->: id/"
+ + header.getRequestId()
+ + ": more?: " + header.moreFragmentsToFollow()
+ + ": " + header);
+ }
+
+ MessageMediator mediator = null;
+ InputObject inputObject = null;
+
+ if (connection.isServer()) {
+ mediator =
+ connection.serverRequestMapGet(header.getRequestId());
+ } else {
+ mediator =
+ connection.clientRequestMapGet(header.getRequestId());
+ }
+ if (mediator != null) {
+ inputObject = mediator.getInputObject();
+ }
+ // See 1.1 comments.
+ if (inputObject == null) {
+ if (transportDebug()) {
+ dprint(".FRAGMENT 1.2: id/"
+ + header.getRequestId()
+ + ": ++++DISCARDING++++: "
+ + header);
+ }
+ // need to release dispatchByteBuffer to pool if
+ // we are discarding
+ releaseByteBufferToPool();
+ return;
+ }
+ ((CDRInputObject)inputObject)
+ .getBufferManager().processFragment(
+ dispatchByteBuffer, header);
+
+ // 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.
+ }
+ */
+ }
+ } finally {
+ // NOTE: This *must* come after queing the fragment
+ // when using the selector to ensure fragments stay in order.
+ setWorkThenReadOrResumeSelect(header);
+ }
+ } catch (Throwable t) {
+ if (transportDebug())
+ dprint(".FRAGMENT 1.2: id/"
+ + header.getRequestId()
+ + ": !!ERROR!!: "
+ + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug()) dprint(".FRAGMENT 1.2<-: id/"
+ + header.getRequestId()
+ + ": "
+ + header);
+ }
+ }
+
+ public void handleInput(CancelRequestMessage header) throws IOException
+ {
+ try {
+ try {
+ messageHeader = header;
+ setInputObject();
+
+ // REVISIT: Move these two to subcontract.
+ inputObject.unmarshalHeader();
+
+ if (transportDebug()) dprint(".CANCEL->: id/"
+ + header.getRequestId() + ": "
+ + header.getGIOPVersion() + ": "
+ + header);
+
+ processCancelRequest(header.getRequestId());
+ releaseByteBufferToPool();
+ } finally {
+ setWorkThenReadOrResumeSelect(header);
+ }
+ } catch (Throwable t) {
+ if (transportDebug()) dprint(".CANCEL: id/"
+ + header.getRequestId()
+ + ": !!ERROR!!: "
+ + header, t);
+ // Mask the exception from thread.;
+ } finally {
+ if (transportDebug()) dprint(".CANCEL<-: id/"
+ + header.getRequestId() + ": "
+ + header.getGIOPVersion() + ": "
+ + header);
+ }
+ }
+
+ private void throwNotImplemented()
+ {
+ isThreadDone = false;
+ throwNotImplemented("");
+ }
+
+ private void throwNotImplemented(String msg)
+ {
+ throw new RuntimeException("CorbaMessageMediatorImpl: not implemented " + msg);
+ }
+
+ private void dprint(String msg, Throwable t)
+ {
+ dprint(msg);
+ t.printStackTrace(System.out);
+ }
+
+ private void dprint(String msg)
+ {
+ ORBUtility.dprint("CorbaMessageMediatorImpl", msg);
+ }
+
+ protected String opAndId(CorbaMessageMediator mediator)
+ {
+ return ORBUtility.operationNameAndRequestId(mediator);
+ }
+
+ private boolean transportDebug()
+ {
+ return orb.transportDebugFlag;
+ }
+
+ // REVISIT: move this to subcontract (but both client and server need it).
+ private final void processCancelRequest(int cancelReqId) {
+
+ // The GIOP version of CancelRequest does not matter, since
+ // CancelRequest_1_0 could be sent to cancel a request which
+ // has a different GIOP version.
+
+ /*
+ * CancelRequest processing logic :
+ *
+ * - find the request with matching requestId
+ *
+ * - 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.
+ *
+ * - 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.
+ */
+
+ if (!connection.isServer()) {
+ return; // we do not support bi-directional giop yet, ignore.
+ }
+
+ // Try to get hold of the InputStream buffer.
+ // In the case of 1.0 requests there is no way to get hold of
+ // InputStream. Try out the 1.1 and 1.2 cases.
+
+ // was the request 1.2 ?
+ MessageMediator mediator = connection.serverRequestMapGet(cancelReqId);
+ int requestId ;
+ if (mediator == null) {
+ // was the request 1.1 ?
+ mediator = connection.serverRequest_1_1_Get();
+ if (mediator == null) {
+ // XXX log this!
+ // either the request was 1.0
+ // or an early reply has already been sent
+ // or request processing is over
+ // or its a spurious CancelRequest
+ return; // do nothing.
+ }
+
+ requestId = ((CorbaMessageMediator) mediator).getRequestId();
+
+ if (requestId != cancelReqId) {
+ // A spurious 1.1 CancelRequest has been received.
+ // XXX log this!
+ return; // do nothing
+ }
+
+ if (requestId == 0) { // special case
+ // XXX log this
+ // 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.
+ // 2. or the 1.1 request has a requestId 0.
+ //
+ // It is a little tricky to distinguish these two. So, be
+ // conservative and do not cancel the request. Downside is that
+ // 1.1 requests with requestId of 0 will never be cancelled.
+ return; // do nothing
+ }
+ } else {
+ requestId = ((CorbaMessageMediator) mediator).getRequestId();
+ }
+
+ Message msg = ((CorbaMessageMediator)mediator).getRequestHeader();
+ if (msg.getType() != Message.GIOPRequest) {
+ // Any mediator obtained here should only ever be for a GIOP
+ // request.
+ wrapper.badMessageTypeForCancel() ;
+ }
+
+ // At this point we have a valid message mediator that contains
+ // a valid requestId.
+
+ // at this point we have chosen a request to be cancelled. But we
+ // do not know if the target object's method has been invoked or not.
+ // Request input stream being available simply means that the request
+ // processing is not over yet. simply set the abort flag in the
+ // BMRS and hope that the worker thread would notice it (this can
+ // happen only if the request stream is being unmarshalled and the
+ // target's method has not been invoked yet). This guarantees
+ // that the requests which have been dispatched to the
+ // target's method will never be cancelled.
+
+ BufferManagerReadStream bufferManager = (BufferManagerReadStream)
+ ((CDRInputObject)mediator.getInputObject()).getBufferManager();
+ bufferManager.cancelProcessing(cancelReqId);
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // spi.protocol.CorbaProtocolHandler
+ //
+
+ public void handleRequest(RequestMessage msg,
+ CorbaMessageMediator messageMediator)
+ {
+ try {
+ beginRequest(messageMediator);
+ try {
+ handleRequestRequest(messageMediator);
+ if (messageMediator.isOneWay()) {
+ return;
+ }
+ } catch (Throwable t) {
+ if (messageMediator.isOneWay()) {
+ return;
+ }
+ handleThrowableDuringServerDispatch(
+ messageMediator, t, CompletionStatus.COMPLETED_MAYBE);
+ }
+ sendResponse(messageMediator);
+ } catch (Throwable t) {
+ dispatchError(messageMediator, "RequestMessage", t);
+ } finally {
+ endRequest(messageMediator);
+ }
+ }
+
+ public void handleRequest(LocateRequestMessage msg,
+ CorbaMessageMediator messageMediator)
+ {
+ try {
+ beginRequest(messageMediator);
+ try {
+ handleLocateRequest(messageMediator);
+ } catch (Throwable t) {
+ handleThrowableDuringServerDispatch(
+ messageMediator, t, CompletionStatus.COMPLETED_MAYBE);
+ }
+ sendResponse(messageMediator);
+ } catch (Throwable t) {
+ dispatchError(messageMediator, "LocateRequestMessage", t);
+ } finally {
+ endRequest(messageMediator);
+ }
+ }
+
+ private void beginRequest(CorbaMessageMediator messageMediator)
+ {
+ ORB orb = (ORB) messageMediator.getBroker();
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleRequest->:");
+ }
+ connection.serverRequestProcessingBegins();
+ }
+
+ private void dispatchError(CorbaMessageMediator messageMediator,
+ String msg, Throwable t)
+ {
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleRequest: " + opAndId(messageMediator)
+ + ": !!ERROR!!: "
+ + msg,
+ t);
+ }
+ // REVISIT - this makes hcks sendTwoObjects fail
+ // messageMediator.getConnection().close();
+ }
+
+ private void sendResponse(CorbaMessageMediator messageMediator)
+ {
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleRequest: " + opAndId(messageMediator)
+ + ": sending response");
+ }
+ // REVISIT - type and location
+ CDROutputObject outputObject = (CDROutputObject)
+ messageMediator.getOutputObject();
+ if (outputObject != null) {
+ // REVISIT - can be null for TRANSIENT below.
+ outputObject.finishSendingMessage();
+ }
+ }
+
+ private void endRequest(CorbaMessageMediator messageMediator)
+ {
+ ORB orb = (ORB) messageMediator.getBroker();
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleRequest<-: " + opAndId(messageMediator));
+ }
+
+ // release NIO ByteBuffers to ByteBufferPool
+
+ try {
+ OutputObject outputObj = messageMediator.getOutputObject();
+ if (outputObj != null) {
+ outputObj.close();
+ }
+ InputObject inputObj = messageMediator.getInputObject();
+ if (inputObj != null) {
+ inputObj.close();
+ }
+ } catch (IOException ex) {
+ // 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.
+ if (orb.subcontractDebugFlag) {
+ dprint(".endRequest: IOException:" + ex.getMessage(), ex);
+ }
+ } finally {
+ ((CorbaConnection)messageMediator.getConnection()).serverRequestProcessingEnds();
+ }
+ }
+
+ protected void handleRequestRequest(CorbaMessageMediator messageMediator)
+ {
+ // Does nothing if already unmarshaled.
+ ((CDRInputObject)messageMediator.getInputObject()).unmarshalHeader();
+
+ ORB orb = (ORB)messageMediator.getBroker();
+ synchronized (orb) {
+ orb.checkShutdownState();
+ }
+
+ ObjectKey okey = messageMediator.getObjectKey();
+ if (orb.subcontractDebugFlag) {
+ ObjectKeyTemplate oktemp = okey.getTemplate() ;
+ dprint( ".handleRequest: " + opAndId(messageMediator)
+ + ": dispatching to scid: " + oktemp.getSubcontractId());
+ }
+
+ CorbaServerRequestDispatcher sc = okey.getServerRequestDispatcher(orb);
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleRequest: " + opAndId(messageMediator)
+ + ": dispatching to sc: " + sc);
+ }
+
+ if (sc == null) {
+ throw wrapper.noServerScInDispatch() ;
+ }
+
+ // NOTE:
+ // This is necessary so mediator can act as ResponseHandler
+ // and pass necessary info to response constructors located
+ // in the subcontract.
+ // REVISIT - same class right now.
+ //messageMediator.setProtocolHandler(this);
+
+ try {
+ orb.startingDispatch();
+ sc.dispatch(messageMediator);
+ } finally {
+ orb.finishedDispatch();
+ }
+ }
+
+ protected void handleLocateRequest(CorbaMessageMediator messageMediator)
+ {
+ ORB orb = (ORB)messageMediator.getBroker();
+ LocateRequestMessage msg = (LocateRequestMessage)
+ messageMediator.getDispatchHeader();
+ IOR ior = null;
+ LocateReplyMessage reply = null;
+ short addrDisp = -1;
+
+ try {
+ ((CDRInputObject)messageMediator.getInputObject()).unmarshalHeader();
+ CorbaServerRequestDispatcher sc =
+ msg.getObjectKey().getServerRequestDispatcher( orb ) ;
+ if (sc == null) {
+ return;
+ }
+
+ ior = sc.locate(msg.getObjectKey());
+
+ if ( ior == null ) {
+ reply = MessageBase.createLocateReply(
+ orb, msg.getGIOPVersion(),
+ msg.getEncodingVersion(),
+ msg.getRequestId(),
+ LocateReplyMessage.OBJECT_HERE, null);
+
+ } else {
+ reply = MessageBase.createLocateReply(
+ orb, msg.getGIOPVersion(),
+ msg.getEncodingVersion(),
+ msg.getRequestId(),
+ LocateReplyMessage.OBJECT_FORWARD, ior);
+ }
+ // REVISIT: Should we catch SystemExceptions?
+
+ } catch (AddressingDispositionException ex) {
+
+ // create a response containing the expected target
+ // addressing disposition.
+
+ reply = MessageBase.createLocateReply(
+ orb, msg.getGIOPVersion(),
+ msg.getEncodingVersion(),
+ msg.getRequestId(),
+ LocateReplyMessage.LOC_NEEDS_ADDRESSING_MODE, null);
+
+ addrDisp = ex.expectedAddrDisp();
+
+ } catch (RequestCanceledException ex) {
+
+ return; // no need to send reply
+
+ } catch ( Exception ex ) {
+
+ // REVISIT If exception is not OBJECT_NOT_EXIST, it should
+ // have a different reply
+
+ // This handles OBJECT_NOT_EXIST exceptions thrown in
+ // the subcontract or obj manager. Send back UNKNOWN_OBJECT.
+
+ reply = MessageBase.createLocateReply(
+ orb, msg.getGIOPVersion(),
+ msg.getEncodingVersion(),
+ msg.getRequestId(),
+ LocateReplyMessage.UNKNOWN_OBJECT, null);
+ }
+
+ CDROutputObject outputObject =
+ createAppropriateOutputObject(messageMediator,
+ msg, reply);
+ messageMediator.setOutputObject(outputObject);
+ outputObject.setMessageMediator(messageMediator);
+
+ reply.write(outputObject);
+ // outputObject.setMessage(reply); // REVISIT - not necessary
+ if (ior != null) {
+ ior.write(outputObject);
+ }
+ if (addrDisp != -1) {
+ AddressingDispositionHelper.write(outputObject, addrDisp);
+ }
+ }
+
+ private CDROutputObject createAppropriateOutputObject(
+ CorbaMessageMediator messageMediator,
+ Message msg, LocateReplyMessage reply)
+ {
+ CDROutputObject outputObject;
+
+ if (msg.getGIOPVersion().lessThan(GIOPVersion.V1_2)) {
+ // locate msgs 1.0 & 1.1 :=> grow,
+ outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
+ (ORB) messageMediator.getBroker(),
+ this,
+ GIOPVersion.V1_0,
+ (CorbaConnection) messageMediator.getConnection(),
+ reply,
+ ORBConstants.STREAM_FORMAT_VERSION_1);
+ } else {
+ // 1.2 :=> stream
+ outputObject = sun.corba.OutputStreamFactory.newCDROutputObject(
+ (ORB) messageMediator.getBroker(),
+ messageMediator,
+ reply,
+ ORBConstants.STREAM_FORMAT_VERSION_1);
+ }
+ return outputObject;
+ }
+
+ public void handleThrowableDuringServerDispatch(
+ CorbaMessageMediator messageMediator,
+ Throwable throwable,
+ CompletionStatus completionStatus)
+ {
+ if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) {
+ dprint(".handleThrowableDuringServerDispatch: "
+ + opAndId(messageMediator) + ": "
+ + throwable);
+ }
+
+ // 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
+ // not match (during header unmarshaling) it throws an exception
+ // to be handled here.
+ /*
+ if (! ((CDRInputObject)messageMediator.getInputObject())
+ .unmarshaledHeader()) {
+ return;
+ }
+ */
+ handleThrowableDuringServerDispatch(messageMediator,
+ throwable,
+ completionStatus,
+ 1);
+ }
+
+
+ // REVISIT - catch and ignore RequestCanceledException.
+
+ protected void handleThrowableDuringServerDispatch(
+ CorbaMessageMediator messageMediator,
+ Throwable throwable,
+ CompletionStatus completionStatus,
+ int iteration)
+ {
+ if (iteration > 10) {
+ if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) {
+ dprint(".handleThrowableDuringServerDispatch: "
+ + opAndId(messageMediator)
+ + ": cannot handle: "
+ + throwable);
+ }
+
+ // REVISIT - should we close connection?
+ RuntimeException rte =
+ new RuntimeException("handleThrowableDuringServerDispatch: " +
+ "cannot create response.");
+ rte.initCause(throwable);
+ throw rte;
+ }
+
+ try {
+ if (throwable instanceof ForwardException) {
+ ForwardException fex = (ForwardException)throwable ;
+ createLocationForward( messageMediator, fex.getIOR(), null ) ;
+ return;
+ }
+
+ if (throwable instanceof AddressingDispositionException) {
+ handleAddressingDisposition(
+ messageMediator,
+ (AddressingDispositionException)throwable);
+ return;
+ }
+
+ // Else.
+
+ SystemException sex =
+ convertThrowableToSystemException(throwable, completionStatus);
+
+ createSystemExceptionResponse(messageMediator, sex, null);
+ return;
+
+ } catch (Throwable throwable2) {
+
+ // User code (e.g., postinvoke, interceptors) may change
+ // the exception, so we end up back here.
+ // Report the changed exception.
+
+ handleThrowableDuringServerDispatch(messageMediator,
+ throwable2,
+ completionStatus,
+ iteration + 1);
+ return;
+ }
+ }
+
+ protected SystemException convertThrowableToSystemException(
+ Throwable throwable,
+ CompletionStatus completionStatus)
+ {
+ if (throwable instanceof SystemException) {
+ 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
+ // that the request was cancelled.
+
+ 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 ServantManagers,
+ // interceptors, or servants) but that should not
+ // effect the ORB threads. So it is just handled
+ // generically.
+
+ //
+ // Last resort.
+ // If user code throws a non-SystemException report it generically.
+ //
+
+ return wrapper.runtimeexception( CompletionStatus.COMPLETED_MAYBE, throwable ) ;
+ }
+
+ protected void handleAddressingDisposition(
+ CorbaMessageMediator messageMediator,
+ AddressingDispositionException ex)
+ {
+
+ short addrDisp = -1;
+
+ // from iiop.RequestProcessor.
+
+ // Respond with expected target addressing disposition.
+
+ switch (messageMediator.getRequestHeader().getType()) {
+ case Message.GIOPRequest :
+ ReplyMessage replyHeader = MessageBase.createReply(
+ (ORB)messageMediator.getBroker(),
+ messageMediator.getGIOPVersion(),
+ messageMediator.getEncodingVersion(),
+ messageMediator.getRequestId(),
+ ReplyMessage.NEEDS_ADDRESSING_MODE,
+ null, null);
+ // REVISIT: via acceptor factory.
+ CDROutputObject outputObject =
+ sun.corba.OutputStreamFactory.newCDROutputObject(
+ (ORB)messageMediator.getBroker(),
+ this,
+ messageMediator.getGIOPVersion(),
+ (CorbaConnection)messageMediator.getConnection(),
+ replyHeader,
+ ORBConstants.STREAM_FORMAT_VERSION_1);
+ messageMediator.setOutputObject(outputObject);
+ outputObject.setMessageMediator(messageMediator);
+ replyHeader.write(outputObject);
+ AddressingDispositionHelper.write(outputObject,
+ ex.expectedAddrDisp());
+ return;
+
+ case Message.GIOPLocateRequest :
+ LocateReplyMessage locateReplyHeader = MessageBase.createLocateReply(
+ (ORB)messageMediator.getBroker(),
+ messageMediator.getGIOPVersion(),
+ messageMediator.getEncodingVersion(),
+ messageMediator.getRequestId(),
+ LocateReplyMessage.LOC_NEEDS_ADDRESSING_MODE,
+ null);
+
+ addrDisp = ex.expectedAddrDisp();
+
+ // REVISIT: via acceptor factory.
+ outputObject =
+ createAppropriateOutputObject(messageMediator,
+ messageMediator.getRequestHeader(),
+ locateReplyHeader);
+ messageMediator.setOutputObject(outputObject);
+ outputObject.setMessageMediator(messageMediator);
+ locateReplyHeader.write(outputObject);
+ IOR ior = null;
+ if (ior != null) {
+ ior.write(outputObject);
+ }
+ if (addrDisp != -1) {
+ AddressingDispositionHelper.write(outputObject, addrDisp);
+ }
+ return;
+ }
+ }
+
+ public CorbaMessageMediator createResponse(
+ CorbaMessageMediator 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));
+ }
+
+ public CorbaMessageMediator createUserExceptionResponse(
+ CorbaMessageMediator messageMediator, ServiceContexts svc)
+ {
+ // REVISIT - same as above
+ return createResponseHelper(
+ messageMediator,
+ getServiceContextsForReply(messageMediator, null),
+ true);
+ }
+
+ public CorbaMessageMediator createUnknownExceptionResponse(
+ CorbaMessageMediator 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 = new ServiceContexts( (ORB)messageMediator.getBroker() );
+ UEInfoServiceContext uei = new UEInfoServiceContext(sys);
+ contexts.put( uei ) ;
+ return createSystemExceptionResponse(messageMediator, sys, contexts);
+ }
+
+ public CorbaMessageMediator createSystemExceptionResponse(
+ CorbaMessageMediator 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
+ // when attempting to unmarshal.
+
+ // REVISIT: Impl - make interface method to do the following.
+ CorbaMessageMediatorImpl mediator = (CorbaMessageMediatorImpl)
+ ((CorbaConnection)messageMediator.getConnection())
+ .serverRequestMapGet(messageMediator.getRequestId());
+
+ OutputObject existingOutputObject = null;
+ if (mediator != null) {
+ existingOutputObject = mediator.getOutputObject();
+ }
+
+ // REVISIT: need to think about messageMediator containing correct
+ // pointer to output object.
+ 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
+ // 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
+ // response until after the ending point is called.
+ ((ORB)messageMediator.getBroker()).getPIHandler().setServerPIInfo( ex );
+ }
+
+ if (((ORB)messageMediator.getBroker()).subcontractDebugFlag &&
+ ex != null)
+ {
+ dprint(".createSystemExceptionResponse: "
+ + opAndId(messageMediator),
+ ex);
+ }
+
+ ServiceContexts serviceContexts =
+ getServiceContextsForReply(messageMediator, svc);
+
+ // NOTE: We MUST add the service context before creating
+ // the response since service contexts are written to the
+ // stream when the response object is created.
+
+ addExceptionDetailMessage(messageMediator, ex, serviceContexts);
+
+ CorbaMessageMediator 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());
+
+ return response;
+ }
+
+ private void addExceptionDetailMessage(CorbaMessageMediator 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 =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)mediator.getBroker());
+ encapsOutputStream.putEndian();
+ encapsOutputStream.write_wstring(baos.toString());
+ UnknownServiceContext serviceContext =
+ new UnknownServiceContext(ExceptionDetailMessage.value,
+ encapsOutputStream.toByteArray());
+ serviceContexts.put(serviceContext);
+ }
+
+ public CorbaMessageMediator createLocationForward(
+ CorbaMessageMediator messageMediator, IOR ior, ServiceContexts svc)
+ {
+ ReplyMessage reply
+ = MessageBase.createReply(
+ (ORB)messageMediator.getBroker(),
+ messageMediator.getGIOPVersion(),
+ messageMediator.getEncodingVersion(),
+ messageMediator.getRequestId(),
+ ReplyMessage.LOCATION_FORWARD,
+ getServiceContextsForReply(messageMediator, svc),
+ ior);
+
+ return createResponseHelper(messageMediator, reply, ior);
+ }
+
+ protected CorbaMessageMediator createResponseHelper(
+ CorbaMessageMediator messageMediator, ServiceContexts svc)
+ {
+ ReplyMessage message =
+ MessageBase.createReply(
+ (ORB)messageMediator.getBroker(),
+ messageMediator.getGIOPVersion(),
+ messageMediator.getEncodingVersion(),
+ messageMediator.getRequestId(),
+ ReplyMessage.NO_EXCEPTION,
+ svc,
+ null);
+ return createResponseHelper(messageMediator, message, null);
+ }
+
+ protected CorbaMessageMediator createResponseHelper(
+ CorbaMessageMediator messageMediator, ServiceContexts svc,boolean user)
+ {
+ ReplyMessage message =
+ MessageBase.createReply(
+ (ORB)messageMediator.getBroker(),
+ messageMediator.getGIOPVersion(),
+ messageMediator.getEncodingVersion(),
+ messageMediator.getRequestId(),
+ user ? ReplyMessage.USER_EXCEPTION :
+ ReplyMessage.SYSTEM_EXCEPTION,
+ svc,
+ null);
+ return createResponseHelper(messageMediator, message, null);
+ }
+
+ // REVISIT - IOR arg is ignored.
+ protected CorbaMessageMediator createResponseHelper(
+ CorbaMessageMediator messageMediator, ReplyMessage reply, IOR ior)
+ {
+ // REVISIT - these should be invoked from subcontract.
+ runServantPostInvoke(messageMediator);
+ runInterceptors(messageMediator, reply);
+ runRemoveThreadInfo(messageMediator);
+
+ if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) {
+ dprint(".createResponseHelper: "
+ + opAndId(messageMediator) + ": "
+ + reply);
+ }
+
+ messageMediator.setReplyHeader(reply);
+
+ OutputObject replyOutputObject;
+ // REVISIT = do not use null.
+ //
+ if (messageMediator.getConnection() == null) {
+ replyOutputObject =
+ sun.corba.OutputStreamFactory.newCDROutputObject(orb,
+ messageMediator, messageMediator.getReplyHeader(),
+ messageMediator.getStreamFormatVersion(),
+ BufferManagerFactory.GROW);
+ } else {
+ replyOutputObject = messageMediator.getConnection().getAcceptor()
+ .createOutputObject(messageMediator.getBroker(), messageMediator);
+ }
+ messageMediator.setOutputObject(replyOutputObject);
+ messageMediator.getOutputObject().setMessageMediator(messageMediator);
+
+ reply.write((OutputStream) messageMediator.getOutputObject());
+ if (reply.getIOR() != null) {
+ reply.getIOR().write((OutputStream) messageMediator.getOutputObject());
+ }
+ // REVISIT - not necessary?
+ //messageMediator.this.replyIOR = reply.getIOR();
+
+ // NOTE: The mediator holds onto output object so return value
+ // not really necessary.
+ return messageMediator;
+ }
+
+ protected void runServantPostInvoke(CorbaMessageMediator messageMediator)
+ {
+ // 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
+ // of returnServant makes sure that postinvoke is only called once.
+ // REVISIT: instead of instanceof, put method on all orbs.
+ ORB orb = null;
+ // This flag is to deal with BootstrapServer use of reply streams,
+ // 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
+ // 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.
+ messageMediator.setExecuteReturnServantInResponseConstructor(false);
+ messageMediator.setExecuteRemoveThreadInfoInResponseConstructor(true);
+
+ try {
+ orb = (ORB)messageMediator.getBroker();
+ OAInvocationInfo info = orb.peekInvocationInfo() ;
+ ObjectAdapter oa = info.oa();
+ try {
+ oa.returnServant() ;
+ } catch (Throwable thr) {
+ wrapper.unexpectedException( thr ) ;
+
+ if (thr instanceof Error)
+ throw (Error)thr ;
+ else if (thr instanceof RuntimeException)
+ throw (RuntimeException)thr ;
+ } finally {
+ oa.exit();
+ }
+ } catch (EmptyStackException ese) {
+ throw wrapper.emptyStackRunServantPostInvoke( ese ) ;
+ }
+ }
+ }
+
+ protected void runInterceptors(CorbaMessageMediator messageMediator,
+ ReplyMessage reply)
+ {
+ if( messageMediator.executePIInResponseConstructor() ) {
+ // Invoke server request ending interception points (send_*):
+ // Note: this may end up with a SystemException or an internal
+ // Runtime ForwardRequest
+ ((ORB)messageMediator.getBroker()).getPIHandler().
+ invokeServerPIEndingPoint( reply );
+
+ // 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.
+ ((ORB)messageMediator.getBroker()).getPIHandler().
+ cleanupServerPIRequest();
+
+ // See createSystemExceptionResponse for why this is necesary.
+ messageMediator.setExecutePIInResponseConstructor(false);
+ }
+ }
+
+ protected void runRemoveThreadInfo(CorbaMessageMediator messageMediator)
+ {
+ // Once you get here then the final reply is available (i.e.,
+ // postinvoke and interceptors have completed.
+ if (messageMediator.executeRemoveThreadInfoInResponseConstructor()) {
+ messageMediator.setExecuteRemoveThreadInfoInResponseConstructor(false);
+ ((ORB)messageMediator.getBroker()).popInvocationInfo() ;
+ }
+ }
+
+ protected ServiceContexts getServiceContextsForReply(
+ CorbaMessageMediator messageMediator, ServiceContexts contexts)
+ {
+ CorbaConnection c = (CorbaConnection) messageMediator.getConnection();
+
+ if (((ORB)messageMediator.getBroker()).subcontractDebugFlag) {
+ dprint(".getServiceContextsForReply: "
+ + opAndId(messageMediator)
+ + ": " + c);
+ }
+
+ if (contexts == null) {
+ contexts = new ServiceContexts(((ORB)messageMediator.getBroker()));
+ }
+
+ // NOTE : We only want to send the runtime context the first time
+
+ if (c != null && !c.isPostInitialContexts()) {
+ c.setPostInitialContexts();
+ SendingContextServiceContext scsc =
+ new SendingContextServiceContext(
+ ((ORB)messageMediator.getBroker()).getFVDCodeBaseIOR()) ;
+
+ if (contexts.get( scsc.getId() ) != null)
+ throw wrapper.duplicateSendingContextServiceContext() ;
+
+ contexts.put( scsc ) ;
+
+ if ( ((ORB)messageMediator.getBroker()).subcontractDebugFlag)
+ dprint(".getServiceContextsForReply: "
+ + opAndId(messageMediator)
+ + ": added SendingContextServiceContext" ) ;
+ }
+
+ // send ORBVersion servicecontext as part of the Reply
+
+ ORBVersionServiceContext ovsc
+ = new ORBVersionServiceContext(ORBVersionFactory.getORBVersion());
+
+ if (contexts.get( ovsc.getId() ) != null)
+ throw wrapper.duplicateOrbVersionServiceContext() ;
+
+ contexts.put( ovsc ) ;
+
+ if ( ((ORB)messageMediator.getBroker()).subcontractDebugFlag)
+ dprint(".getServiceContextsForReply: "
+ + opAndId(messageMediator)
+ + ": added ORB version service context");
+
+ return contexts;
+ }
+
+ // REVISIT - this method should be migrated to orbutil.ORBUtility
+ // since all locations that release ByteBuffers use
+ // very similar logic and debug information.
+ private void releaseByteBufferToPool() {
+ if (dispatchByteBuffer != null) {
+ orb.getByteBufferPool().releaseByteBuffer(dispatchByteBuffer);
+ if (transportDebug()) {
+ int bbId = System.identityHashCode(dispatchByteBuffer);
+ StringBuffer sb = new StringBuffer();
+ sb.append(".handleInput: releasing ByteBuffer (" + bbId +
+ ") to ByteBufferPool");
+ dprint(sb.toString());
+ }
+ }
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaServerRequestDispatcherImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaServerRequestDispatcherImpl.java
new file mode 100644
index 0000000..b3bea05
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/CorbaServerRequestDispatcherImpl.java
@@ -0,0 +1,885 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+
+package com.sun.corba.se.impl.protocol;
+
+import org.omg.PortableServer.Servant ;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.Any;
+
+import org.omg.CORBA.portable.InvokeHandler;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.CORBA.portable.ResponseHandler;
+
+import com.sun.org.omg.SendingContext.CodeBase;
+
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersion;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.ObjectKey;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
+import com.sun.corba.se.spi.ior.ObjectAdapterId;
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory;
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+import com.sun.corba.se.spi.oa.OAInvocationInfo;
+import com.sun.corba.se.spi.oa.OADestroyed;
+import com.sun.corba.se.spi.oa.NullServant;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher;
+import com.sun.corba.se.spi.protocol.ForwardException ;
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.impl.protocol.SpecialMethod ;
+import com.sun.corba.se.spi.servicecontext.ServiceContext;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext;
+import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext;
+import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext;
+import com.sun.corba.se.spi.servicecontext.ORBVersionServiceContext;
+
+import com.sun.corba.se.impl.corba.ServerRequestImpl ;
+import com.sun.corba.se.impl.encoding.MarshalInputStream;
+import com.sun.corba.se.impl.encoding.MarshalOutputStream;
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.protocol.RequestCanceledException;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.logging.POASystemException;
+
+public class CorbaServerRequestDispatcherImpl
+ implements CorbaServerRequestDispatcher
+{
+ protected ORB orb; // my ORB instance
+ private ORBUtilSystemException wrapper ;
+ private POASystemException poaWrapper ;
+
+ // Added from last version because it broke the build - RTW
+ // XXX remove me and rebuild: probably no longer needed
+ // public static final int UNKNOWN_EXCEPTION_INFO_ID = 9;
+
+ public CorbaServerRequestDispatcherImpl(ORB orb)
+ {
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ poaWrapper = POASystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ /** XXX/REVISIT:
+ * We do not want to look for a servant in the POA/ServantManager case,
+ * but we could in most other cases. The OA could have a method that
+ * returns true if the servant MAY exist, and false only if the servant
+ * definitely DOES NOT exist.
+ *
+ * XXX/REVISIT:
+ * We may wish to indicate OBJECT_HERE by some mechanism other than
+ * returning a null result.
+ *
+ * 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 OBJECT_NOT_EXIST is thrown if we know the object does not
+ * exist here, and we are not forwarding.
+ */
+ public IOR locate(ObjectKey okey)
+ {
+ try {
+ if (orb.subcontractDebugFlag)
+ dprint(".locate->");
+
+ ObjectKeyTemplate oktemp = okey.getTemplate() ;
+
+ try {
+ checkServerId(okey);
+ } catch (ForwardException fex) {
+ return fex.getIOR() ;
+ }
+
+ // Called only for its side-effect of throwing appropriate exceptions
+ findObjectAdapter(oktemp);
+
+ return null ;
+ } finally {
+ if (orb.subcontractDebugFlag)
+ dprint(".locate<-");
+ }
+ }
+
+ public void dispatch(MessageMediator messageMediator)
+ {
+ CorbaMessageMediator request = (CorbaMessageMediator) messageMediator;
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatch->: " + opAndId(request));
+ }
+
+ // to set the codebase information, if any transmitted; and also
+ // appropriate ORB Version.
+ consumeServiceContexts(request);
+
+ // Now that we have the service contexts processed and the
+ // correct ORBVersion set, we must finish initializing the
+ // stream.
+ ((MarshalInputStream)request.getInputObject())
+ .performORBVersionSpecificInit();
+
+ ObjectKey okey = request.getObjectKey();
+
+ // Check that this server is the right server
+ try {
+ checkServerId(okey);
+ } catch (ForwardException fex) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatch: " + opAndId(request)
+ + ": bad server id");
+ }
+
+ request.getProtocolHandler()
+ .createLocationForward(request, fex.getIOR(), null);
+ return;
+ }
+
+ String operation = request.getOperationName();
+ ObjectAdapter objectAdapter = null ;
+
+ try {
+ byte[] objectId = okey.getId().getId() ;
+ ObjectKeyTemplate oktemp = okey.getTemplate() ;
+ objectAdapter = findObjectAdapter(oktemp);
+
+ java.lang.Object servant = getServantWithPI(request, objectAdapter,
+ objectId, oktemp, operation);
+
+ dispatchToServant(servant, request, objectId, objectAdapter);
+ } catch (ForwardException ex) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatch: " + opAndId(request)
+ + ": ForwardException caught");
+ }
+
+ // Thrown by Portable Interceptors from InterceptorInvoker,
+ // through Response constructor.
+ request.getProtocolHandler()
+ .createLocationForward(request, ex.getIOR(), null);
+ } catch (OADestroyed ex) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatch: " + opAndId(request)
+ + ": OADestroyed exception caught");
+ }
+
+ // DO NOT CALL THIS HERE:
+ // releaseServant(objectAdapter);
+ // The problem is that OADestroyed is only thrown by oa.enter, in
+ // which case oa.exit should NOT be called, and neither should
+ // the invocationInfo stack be popped.
+
+ // Destroyed POAs can be recreated by normal adapter activation.
+ // So just restart the dispatch.
+ dispatch(request);
+ } catch (RequestCanceledException ex) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatch: " + opAndId(request)
+ + ": RequestCanceledException caught");
+ }
+
+ // IDLJ generated non-tie based skeletons do not catch the
+ // RequestCanceledException. Rethrow the exception, which will
+ // cause the worker thread to unwind the dispatch and wait for
+ // other requests.
+ throw ex;
+ } catch (UnknownException ex) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatch: " + opAndId(request)
+ + ": UnknownException caught " + ex);
+ }
+
+ // RMIC generated tie skeletons convert all Throwable exception
+ // types (including RequestCanceledException, ThreadDeath)
+ // thrown during reading fragments into UnknownException.
+ // If RequestCanceledException was indeed raised,
+ // then rethrow it, which will eventually cause the worker
+ // thread to unstack the dispatch and wait for other requests.
+ if (ex.originalEx instanceof RequestCanceledException) {
+ throw (RequestCanceledException) ex.originalEx;
+ }
+
+ ServiceContexts contexts = new ServiceContexts(orb);
+ UEInfoServiceContext usc = new UEInfoServiceContext(
+ ex.originalEx);
+
+ contexts.put( usc ) ;
+
+ SystemException sysex = wrapper.unknownExceptionInDispatch(
+ CompletionStatus.COMPLETED_MAYBE, ex ) ;
+ request.getProtocolHandler()
+ .createSystemExceptionResponse(request, sysex,
+ contexts);
+ } catch (Throwable ex) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatch: " + opAndId(request)
+ + ": other exception " + ex);
+ }
+ request.getProtocolHandler()
+ .handleThrowableDuringServerDispatch(
+ request, ex, CompletionStatus.COMPLETED_MAYBE);
+ }
+ return;
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatch<-: " + opAndId(request));
+ }
+ }
+ }
+
+ private void releaseServant(ObjectAdapter objectAdapter)
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".releaseServant->");
+ }
+
+ if (objectAdapter == null) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".releaseServant: null object adapter");
+ }
+ return ;
+ }
+
+ try {
+ objectAdapter.returnServant();
+ } finally {
+ objectAdapter.exit();
+ orb.popInvocationInfo() ;
+ }
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".releaseServant<-");
+ }
+ }
+ }
+
+ // Note that objectAdapter.enter() must be called before getServant.
+ private java.lang.Object getServant(ObjectAdapter objectAdapter, byte[] objectId,
+ String operation)
+ throws OADestroyed
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".getServant->");
+ }
+
+ OAInvocationInfo info = objectAdapter.makeInvocationInfo(objectId);
+ info.setOperation(operation);
+ orb.pushInvocationInfo(info);
+ objectAdapter.getInvocationServant(info);
+ return info.getServantContainer() ;
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".getServant<-");
+ }
+ }
+ }
+
+ protected java.lang.Object getServantWithPI(CorbaMessageMediator request,
+ ObjectAdapter objectAdapter,
+ byte[] objectId, ObjectKeyTemplate oktemp, String operation)
+ throws OADestroyed
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".getServantWithPI->");
+ }
+
+ // Prepare Portable Interceptors for a new server request
+ // and invoke receive_request_service_contexts. The starting
+ // point may throw a SystemException or ForwardException.
+ orb.getPIHandler().initializeServerPIInfo(request, objectAdapter,
+ objectId, oktemp);
+ orb.getPIHandler().invokeServerPIStartingPoint();
+
+ objectAdapter.enter() ;
+
+ // This must be set just after the enter so that exceptions thrown by
+ // enter do not cause
+ // the exception reply to pop the thread stack and do an extra oa.exit.
+ if (request != null)
+ request.setExecuteReturnServantInResponseConstructor(true);
+
+ 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" ;
+
+ if (servant instanceof NullServant)
+ 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)) {
+ orb.getPIHandler().invokeServerPIIntermediatePoint();
+ }
+
+ return servant ;
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".getServantWithPI<-");
+ }
+ }
+ }
+
+ protected void checkServerId(ObjectKey okey)
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".checkServerId->");
+ }
+
+ ObjectKeyTemplate oktemp = okey.getTemplate() ;
+ int sId = oktemp.getServerId() ;
+ int scid = oktemp.getSubcontractId() ;
+
+ if (!orb.isLocalServerId(scid, sId)) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".checkServerId: bad server id");
+ }
+
+ orb.handleBadServerId(okey);
+ }
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".checkServerId<-");
+ }
+ }
+ }
+
+ private ObjectAdapter findObjectAdapter(ObjectKeyTemplate oktemp)
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".findObjectAdapter->");
+ }
+
+ RequestDispatcherRegistry scr = orb.getRequestDispatcherRegistry() ;
+ int scid = oktemp.getSubcontractId() ;
+ ObjectAdapterFactory oaf = scr.getObjectAdapterFactory(scid);
+ if (oaf == null) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".findObjectAdapter: failed to find ObjectAdapterFactory");
+ }
+
+ throw wrapper.noObjectAdapterFactory() ;
+ }
+
+ ObjectAdapterId oaid = oktemp.getObjectAdapterId() ;
+ ObjectAdapter oa = oaf.find(oaid);
+
+ if (oa == null) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".findObjectAdapter: failed to find ObjectAdaptor");
+ }
+
+ throw wrapper.badAdapterId() ;
+ }
+
+ return oa ;
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".findObjectAdapter<-");
+ }
+ }
+ }
+
+ /** 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.
+ */
+ protected void handleNullServant(String operation, NullServant nserv )
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleNullServant->: " + operation);
+ }
+
+ SpecialMethod specialMethod =
+ SpecialMethod.getSpecialMethod(operation);
+
+ if ((specialMethod == null) ||
+ !specialMethod.isNonExistentMethod()) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleNullServant: " + operation
+ + ": throwing OBJECT_NOT_EXIST");
+ }
+
+ throw nserv.getException() ;
+ }
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleNullServant<-: " + operation);
+ }
+ }
+ }
+
+ protected void consumeServiceContexts(CorbaMessageMediator request)
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".consumeServiceContexts->: "
+ + opAndId(request));
+ }
+
+ 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
+
+ boolean hasCodeSetContext = processCodeSetContext(request, ctxts);
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".consumeServiceContexts: " + opAndId(request)
+ + ": GIOP version: " + giopVersion);
+ dprint(".consumeServiceContexts: " + opAndId(request)
+ + ": as code set context? " + hasCodeSetContext);
+ }
+
+ sc = ctxts.get(
+ SendingContextServiceContext.SERVICE_CONTEXT_ID ) ;
+
+ if (sc != null) {
+ SendingContextServiceContext scsc =
+ (SendingContextServiceContext)sc ;
+ IOR ior = scsc.getIOR() ;
+
+ try {
+ ((CorbaConnection)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) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".consumeServiceCOntexts: " + opAndId(request)
+ + ": Determined to be an 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;
+
+ ORBVersion version = ovsc.getVersion();
+ orb.setORBVersion(version);
+
+ isForeignORB = false;
+ }
+
+ if (isForeignORB) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".consumeServiceContexts: " + opAndId(request)
+ + ": Determined to be a foreign ORB");
+ }
+
+ orb.setORBVersion(ORBVersionFactory.getFOREIGN());
+ }
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".consumeServiceContexts<-: " + opAndId(request));
+ }
+ }
+ }
+
+ protected CorbaMessageMediator dispatchToServant(
+ java.lang.Object servant,
+ CorbaMessageMediator req,
+ byte[] objectId, ObjectAdapter objectAdapter)
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatchToServant->: " + opAndId(req));
+ }
+
+ CorbaMessageMediator response = null ;
+
+ String operation = req.getOperationName() ;
+
+ SpecialMethod method = SpecialMethod.getSpecialMethod(operation) ;
+ if (method != null) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatchToServant: " + opAndId(req)
+ + ": Handling special method");
+ }
+
+ response = method.invoke(servant, req, objectId, objectAdapter);
+ return response ;
+ }
+
+ // Invoke on the servant using the portable DSI skeleton
+ if (servant instanceof org.omg.CORBA.DynamicImplementation) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatchToServant: " + opAndId(req)
+ + ": Handling old style DSI type 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) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatchToServant: " + opAndId(req)
+ + ": 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 {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatchToServant: " + opAndId(req)
+ + ": Handling invoke handler type servant");
+ }
+
+ InvokeHandler invhandle = (InvokeHandler)servant ;
+
+ OutputStream stream =
+ (OutputStream)invhandle._invoke(
+ operation,
+ (org.omg.CORBA.portable.InputStream)req.getInputObject(),
+ req);
+ response = (CorbaMessageMediator)
+ ((OutputObject)stream).getMessageMediator();
+ }
+
+ return response ;
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".dispatchToServant<-: " + opAndId(req));
+ }
+ }
+ }
+
+ protected CorbaMessageMediator handleDynamicResult(
+ ServerRequestImpl sreq,
+ CorbaMessageMediator req)
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleDynamicResult->: " + opAndId(req));
+ }
+
+ CorbaMessageMediator response = null ;
+
+ // Check if ServerRequestImpl.result() has been called
+ Any excany = sreq.checkResultCalled();
+
+ if (excany == null) { // normal return
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleDynamicResult: " + opAndId(req)
+ + ": handling normal result");
+ }
+
+ // Marshal out/inout/return parameters into the ReplyMessage
+ response = sendingReply(req);
+ OutputStream os = (OutputStream) response.getOutputObject();
+ sreq.marshalReplyParams(os);
+ } else {
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleDynamicResult: " + opAndId(req)
+ + ": handling error");
+ }
+
+ response = sendingReply(req, excany);
+ }
+
+ return response ;
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".handleDynamicResult<-: " + opAndId(req));
+ }
+ }
+ }
+
+ protected CorbaMessageMediator sendingReply(CorbaMessageMediator req)
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".sendingReply->: " + opAndId(req));
+ }
+
+ ServiceContexts scs = new ServiceContexts(orb);
+ return req.getProtocolHandler().createResponse(req, scs);
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".sendingReply<-: " + opAndId(req));
+ }
+ }
+ }
+
+ /** Must always be called, just after the servant's method returns.
+ * Creates the ReplyMessage header and puts in the transaction context
+ * if necessary.
+ */
+ protected CorbaMessageMediator sendingReply(CorbaMessageMediator req, Any excany)
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".sendingReply/Any->: " + opAndId(req));
+ }
+
+ ServiceContexts scs = new ServiceContexts(orb);
+
+ // Check if the servant set a SystemException or
+ // UserException
+ CorbaMessageMediator resp;
+ String repId=null;
+ try {
+ repId = excany.type().id();
+ } catch (org.omg.CORBA.TypeCodePackage.BadKind e) {
+ throw wrapper.problemWithExceptionTypecode( e ) ;
+ }
+
+ if (ORBUtility.isSystemException(repId)) {
+ if (orb.subcontractDebugFlag) {
+ dprint(".sendingReply/Any: " + opAndId(req)
+ + ": 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);
+ } else {
+ if (orb.subcontractDebugFlag) {
+ dprint(".sendingReply/Any: " + opAndId(req)
+ + ": handling user exception");
+ }
+
+ resp = req.getProtocolHandler()
+ .createUserExceptionResponse(req, scs);
+ OutputStream os = (OutputStream)resp.getOutputObject();
+ excany.write_value(os);
+ }
+
+ return resp;
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".sendingReply/Any<-: " + opAndId(req));
+ }
+ }
+ }
+
+ /**
+ * Handles setting the connection's code sets if required.
+ * Returns true if the CodeSetContext was in the request, false
+ * otherwise.
+ */
+ protected boolean processCodeSetContext(
+ CorbaMessageMediator request, ServiceContexts contexts)
+ {
+ try {
+ if (orb.subcontractDebugFlag) {
+ dprint(".processCodeSetContext->: " + opAndId(request));
+ }
+
+ ServiceContext sc = contexts.get(
+ CodeSetServiceContext.SERVICE_CONTEXT_ID);
+ if (sc != null) {
+ // Somehow a code set service context showed up in the local case.
+ if (request.getConnection() == null) {
+ return true;
+ }
+
+ // 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 ;
+ CodeSetComponentInfo.CodeSetContext csctx = cssc.getCodeSetContext();
+
+ // Note on threading:
+ //
+ // getCodeSetContext and setCodeSetContext are synchronized
+ // on the Connection. At worst, this will result in
+ // multiple threads entering this block and calling
+ // setCodeSetContext but not actually changing the
+ // values on the Connection.
+ //
+ // Alternative would be to lock the connection for the
+ // whole block, but it's fine either way.
+
+ // The connection's codeSetContext is null until we've received a
+ // request with a code set context with the negotiated code sets.
+ if (((CorbaConnection)request.getConnection())
+ .getCodeSetContext() == null)
+ {
+
+ // Use these code sets on this connection
+ if (orb.subcontractDebugFlag) {
+ dprint(".processCodeSetContext: " + opAndId(request)
+ + ": Setting code sets to: " + csctx);
+ }
+
+ ((CorbaConnection)request.getConnection())
+ .setCodeSetContext(csctx);
+
+ // 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
+ // the CDR stream to null any converter references
+ // it has created so that it will reacquire
+ // the code sets again using the new info.
+ //
+ // This should probably compare with the stream's
+ // 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 no code set information is ever sent from the client,
+ // the server will use ISO8859-1 for char and throw an
+ // exception for any wchar transmissions.
+ //
+ // In the local case, we use ORB provided streams for
+ // marshaling and unmarshaling. Currently, they use
+ // ISO8859-1 for char/string and UTF16 for wchar/wstring.
+ return sc != null ;
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".processCodeSetContext<-: " + opAndId(request));
+ }
+ }
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("CorbaServerRequestDispatcherImpl", msg);
+ }
+
+ protected String opAndId(CorbaMessageMediator mediator)
+ {
+ return ORBUtility.operationNameAndRequestId(mediator);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/FullServantCacheLocalCRDImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/FullServantCacheLocalCRDImpl.java
new file mode 100644
index 0000000..0b5e876
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/FullServantCacheLocalCRDImpl.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.corba.se.impl.protocol;
+
+import org.omg.CORBA.portable.ServantObject ;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.oa.OAInvocationInfo ;
+import com.sun.corba.se.spi.oa.OADestroyed ;
+
+import com.sun.corba.se.spi.ior.IOR;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.logging.POASystemException ;
+
+public class FullServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase
+{
+ public FullServantCacheLocalCRDImpl( ORB orb, int scid, IOR ior )
+ {
+ super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ) ;
+ }
+
+ public ServantObject servant_preinvoke( org.omg.CORBA.Object self,
+ String operation, Class 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 info = new OAInvocationInfo( cachedInfo, operation ) ;
+ orb.pushInvocationInfo( info ) ;
+
+ try {
+ info.oa().enter() ;
+ } catch (OADestroyed pdes) {
+ throw wrapper.preinvokePoaDestroyed( pdes ) ;
+ }
+
+ return info ;
+ }
+
+ public void servant_postinvoke(org.omg.CORBA.Object self,
+ ServantObject servantobj)
+ {
+ OAInvocationInfo cachedInfo = getCachedInfo() ;
+ cachedInfo.oa().exit() ;
+ orb.popInvocationInfo() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/INSServerRequestDispatcher.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/INSServerRequestDispatcher.java
new file mode 100644
index 0000000..9e66f6b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/INSServerRequestDispatcher.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.ObjectKey;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.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 CorbaServerRequestDispatcher
+{
+
+ private ORB orb = null;
+ private ORBUtilSystemException wrapper ;
+
+ public INSServerRequestDispatcher( ORB orb ) {
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ // 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
+ // registered then it will throw OBJECT_NOT_EXIST Exception
+ String insKey = new String( okey.getBytes(orb) );
+ return getINSReference( insKey );
+ }
+
+ public void dispatch(MessageMediator mediator)
+ {
+ CorbaMessageMediator request = (CorbaMessageMediator) mediator;
+ // 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.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 = ORBUtility.getIOR( orb.getLocalResolver().resolve( insKey ) ) ;
+ 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() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/InfoOnlyServantCacheLocalCRDImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/InfoOnlyServantCacheLocalCRDImpl.java
new file mode 100644
index 0000000..d82ac0c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/InfoOnlyServantCacheLocalCRDImpl.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.corba.se.impl.protocol;
+
+import org.omg.CORBA.portable.ServantObject ;
+
+import com.sun.corba.se.spi.oa.OAInvocationInfo ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
+
+import com.sun.corba.se.spi.ior.IOR;
+
+public class InfoOnlyServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase
+{
+ public InfoOnlyServantCacheLocalCRDImpl( ORB orb, int scid, IOR ior )
+ {
+ super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ) ;
+ }
+
+ public ServantObject servant_preinvoke( org.omg.CORBA.Object self,
+ String operation, Class 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 copy it.
+ OAInvocationInfo info = new OAInvocationInfo(cachedInfo, operation) ;
+ orb.pushInvocationInfo( info ) ;
+
+ return info ;
+ }
+
+ public void servant_postinvoke(org.omg.CORBA.Object self,
+ ServantObject servantobj)
+ {
+ orb.popInvocationInfo() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/JIDLLocalCRDImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/JIDLLocalCRDImpl.java
new file mode 100644
index 0000000..7109b4e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/JIDLLocalCRDImpl.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.portable.ServantObject;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
+
+import com.sun.corba.se.spi.ior.IOR ;
+
+import com.sun.corba.se.impl.protocol.LocalClientRequestDispatcherBase ;
+
+import com.sun.corba.se.pept.broker.Broker;
+
+public class JIDLLocalCRDImpl extends LocalClientRequestDispatcherBase
+{
+ public JIDLLocalCRDImpl( ORB orb, int scid, IOR ior )
+ {
+ super( (com.sun.corba.se.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 ;
+
+ return 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 )
+ {
+ if (servant != null && servant instanceof Tie) {
+ this.servant = new ServantObject();
+ 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
+ // null pointer exceptions happen during an colocated invocation.
+ // It is better to let the invocation proceed and get OBJECT_NOT_EXIST
+ // from the server side.
+ //ior = null;
+ servant = null;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java
new file mode 100644
index 0000000..627ca7a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/LocalClientRequestDispatcherBase.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import org.omg.CORBA.portable.ServantObject;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher;
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory;
+
+import com.sun.corba.se.spi.ior.ObjectAdapterId;
+import com.sun.corba.se.spi.ior.TaggedProfile;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
+import com.sun.corba.se.spi.ior.ObjectId;
+
+public abstract class LocalClientRequestDispatcherBase implements LocalClientRequestDispatcher
+{
+ protected ORB orb;
+ int scid;
+
+ // Cached information needed for local dispatch
+ protected boolean servantIsLocal ;
+ protected ObjectAdapterFactory oaf ;
+ protected ObjectAdapterId oaid ;
+ protected byte[] objectId ;
+
+ // If isNextIsLocalValid.get() == Boolean.TRUE,
+ // the next call to isLocal should be valid
+ private static final ThreadLocal isNextCallValid = new ThreadLocal() {
+ protected synchronized Object initialValue() {
+ return Boolean.TRUE;
+ }
+ };
+
+ 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 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
+ *
+ */
+ public boolean useLocalInvocation( org.omg.CORBA.Object self )
+ {
+ if (isNextCallValid.get() == Boolean.TRUE)
+ return servantIsLocal ;
+ else
+ isNextCallValid.set( Boolean.TRUE ) ;
+
+ 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.
+ */
+ protected boolean checkForCompatibleServant( ServantObject so,
+ Class expectedType )
+ {
+ if (so == null)
+ return false ;
+
+ // 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 )) {
+ isNextCallValid.set( Boolean.FALSE ) ;
+
+ // When servant_preinvoke returns null, the stub will
+ // recursively re-invoke itself. Thus, the next call made from
+ // the stub is another useLocalInvocation call.
+ return false ;
+ }
+
+ return true ;
+ }
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/MinimalServantCacheLocalCRDImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/MinimalServantCacheLocalCRDImpl.java
new file mode 100644
index 0000000..2a28e09
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/MinimalServantCacheLocalCRDImpl.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.corba.se.impl.protocol ;
+
+import org.omg.CORBA.portable.ServantObject ;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
+
+import com.sun.corba.se.spi.ior.IOR ;
+
+import com.sun.corba.se.spi.oa.OAInvocationInfo ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+public class MinimalServantCacheLocalCRDImpl extends ServantCacheLocalCRDBase
+{
+ public MinimalServantCacheLocalCRDImpl( ORB orb, int scid, IOR ior )
+ {
+ super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior ) ;
+ }
+
+ public ServantObject servant_preinvoke( org.omg.CORBA.Object self,
+ String operation, Class expectedType )
+ {
+ OAInvocationInfo cachedInfo = getCachedInfo() ;
+ if (checkForCompatibleServant( cachedInfo, expectedType ))
+ return cachedInfo ;
+ else
+ return null ;
+ }
+
+ public void servant_postinvoke(org.omg.CORBA.Object self,
+ ServantObject servantobj)
+ {
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/NotLocalLocalCRDImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/NotLocalLocalCRDImpl.java
new file mode 100644
index 0000000..135121f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/NotLocalLocalCRDImpl.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.portable.ServantObject;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
+
+/**
+ * @author Harold Carr
+ */
+
+public class NotLocalLocalCRDImpl implements LocalClientRequestDispatcher
+{
+ public boolean useLocalInvocation(org.omg.CORBA.Object self)
+ {
+ return false;
+ }
+
+ public boolean is_local(org.omg.CORBA.Object self)
+ {
+ return false;
+ }
+
+ 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();
+ }
+
+ public void servant_postinvoke(org.omg.CORBA.Object self,
+ ServantObject servant)
+ {
+ //throw new INTERNAL();
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/POALocalCRDImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/POALocalCRDImpl.java
new file mode 100644
index 0000000..18bb663
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/POALocalCRDImpl.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.OBJ_ADAPTER ;
+import org.omg.CORBA.UNKNOWN ;
+import org.omg.CORBA.CompletionStatus ;
+
+import org.omg.CORBA.portable.ServantObject;
+
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory;
+import com.sun.corba.se.spi.protocol.ForwardException ;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+import com.sun.corba.se.spi.oa.OAInvocationInfo ;
+import com.sun.corba.se.spi.oa.OADestroyed;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.ior.IOR ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.POASystemException ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+public class POALocalCRDImpl extends LocalClientRequestDispatcherBase
+{
+ private ORBUtilSystemException wrapper ;
+ private POASystemException poaWrapper ;
+
+ public POALocalCRDImpl( ORB orb, int scid, IOR ior)
+ {
+ super( (com.sun.corba.se.spi.orb.ORB)orb, scid, ior );
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ poaWrapper = POASystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ private OAInvocationInfo servantEnter( ObjectAdapter oa ) throws OADestroyed
+ {
+ oa.enter() ;
+
+ OAInvocationInfo info = oa.makeInvocationInfo( objectId ) ;
+ orb.pushInvocationInfo( info ) ;
+
+ return info ;
+ }
+
+ private void servantExit( ObjectAdapter oa )
+ {
+ try {
+ oa.returnServant();
+ } finally {
+ 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
+ // 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.
+ public ServantObject servant_preinvoke(org.omg.CORBA.Object self,
+ String operation,
+ Class expectedType)
+ {
+ ObjectAdapter oa = oaf.find( oaid ) ;
+ OAInvocationInfo info = null ;
+
+ try {
+ info = servantEnter( oa ) ;
+ info.setOperation( operation ) ;
+ } catch ( OADestroyed ex ) {
+ // Destroyed POAs can be recreated by normal adapter activation.
+ // So just reinvoke this method.
+ return servant_preinvoke(self, operation, expectedType);
+ }
+
+ try {
+ try {
+ oa.getInvocationServant( info );
+ if (!checkForCompatibleServant( info, expectedType ))
+ return null ;
+ } catch (Throwable thr) {
+ // Cleanup after this call, then throw to allow
+ // outer try to handle the exception appropriately.
+ servantExit( oa ) ;
+ throw thr ;
+ }
+ } catch ( ForwardException ex ) {
+ /* REVISIT
+ ClientRequestDispatcher csub = (ClientRequestDispatcher)
+ StubAdapter.getDelegate( ex.forward_reference ) ;
+ IOR ior = csub.getIOR() ;
+ setLocatedIOR( ior ) ;
+ */
+ RuntimeException runexc = new RuntimeException("deal with this.");
+ runexc.initCause( ex ) ;
+ throw runexc ;
+ } catch ( ThreadDeath ex ) {
+ // ThreadDeath on the server side should not cause a client
+ // 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.
+ throw wrapper.runtimeexception( ex ) ;
+ } catch ( Throwable t ) {
+ if (t instanceof SystemException)
+ throw (SystemException)t ;
+
+ throw poaWrapper.localServantLookup( t ) ;
+ }
+
+ if (!checkForCompatibleServant( info, expectedType )) {
+ servantExit( oa ) ;
+ return null ;
+ }
+
+ return info;
+ }
+
+ public void servant_postinvoke(org.omg.CORBA.Object self,
+ ServantObject servantobj)
+ {
+ ObjectAdapter oa = orb.peekInvocationInfo().oa() ;
+ servantExit( oa ) ;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/RequestCanceledException.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/RequestCanceledException.java
new file mode 100644
index 0000000..f5920b1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/RequestCanceledException.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+/**
+ * If this exception is caught explicitly, this need to be rethrown.
+ */
+public class RequestCanceledException extends RuntimeException {
+
+ private int requestId = 0;
+
+ public RequestCanceledException(int requestId) {
+ this.requestId = requestId;
+ }
+
+ public int getRequestId() {
+ return this.requestId;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/RequestDispatcherRegistryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/RequestDispatcherRegistryImpl.java
new file mode 100644
index 0000000..d264f21
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/RequestDispatcherRegistryImpl.java
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import java.util.Set;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.Collections;
+
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher ;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
+
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+import com.sun.corba.se.impl.orbutil.DenseIntMapImpl ;
+
+/**
+ * This is a registry of all subcontract ID dependent objects. This includes:
+ * LocalClientRequestDispatcherFactory, ClientRequestDispatcher, ServerSubcontract, and
+ * ObjectAdapterFactory.
+ */
+public class RequestDispatcherRegistryImpl implements RequestDispatcherRegistry {
+ private ORB orb;
+
+ 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 ; // ServerRequestDispatcher registry
+ private DenseIntMapImpl CSRegistry ; // ClientRequestDispatcher registry
+ private DenseIntMapImpl OAFRegistry ; // ObjectAdapterFactory registry
+ private DenseIntMapImpl LCSFRegistry ; // LocalClientRequestDispatcherFactory registry
+ private Set objectAdapterFactories ; // Set of all ObjectAdapterFactory instances
+ private Set objectAdapterFactoriesView ; // Read-only view of oaf instances
+ private Map stringToServerSubcontract ; // Map from obect key string to
+ // ServerSubcontract
+ // for special bootstrap IORs
+
+ public RequestDispatcherRegistryImpl(ORB orb, int defaultId )
+ {
+ this.orb = orb;
+ 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() ;
+ }
+
+ 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 registerServerRequestDispatcher(
+ CorbaServerRequestDispatcher ssc, int scid)
+ {
+ SDRegistry.set( scid, ssc ) ;
+ }
+
+ public synchronized void registerServerRequestDispatcher(
+ CorbaServerRequestDispatcher scc, String name )
+ {
+ stringToServerSubcontract.put( name, scc ) ;
+ }
+
+ public synchronized void registerObjectAdapterFactory(
+ ObjectAdapterFactory oaf, int scid)
+ {
+ objectAdapterFactories.add( oaf ) ;
+ OAFRegistry.set( scid, oaf ) ;
+ }
+
+ // **************************************************
+ // Methods to find the subcontract side subcontract
+ // **************************************************
+
+ // 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
+ // result in a lookup in the named key table (stringToServerSubcontract),
+ // which must return a valid ServerRequestDispatcher. A bad subcontract ID
+ // will similarly need to return the default ServerRequestDispatcher.
+
+ public CorbaServerRequestDispatcher getServerRequestDispatcher(int scid)
+ {
+ CorbaServerRequestDispatcher sdel =
+ (CorbaServerRequestDispatcher)(SDRegistry.get(scid)) ;
+ if ( sdel == null )
+ sdel = (CorbaServerRequestDispatcher)(SDRegistry.get(defaultId)) ;
+
+ return sdel;
+ }
+
+ public CorbaServerRequestDispatcher getServerRequestDispatcher( String name )
+ {
+ CorbaServerRequestDispatcher sdel =
+ (CorbaServerRequestDispatcher)stringToServerSubcontract.get( name ) ;
+
+ if ( sdel == null )
+ sdel = (CorbaServerRequestDispatcher)(SDRegistry.get(defaultId)) ;
+
+ return sdel;
+ }
+
+ public LocalClientRequestDispatcherFactory getLocalClientRequestDispatcherFactory(
+ int scid )
+ {
+ LocalClientRequestDispatcherFactory factory =
+ (LocalClientRequestDispatcherFactory)(LCSFRegistry.get(scid)) ;
+ if (factory == null) {
+ factory = (LocalClientRequestDispatcherFactory)(LCSFRegistry.get(defaultId)) ;
+ }
+
+ return factory ;
+ }
+
+ public ClientRequestDispatcher getClientRequestDispatcher( int scid )
+ {
+ ClientRequestDispatcher subcontract =
+ (ClientRequestDispatcher)(CSRegistry.get(scid)) ;
+ if (subcontract == null) {
+ subcontract = (ClientRequestDispatcher)(CSRegistry.get(defaultId)) ;
+ }
+
+ return subcontract ;
+ }
+
+ public ObjectAdapterFactory getObjectAdapterFactory( int scid )
+ {
+ ObjectAdapterFactory oaf =
+ (ObjectAdapterFactory)(OAFRegistry.get(scid)) ;
+ if ( oaf == null )
+ oaf = (ObjectAdapterFactory)(OAFRegistry.get(defaultId)) ;
+
+ return oaf;
+ }
+
+ public Set getObjectAdapterFactories()
+ {
+ return objectAdapterFactoriesView ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/ServantCacheLocalCRDBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/ServantCacheLocalCRDBase.java
new file mode 100644
index 0000000..76b935f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/ServantCacheLocalCRDBase.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import org.omg.CORBA.BAD_OPERATION ;
+import org.omg.CORBA.INTERNAL ;
+import org.omg.CORBA.SystemException ;
+import org.omg.CORBA.CompletionStatus ;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher;
+import com.sun.corba.se.spi.protocol.ForwardException;
+
+// XXX This should be in the SPI
+import com.sun.corba.se.impl.protocol.LocalClientRequestDispatcherBase;
+
+import com.sun.corba.se.spi.oa.OAInvocationInfo;
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+import com.sun.corba.se.spi.oa.OADestroyed;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.ior.IOR ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.POASystemException;
+
+public abstract class ServantCacheLocalCRDBase extends LocalClientRequestDispatcherBase
+{
+
+ private OAInvocationInfo cachedInfo ;
+ protected POASystemException wrapper ;
+
+ protected ServantCacheLocalCRDBase( ORB orb, int scid, IOR ior )
+ {
+ super( orb, scid, ior ) ;
+ wrapper = POASystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ protected synchronized OAInvocationInfo getCachedInfo()
+ {
+ if (!servantIsLocal)
+ throw wrapper.servantMustBeLocal() ;
+
+ if (cachedInfo == null) {
+ ObjectAdapter oa = oaf.find( oaid ) ;
+ cachedInfo = oa.makeInvocationInfo( objectId ) ;
+
+ // InvocationInfo must be pushed before calling getInvocationServant
+ orb.pushInvocationInfo( cachedInfo ) ;
+
+ try {
+ oa.enter( );
+ oa.getInvocationServant( cachedInfo ) ;
+ } catch (ForwardException freq) {
+ throw wrapper.illegalForwardRequest( freq ) ;
+ } catch( OADestroyed oades ) {
+ // This is an error since no user of this implementation
+ // should ever throw this exception
+ throw wrapper.adapterDestroyed( oades ) ;
+ } finally {
+ oa.returnServant( );
+ oa.exit( );
+ orb.popInvocationInfo() ;
+ }
+ }
+
+ return cachedInfo ;
+ }
+}
+
+// End of File
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java
new file mode 100644
index 0000000..9f9a5f6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/SharedCDRClientRequestDispatcherImpl.java
@@ -0,0 +1,237 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.protocol;
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.rmi.RemoteException;
+import java.nio.ByteBuffer;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import javax.rmi.CORBA.Util;
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.WrongTransaction;
+import org.omg.CORBA.Request;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.DATA_CONVERSION;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA.portable.RemarshalException;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.portable.ServantObject;
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.IOP.TAG_CODE_SETS;
+
+import com.sun.org.omg.SendingContext.CodeBase;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ConnectionCache;
+import com.sun.corba.se.pept.transport.ContactInfo;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate;
+import com.sun.corba.se.spi.ior.iiop.CodeSetsComponent;
+import com.sun.corba.se.spi.oa.OAInvocationInfo;
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersion;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
+import com.sun.corba.se.spi.transport.CorbaContactInfo ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator ;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContext;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.servicecontext.UEInfoServiceContext;
+import com.sun.corba.se.spi.servicecontext.CodeSetServiceContext;
+import com.sun.corba.se.spi.servicecontext.MaxStreamFormatVersionServiceContext;
+import com.sun.corba.se.spi.servicecontext.SendingContextServiceContext;
+import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
+import com.sun.corba.se.impl.encoding.CDRInputObject;
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
+import com.sun.corba.se.impl.encoding.CodeSetConversion;
+import com.sun.corba.se.impl.encoding.MarshalOutputStream;
+import com.sun.corba.se.impl.encoding.MarshalInputStream;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr;
+import com.sun.corba.se.impl.transport.CorbaContactInfoListIteratorImpl;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.util.JDKBridge;
+
+/**
+ * ClientDelegate is the RMI client-side subcontract or representation
+ * It implements RMI delegate as well as our internal ClientRequestDispatcher
+ * interface.
+ */
+public class SharedCDRClientRequestDispatcherImpl
+ extends
+ CorbaClientRequestDispatcherImpl
+{
+ // REVISIT:
+ // Rather than have separate CDR subcontract,
+ // use same CorbaClientRequestDispatcherImpl but have
+ // different MessageMediator finishSendingRequest and waitForResponse
+ // handle what is done below.
+ // Benefit: then in ContactInfo no need to do a direct new
+ // of subcontract - does not complicate subcontract registry.
+
+ public InputObject marshalingComplete(java.lang.Object self,
+ OutputObject outputObject)
+ throws
+ ApplicationException,
+ org.omg.CORBA.portable.RemarshalException
+ {
+ ORB orb = null;
+ CorbaMessageMediator messageMediator = null;
+ try {
+ messageMediator = (CorbaMessageMediator)
+ outputObject.getMessageMediator();
+
+ orb = (ORB) messageMediator.getBroker();
+
+ if (orb.subcontractDebugFlag) {
+ dprint(".marshalingComplete->: " + opAndId(messageMediator));
+ }
+
+ CDROutputObject cdrOutputObject = (CDROutputObject) outputObject;
+
+ //
+ // Create server-side input object.
+ //
+
+ ByteBufferWithInfo bbwi = cdrOutputObject.getByteBufferWithInfo();
+ cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
+ final ORB inOrb = orb;
+ final ByteBuffer inBuffer = bbwi.byteBuffer;
+ final Message inMsg = cdrOutputObject.getMessageHeader();
+ CDRInputObject cdrInputObject = AccessController
+ .doPrivileged(new PrivilegedAction<CDRInputObject>() {
+ @Override
+ public CDRInputObject run() {
+ return new CDRInputObject(inOrb, null, inBuffer,
+ inMsg);
+ }
+ });
+ messageMediator.setInputObject(cdrInputObject);
+ cdrInputObject.setMessageMediator(messageMediator);
+
+ //
+ // Dispatch
+ //
+
+ // REVISIT: Impl cast.
+ ((CorbaMessageMediatorImpl)messageMediator).handleRequestRequest(
+ messageMediator);
+
+ // InputStream must be closed on the InputObject so that its
+ // ByteBuffer can be released to the ByteBufferPool. We must do
+ // this before we re-assign the cdrInputObject reference below.
+ try { cdrInputObject.close(); }
+ catch (IOException ex) {
+ // No need to do anything since we're done with the input stream
+ // and cdrInputObject will be re-assigned a new client-side input
+ // object, (i.e. won't result in a corba error).
+
+ if (orb.transportDebugFlag) {
+ dprint(".marshalingComplete: ignoring IOException - " + ex.toString());
+ }
+ }
+
+ //
+ // Create client-side input object
+ //
+
+ cdrOutputObject = (CDROutputObject) messageMediator.getOutputObject();
+ bbwi = cdrOutputObject.getByteBufferWithInfo();
+ cdrOutputObject.getMessageHeader().setSize(bbwi.byteBuffer, bbwi.getSize());
+ final ORB inOrb2 = orb;
+ final ByteBuffer inBuffer2 = bbwi.byteBuffer;
+ final Message inMsg2 = cdrOutputObject.getMessageHeader();
+ cdrInputObject = AccessController
+ .doPrivileged(new PrivilegedAction<CDRInputObject>() {
+ @Override
+ public CDRInputObject run() {
+ return new CDRInputObject(inOrb2, null, inBuffer2,
+ inMsg2);
+ }
+ });
+ messageMediator.setInputObject(cdrInputObject);
+ cdrInputObject.setMessageMediator(messageMediator);
+
+ cdrInputObject.unmarshalHeader();
+
+ InputObject inputObject = cdrInputObject;
+
+ return processResponse(orb, messageMediator, inputObject);
+
+ } finally {
+ if (orb.subcontractDebugFlag) {
+ dprint(".marshalingComplete<-: " + opAndId(messageMediator));
+ }
+ }
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("SharedCDRClientRequestDispatcherImpl", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/SpecialMethod.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/SpecialMethod.java
new file mode 100644
index 0000000..262c6e0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/SpecialMethod.java
@@ -0,0 +1,168 @@
+/*
+ * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol ;
+
+import javax.rmi.CORBA.Tie;
+
+import org.omg.CORBA.SystemException ;
+import org.omg.CORBA.NO_IMPLEMENT ;
+import org.omg.CORBA.OBJECT_NOT_EXIST ;
+import org.omg.CORBA.CompletionStatus ;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+import com.sun.corba.se.spi.oa.NullServant ;
+
+public abstract class SpecialMethod {
+ public abstract boolean isNonExistentMethod() ;
+ public abstract String getName();
+ public abstract CorbaMessageMediator invoke(java.lang.Object servant,
+ CorbaMessageMediator request,
+ byte[] objectId,
+ ObjectAdapter objectAdapter);
+
+ public static final SpecialMethod getSpecialMethod(String operation) {
+ for(int i = 0; i < methods.length; i++)
+ if (methods[i].getName().equals(operation))
+ return methods[i];
+ return null;
+ }
+
+ static SpecialMethod[] methods = {
+ new IsA(),
+ new GetInterface(),
+ new NonExistent(),
+ new NotExistent()
+ };
+}
+
+class NonExistent extends SpecialMethod {
+ public boolean isNonExistentMethod()
+ {
+ return true ;
+ }
+
+ public String getName() { // _non_existent
+ return "_non_existent";
+ }
+
+ public CorbaMessageMediator invoke(java.lang.Object servant,
+ CorbaMessageMediator request,
+ byte[] objectId,
+ ObjectAdapter objectAdapter)
+ {
+ boolean result = (servant == null) || (servant instanceof NullServant) ;
+ CorbaMessageMediator response =
+ request.getProtocolHandler().createResponse(request, null);
+ ((OutputStream)response.getOutputObject()).write_boolean(result);
+ return response;
+ }
+}
+
+class NotExistent extends NonExistent {
+ public String getName() { // _not_existent
+ return "_not_existent";
+ }
+}
+
+class IsA extends SpecialMethod { // _is_a
+ public boolean isNonExistentMethod()
+ {
+ return false ;
+ }
+
+ public String getName() {
+ return "_is_a";
+ }
+ public CorbaMessageMediator invoke(java.lang.Object servant,
+ CorbaMessageMediator request,
+ byte[] objectId,
+ ObjectAdapter objectAdapter)
+ {
+ if ((servant == null) || (servant instanceof NullServant)) {
+ ORB orb = (ORB)request.getBroker() ;
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.OA_INVOCATION ) ;
+
+ return request.getProtocolHandler().createSystemExceptionResponse(
+ request, wrapper.badSkeleton(), null);
+ }
+
+ String[] ids = objectAdapter.getInterfaces( servant, objectId );
+ String clientId =
+ ((InputStream)request.getInputObject()).read_string();
+ boolean answer = false;
+ for(int i = 0; i < ids.length; i++)
+ if (ids[i].equals(clientId)) {
+ answer = true;
+ break;
+ }
+
+ CorbaMessageMediator 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 ;
+ }
+
+ public String getName() {
+ return "_interface";
+ }
+ public CorbaMessageMediator invoke(java.lang.Object servant,
+ CorbaMessageMediator request,
+ byte[] objectId,
+ ObjectAdapter objectAdapter)
+ {
+ ORB orb = (ORB)request.getBroker() ;
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.OA_INVOCATION ) ;
+
+ if ((servant == null) || (servant instanceof NullServant)) {
+ return request.getProtocolHandler().createSystemExceptionResponse(
+ request, wrapper.badSkeleton(), null);
+ } else {
+ return request.getProtocolHandler().createSystemExceptionResponse(
+ request, wrapper.getinterfaceNotImplemented(), null);
+ }
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java
new file mode 100644
index 0000000..9d446fe
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+
+/**
+* com/sun/corba/se/impl/protocol/giopmsgheaders/AddressingDispositionHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ../../../../../../../src/share/classes/com/sun/corba/se/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";
+
+ 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 ());
+ }
+
+ 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.se.impl.protocol.giopmsgheaders.AddressingDispositionHelper.id (), "AddressingDisposition", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ 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 void write (org.omg.CORBA.portable.OutputStream ostream, short value)
+ {
+ ostream.write_short (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage.java
new file mode 100644
index 0000000..b32b655
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+/**
+ * This interface captures the CancelRequestMessage contract.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public interface CancelRequestMessage extends Message {
+ int CANCEL_REQ_MSG_SIZE = 4;
+ int getRequestId();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_0.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_0.java
new file mode 100644
index 0000000..157281b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_0.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+/**
+ * This implements the GIOP 1.0 CancelRequest header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class CancelRequestMessage_1_0 extends Message_1_0
+ implements CancelRequestMessage {
+
+ // Instance variables
+
+ private int request_id = (int) 0;
+
+ // Constructors
+
+ CancelRequestMessage_1_0() {}
+
+ CancelRequestMessage_1_0(int _request_id) {
+ super(Message.GIOPBigMagic, false, Message.GIOPCancelRequest,
+ CANCEL_REQ_MSG_SIZE);
+ request_id = _request_id;
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong(this.request_id);
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class CancelRequestMessage_1_0
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_1.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_1.java
new file mode 100644
index 0000000..d6e304b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_1.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+/**
+ * This implements the GIOP 1.1 CancelRequest header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class CancelRequestMessage_1_1 extends Message_1_1
+ implements CancelRequestMessage {
+
+ // Instance variables
+
+ private int request_id = (int) 0;
+
+ // Constructors
+
+ 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);
+ request_id = _request_id;
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong(this.request_id);
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class CancelRequestMessage_1_1
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_2.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_2.java
new file mode 100644
index 0000000..21da05a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/CancelRequestMessage_1_2.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+/**
+ * This implements the GIOP 1.2 CancelRequest header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class CancelRequestMessage_1_2 extends Message_1_1
+ implements CancelRequestMessage {
+
+ // Instance variables
+
+ private int request_id = (int) 0;
+
+ // Constructors
+
+ 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);
+ request_id = _request_id;
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong(this.request_id);
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class CancelRequestMessage_1_2
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage.java
new file mode 100644
index 0000000..25fd38c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+/**
+ * This interface captures the FragmentMessage contract.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public interface FragmentMessage extends Message {
+ int getRequestId();
+ int getHeaderLength();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_1.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_1.java
new file mode 100644
index 0000000..652b6fd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_1.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+/**
+ * This implements the GIOP 1.1 Fragment header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class FragmentMessage_1_1 extends Message_1_1
+ implements FragmentMessage {
+
+ // Constructors
+
+ FragmentMessage_1_1() {}
+
+ FragmentMessage_1_1(Message_1_1 msg11) {
+ this.magic = msg11.magic;
+ this.GIOP_version = msg11.GIOP_version;
+ this.flags = msg11.flags;
+ this.message_type = GIOPFragment;
+ this.message_size = 0;
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return -1; // 1.1 has no fragment header and so no request_id
+ }
+
+ public int getHeaderLength() {
+ return GIOPMessageHeaderLength;
+ }
+
+ // IO methods
+
+ /* 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) {
+ super.read(istream);
+ }
+
+ /* 1.1 has no request_id; so nothing to write */
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class FragmentMessage_1_1
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_2.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_2.java
new file mode 100644
index 0000000..63b7e7b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/FragmentMessage_1_2.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+/**
+ * This implements the GIOP 1.2 Fragment header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class FragmentMessage_1_2 extends Message_1_2
+ implements FragmentMessage {
+
+ // Constructors
+
+ FragmentMessage_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);
+ this.message_type = GIOPFragment;
+ request_id = _request_id;
+ }
+
+ FragmentMessage_1_2(Message_1_1 msg12) {
+ this.magic = msg12.magic;
+ this.GIOP_version = msg12.GIOP_version;
+ this.flags = msg12.flags;
+ this.message_type = GIOPFragment;
+ 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;
+ }
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public int getHeaderLength() {
+ return GIOPMessageHeaderLength + 4;
+ }
+
+ // IO methods
+
+ /* 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) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong(this.request_id);
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class FragmentMessage_1_2
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfo.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfo.java
new file mode 100644
index 0000000..89805d8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfo.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+
+/**
+* com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfo.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ../../../../../../../src/share/classes/com/sun/corba/se/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 IORAddressingInfo ()
+ {
+ } // 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/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java
new file mode 100644
index 0000000..6499b43
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+
+/**
+* com/sun/corba/se/impl/protocol/giopmsgheaders/IORAddressingInfoHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ../../../../../../../src/share/classes/com/sun/corba/se/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";
+
+ public static void insert (org.omg.CORBA.Any a, com.sun.corba.se.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.se.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;
+ 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.se.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.id (), "IORAddressingInfo", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo read (org.omg.CORBA.portable.InputStream istream)
+ {
+ com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo value = new com.sun.corba.se.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.se.impl.protocol.giopmsgheaders.IORAddressingInfo value)
+ {
+ ostream.write_ulong (value.selected_profile_index);
+ org.omg.IOP.IORHelper.write (ostream, value.ior);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/KeyAddr.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/KeyAddr.java
new file mode 100644
index 0000000..c06a0ae
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/KeyAddr.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+
+/**
+* com/sun/corba/se/impl/protocol/giopmsgheaders/KeyAddr.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl
+* Sunday, June 4, 2000 5:18:54 PM PDT
+*/
+
+public interface KeyAddr
+{
+ public static final short value = (short)(0);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage.java
new file mode 100644
index 0000000..f87710c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.SystemException;
+import com.sun.corba.se.spi.ior.IOR;
+
+/**
+ * This interface captures the LocateReplyMessage contract.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public interface LocateReplyMessage extends Message, LocateReplyOrReplyMessage {
+
+ int UNKNOWN_OBJECT = 0;
+ int OBJECT_HERE = 1;
+ int OBJECT_FORWARD = 2;
+ int OBJECT_FORWARD_PERM = 3; // 1.2
+ int LOC_SYSTEM_EXCEPTION = 4; // 1.2
+ int LOC_NEEDS_ADDRESSING_MODE = 5; // 1.2
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_0.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_0.java
new file mode 100644
index 0000000..2427c79
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_0.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.SystemException;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/**
+ * This implements the GIOP 1.0 LocateReply header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class LocateReplyMessage_1_0 extends Message_1_0
+ implements LocateReplyMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private int request_id = (int) 0;
+ private int locate_status = (int) 0;
+ private IOR ior = null;
+
+ // Constructors
+
+ LocateReplyMessage_1_0(ORB orb) {
+ this.orb = orb;
+ }
+
+ 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;
+ locate_status = _locate_status;
+ ior = _ior;
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public int getReplyStatus() {
+ return this.locate_status;
+ }
+
+ public short getAddrDisposition() {
+ return KeyAddr.value;
+ }
+
+ public SystemException getSystemException(String message) {
+ return null; // 1.0 LocateReply body does not contain SystemException
+ }
+
+ public IOR getIOR() {
+ return this.ior;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ this.locate_status = istream.read_long();
+ isValidReplyStatus(this.locate_status); // raises exception on error
+
+ // The code below reads the reply body if status is OBJECT_FORWARD
+ if (this.locate_status == OBJECT_FORWARD) {
+ CDRInputStream cdr = (CDRInputStream) istream;
+ this.ior = IORFactories.makeIOR( cdr ) ;
+ }
+ }
+
+ // Note, this writes only the header information.
+ // IOR may be written afterwards into the reply mesg body.
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong(this.request_id);
+ ostream.write_long(this.locate_status);
+ }
+
+ // Static methods
+
+ public static void isValidReplyStatus(int replyStatus) {
+ switch (replyStatus) {
+ case UNKNOWN_OBJECT :
+ case OBJECT_HERE :
+ case OBJECT_FORWARD :
+ break;
+ default :
+ ORBUtilSystemException localWrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class LocateReplyMessage_1_0
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_1.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_1.java
new file mode 100644
index 0000000..08e6e05
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_1.java
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.SystemException;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/**
+ * This implements the GIOP 1.1 LocateReply header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class LocateReplyMessage_1_1 extends Message_1_1
+ implements LocateReplyMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private int request_id = (int) 0;
+ private int reply_status = (int) 0;
+ private IOR ior = null;
+
+ // Constructors
+
+ LocateReplyMessage_1_1(ORB orb) {
+ 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);
+ this.orb = orb;
+ request_id = _request_id;
+ reply_status = _reply_status;
+ ior = _ior;
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public int getReplyStatus() {
+ return this.reply_status;
+ }
+
+ public short getAddrDisposition() {
+ return KeyAddr.value;
+ }
+
+ public SystemException getSystemException(String message) {
+ return null; // 1.0 LocateReply body does not contain SystemException
+ }
+
+ public IOR getIOR() {
+ return this.ior;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ this.reply_status = istream.read_long();
+ isValidReplyStatus(this.reply_status); // raises exception on error
+
+ // The code below reads the reply body if status is OBJECT_FORWARD
+ if (this.reply_status == OBJECT_FORWARD) {
+ CDRInputStream cdr = (CDRInputStream) istream;
+ this.ior = IORFactories.makeIOR( cdr ) ;
+ }
+ }
+
+ // Note, this writes only the header information. SystemException or
+ // IOR may be written afterwards into the reply mesg body.
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong(this.request_id);
+ ostream.write_long(this.reply_status);
+ }
+
+ // Static methods
+
+ public static void isValidReplyStatus(int replyStatus) {
+ switch (replyStatus) {
+ case UNKNOWN_OBJECT :
+ case OBJECT_HERE :
+ case OBJECT_FORWARD :
+ break;
+ default :
+ ORBUtilSystemException localWrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class LocateReplyMessage_1_1
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java
new file mode 100644
index 0000000..8274de6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyMessage_1_2.java
@@ -0,0 +1,194 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/**
+ * This implements the GIOP 1.2 LocateReply header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class LocateReplyMessage_1_2 extends Message_1_2
+ implements LocateReplyMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private ORBUtilSystemException wrapper = null ;
+ private int reply_status = (int) 0;
+ private IOR ior = null;
+ private String exClassName = null;
+ private int minorCode = (int) 0;
+ private CompletionStatus completionStatus = null;
+ private short addrDisposition = KeyAddr.value; // default;
+
+ // Constructors
+
+ LocateReplyMessage_1_2(ORB orb) {
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ 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;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ request_id = _request_id;
+ reply_status = _reply_status;
+ ior = _ior;
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public int getReplyStatus() {
+ return this.reply_status;
+ }
+
+ public short getAddrDisposition() {
+ return this.addrDisposition;
+ }
+
+ public SystemException getSystemException(String message) {
+ return MessageBase.getSystemException(
+ exClassName, minorCode, completionStatus, message, wrapper);
+ }
+
+ public IOR getIOR() {
+ return this.ior;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ this.reply_status = istream.read_long();
+ isValidReplyStatus(this.reply_status); // raises exception on error
+
+ // GIOP 1.2 LocateReply message bodies are not aligned on
+ // 8 byte boundaries.
+
+ // The code below reads the reply body in some cases
+ // LOC_SYSTEM_EXCEPTION & OBJECT_FORWARD & OBJECT_FORWARD_PERM &
+ // LOC_NEEDS_ADDRESSING_MODE
+ if (this.reply_status == LOC_SYSTEM_EXCEPTION) {
+
+ String reposId = istream.read_string();
+ this.exClassName = ORBUtility.classNameOf(reposId);
+ this.minorCode = istream.read_long();
+ 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(
+ CompletionStatus.COMPLETED_MAYBE, new Integer(status) );
+ }
+ } else if ( (this.reply_status == OBJECT_FORWARD) ||
+ (this.reply_status == OBJECT_FORWARD_PERM) ){
+ CDRInputStream cdr = (CDRInputStream) istream;
+ this.ior = IORFactories.makeIOR( cdr ) ;
+ } else if (this.reply_status == LOC_NEEDS_ADDRESSING_MODE) {
+ // read GIOP::AddressingDisposition from body and resend the
+ // original request using the requested addressing mode. The
+ // resending is transparent to the caller.
+ this.addrDisposition = AddressingDispositionHelper.read(istream);
+ }
+ }
+
+ // Note, this writes only the header information. SystemException or
+ // IOR or GIOP::AddressingDisposition may be written afterwards into the
+ // reply mesg body.
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(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.
+ }
+
+ // Static methods
+
+ 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 :
+ ORBUtilSystemException localWrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class LocateReplyMessage_1_2
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java
new file mode 100644
index 0000000..8a66b59
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateReplyOrReplyMessage.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.SystemException;
+import com.sun.corba.se.spi.ior.IOR;
+
+public interface LocateReplyOrReplyMessage extends Message {
+
+ int getRequestId();
+ int getReplyStatus();
+ SystemException getSystemException(String message);
+ IOR getIOR();
+ short getAddrDisposition();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage.java
new file mode 100644
index 0000000..585cdda
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import com.sun.corba.se.spi.ior.ObjectKey;
+
+/**
+ * This interface captures the LocateRequestMessage contract.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public interface LocateRequestMessage extends Message {
+ int getRequestId();
+ ObjectKey getObjectKey();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java
new file mode 100644
index 0000000..39cd1d8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_0.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.ior.ObjectKey;
+
+/**
+ * This implements the GIOP 1.0 LocateRequest header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class LocateRequestMessage_1_0 extends Message_1_0
+ implements LocateRequestMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private int request_id = (int) 0;
+ private byte[] object_key = null;
+ private ObjectKey objectKey = null;
+
+ // Constructor
+
+ LocateRequestMessage_1_0(ORB orb) {
+ this.orb = orb;
+ }
+
+ LocateRequestMessage_1_0(ORB orb, int _request_id, byte[] _object_key) {
+ super(Message.GIOPBigMagic, false, Message.GIOPLocateRequest, 0);
+ this.orb = orb;
+ request_id = _request_id;
+ object_key = _object_key;
+ }
+
+ // Accessor methods (LocateRequestMessage interface)
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public ObjectKey getObjectKey() {
+ if (this.objectKey == null) {
+ // this will raise a MARSHAL exception upon errors.
+ this.objectKey = MessageBase.extractObjectKey(object_key, orb);
+ }
+
+ return this.objectKey;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream 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);
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong(this.request_id);
+ nullCheck(this.object_key);
+ ostream.write_long(this.object_key.length);
+ ostream.write_octet_array(this.object_key, 0, this.object_key.length);
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class LocateRequestMessage_1_0
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java
new file mode 100644
index 0000000..0a9b20a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_1.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.ior.ObjectKey;
+
+/**
+ * This implements the GIOP 1.1 LocateRequest header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class LocateRequestMessage_1_1 extends Message_1_1
+ implements LocateRequestMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private int request_id = (int) 0;
+ private byte[] object_key = null;
+ private ObjectKey objectKey = null;
+
+ // Constructors
+
+ LocateRequestMessage_1_1(ORB orb) {
+ this.orb = orb;
+ }
+
+ 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);
+ this.orb = orb;
+ request_id = _request_id;
+ object_key = _object_key;
+ }
+
+ // Accessor methods (LocateRequestMessage interface)
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public ObjectKey getObjectKey() {
+ if (this.objectKey == null) {
+ // this will raise a MARSHAL exception upon errors.
+ this.objectKey = MessageBase.extractObjectKey(object_key, orb);
+ }
+
+ return this.objectKey;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ int _len1 = istream.read_long();
+ this.object_key = new byte[_len1];
+ istream.read_octet_array(this.object_key, 0, _len1);
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong(this.request_id);
+ nullCheck(this.object_key);
+ ostream.write_long(this.object_key.length);
+ ostream.write_octet_array(this.object_key, 0, this.object_key.length);
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class LocateRequestMessage_1_1
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java
new file mode 100644
index 0000000..2020994
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/LocateRequestMessage_1_2.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import com.sun.corba.se.spi.ior.ObjectKey;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+
+/**
+ * This implements the GIOP 1.2 LocateRequest header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class LocateRequestMessage_1_2 extends Message_1_2
+ implements LocateRequestMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private ObjectKey objectKey = null;
+ private TargetAddress target = null;
+
+ // Constructors
+
+ LocateRequestMessage_1_2(ORB orb) {
+ this.orb = orb;
+ }
+
+ LocateRequestMessage_1_2(ORB orb, int _request_id, TargetAddress _target) {
+ super(Message.GIOPBigMagic, GIOPVersion.V1_2, FLAG_NO_FRAG_BIG_ENDIAN,
+ Message.GIOPLocateRequest, 0);
+ this.orb = orb;
+ request_id = _request_id;
+ target = _target;
+ }
+
+ // Accessor methods (LocateRequestMessage interface)
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public ObjectKey getObjectKey() {
+ if (this.objectKey == null) {
+ // this will raise a MARSHAL exception upon errors.
+ this.objectKey = MessageBase.extractObjectKey(target, orb);
+ }
+
+ return this.objectKey;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ this.target = TargetAddressHelper.read(istream);
+ getObjectKey(); // this does AddressingDisposition check
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong (this.request_id);
+ nullCheck(this.target);
+ TargetAddressHelper.write(ostream, this.target);
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class LocateRequestMessage_1_2
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message.java
new file mode 100644
index 0000000..fae4a24
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+/**
+ * This is the base interface for different message type interfaces.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public interface Message {
+
+ // Generic constants
+
+ int defaultBufferSize = 1024;
+ int GIOPBigEndian = 0;
+ int GIOPLittleEndian = 1;
+ int GIOPBigMagic = 0x47494F50;
+ int GIOPLittleMagic = 0x504F4947;
+ int GIOPMessageHeaderLength = 12;
+
+ // Other useful constants
+
+ byte LITTLE_ENDIAN_BIT = 0x01;
+ byte MORE_FRAGMENTS_BIT = 0x02;
+ byte FLAG_NO_FRAG_BIG_ENDIAN = 0x00;
+ static final byte TRAILING_TWO_BIT_BYTE_MASK = 0x3;
+ static final byte THREAD_POOL_TO_USE_MASK = 0x3F;
+
+ // Encoding related constants
+
+ byte CDR_ENC_VERSION = 0x00;
+ byte JAVA_ENC_VERSION = 0x01;
+
+ // Message types
+
+ byte GIOPRequest = 0;
+ byte GIOPReply = 1;
+ byte GIOPCancelRequest = 2;
+ byte GIOPLocateRequest = 3;
+ byte GIOPLocateReply = 4;
+ byte GIOPCloseConnection = 5;
+ byte GIOPMessageError = 6;
+ byte GIOPFragment = 7; // 1.1 & 1.2:
+
+ // Accessor methods
+
+ GIOPVersion getGIOPVersion();
+ byte getEncodingVersion();
+ boolean isLittleEndian();
+ boolean moreFragmentsToFollow();
+ int getType();
+ int getSize();
+ ByteBuffer getByteBuffer();
+ int getThreadPoolToUse();
+
+ // Mutator methods
+
+ void read(org.omg.CORBA.portable.InputStream istream);
+ void write(org.omg.CORBA.portable.OutputStream ostream);
+
+ void setSize(ByteBuffer byteBuffer, int size);
+
+ FragmentMessage createFragmentMessage();
+
+ void callback(MessageHandler handler) throws IOException;
+
+ void setByteBuffer(ByteBuffer byteBuffer);
+ void setEncodingVersion(byte version);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java
new file mode 100644
index 0000000..6559be7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageBase.java
@@ -0,0 +1,967 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import java.io.IOException;
+import java.lang.Class;
+import java.lang.reflect.Constructor;
+import java.nio.ByteBuffer;
+import java.util.Iterator;
+
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.SystemException;
+import org.omg.IOP.TaggedProfile;
+
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+
+import com.sun.corba.se.spi.ior.ObjectKey;
+import com.sun.corba.se.spi.ior.ObjectId;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile;
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.ior.iiop.RequestPartitioningComponent;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.transport.ReadTimeouts;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
+import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.protocol.AddressingDispositionException;
+
+import sun.corba.SharedSecrets;
+
+/**
+ * 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
+ */
+
+public abstract class MessageBase implements Message{
+
+ // This is only used when the giopDebug flag is
+ // turned on.
+ public byte[] giopHeader;
+ private ByteBuffer byteBuffer;
+ private int threadPoolToUse;
+
+ // (encodingVersion == 0x00) implies CDR encoding,
+ // (encodingVersion > 0x00) implies Java serialization version.
+ byte encodingVersion = (byte) Message.CDR_ENC_VERSION;
+
+ private static ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get( CORBALogDomains.RPC_PROTOCOL ) ;
+
+ // Static methods
+
+ public static String typeToString(int type)
+ {
+ return typeToString((byte)type);
+ }
+
+ 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;
+ }
+ return result;
+ }
+
+ public static MessageBase readGIOPMessage(ORB orb, CorbaConnection connection)
+ {
+ MessageBase msg = readGIOPHeader(orb, connection);
+ msg = (MessageBase)readGIOPBody(orb, connection, (Message)msg);
+ return msg;
+ }
+
+ public static MessageBase readGIOPHeader(ORB orb, CorbaConnection connection)
+ {
+ MessageBase msg = null;
+ ReadTimeouts readTimeouts =
+ orb.getORBData().getTransportTCPReadTimeouts();
+
+ ByteBuffer buf = null;
+
+ try {
+ buf = connection.read(GIOPMessageHeaderLength,
+ 0, GIOPMessageHeaderLength,
+ readTimeouts.get_max_giop_header_time_to_wait());
+ } catch (IOException e) {
+ throw wrapper.ioexceptionWhenReadingConnection(e);
+ }
+
+ if (orb.giopDebugFlag) {
+ // Since this is executed in debug mode only the overhead of
+ // using a View Buffer is not an issue. We'll also use a
+ // read-only View Buffer so we don't disturb the state of
+ // byteBuffer.
+ dprint(".readGIOPHeader: " + typeToString(buf.get(7)));
+ dprint(".readGIOPHeader: GIOP header is: ");
+ ByteBuffer viewBuffer = buf.asReadOnlyBuffer();
+ viewBuffer.position(0).limit(GIOPMessageHeaderLength);
+ ByteBufferWithInfo bbwi = new ByteBufferWithInfo(orb,viewBuffer);
+ bbwi.buflen = GIOPMessageHeaderLength;
+ CDRInputStream_1_0.printBuffer(bbwi);
+ }
+
+ // 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.
+ */
+
+ int b1, b2, b3, b4;
+
+ b1 = (buf.get(0) << 24) & 0xFF000000;
+ b2 = (buf.get(1) << 16) & 0x00FF0000;
+ b3 = (buf.get(2) << 8) & 0x0000FF00;
+ b4 = (buf.get(3) << 0) & 0x000000FF;
+ int magic = (b1 | b2 | b3 | b4);
+
+ if (magic != GIOPBigMagic) {
+ // If Magic is incorrect, it is an error.
+ // ACTION : send MessageError and close the connection.
+ throw wrapper.giopMagicError( CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ // Extract the encoding version from the request GIOP Version,
+ // if it contains an encoding, and set GIOP version appropriately.
+ // For Java serialization, we use GIOP Version 1.2 message format.
+ byte requestEncodingVersion = Message.CDR_ENC_VERSION;
+ if ((buf.get(4) == 0x0D) &&
+ (buf.get(5) <= Message.JAVA_ENC_VERSION) &&
+ (buf.get(5) > Message.CDR_ENC_VERSION) &&
+ orb.getORBData().isJavaSerializationEnabled()) {
+ // Entering this block means the request is using Java encoding,
+ // and the encoding version is <= this ORB's Java encoding version.
+ requestEncodingVersion = buf.get(5);
+ buf.put(4, (byte) 0x01);
+ buf.put(5, (byte) 0x02);
+ }
+
+ GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
+
+ if (orb.giopDebugFlag) {
+ dprint(".readGIOPHeader: Message GIOP version: "
+ + buf.get(4) + '.' + buf.get(5));
+ dprint(".readGIOPHeader: ORB Max GIOP Version: "
+ + orbVersion);
+ }
+
+ if ( (buf.get(4) > orbVersion.getMajor()) ||
+ ( (buf.get(4) == orbVersion.getMajor()) && (buf.get(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,
+ // it is an error.
+
+ // For replies, the ORB should always receive a version it supports
+ // or less, but never greater (except for MessageError)
+
+ // ACTION : Send back a MessageError() with the the highest version
+ // the server ORB supports, and close the connection.
+ if ( buf.get(7) != GIOPMessageError ) {
+ throw wrapper.giopVersionError( CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ AreFragmentsAllowed(buf.get(4), buf.get(5), buf.get(6), buf.get(7));
+
+ // create appropriate messages types
+
+ switch (buf.get(7)) {
+
+ case GIOPRequest:
+ if (orb.giopDebugFlag) {
+ dprint(".readGIOPHeader: creating RequestMessage");
+ }
+ //msg = new RequestMessage(orb.giopDebugFlag);
+ if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0
+ msg = new RequestMessage_1_0(orb);
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1
+ msg = new RequestMessage_1_1(orb);
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2
+ msg = new RequestMessage_1_2(orb);
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ break;
+
+ case GIOPLocateRequest:
+ if (orb.giopDebugFlag) {
+ dprint(".readGIOPHeader: creating LocateRequestMessage");
+ }
+ //msg = new LocateRequestMessage(orb.giopDebugFlag);
+ if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0
+ msg = new LocateRequestMessage_1_0(orb);
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1
+ msg = new LocateRequestMessage_1_1(orb);
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2
+ msg = new LocateRequestMessage_1_2(orb);
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ break;
+
+ case GIOPCancelRequest:
+ if (orb.giopDebugFlag) {
+ dprint(".readGIOPHeader: creating CancelRequestMessage");
+ }
+ //msg = new CancelRequestMessage(orb.giopDebugFlag);
+ if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0
+ msg = new CancelRequestMessage_1_0();
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1
+ msg = new CancelRequestMessage_1_1();
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2
+ msg = new CancelRequestMessage_1_2();
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ break;
+
+ case GIOPReply:
+ if (orb.giopDebugFlag) {
+ dprint(".readGIOPHeader: creating ReplyMessage");
+ }
+ //msg = new ReplyMessage(orb.giopDebugFlag);
+ if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0
+ msg = new ReplyMessage_1_0(orb);
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1
+ msg = new ReplyMessage_1_1(orb);
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2
+ msg = new ReplyMessage_1_2(orb);
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ break;
+
+ case GIOPLocateReply:
+ if (orb.giopDebugFlag) {
+ dprint(".readGIOPHeader: creating LocateReplyMessage");
+ }
+ //msg = new LocateReplyMessage(orb.giopDebugFlag);
+ if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0
+ msg = new LocateReplyMessage_1_0(orb);
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1
+ msg = new LocateReplyMessage_1_1(orb);
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2
+ msg = new LocateReplyMessage_1_2(orb);
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ break;
+
+ case GIOPCloseConnection:
+ case GIOPMessageError:
+ if (orb.giopDebugFlag) {
+ dprint(".readGIOPHeader: 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 ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0
+ msg = new Message_1_0();
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1
+ msg = new Message_1_1();
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2
+ msg = new Message_1_1();
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ break;
+
+ case GIOPFragment:
+ if (orb.giopDebugFlag) {
+ dprint(".readGIOPHeader: creating FragmentMessage");
+ }
+ //msg = new FragmentMessage(orb.giopDebugFlag);
+ if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0
+ // not possible (error checking done already)
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x01) ) { // 1.1
+ msg = new FragmentMessage_1_1();
+ } else if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x02) ) { // 1.2
+ msg = new FragmentMessage_1_2();
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ break;
+
+ default:
+ if (orb.giopDebugFlag)
+ dprint(".readGIOPHeader: UNKNOWN MESSAGE TYPE: "
+ + buf.get(7));
+ // unknown message type ?
+ // ACTION : send MessageError and close the connection
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ //
+ // Initialize the generic GIOP header instance variables.
+ //
+
+ if ( (buf.get(4) == 0x01) && (buf.get(5) == 0x00) ) { // 1.0
+ Message_1_0 msg10 = (Message_1_0) msg;
+ msg10.magic = magic;
+ msg10.GIOP_version = new GIOPVersion(buf.get(4), buf.get(5));
+ msg10.byte_order = (buf.get(6) == LITTLE_ENDIAN_BIT);
+ // 'request partitioning' not supported on GIOP version 1.0
+ // so just use the default thread pool, 0.
+ msg.threadPoolToUse = 0;
+ msg10.message_type = buf.get(7);
+ msg10.message_size = readSize(buf.get(8), buf.get(9), buf.get(10), buf.get(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(buf.get(4), buf.get(5));
+ msg11.flags = (byte)(buf.get(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.
+ //
+ // 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.
+ msg.threadPoolToUse = (buf.get(6) >>> 2) & THREAD_POOL_TO_USE_MASK;
+ msg11.message_type = buf.get(7);
+ msg11.message_size =
+ readSize(buf.get(8), buf.get(9), buf.get(10), buf.get(11),
+ msg11.isLittleEndian()) + GIOPMessageHeaderLength;
+ }
+
+
+ if (orb.giopDebugFlag) {
+ // Since this is executed in debug mode only the overhead of
+ // using a View Buffer is not an issue. We'll also use a
+ // read-only View Buffer so we don't disturb the state of
+ // byteBuffer.
+ dprint(".readGIOPHeader: header construction complete.");
+
+ // For debugging purposes, save the 12 bytes of the header
+ ByteBuffer viewBuf = buf.asReadOnlyBuffer();
+ byte[] msgBuf = new byte[GIOPMessageHeaderLength];
+ viewBuf.position(0).limit(GIOPMessageHeaderLength);
+ viewBuf.get(msgBuf,0,msgBuf.length);
+ // REVISIT: is giopHeader still used?
+ ((MessageBase)msg).giopHeader = msgBuf;
+ }
+
+ msg.setByteBuffer(buf);
+ msg.setEncodingVersion(requestEncodingVersion);
+
+ return msg;
+ }
+
+ public static Message readGIOPBody(ORB orb,
+ CorbaConnection connection,
+ Message msg)
+ {
+ ReadTimeouts readTimeouts =
+ orb.getORBData().getTransportTCPReadTimeouts();
+ ByteBuffer buf = msg.getByteBuffer();
+
+ buf.position(MessageBase.GIOPMessageHeaderLength);
+ int msgSizeMinusHeader =
+ msg.getSize() - MessageBase.GIOPMessageHeaderLength;
+ try {
+ buf = connection.read(buf,
+ GIOPMessageHeaderLength, msgSizeMinusHeader,
+ readTimeouts.get_max_time_to_wait());
+ } catch (IOException e) {
+ throw wrapper.ioexceptionWhenReadingConnection(e);
+ }
+
+ msg.setByteBuffer(buf);
+
+ if (orb.giopDebugFlag) {
+ dprint(".readGIOPBody: received message:");
+ ByteBuffer viewBuffer = buf.asReadOnlyBuffer();
+ viewBuffer.position(0).limit(msg.getSize());
+ ByteBufferWithInfo bbwi = new ByteBufferWithInfo(orb, viewBuffer);
+ CDRInputStream_1_0.printBuffer(bbwi);
+ }
+
+ return msg;
+ }
+
+ private static RequestMessage createRequest(
+ ORB orb, GIOPVersion gv, byte encodingVersion, int request_id,
+ boolean response_expected, byte[] object_key, String operation,
+ ServiceContexts service_contexts, 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);
+ } 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);
+ } 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
+ // response on a oneway call too, but we do not support it now.
+ byte response_flags = 0x03;
+ if (response_expected) {
+ response_flags = 0x03;
+ } else {
+ 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);
+ msg.setEncodingVersion(encodingVersion);
+ return msg;
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ 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, Principal requesting_principal) {
+
+ RequestMessage requestMessage = null;
+ IIOPProfile profile = ior.getProfile();
+
+ if (addrDisp == KeyAddr.value) {
+ // object key will be used for target addressing
+ 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);
+ } else {
+
+ if (!(gv.equals(GIOPVersion.V1_2))) {
+ // only object_key based target addressing is allowed for
+ // GIOP 1.0 & 1.1
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ // Note: Currently we use response_expected flag to decide if the
+ // call is oneway or not. Ideally, it is possible to expect a
+ // response on a oneway call too, but we do not support it now.
+ byte response_flags = 0x03;
+ if (response_expected) {
+ response_flags = 0x03;
+ } else {
+ response_flags = 0x00;
+ }
+
+ TargetAddress target = new TargetAddress();
+ 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());
+ target.ior(iorInfo);
+ } else {
+ // invalid target addressing disposition value
+ throw wrapper.illegalTargetAddressDisposition(
+ CompletionStatus.COMPLETED_NO);
+ }
+
+ 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);
+ if (iter.hasNext()) {
+ 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(new Integer(poolToUse),
+ new Integer(ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
+ new Integer(ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
+ }
+ requestMessage.setThreadPoolToUse(poolToUse);
+ }
+
+ return requestMessage;
+ }
+
+ 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);
+ } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
+ 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);
+ msg.setEncodingVersion(encodingVersion);
+ return msg;
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ 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);
+ } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
+ return new LocateRequestMessage_1_1(orb, request_id, object_key);
+ } 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);
+ msg.setEncodingVersion(encodingVersion);
+ return msg;
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ 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);
+ } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
+ 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);
+ msg.setEncodingVersion(encodingVersion);
+ return msg;
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ public static CancelRequestMessage createCancelRequest(
+ GIOPVersion gv, int request_id) {
+
+ if (gv.equals(GIOPVersion.V1_0)) { // 1.0
+ return new CancelRequestMessage_1_0(request_id);
+ } else if (gv.equals(GIOPVersion.V1_1)) { // 1.1
+ return new CancelRequestMessage_1_1(request_id);
+ } else if (gv.equals(GIOPVersion.V1_2)) { // 1.2
+ return new CancelRequestMessage_1_2(request_id);
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ 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);
+ } 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);
+ } 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);
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ 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);
+ } 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);
+ } 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);
+ } else {
+ throw wrapper.giopVersionError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ public static FragmentMessage createFragmentMessage(GIOPVersion gv) {
+ // This method is not currently used.
+ // New fragment messages are always created from existing messages.
+ // Creating a FragmentMessage from InputStream is done in
+ // createFromStream(..)
+ return null;
+ }
+
+ public static int getRequestId(Message msg) {
+ switch (msg.getType()) {
+ case GIOPRequest :
+ return ((RequestMessage) msg).getRequestId();
+ case GIOPReply :
+ return ((ReplyMessage) msg).getRequestId();
+ case GIOPLocateRequest :
+ return ((LocateRequestMessage) msg).getRequestId();
+ case GIOPLocateReply :
+ return ((LocateReplyMessage) msg).getRequestId();
+ case GIOPCancelRequest :
+ return ((CancelRequestMessage) msg).getRequestId();
+ case GIOPFragment :
+ return ((FragmentMessage) msg).getRequestId();
+ }
+
+ throw wrapper.illegalGiopMsgType(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ /**
+ * Set a flag in the given buffer (fragment bit, byte order bit, etc)
+ */
+ public static void setFlag(ByteBuffer byteBuffer, int flag) {
+ byte b = byteBuffer.get(6);
+ b |= flag;
+ byteBuffer.put(6,b);
+ }
+
+ /**
+ * Clears a flag in the given buffer
+ */
+ public static void clearFlag(byte[] buf, int flag) {
+ buf[6] &= (0xFF ^ flag);
+ }
+
+ private static void AreFragmentsAllowed(byte major, byte minor, byte flag,
+ byte msgType) {
+
+ if ( (major == 0x01) && (minor == 0x00) ) { // 1.0
+ if (msgType == GIOPFragment) {
+ throw wrapper.fragmentationDisallowed(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ if ( (flag & MORE_FRAGMENTS_BIT) == MORE_FRAGMENTS_BIT ) {
+ switch (msgType) {
+ case GIOPCancelRequest :
+ case GIOPCloseConnection :
+ case GIOPMessageError :
+ throw wrapper.fragmentationDisallowed(
+ CompletionStatus.COMPLETED_MAYBE);
+ case GIOPLocateRequest :
+ case GIOPLocateReply :
+ if ( (major == 0x01) && (minor == 0x01) ) { // 1.1
+ throw wrapper.fragmentationDisallowed(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ break;
+ }
+ }
+ }
+
+ /**
+ * Construct an ObjectKey from a byte[].
+ *
+ * @return ObjectKey the object key.
+ */
+ static ObjectKey extractObjectKey(byte[] objKey, ORB orb) {
+
+ try {
+ if (objKey != null) {
+ ObjectKey objectKey =
+ orb.getObjectKeyFactory().create(objKey);
+ if (objectKey != null) {
+ return objectKey;
+ }
+ }
+ } catch (Exception e) {
+ // XXX log this exception
+ }
+
+ // This exception is thrown if any exceptions are raised while
+ // extracting the object key or if the object key is empty.
+ throw wrapper.invalidObjectKey();
+ }
+
+ /**
+ * Extract the object key from TargetAddress.
+ *
+ * @return ObjectKey the object key.
+ */
+ static ObjectKey extractObjectKey(TargetAddress target, ORB orb) {
+
+ short orbTargetAddrPref = orb.getORBData().getGIOPTargetAddressPreference();
+ short reqAddrDisp = target.discriminator();
+
+ switch (orbTargetAddrPref) {
+ 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
+ ObjectKey objectKey =
+ orb.getObjectKeyFactory().create(objKey);
+ if (objectKey != null) {
+ return objectKey;
+ }
+ }
+ break;
+ case ProfileAddr.value :
+ IIOPProfile iiopProfile = null;
+ TaggedProfile profile = target.profile();
+ if (profile != null) { // AddressingDisposition::ProfileAddr
+ iiopProfile = IIOPFactories.makeIIOPProfile(orb, profile);
+ ObjectKey objectKey = iiopProfile.getObjectKey();
+ if (objectKey != null) {
+ return objectKey;
+ }
+ }
+ break;
+ case ReferenceAddr.value :
+ IORAddressingInfo iorInfo = target.ior();
+ if (iorInfo != null) { // AddressingDisposition::IORAddr
+ profile = iorInfo.ior.profiles[iorInfo.selected_profile_index];
+ iiopProfile = IIOPFactories.makeIIOPProfile(orb, profile);
+ ObjectKey objectKey = iiopProfile.getObjectKey();
+ if (objectKey != null) {
+ return 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;
+ }
+ } catch (Exception e) {}
+
+ // This exception is thrown if any exceptions are raised while
+ // extracting the object key from the TargetAddress or if all the
+ // the valid TargetAddress::AddressingDispositions are empty.
+ throw wrapper.invalidObjectKey() ;
+ }
+
+ private static int readSize(byte b1, byte b2, byte b3, byte b4,
+ boolean littleEndian) {
+
+ int a1, a2, a3, a4;
+
+ if (!littleEndian) {
+ a1 = (b1 << 24) & 0xFF000000;
+ a2 = (b2 << 16) & 0x00FF0000;
+ a3 = (b3 << 8) & 0x0000FF00;
+ a4 = (b4 << 0) & 0x000000FF;
+ } else {
+ a1 = (b4 << 24) & 0xFF000000;
+ a2 = (b3 << 16) & 0x00FF0000;
+ a3 = (b2 << 8) & 0x0000FF00;
+ a4 = (b1 << 0) & 0x000000FF;
+ }
+
+ return (a1 | a2 | a3 | a4);
+ }
+
+ static void nullCheck(Object obj) {
+ if (obj == null) {
+ throw wrapper.nullNotAllowed() ;
+ }
+ }
+
+ static SystemException getSystemException(
+ String exClassName, int minorCode, CompletionStatus completionStatus,
+ String message, ORBUtilSystemException wrapper)
+ {
+ SystemException sysEx = null;
+
+ try {
+ Class<?> clazz =
+ SharedSecrets.getJavaCorbaAccess().loadClass(exClassName);
+ if (message == null) {
+ sysEx = (SystemException) clazz.newInstance();
+ } else {
+ Class[] types = { String.class };
+ Constructor constructor = clazz.getConstructor(types);
+ Object[] args = { message };
+ sysEx = (SystemException)constructor.newInstance(args);
+ }
+ } catch (Exception someEx) {
+ throw wrapper.badSystemExceptionInReply(
+ CompletionStatus.COMPLETED_MAYBE, someEx );
+ }
+
+ sysEx.minor = minorCode;
+ sysEx.completed = completionStatus;
+
+ return sysEx;
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+
+ public ByteBuffer getByteBuffer()
+ {
+ return byteBuffer;
+ }
+
+ public void setByteBuffer(ByteBuffer byteBuffer)
+ {
+ this.byteBuffer = byteBuffer;
+ }
+
+ public int getThreadPoolToUse()
+ {
+ return threadPoolToUse;
+ }
+
+ public byte getEncodingVersion() {
+ return this.encodingVersion;
+ }
+
+ public void setEncodingVersion(byte version) {
+ this.encodingVersion = version;
+ }
+
+ private static void dprint(String msg)
+ {
+ ORBUtility.dprint("MessageBase", msg);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageHandler.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageHandler.java
new file mode 100644
index 0000000..fadb14d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/MessageHandler.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import java.io.IOException;
+
+/**
+ * Interface which allows an implementation to use
+ * double dispatch when processing the various
+ * concrete message types found in this package.
+ */
+public interface MessageHandler
+{
+ //
+ // REVISIT - These should not throw IOException.
+ // 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.
+ */
+ void handleInput(Message header) throws IOException;
+
+ // 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_1 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/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_0.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_0.java
new file mode 100644
index 0000000..42bcd4b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_0.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import java.nio.ByteBuffer;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/*
+ * This implements the GIOP 1.0 Message header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public class Message_1_0
+ extends com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase {
+
+ private static ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get( CORBALogDomains.RPC_PROTOCOL ) ;
+
+ // Instance variables
+ int magic = (int) 0;
+ GIOPVersion GIOP_version = null;
+ boolean byte_order = false;
+ byte message_type = (byte) 0;
+ int message_size = (int) 0;
+
+ // Constructor
+
+ Message_1_0() {
+ }
+
+ 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;
+ message_type = _message_type;
+ message_size = _message_size;
+ }
+
+ // Accessor methods
+
+ public GIOPVersion getGIOPVersion() {
+ return this.GIOP_version;
+ }
+
+ public int getType() {
+ return this.message_type;
+ }
+
+ public int getSize() {
+ return this.message_size;
+ }
+
+ public boolean isLittleEndian() {
+ return this.byte_order;
+ }
+
+ public boolean moreFragmentsToFollow() {
+ return false;
+ }
+
+ // Mutator methods
+
+ public void setSize(ByteBuffer byteBuffer, int size) {
+ this.message_size = size;
+
+ //
+ // Patch the size field in the header.
+ //
+ 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));
+ } 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));
+ }
+ }
+
+ public FragmentMessage createFragmentMessage() {
+ throw wrapper.fragmentationDisallowed(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ // IO methods
+
+ // This should do nothing even if it is called. The Message Header already
+ // is read off java.io.InputStream (not a CDRInputStream) by IIOPConnection
+ // in order to choose the correct CDR Version, msg_type, and msg_size.
+ // 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();
+ */
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ ostream.write_long(this.magic);
+ nullCheck(this.GIOP_version);
+ this.GIOP_version.write(ostream);
+ ostream.write_boolean(this.byte_order);
+ ostream.write_octet(this.message_type);
+ ostream.write_ulong(this.message_size);
+ }
+
+} // class Message_1_0
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_1.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_1.java
new file mode 100644
index 0000000..f0d26e2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_1.java
@@ -0,0 +1,196 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import java.nio.ByteBuffer;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/*
+ * This implements the GIOP 1.1 & 1.2 Message header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public class Message_1_1
+ extends com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase {
+
+ // Constants
+ final static int UPPER_THREE_BYTES_OF_INT_MASK = 0xFF;
+
+ private static ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get( CORBALogDomains.RPC_PROTOCOL ) ;
+
+ // Instance variables
+ int magic = (int) 0;
+ GIOPVersion GIOP_version = null;
+ byte flags = (byte) 0;
+ byte message_type = (byte) 0;
+ int message_size = (int) 0;
+
+ // Constructor
+
+ Message_1_1() {
+ }
+
+ Message_1_1(int _magic, GIOPVersion _GIOP_version, byte _flags,
+ byte _message_type, int _message_size) {
+ magic = _magic;
+ GIOP_version = _GIOP_version;
+ flags = _flags;
+ message_type = _message_type;
+ message_size = _message_size;
+ }
+
+ // Accessor methods
+
+ public GIOPVersion getGIOPVersion() {
+ return this.GIOP_version;
+ }
+
+ public int getType() {
+ return this.message_type;
+ }
+
+ public int getSize() {
+ return this.message_size;
+ }
+
+ public boolean isLittleEndian() {
+ return ((this.flags & LITTLE_ENDIAN_BIT) == LITTLE_ENDIAN_BIT);
+ }
+
+ public boolean moreFragmentsToFollow() {
+ return ( (this.flags & MORE_FRAGMENTS_BIT) == MORE_FRAGMENTS_BIT );
+ }
+
+ // Mutator methods
+
+ // NOTE: This is a SUN PROPRIETARY EXTENSION
+ // Add the poolToUse to the upper 6 bits of byte 6 of the GIOP header.
+ // 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.
+ int tmpFlags = poolToUse << 2;
+ tmpFlags &= UPPER_THREE_BYTES_OF_INT_MASK;
+ tmpFlags |= flags;
+ flags = (byte)tmpFlags;
+ }
+
+ public void setSize(ByteBuffer byteBuffer, int size) {
+
+ this.message_size = size;
+
+ //
+ // Patch the size field in the header.
+ //
+
+ 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));
+ } 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));
+ }
+ }
+
+ /**
+ * Allows us to create a fragment message from any message type.
+ */
+ public FragmentMessage createFragmentMessage() {
+
+ // check for message type validity
+
+ switch (this.message_type) {
+ case GIOPCancelRequest :
+ case GIOPCloseConnection :
+ case GIOPMessageError :
+ throw wrapper.fragmentationDisallowed(
+ CompletionStatus.COMPLETED_MAYBE);
+ case GIOPLocateRequest :
+ case GIOPLocateReply :
+ if (this.GIOP_version.equals(GIOPVersion.V1_1)) {
+ throw wrapper.fragmentationDisallowed(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+ 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);
+ }
+ */
+ 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( CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ // IO methods
+
+ // This should do nothing even if it is called. The Message Header is read
+ // off a java.io.InputStream (not a CDRInputStream) by IIOPConnection
+ // in order to choose the correct CDR Version , msg_type, and msg_size.
+ // 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();
+ */
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ ostream.write_long(this.magic);
+ nullCheck(this.GIOP_version);
+ this.GIOP_version.write(ostream);
+ ostream.write_octet(this.flags);
+ ostream.write_octet(this.message_type);
+ ostream.write_ulong(this.message_size);
+ }
+} // class Message_1_1
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_2.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_2.java
new file mode 100644
index 0000000..5a352ca
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/Message_1_2.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import java.nio.ByteBuffer;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+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) {
+
+ 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.
+ */
+ public void unmarshalRequestID(ByteBuffer byteBuffer) {
+ int b1, b2, b3, b4;
+
+ if (!isLittleEndian()) {
+ b1 = (byteBuffer.get(GIOPMessageHeaderLength+0) << 24) & 0xFF000000;
+ b2 = (byteBuffer.get(GIOPMessageHeaderLength+1) << 16) & 0x00FF0000;
+ b3 = (byteBuffer.get(GIOPMessageHeaderLength+2) << 8) & 0x0000FF00;
+ b4 = (byteBuffer.get(GIOPMessageHeaderLength+3) << 0) & 0x000000FF;
+ } else {
+ b1 = (byteBuffer.get(GIOPMessageHeaderLength+3) << 24) & 0xFF000000;
+ b2 = (byteBuffer.get(GIOPMessageHeaderLength+2) << 16) & 0x00FF0000;
+ b3 = (byteBuffer.get(GIOPMessageHeaderLength+1) << 8) & 0x0000FF00;
+ b4 = (byteBuffer.get(GIOPMessageHeaderLength+0) << 0) & 0x000000FF;
+ }
+
+ this.request_id = (b1 | b2 | b3 | b4);
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ if (this.encodingVersion == Message.CDR_ENC_VERSION) {
+ super.write(ostream);
+ return;
+ }
+ GIOPVersion gv = this.GIOP_version; // save
+ this.GIOP_version = GIOPVersion.getInstance((byte)13,
+ this.encodingVersion);
+ super.write(ostream);
+ this.GIOP_version = gv; // restore
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ProfileAddr.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ProfileAddr.java
new file mode 100644
index 0000000..00eaad7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ProfileAddr.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+
+/**
+* com/sun/corba/se/impl/protocol/giopmsgheaders/ProfileAddr.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl
+* Sunday, June 4, 2000 5:18:54 PM PDT
+*/
+
+public interface ProfileAddr
+{
+ public static final short value = (short)(1);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReferenceAddr.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReferenceAddr.java
new file mode 100644
index 0000000..feb7d0d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReferenceAddr.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+
+/**
+* com/sun/corba/se/impl/protocol/giopmsgheaders/ReferenceAddr.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ../../../../../../../src/share/classes/com/sun/corba/se/GiopIDL/g.idl
+* Sunday, June 4, 2000 5:18:54 PM PDT
+*/
+
+public interface ReferenceAddr
+{
+ public static final short value = (short)(2);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage.java
new file mode 100644
index 0000000..8eaf9f7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import org.omg.CORBA.SystemException;
+import com.sun.corba.se.spi.ior.IOR;
+
+/**
+ * This interface captures the ReplyMessage contract.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public interface ReplyMessage extends Message, LocateReplyOrReplyMessage {
+
+ // Note: If the value, order, or number of these constants change,
+ // please update the REPLY_MESSAGE_TO_PI_REPLY_STATUS table in PIHandlerImpl.
+ int NO_EXCEPTION = 0;
+ 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
+
+ ServiceContexts getServiceContexts();
+ void setServiceContexts( ServiceContexts sc );
+ void setIOR( IOR newIOR );
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java
new file mode 100644
index 0000000..4d77e3a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_0.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.SystemException;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/**
+ * This implements the GIOP 1.0 Reply header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class ReplyMessage_1_0 extends Message_1_0
+ implements ReplyMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private ORBUtilSystemException wrapper = null ;
+ private ServiceContexts service_contexts = null;
+ private int request_id = (int) 0;
+ private int reply_status = (int) 0;
+ private IOR ior = null;
+ private String exClassName = null;
+ private int minorCode = (int) 0;
+ private CompletionStatus completionStatus = null;
+
+ // Constructors
+
+ ReplyMessage_1_0(ORB orb) {
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ 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;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ service_contexts = _service_contexts;
+ request_id = _request_id;
+ reply_status = _reply_status;
+ ior = _ior;
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public int getReplyStatus() {
+ return this.reply_status;
+ }
+
+ public short getAddrDisposition() {
+ return KeyAddr.value;
+ }
+
+ public ServiceContexts getServiceContexts() {
+ return this.service_contexts;
+ }
+
+ public void setServiceContexts( ServiceContexts sc ) {
+ this.service_contexts = sc;
+ }
+
+ public SystemException getSystemException(String message) {
+ return MessageBase.getSystemException(
+ exClassName, minorCode, completionStatus, message, wrapper);
+ }
+
+ public IOR getIOR() {
+ return this.ior;
+ }
+
+ public void setIOR( IOR ior ) {
+ this.ior = ior;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.service_contexts
+ = new ServiceContexts((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
+
+ // The code below reads the reply body in some cases
+ // SYSTEM_EXCEPTION & LOCATION_FORWARD
+ if (this.reply_status == SYSTEM_EXCEPTION) {
+
+ String reposId = istream.read_string();
+ this.exClassName = ORBUtility.classNameOf(reposId);
+ this.minorCode = istream.read_long();
+ 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(
+ CompletionStatus.COMPLETED_MAYBE, new Integer(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) {
+ CDRInputStream cdr = (CDRInputStream) istream;
+ this.ior = IORFactories.makeIOR( cdr ) ;
+ }
+ }
+
+ // Note, this writes only the header information. SystemException or
+ // IOR may be written afterwards into the reply mesg body.
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ if (this.service_contexts != null) {
+ service_contexts.write(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream,
+ GIOPVersion.V1_0);
+ } else {
+ ServiceContexts.writeNullServiceContext(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream);
+ }
+ ostream.write_ulong(this.request_id);
+ ostream.write_long(this.reply_status);
+ }
+
+ // Static methods
+
+ public static void isValidReplyStatus(int replyStatus) {
+ switch (replyStatus) {
+ case NO_EXCEPTION :
+ case USER_EXCEPTION :
+ case SYSTEM_EXCEPTION :
+ case LOCATION_FORWARD :
+ break;
+ default :
+ ORBUtilSystemException localWrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} //
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java
new file mode 100644
index 0000000..65d8578
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_1.java
@@ -0,0 +1,201 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.SystemException;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/**
+ * This implements the GIOP 1.1 Reply header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class ReplyMessage_1_1 extends Message_1_1
+ implements ReplyMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private ORBUtilSystemException wrapper = null ;
+ private ServiceContexts service_contexts = null;
+ private int request_id = (int) 0;
+ private int reply_status = (int) 0;
+ private IOR ior = null;
+ private String exClassName = null;
+ private int minorCode = (int) 0;
+ private CompletionStatus completionStatus = null;
+
+ // Constructors
+
+ ReplyMessage_1_1(ORB orb) {
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ 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;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ service_contexts = _service_contexts;
+ request_id = _request_id;
+ reply_status = _reply_status;
+ ior = _ior;
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public int getReplyStatus() {
+ return this.reply_status;
+ }
+
+ public short getAddrDisposition() {
+ return KeyAddr.value;
+ }
+
+ public ServiceContexts getServiceContexts() {
+ return this.service_contexts;
+ }
+
+ public void setServiceContexts( ServiceContexts sc ) {
+ this.service_contexts = sc;
+ }
+
+ public SystemException getSystemException(String message) {
+ return MessageBase.getSystemException(
+ exClassName, minorCode, completionStatus, message, wrapper);
+ }
+
+ public IOR getIOR() {
+ return this.ior;
+ }
+
+ public void setIOR( IOR ior ) {
+ this.ior = ior;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.service_contexts
+ = new ServiceContexts((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
+
+ // The code below reads the reply body in some cases
+ // SYSTEM_EXCEPTION & LOCATION_FORWARD
+ if (this.reply_status == SYSTEM_EXCEPTION) {
+
+ String reposId = istream.read_string();
+ this.exClassName = ORBUtility.classNameOf(reposId);
+ this.minorCode = istream.read_long();
+ 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(
+ CompletionStatus.COMPLETED_MAYBE, new Integer(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) {
+ CDRInputStream cdr = (CDRInputStream) istream;
+ this.ior = IORFactories.makeIOR(cdr) ;
+ }
+ }
+
+ // Note, this writes only the header information. SystemException or
+ // IOR may be written afterwards into the reply mesg body.
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ if (this.service_contexts != null) {
+ service_contexts.write(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream,
+ GIOPVersion.V1_1);
+ } else {
+ ServiceContexts.writeNullServiceContext(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream);
+ }
+ ostream.write_ulong(this.request_id);
+ ostream.write_long(this.reply_status);
+ }
+
+ // Static methods
+
+ public static void isValidReplyStatus(int replyStatus) {
+ switch (replyStatus) {
+ case NO_EXCEPTION :
+ case USER_EXCEPTION :
+ case SYSTEM_EXCEPTION :
+ case LOCATION_FORWARD :
+ break;
+ default :
+ ORBUtilSystemException localWrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} //
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_2.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_2.java
new file mode 100644
index 0000000..de97cba
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/ReplyMessage_1_2.java
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORFactories ;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+import com.sun.corba.se.impl.encoding.CDRInputStream_1_2;
+import com.sun.corba.se.impl.encoding.CDROutputStream_1_2;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/**
+ * This implements the GIOP 1.2 Reply header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class ReplyMessage_1_2 extends Message_1_2
+ implements ReplyMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private ORBUtilSystemException wrapper = null ;
+ private int reply_status = (int) 0;
+ private ServiceContexts service_contexts = null;
+ private IOR ior = null;
+ private String exClassName = null;
+ private int minorCode = (int) 0;
+ private CompletionStatus completionStatus = null;
+ private short addrDisposition = KeyAddr.value; // default;
+
+ // Constructors
+
+ ReplyMessage_1_2(ORB orb) {
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ 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;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ request_id = _request_id;
+ reply_status = _reply_status;
+ service_contexts = _service_contexts;
+ ior = _ior;
+ }
+
+ // Accessor methods
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public int getReplyStatus() {
+ return this.reply_status;
+ }
+
+ public short getAddrDisposition() {
+ return this.addrDisposition;
+ }
+
+ public ServiceContexts getServiceContexts() {
+ return this.service_contexts;
+ }
+
+ public void setServiceContexts( ServiceContexts sc ) {
+ this.service_contexts = sc;
+ }
+
+ public SystemException getSystemException(String message) {
+ return MessageBase.getSystemException(
+ exClassName, minorCode, completionStatus, message, wrapper);
+ }
+
+ public IOR getIOR() {
+ return this.ior;
+ }
+
+ public void setIOR( IOR ior ) {
+ this.ior = ior;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ this.reply_status = istream.read_long();
+ isValidReplyStatus(this.reply_status); // raises exception on error
+ this.service_contexts
+ = new ServiceContexts((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.
+ ((CDRInputStream)istream).setHeaderPadding(true);
+
+ // The code below reads the reply body in some cases
+ // SYSTEM_EXCEPTION & LOCATION_FORWARD & LOCATION_FORWARD_PERM &
+ // NEEDS_ADDRESSING_MODE
+ if (this.reply_status == SYSTEM_EXCEPTION) {
+
+ String reposId = istream.read_string();
+ this.exClassName = ORBUtility.classNameOf(reposId);
+ this.minorCode = istream.read_long();
+ 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(
+ CompletionStatus.COMPLETED_MAYBE, new Integer(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) ){
+ CDRInputStream cdr = (CDRInputStream) istream;
+ this.ior = IORFactories.makeIOR( 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);
+ }
+ }
+
+ // Note, this writes only the header information. SystemException or
+ // IOR or GIOP::AddressingDisposition may be written afterwards into the
+ // reply mesg body.
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong(this.request_id);
+ ostream.write_long(this.reply_status);
+ if (this.service_contexts != null) {
+ service_contexts.write(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream,
+ GIOPVersion.V1_2);
+ } else {
+ ServiceContexts.writeNullServiceContext(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream);
+ }
+
+ // 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.
+ ((CDROutputStream)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 :
+ break;
+ default :
+ ORBUtilSystemException localWrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ throw localWrapper.illegalReplyStatus( CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class ReplyMessage_1_2
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage.java
new file mode 100644
index 0000000..2a3df78
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.Principal;
+import com.sun.corba.se.spi.ior.ObjectKey;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+
+/**
+ * This interface captures the RequestMessage contract.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public interface RequestMessage extends Message {
+
+ byte RESPONSE_EXPECTED_BIT = 0x01;
+
+ ServiceContexts getServiceContexts();
+ int getRequestId();
+ boolean isResponseExpected();
+ byte[] getReserved();
+ ObjectKey getObjectKey();
+ String getOperation();
+ Principal getPrincipal();
+
+ // NOTE: This is a SUN PROPRIETARY EXTENSION
+ void setThreadPoolToUse(int poolToUse);
+
+
+} // interface RequestMessage
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_0.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_0.java
new file mode 100644
index 0000000..8dfa66b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_0.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.Principal;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.ObjectKey;
+
+/**
+ * This implements the GIOP 1.0 Request header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class RequestMessage_1_0 extends Message_1_0
+ implements RequestMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private ServiceContexts service_contexts = null;
+ private int request_id = (int) 0;
+ private boolean response_expected = false;
+ private byte[] object_key = null;
+ private String operation = null;
+ private Principal requesting_principal = null;
+ private ObjectKey objectKey = null;
+
+ // Constructor
+
+ RequestMessage_1_0(ORB orb) {
+ this.orb = orb;
+ }
+
+ RequestMessage_1_0(ORB orb, ServiceContexts _service_contexts,
+ int _request_id, boolean _response_expected, byte[] _object_key,
+ String _operation, Principal _requesting_principal) {
+ super(Message.GIOPBigMagic, false, Message.GIOPRequest, 0);
+ this.orb = orb;
+ service_contexts = _service_contexts;
+ request_id = _request_id;
+ response_expected = _response_expected;
+ object_key = _object_key;
+ operation = _operation;
+ requesting_principal = _requesting_principal;
+ }
+
+ // Accessor methods (RequestMessage interface)
+
+ public ServiceContexts getServiceContexts() {
+ return this.service_contexts;
+ }
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public boolean isResponseExpected() {
+ return this.response_expected;
+ }
+
+ public byte[] getReserved() {
+ // REVISIT Should we throw an exception or return null ?
+ return null;
+ }
+
+ public ObjectKey getObjectKey() {
+ if (this.objectKey == null) {
+ // this will raise a MARSHAL exception upon errors.
+ this.objectKey = MessageBase.extractObjectKey(object_key, orb);
+ }
+
+ return this.objectKey;
+ }
+
+ public String getOperation() {
+ return this.operation;
+ }
+
+ public 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.
+ }
+
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.service_contexts
+ = new ServiceContexts((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();
+ this.object_key = new byte[_len0];
+ istream.read_octet_array(this.object_key, 0, _len0);
+ this.operation = istream.read_string();
+ this.requesting_principal = istream.read_Principal();
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ if (this.service_contexts != null) {
+ service_contexts.write(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream,
+ GIOPVersion.V1_0);
+ } else {
+ ServiceContexts.writeNullServiceContext(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream);
+ }
+ ostream.write_ulong(this.request_id);
+ ostream.write_boolean(this.response_expected);
+ nullCheck(this.object_key);
+ ostream.write_long(this.object_key.length);
+ ostream.write_octet_array(this.object_key, 0, this.object_key.length);
+ ostream.write_string(this.operation);
+ if (this.requesting_principal != null) {
+ ostream.write_Principal(this.requesting_principal);
+ } else {
+ ostream.write_long(0);
+ }
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class RequestMessage_1_0
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_1.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_1.java
new file mode 100644
index 0000000..00068b1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_1.java
@@ -0,0 +1,175 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.Principal;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.ObjectKey;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/**
+ * This implements the GIOP 1.1 Request header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class RequestMessage_1_1 extends Message_1_1
+ implements RequestMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private ORBUtilSystemException wrapper = null ;
+ private ServiceContexts service_contexts = null;
+ private int request_id = (int) 0;
+ private boolean response_expected = false;
+ private byte[] reserved = null; // Added in GIOP 1.1
+ private byte[] object_key = null;
+ private String operation = null;
+ private Principal requesting_principal = null;
+ private ObjectKey objectKey = null;
+
+ // Constructors
+
+ RequestMessage_1_1(ORB orb) {
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ RequestMessage_1_1(ORB orb, ServiceContexts _service_contexts,
+ int _request_id, boolean _response_expected, byte[] _reserved,
+ byte[] _object_key, String _operation,
+ Principal _requesting_principal) {
+ super(Message.GIOPBigMagic, GIOPVersion.V1_1, FLAG_NO_FRAG_BIG_ENDIAN,
+ Message.GIOPRequest, 0);
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ service_contexts = _service_contexts;
+ request_id = _request_id;
+ response_expected = _response_expected;
+ reserved = _reserved;
+ object_key = _object_key;
+ operation = _operation;
+ requesting_principal = _requesting_principal;
+ }
+
+ // Accessor methods (RequestMessage interface)
+
+ public ServiceContexts getServiceContexts() {
+ return this.service_contexts;
+ }
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ public boolean isResponseExpected() {
+ return this.response_expected;
+ }
+
+ public byte[] getReserved() {
+ return this.reserved;
+ }
+
+ public ObjectKey getObjectKey() {
+ if (this.objectKey == null) {
+ // this will raise a MARSHAL exception upon errors.
+ this.objectKey = MessageBase.extractObjectKey(object_key, orb);
+ }
+
+ return this.objectKey;
+ }
+
+ public String getOperation() {
+ return this.operation;
+ }
+
+ public Principal getPrincipal() {
+ return this.requesting_principal;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.service_contexts
+ = new ServiceContexts((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];
+ for (int _o0 = 0;_o0 < (3); ++_o0) {
+ this.reserved[_o0] = istream.read_octet();
+ }
+ int _len1 = istream.read_long();
+ this.object_key = new byte[_len1];
+ istream.read_octet_array(this.object_key, 0, _len1);
+ this.operation = istream.read_string();
+ this.requesting_principal = istream.read_Principal();
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ if (this.service_contexts != null) {
+ service_contexts.write(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream,
+ GIOPVersion.V1_1);
+ } else {
+ ServiceContexts.writeNullServiceContext(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream);
+ }
+ ostream.write_ulong(this.request_id);
+ ostream.write_boolean(this.response_expected);
+ nullCheck(this.reserved);
+ if (this.reserved.length != (3)) {
+ throw wrapper.badReservedLength(
+ org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ }
+ for (int _i0 = 0;_i0 < (3); ++_i0) {
+ ostream.write_octet(this.reserved[_i0]);
+ }
+ nullCheck(this.object_key);
+ ostream.write_long(this.object_key.length);
+ ostream.write_octet_array(this.object_key, 0, this.object_key.length);
+ ostream.write_string(this.operation);
+ if (this.requesting_principal != null) {
+ ostream.write_Principal(this.requesting_principal);
+ } else {
+ ostream.write_long(0);
+ }
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class RequestMessage_1_1
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_2.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_2.java
new file mode 100644
index 0000000..706bdc4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/RequestMessage_1_2.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+import org.omg.CORBA.Principal;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.ObjectKey;
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.encoding.CDRInputStream_1_2;
+import com.sun.corba.se.impl.encoding.CDROutputStream_1_2;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+/**
+ * This implements the GIOP 1.2 Request header.
+ *
+ * @author Ram Jeyaraman 05/14/2000
+ */
+
+public final class RequestMessage_1_2 extends Message_1_2
+ implements RequestMessage {
+
+ // Instance variables
+
+ private ORB orb = null;
+ private ORBUtilSystemException wrapper = null ;
+ private byte response_flags = (byte) 0;
+ private byte reserved[] = null;
+ private TargetAddress target = null;
+ private String operation = null;
+ private ServiceContexts service_contexts = null;
+ private ObjectKey objectKey = null;
+
+ // Constructors
+
+ RequestMessage_1_2(ORB orb) {
+ this.orb = orb;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ }
+
+ 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;
+ this.wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+ request_id = _request_id;
+ response_flags = _response_flags;
+ reserved = _reserved;
+ target = _target;
+ operation = _operation;
+ service_contexts = _service_contexts;
+ }
+
+ // Accessor methods (RequestMessage interface)
+
+ public int getRequestId() {
+ return this.request_id;
+ }
+
+ 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.
+ */
+
+ if ( (this.response_flags & RESPONSE_EXPECTED_BIT) == RESPONSE_EXPECTED_BIT ) {
+ return true;
+ }
+
+ return false;
+ }
+
+ public byte[] getReserved() {
+ return this.reserved;
+ }
+
+ public ObjectKey getObjectKey() {
+ if (this.objectKey == null) {
+ // this will raise a MARSHAL exception upon errors.
+ this.objectKey = MessageBase.extractObjectKey(target, orb);
+ }
+
+ return this.objectKey;
+ }
+
+ public String getOperation() {
+ return this.operation;
+ }
+
+ public Principal getPrincipal() {
+ // REVISIT Should we throw an exception or return null ?
+ return null;
+ }
+
+ public ServiceContexts getServiceContexts() {
+ return this.service_contexts;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ super.read(istream);
+ this.request_id = istream.read_ulong();
+ this.response_flags = istream.read_octet();
+ this.reserved = new byte[3];
+ for (int _o0 = 0;_o0 < (3); ++_o0) {
+ this.reserved[_o0] = istream.read_octet();
+ }
+ this.target = TargetAddressHelper.read(istream);
+ getObjectKey(); // this does AddressingDisposition check
+ this.operation = istream.read_string();
+ this.service_contexts
+ = new ServiceContexts((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.
+ ((CDRInputStream)istream).setHeaderPadding(true);
+
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ super.write(ostream);
+ ostream.write_ulong(this.request_id);
+ ostream.write_octet(this.response_flags);
+ nullCheck(this.reserved);
+ if (this.reserved.length != (3)) {
+ throw wrapper.badReservedLength(
+ org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ }
+ for (int _i0 = 0;_i0 < (3); ++_i0) {
+ ostream.write_octet(this.reserved[_i0]);
+ }
+ nullCheck(this.target);
+ TargetAddressHelper.write(ostream, this.target);
+ ostream.write_string(this.operation);
+ if (this.service_contexts != null) {
+ service_contexts.write(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream,
+ GIOPVersion.V1_2);
+ } else {
+ ServiceContexts.writeNullServiceContext(
+ (org.omg.CORBA_2_3.portable.OutputStream) ostream);
+ }
+
+ // 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.
+ ((CDROutputStream)ostream).setHeaderPadding(true);
+ }
+
+ public void callback(MessageHandler handler)
+ throws java.io.IOException
+ {
+ handler.handleInput(this);
+ }
+} // class RequestMessage_1_2
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddress.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddress.java
new file mode 100644
index 0000000..bfaf1a0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddress.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+
+/**
+* com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddress.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ../../../../../../../src/share/classes/com/sun/corba/se/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.se.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.se.impl.protocol.giopmsgheaders.KeyAddr.value;
+ ___object_key = value;
+ __uninitialized = false;
+ }
+
+ private void verifyobject_key (short discriminator)
+ {
+ if (discriminator != com.sun.corba.se.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.se.impl.protocol.giopmsgheaders.ProfileAddr.value;
+ ___profile = value;
+ __uninitialized = false;
+ }
+
+ private void verifyprofile (short discriminator)
+ {
+ if (discriminator != com.sun.corba.se.impl.protocol.giopmsgheaders.ProfileAddr.value)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+
+ public com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo ior ()
+ {
+ if (__uninitialized)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ verifyior (__discriminator);
+ return ___ior;
+ }
+
+ public void ior (com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo value)
+ {
+ __discriminator = com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value;
+ ___ior = value;
+ __uninitialized = false;
+ }
+
+ private void verifyior (short discriminator)
+ {
+ if (discriminator != com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value)
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+
+ public void _default ()
+ {
+ __discriminator = -32768;
+ __uninitialized = false;
+ }
+
+} // class TargetAddress
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddressHelper.java b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddressHelper.java
new file mode 100644
index 0000000..080e86d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddressHelper.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.protocol.giopmsgheaders;
+
+
+/**
+* com/sun/corba/se/impl/protocol/giopmsgheaders/TargetAddressHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ../../../../../../../src/share/classes/com/sun/corba/se/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";
+
+ public static void insert (org.omg.CORBA.Any a, com.sun.corba.se.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.se.impl.protocol.giopmsgheaders.TargetAddress 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)
+ {
+ 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.se.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.se.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.se.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.se.impl.protocol.giopmsgheaders.ReferenceAddr.value);
+ _tcOf_members0 = com.sun.corba.se.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.se.impl.protocol.giopmsgheaders.TargetAddressHelper.id (), "TargetAddress", _disTypeCode0, _members0);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress read (org.omg.CORBA.portable.InputStream istream)
+ {
+ com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress value = new com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress ();
+ short _dis0 = (short)0;
+ _dis0 = istream.read_short ();
+ switch (_dis0)
+ {
+ case com.sun.corba.se.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.se.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.se.impl.protocol.giopmsgheaders.ReferenceAddr.value:
+ com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfo _ior = null;
+ _ior = com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.read (istream);
+ value.ior (_ior);
+ break;
+ default:
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.corba.se.impl.protocol.giopmsgheaders.TargetAddress value)
+ {
+ ostream.write_short (value.discriminator ());
+ switch (value.discriminator ())
+ {
+ case com.sun.corba.se.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.se.impl.protocol.giopmsgheaders.ProfileAddr.value:
+ org.omg.IOP.TaggedProfileHelper.write (ostream, value.profile ());
+ break;
+ case com.sun.corba.se.impl.protocol.giopmsgheaders.ReferenceAddr.value:
+ com.sun.corba.se.impl.protocol.giopmsgheaders.IORAddressingInfoHelper.write (ostream, value.ior ());
+ break;
+ default:
+ throw new org.omg.CORBA.BAD_OPERATION ();
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/BootstrapResolverImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/BootstrapResolverImpl.java
new file mode 100644
index 0000000..cd02af7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/BootstrapResolverImpl.java
@@ -0,0 +1,165 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.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.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.IORFactories ;
+import com.sun.corba.se.spi.ior.IORTemplate ;
+import com.sun.corba.se.spi.ior.ObjectKey ;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.resolver.Resolver ;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+public class BootstrapResolverImpl implements Resolver {
+ private org.omg.CORBA.portable.Delegate bootstrapDelegate ;
+ private ORBUtilSystemException wrapper ;
+
+ public BootstrapResolverImpl(ORB orb, String host, int port) {
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.ORB_RESOLVER ) ;
+
+ // Create a new IOR with the magic of INIT
+ byte[] initialKey = "INIT".getBytes() ;
+ ObjectKey okey = orb.getObjectKeyFactory().create(initialKey) ;
+
+ IIOPAddress addr = IIOPFactories.makeIIOPAddress( orb, host, port ) ;
+ IIOPProfileTemplate ptemp = IIOPFactories.makeIIOPProfileTemplate(
+ orb, GIOPVersion.V1_0, addr);
+
+ IORTemplate iortemp = IORFactories.makeIORTemplate( okey.getTemplate() ) ;
+ iortemp.add( ptemp ) ;
+
+ IOR initialIOR = iortemp.makeIOR( (com.sun.corba.se.spi.orb.ORB)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.
+ *
+ * @return InputStream which contains the response from the
+ * BootStrapOperation.
+ */
+ private InputStream invoke( String operationName, String parameter )
+ {
+ boolean remarshal = true;
+
+ // Invoke.
+
+ InputStream inStream = null;
+
+ // If there is a location forward then you will need
+ // to invoke again on the updated information.
+ // Just calling this same routine with the same host/port
+ // does not take the location forward info into account.
+
+ while (remarshal) {
+ org.omg.CORBA.Object objref = null ;
+ remarshal = false;
+
+ OutputStream os = (OutputStream) bootstrapDelegate.request( objref,
+ operationName, true);
+
+ 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
+ // call stack will become unbalanced since the version of
+ // 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);
+ } catch (ApplicationException e) {
+ throw wrapper.bootstrapApplicationException( e ) ;
+ } catch (RemarshalException e) {
+ // XXX log this
+ remarshal = true;
+ }
+ }
+
+ return inStream;
+ }
+
+ public org.omg.CORBA.Object resolve( String identifier )
+ {
+ InputStream inStream = null ;
+ org.omg.CORBA.Object result = null ;
+
+ 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 ) ;
+ }
+
+ return result ;
+ }
+
+ public java.util.Set list()
+ {
+ InputStream inStream = null ;
+ java.util.Set result = new java.util.HashSet() ;
+
+ try {
+ inStream = invoke( "list", null ) ;
+
+ int count = inStream.read_long();
+ 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 ) ;
+ }
+
+ return result ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/CompositeResolverImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/CompositeResolverImpl.java
new file mode 100644
index 0000000..0691055
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/CompositeResolverImpl.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.resolver ;
+
+import java.util.Set ;
+import java.util.HashSet ;
+
+import com.sun.corba.se.spi.resolver.Resolver ;
+
+public class CompositeResolverImpl implements Resolver {
+ private Resolver first ;
+ private Resolver 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 java.util.Set list()
+ {
+ Set result = new HashSet() ;
+ result.addAll( first.list() ) ;
+ result.addAll( second.list() ) ;
+ return result ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/FileResolverImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/FileResolverImpl.java
new file mode 100644
index 0000000..9594064
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/FileResolverImpl.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.resolver ;
+
+import org.omg.CORBA.ORBPackage.InvalidName;
+
+import com.sun.corba.se.spi.resolver.Resolver ;
+
+import java.util.Enumeration;
+import java.util.Properties;
+import java.util.Set;
+import java.util.HashSet;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.orbutil.CorbaResourceUtil ;
+
+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 org.omg.CORBA.Object resolve( String name )
+ {
+ check() ;
+ String stringifiedObject = savedProps.getProperty( name ) ;
+ if (stringifiedObject == null) {
+ return null;
+ }
+ return orb.string_to_object( stringifiedObject ) ;
+ }
+
+ public java.util.Set list()
+ {
+ check() ;
+
+ Set result = new HashSet() ;
+
+ // Obtain all the keys from the property object
+ Enumeration theKeys = savedProps.propertyNames();
+ while (theKeys.hasMoreElements()) {
+ result.add( theKeys.nextElement() ) ;
+ }
+
+ return result ;
+ }
+
+ /**
+ * 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;
+
+ long lastMod = file.lastModified();
+ if (lastMod > fileModified) {
+ try {
+ FileInputStream fileIS = new FileInputStream(file);
+ savedProps.clear();
+ savedProps.load(fileIS);
+ fileIS.close();
+ fileModified = lastMod;
+ } catch (java.io.FileNotFoundException e) {
+ 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()));
+ }
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java
new file mode 100644
index 0000000..91976a2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/INSURLOperationImpl.java
@@ -0,0 +1,329 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.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 sun.corba.EncapsInputStreamFactory;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.IORTemplate;
+import com.sun.corba.se.spi.ior.ObjectKey;
+import com.sun.corba.se.spi.ior.IORFactories;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.spi.orb.Operation;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.resolver.Resolver;
+
+import com.sun.corba.se.impl.encoding.EncapsInputStream;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.logging.OMGSystemException;
+import com.sun.corba.se.impl.naming.namingutil.INSURLHandler;
+import com.sun.corba.se.impl.naming.namingutil.IIOPEndpointInfo;
+import com.sun.corba.se.impl.naming.namingutil.INSURL;
+import com.sun.corba.se.impl.naming.namingutil.CorbalocURL;
+import com.sun.corba.se.impl.naming.namingutil.CorbanameURL;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.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.
+ *
+ * @author Hemanth
+ * @author Ken
+ */
+public class INSURLOperationImpl implements Operation
+{
+ ORB orb;
+ ORBUtilSystemException wrapper ;
+ OMGSystemException omgWrapper ;
+ Resolver bootstrapResolver ;
+
+ // Root Naming Context for default resolution of names.
+ private NamingContextExt rootNamingContextExt;
+ private Object rootContextCacheLock = new Object() ;
+
+ // The URLHandler to parse INS URL's
+ private INSURLHandler insURLHandler = INSURLHandler.getINSURLHandler() ;
+
+ public INSURLOperationImpl( ORB orb, Resolver bootstrapResolver )
+ {
+ this.orb = orb ;
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.ORB_RESOLVER ) ;
+ omgWrapper = OMGSystemException.get( orb,
+ CORBALogDomains.ORB_RESOLVER ) ;
+ this.bootstrapResolver = bootstrapResolver ;
+ }
+
+ 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 )
+ 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);
+ }
+ EncapsInputStream s = EncapsInputStreamFactory.newEncapsInputStream(orb, buf, buf.length,
+ orb.getORBData().getGIOPVersion());
+ s.consumeEndian();
+ return s.read_Object() ;
+ }
+
+ public Object operate( Object arg )
+ {
+ if (arg instanceof String) {
+ String str = (String)arg ;
+
+ if (str.startsWith( ORBConstants.STRINGIFY_PREFIX ))
+ // XXX handle this as just another URL scheme
+ return getIORFromString( str ) ;
+ else {
+ INSURL insURL = insURLHandler.parseURL( str ) ;
+ if (insURL == null)
+ throw omgWrapper.soBadSchemeName() ;
+ return resolveINSURL( insURL ) ;
+ }
+ }
+
+ throw wrapper.stringExpected() ;
+ }
+
+ private org.omg.CORBA.Object resolveINSURL( INSURL theURLObject ) {
+ // XXX resolve should be a method on INSURL
+ if( theURLObject.isCorbanameURL() ) {
+ return resolveCorbaname( (CorbanameURL)theURLObject );
+ } else {
+ return resolveCorbaloc( (CorbalocURL)theURLObject );
+ }
+ }
+
+ /**
+ * resolves a corbaloc: url that is encapsulated in a CorbalocURL object.
+ *
+ * @return the CORBA.Object if resolution is successful
+ */
+ private org.omg.CORBA.Object resolveCorbaloc(
+ CorbalocURL theCorbaLocObject )
+ {
+ org.omg.CORBA.Object result = null;
+ // If RIR flag is true use the Bootstrap protocol
+ if( theCorbaLocObject.getRIRFlag( ) ) {
+ result = bootstrapResolver.resolve(theCorbaLocObject.getKeyString());
+ } else {
+ result = getIORUsingCorbaloc( theCorbaLocObject );
+ }
+
+ return result;
+ }
+
+ /**
+ * resolves a corbaname: url that is encapsulated in a CorbanameURL object.
+ *
+ * @return the CORBA.Object if resolution is successful
+ */
+ private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
+ org.omg.CORBA.Object result = null;
+
+ try {
+ NamingContextExt theNamingContext = null;
+
+ if( theCorbaName.getRIRFlag( ) ) {
+ // Case 1 of corbaname: rir#
+ theNamingContext = getDefaultRootNamingContext( );
+ } else {
+ // Case 2 of corbaname: ::hostname#
+ org.omg.CORBA.Object corbalocResult =
+ getIORUsingCorbaloc( theCorbaName );
+ if( corbalocResult == null ) {
+ return null;
+ }
+
+ theNamingContext =
+ NamingContextExtHelper.narrow( corbalocResult );
+ }
+
+ String StringifiedName = theCorbaName.getStringifiedName( );
+
+ if( StringifiedName == null ) {
+ // This means return the Root Naming context
+ return theNamingContext;
+ } else {
+ return theNamingContext.resolve_str( StringifiedName );
+ }
+ } catch( Exception e ) {
+ clearRootNamingContextCache( );
+ return null;
+ }
+ }
+
+ /**
+ * This is an internal method to get the IOR from the CorbalocURL object.
+ *
+ * @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();
+
+ // 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 ) {
+ 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( orb, 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);
+ profileList1_0.add(profileTemplate);
+ } else {
+ if (profileMap.get(giopVersion) == null) {
+ profileTemplate = IIOPFactories.makeIIOPProfileTemplate(
+ orb, giopVersion, addr);
+ profileMap.put(giopVersion, profileTemplate);
+ } else {
+ profileTemplate = (IIOPProfileTemplate)profileMap.get(giopVersion);
+ AlternateIIOPAddressComponent iiopAddressComponent =
+ IIOPFactories.makeAlternateIIOPAddressComponent(addr);
+ profileTemplate.add(iiopAddressComponent);
+ }
+ }
+ }
+
+ GIOPVersion giopVersion = orb.getORBData().getGIOPVersion();
+ 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
+ }
+
+ // 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;
+ return (gv1.lessThan(gv2) ? 1 : (gv1.equals(gv2) ? 0 : -1));
+ };
+ };
+
+ // Now sort using the above comparator
+ List list = new ArrayList(profileMap.keySet());
+ Collections.sort(list, comp);
+
+ // Add the profiles in the sorted order
+ Iterator iter = list.iterator();
+ while (iter.hasNext()) {
+ 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 ) ;
+ }
+
+ /**
+ * 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
+ *
+ */
+ private NamingContextExt getDefaultRootNamingContext( ) {
+ synchronized( rootContextCacheLock ) {
+ if( rootNamingContextExt == null ) {
+ try {
+ rootNamingContextExt =
+ NamingContextExtHelper.narrow(
+ orb.getLocalResolver().resolve( "NameService" ) );
+ } catch( Exception e ) {
+ rootNamingContextExt = null;
+ }
+ }
+ }
+ return rootNamingContextExt;
+ }
+
+ /**
+ * A utility method to clear the RootNamingContext, if there is an
+ * exception in resolving CosNaming:Name from the RootNamingContext,
+ */
+ private void clearRootNamingContextCache( ) {
+ synchronized( rootContextCacheLock ) {
+ rootNamingContextExt = null;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/LocalResolverImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/LocalResolverImpl.java
new file mode 100644
index 0000000..b25bba2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/LocalResolverImpl.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.resolver ;
+
+import com.sun.corba.se.spi.resolver.LocalResolver ;
+import com.sun.corba.se.spi.orbutil.closure.Closure ;
+
+public class LocalResolverImpl implements LocalResolver {
+ java.util.Map nameToClosure = new java.util.HashMap() ;
+
+ public synchronized org.omg.CORBA.Object resolve( String name )
+ {
+ Closure cl = (Closure)nameToClosure.get( name ) ;
+ if (cl == null)
+ return null ;
+
+ return (org.omg.CORBA.Object)(cl.evaluate()) ;
+ }
+
+ public synchronized java.util.Set list()
+ {
+ return nameToClosure.keySet() ;
+ }
+
+ public synchronized void register( String name, Closure closure )
+ {
+ nameToClosure.put( name, closure ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/ORBDefaultInitRefResolverImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/ORBDefaultInitRefResolverImpl.java
new file mode 100644
index 0000000..6e0e335
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/ORBDefaultInitRefResolverImpl.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.resolver ;
+
+import com.sun.corba.se.spi.resolver.Resolver ;
+
+import com.sun.corba.se.spi.orb.Operation ;
+
+public class ORBDefaultInitRefResolverImpl implements Resolver {
+ Operation urlHandler ;
+ String orbDefaultInitRef ;
+
+ public ORBDefaultInitRefResolverImpl( Operation urlHandler, String orbDefaultInitRef )
+ {
+ this.urlHandler = urlHandler ;
+
+ // XXX Validate the URL?
+ this.orbDefaultInitRef = orbDefaultInitRef ;
+ }
+
+ public org.omg.CORBA.Object resolve( String ident )
+ {
+ // If the ORBDefaultInitRef is not defined simply return null
+ if( orbDefaultInitRef == null ) {
+ return null;
+ }
+
+ String urlString;
+ // If the ORBDefaultInitDef is defined as corbaloc: then create the
+ // corbaloc String in the format
+ // <ORBInitDefaultInitDef Param>/<Identifier>
+ // and resolve it using resolveCorbaloc method
+ if( orbDefaultInitRef.startsWith( "corbaloc:" ) ) {
+ urlString = orbDefaultInitRef + "/" + ident;
+ } else {
+ urlString = orbDefaultInitRef + "#" + ident;
+ }
+
+ return (org.omg.CORBA.Object)urlHandler.operate( urlString ) ;
+ }
+
+ public java.util.Set list()
+ {
+ return new java.util.HashSet() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/ORBInitRefResolverImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/ORBInitRefResolverImpl.java
new file mode 100644
index 0000000..eac36a6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/ORBInitRefResolverImpl.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.resolver ;
+
+import com.sun.corba.se.spi.resolver.Resolver ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.orb.Operation ;
+import com.sun.corba.se.spi.orb.StringPair ;
+
+public class ORBInitRefResolverImpl implements Resolver {
+ Operation urlHandler ;
+ java.util.Map orbInitRefTable ;
+
+ public ORBInitRefResolverImpl( Operation urlHandler, StringPair[] initRefs )
+ {
+ this.urlHandler = urlHandler ;
+ orbInitRefTable = new java.util.HashMap() ;
+
+ for( int i = 0; i < initRefs.length ; i++ ) {
+ StringPair sp = initRefs[i] ;
+ orbInitRefTable.put( sp.getFirst(), sp.getSecond() ) ;
+ }
+ }
+
+ public org.omg.CORBA.Object resolve( String ident )
+ {
+ String url = (String)orbInitRefTable.get( ident ) ;
+ if (url == null)
+ return null ;
+
+ org.omg.CORBA.Object result =
+ (org.omg.CORBA.Object)urlHandler.operate( url ) ;
+ return result ;
+ }
+
+ public java.util.Set list()
+ {
+ return orbInitRefTable.keySet() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/SplitLocalResolverImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/SplitLocalResolverImpl.java
new file mode 100644
index 0000000..20a1808
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/resolver/SplitLocalResolverImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.resolver ;
+
+import com.sun.corba.se.spi.orbutil.closure.Closure ;
+
+import com.sun.corba.se.spi.resolver.Resolver ;
+import com.sun.corba.se.spi.resolver.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 void register( String name, Closure closure )
+ {
+ localResolver.register( name, closure ) ;
+ }
+
+ public org.omg.CORBA.Object resolve( String name )
+ {
+ return resolver.resolve( name ) ;
+ }
+
+ public java.util.Set list()
+ {
+ return resolver.list() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ByteBufferPoolImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ByteBufferPoolImpl.java
new file mode 100644
index 0000000..91b26c4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ByteBufferPoolImpl.java
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+
+/**
+ * @author Charlie Hunt
+ */
+
+public class ByteBufferPoolImpl implements ByteBufferPool
+{
+ private ORB itsOrb;
+ private int itsByteBufferSize;
+ private ArrayList itsPool;
+ private int itsObjectCounter = 0;
+ private boolean debug;
+
+ // Construct a ByteBufferPool for a pool of NIO ByteBuffers
+ // of ORB fragment size.
+ public ByteBufferPoolImpl(ORB theORB)
+ {
+ itsByteBufferSize = theORB.getORBData().getGIOPFragmentSize();
+ itsPool = new ArrayList();
+ itsOrb = theORB;
+ debug = theORB.transportDebugFlag;
+ }
+
+ /*
+ * Locations where ByteBuffers are gotten from the pool:
+ * 1. ContactInfoBase.createMessageMediator()
+ * 2. ByteBufferWithInfo.growBuffer()
+ * 3. ByteBufferWithInfo(ORB, BufferManagerWrite) - constructor
+ */
+
+ // If the requested ByteBuffer size is less than or equal to
+ // the ORB fragment size, and we have not disabled use of
+ // direct byte buffers (normally for debugging purposes)
+ // then get a DirectByteBuffer from the
+ // pool if there is one, if there is not one in the pool,
+ // then allocate a a DirectByteBuffer of ORB fragment size.
+ //
+ // If the request ByteBuffer size is greater than the ORB fragment
+ // size, allocate a new non-direct ByteBuffer.
+ public ByteBuffer getByteBuffer(int theAskSize)
+ {
+ ByteBuffer abb = null;
+
+ if ((theAskSize <= itsByteBufferSize) &&
+ !itsOrb.getORBData().disableDirectByteBufferUse())
+ {
+ // check if there's one in the pool, if not allocate one.
+ int poolSize;
+ synchronized (itsPool)
+ {
+ poolSize = itsPool.size();
+ if (poolSize > 0)
+ {
+ abb = (ByteBuffer)itsPool.remove(poolSize - 1);
+
+ // clear ByteBuffer before returning it
+ abb.clear();
+ }
+ }
+
+ // NOTE: Moved the 'else' part of the above if statement
+ // outside the synchronized block since it is likely
+ // less expensive to check poolSize than to allocate a
+ // DirectByteBuffer in the synchronized block.
+ if (poolSize <= 0)
+ {
+ abb = ByteBuffer.allocateDirect(itsByteBufferSize);
+ }
+
+ // increment the number of ByteBuffers gotten from pool
+ // IMPORTANT: Since this counter is used only for information
+ // purposes, it does not use synchronized access.
+ itsObjectCounter++;
+ }
+ else
+ {
+ // Requested ByteBuffer size larger than the pool manages.
+ // Just allocate a non-direct ByteBuffer
+ abb = ByteBuffer.allocate(theAskSize);
+ }
+
+ return abb;
+ }
+
+
+ /*
+ * Locations where ByteBuffers are released to the pool:
+ * 1. ByteBufferWithInfo.growBuffer()
+ * 2. BufferManagerWriteCollect.sendMessage()
+ * 3. CDROutputStream_1_0.close()
+ * 4. CDRInputStream_1_0.close()
+ * 5. BufferManagerReadStream.underflow()
+ * 6. BufferManagerWrite.close()
+ * 7. BufferManagerRead.close()
+ * 8. CorbaMessageMediatorImpl.releaseByteBufferToPool()
+ */
+
+ // If the ByteBuffer is a DirectByteBuffer, add it to the pool.
+ // Otherwise, set its reference to null since it's not kept in
+ // the pool and caller is saying he/she is done with it.
+ // NOTE: The size of the ByteBuffer is not checked with the
+ // this pool's ByteBuffer size since only DirectByteBuffers
+ // ever allocated. Hence, only DirectByteBuffer are checked
+ // here. An additional check could be added here for that though.
+ public void releaseByteBuffer(ByteBuffer thebb)
+ {
+ if (thebb.isDirect())
+ {
+ synchronized (itsPool)
+ {
+ // use with debug to determine if byteBuffer is already
+ // in the pool.
+ boolean refInPool = false;
+ int bbAddr = 0;
+
+ if (debug)
+ {
+ // Check to make sure we don't have 'thebb' reference
+ // already in the pool before adding it.
+
+ for (int i = 0; i < itsPool.size() && refInPool == false; i++)
+ {
+ ByteBuffer tmpbb = (ByteBuffer)itsPool.get(i);
+ if (thebb == tmpbb)
+ {
+ refInPool = true;
+ bbAddr = System.identityHashCode(thebb);
+ }
+ }
+
+ }
+
+ // NOTE: The else part of this if will only get called
+ // if debug = true and refInPool = true, see logic above.
+ if (refInPool == false || debug == false)
+ {
+ // add ByteBuffer back to the pool
+ itsPool.add(thebb);
+ }
+ else // otherwise, log a stack trace with duplicate message
+ {
+ String threadName = Thread.currentThread().getName();
+ Throwable t =
+ new Throwable(threadName +
+ ": Duplicate ByteBuffer reference (" +
+ bbAddr + ")");
+ t.printStackTrace(System.out);
+ }
+ }
+
+ // decrement the count of ByteBuffers released
+ // IMPORTANT: Since this counter is used only for information
+ // purposes, it does not use synchronized access.
+ itsObjectCounter--;
+ }
+ else
+ {
+ // ByteBuffer not pooled nor needed
+ thebb = null;
+ }
+ }
+
+
+ // Get a count of the outstanding allocated DirectByteBuffers.
+ // (Those allocated and have not been returned to the pool).
+ // IMPORTANT: Since this counter is used only for information
+ // purposes, it does not use synchronized access.
+ public int activeCount()
+ {
+ return itsObjectCounter;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java
new file mode 100644
index 0000000..4f8aeda
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaConnectionCacheBase.java
@@ -0,0 +1,268 @@
+/*
+ * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.util.Collection;
+import java.util.Iterator;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ConnectionCache;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.transport.CorbaConnectionCache;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+/**
+ * @author Harold Carr
+ */
+public abstract class CorbaConnectionCacheBase
+ implements
+ ConnectionCache,
+ CorbaConnectionCache
+{
+ protected ORB orb;
+ protected long timestamp = 0;
+ protected String cacheType;
+ protected String monitoringName;
+ protected ORBUtilSystemException wrapper;
+
+ protected CorbaConnectionCacheBase(ORB orb, String cacheType,
+ String monitoringName)
+ {
+ this.orb = orb;
+ this.cacheType = cacheType;
+ this.monitoringName = monitoringName;
+ wrapper =ORBUtilSystemException.get(orb,CORBALogDomains.RPC_TRANSPORT);
+ registerWithMonitoring();
+ dprintCreation();
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.ConnectionCache
+ //
+
+ public String getCacheType()
+ {
+ return cacheType;
+ }
+
+ public synchronized void stampTime(Connection c)
+ {
+ // _REVISIT_ Need to worry about wrap around some day
+ c.setTimeStamp(timestamp++);
+ }
+
+ public long numberOfConnections()
+ {
+ synchronized (backingStore()) {
+ return values().size();
+ }
+ }
+
+ public void close() {
+ synchronized (backingStore()) {
+ for (Object obj : values()) {
+ ((CorbaConnection)obj).closeConnectionResources() ;
+ }
+ }
+ }
+
+ public long numberOfIdleConnections()
+ {
+ long count = 0;
+ synchronized (backingStore()) {
+ Iterator connections = values().iterator();
+ while (connections.hasNext()) {
+ if (! ((Connection)connections.next()).isBusy()) {
+ count++;
+ }
+ }
+ }
+ return count;
+ }
+
+ public long numberOfBusyConnections()
+ {
+ long count = 0;
+ synchronized (backingStore()) {
+ Iterator connections = values().iterator();
+ while (connections.hasNext()) {
+ if (((Connection)connections.next()).isBusy()) {
+ 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 {@literal <=} .... ). 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 {@literal &} 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.
+ */
+ synchronized public boolean reclaim()
+ {
+ try {
+ long numberOfConnections = numberOfConnections();
+
+ if (orb.transportDebugFlag) {
+ dprint(".reclaim->: " + numberOfConnections
+ + " ("
+ + orb.getORBData().getHighWaterMark()
+ + "/"
+ + orb.getORBData().getLowWaterMark()
+ + "/"
+ + orb.getORBData().getNumberToReclaim()
+ + ")");
+ }
+
+ if (numberOfConnections <= orb.getORBData().getHighWaterMark() ||
+ numberOfConnections < orb.getORBData().getLowWaterMark()) {
+ return false;
+ }
+
+ Object backingStore = backingStore();
+ synchronized (backingStore) {
+
+ // REVISIT - A less expensive alternative connection reclaiming
+ // algorithm could be investigated.
+
+ 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() ) {
+ Connection c = (Connection) iterator.next();
+ if ( !c.isBusy() && c.getTimeStamp() < lru ) {
+ toClose = c;
+ lru = c.getTimeStamp();
+ }
+ }
+
+ if ( toClose == null ) {
+ return false;
+ }
+
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".reclaim: closing: " + toClose);
+ }
+ toClose.close();
+ } catch (Exception ex) {
+ // REVISIT - log
+ }
+ }
+
+ if (orb.transportDebugFlag) {
+ dprint(".reclaim: connections reclaimed ("
+ + (numberOfConnections - numberOfConnections()) + ")");
+ }
+ }
+
+ // XXX is necessary to do a GC to reclaim
+ // closed network connections ??
+ // java.lang.System.gc();
+
+ return true;
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".reclaim<-: " + numberOfConnections());
+ }
+ }
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // spi.transport.ConnectionCache
+ //
+
+ public String getMonitoringName()
+ {
+ return monitoringName;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation
+ //
+
+ // This is public so folb.Server test can access it.
+ public abstract Collection values();
+
+ protected abstract Object backingStore();
+
+ protected abstract void registerWithMonitoring();
+
+ protected void dprintCreation()
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".constructor: cacheType: " + getCacheType()
+ + " monitoringName: " + getMonitoringName());
+ }
+ }
+
+ protected void dprintStatistics()
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".stats: "
+ + numberOfConnections() + "/total "
+ + numberOfBusyConnections() + "/busy "
+ + numberOfIdleConnections() + "/idle"
+ + " ("
+ + orb.getORBData().getHighWaterMark() + "/"
+ + orb.getORBData().getLowWaterMark() + "/"
+ + orb.getORBData().getNumberToReclaim()
+ + ")");
+ }
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("CorbaConnectionCacheBase", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java
new file mode 100644
index 0000000..419efe7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoBase.java
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.nio.ByteBuffer;
+
+import org.omg.CORBA.INTERNAL;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.ContactInfoList;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.EventHandler;
+import com.sun.corba.se.pept.transport.OutboundConnectionCache;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList;
+import com.sun.corba.se.spi.transport.CorbaContactInfo;
+
+import com.sun.corba.se.impl.encoding.ByteBufferWithInfo;
+import com.sun.corba.se.impl.encoding.CDRInputObject;
+import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.KeyAddr;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+/**
+ * @author Harold Carr
+ */
+public abstract class CorbaContactInfoBase
+ implements
+ CorbaContactInfo
+{
+ protected ORB orb;
+ protected CorbaContactInfoList contactInfoList;
+ // NOTE: This may be different from same named one in CorbaContactInfoList.
+ protected IOR effectiveTargetIOR;
+ protected short addressingDisposition;
+ protected OutboundConnectionCache connectionCache;
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.ContactInfo
+ //
+
+ public Broker getBroker()
+ {
+ return orb;
+ }
+
+ public ContactInfoList getContactInfoList()
+ {
+ return contactInfoList;
+ }
+
+ 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)
+ {
+ this.connectionCache = connectionCache;
+ }
+
+ public OutboundConnectionCache getConnectionCache()
+ {
+ return connectionCache;
+ }
+
+ // Called when client making an invocation.
+ public MessageMediator createMessageMediator(Broker 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
+ // factory method because it breaks generic abstraction.
+ // Maybe set methods on mediator called from subcontract
+ // after creation?
+ CorbaMessageMediator messageMediator =
+ new CorbaMessageMediatorImpl(
+ (ORB) broker,
+ contactInfo,
+ connection,
+ GIOPVersion.chooseRequestVersion( (ORB)broker,
+ effectiveTargetIOR),
+ effectiveTargetIOR,
+ ((CorbaConnection)connection).getNextRequestId(),
+ getAddressingDisposition(),
+ methodName,
+ isOneWay);
+
+ return messageMediator;
+ }
+
+ // Called when connection handling a read event.
+ public MessageMediator createMessageMediator(Broker broker,Connection conn)
+ {
+ ORB orb = (ORB) broker;
+ CorbaConnection connection = (CorbaConnection) conn;
+
+ if (orb.transportDebugFlag) {
+ if (connection.shouldReadGiopHeaderOnly()) {
+ dprint(
+ ".createMessageMediator: waiting for message header on connection: "
+ + connection);
+ } else {
+ dprint(
+ ".createMessageMediator: waiting for message on connection: "
+ + connection);
+ }
+ }
+
+ Message msg = null;
+
+ if (connection.shouldReadGiopHeaderOnly()) {
+ // read giop header only
+ msg = MessageBase.readGIOPHeader(orb, connection);
+ } else {
+ // read entire giop message
+ msg = MessageBase.readGIOPMessage(orb, connection);
+ }
+
+ ByteBuffer byteBuffer = msg.getByteBuffer();
+ msg.setByteBuffer(null);
+ CorbaMessageMediator messageMediator =
+ new CorbaMessageMediatorImpl(orb, connection, msg, byteBuffer);
+
+ return messageMediator;
+ }
+
+ // Called when connection reading message body
+ public MessageMediator finishCreatingMessageMediator(Broker broker,
+ Connection conn, MessageMediator messageMediator)
+ {
+ ORB orb = (ORB) broker;
+ CorbaConnection connection = (CorbaConnection) conn;
+ CorbaMessageMediator corbaMessageMediator =
+ (CorbaMessageMediator)messageMediator;
+
+ if (orb.transportDebugFlag) {
+ dprint(
+ ".finishCreatingMessageMediator: waiting for message body on connection: "
+ + connection);
+ }
+
+ Message msg = corbaMessageMediator.getDispatchHeader();
+ msg.setByteBuffer(corbaMessageMediator.getDispatchBuffer());
+
+ // read giop body only
+ msg = MessageBase.readGIOPBody(orb, connection, msg);
+
+ ByteBuffer byteBuffer = msg.getByteBuffer();
+ msg.setByteBuffer(null);
+ corbaMessageMediator.setDispatchHeader(msg);
+ corbaMessageMediator.setDispatchBuffer(byteBuffer);
+
+ return corbaMessageMediator;
+ }
+
+ public OutputObject createOutputObject(MessageMediator messageMediator)
+ {
+ CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
+ messageMediator;
+
+ OutputObject outputObject =
+ sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
+ corbaMessageMediator.getRequestHeader(),
+ corbaMessageMediator.getStreamFormatVersion());
+
+ messageMediator.setOutputObject(outputObject);
+ return outputObject;
+ }
+
+ public InputObject createInputObject(Broker broker,
+ MessageMediator messageMediator)
+ {
+ // REVISIT: Duplicate of acceptor code.
+ CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
+ messageMediator;
+ return new CDRInputObject((ORB)broker,
+ (CorbaConnection)messageMediator.getConnection(),
+ corbaMessageMediator.getDispatchBuffer(),
+ corbaMessageMediator.getDispatchHeader());
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // spi.transport.CorbaContactInfo
+ //
+
+ public short getAddressingDisposition()
+ {
+ return addressingDisposition;
+ }
+
+ public void setAddressingDisposition(short addressingDisposition)
+ {
+ this.addressingDisposition = addressingDisposition;
+ }
+
+ // REVISIT - remove this.
+ public IOR getTargetIOR()
+ {
+ return contactInfoList.getTargetIOR();
+ }
+
+ public IOR getEffectiveTargetIOR()
+ {
+ return effectiveTargetIOR ;
+ }
+
+ public IIOPProfile getEffectiveProfile()
+ {
+ return effectiveTargetIOR.getProfile();
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // java.lang.Object
+ //
+
+ public String toString()
+ {
+ return
+ "CorbaContactInfoBase["
+ + "]";
+ }
+
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation
+ //
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("CorbaContactInfoBase", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListImpl.java
new file mode 100644
index 0000000..cb8c895
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListImpl.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.sun.corba.se.pept.transport.ContactInfo;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.oa.ObjectAdapterFactory;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
+import com.sun.corba.se.spi.transport.SocketInfo;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.protocol.NotLocalLocalCRDImpl;
+
+/**
+ * @author Harold Carr
+ */
+public class CorbaContactInfoListImpl
+ implements
+ CorbaContactInfoList
+{
+ protected ORB orb;
+ protected LocalClientRequestDispatcher LocalClientRequestDispatcher;
+ protected IOR targetIOR;
+ protected IOR effectiveTargetIOR;
+ protected List effectiveTargetIORContactInfoList;
+ protected ContactInfo primaryContactInfo;
+
+ // XREVISIT - is this used?
+ public CorbaContactInfoListImpl(ORB orb)
+ {
+ this.orb = orb;
+ }
+
+ public CorbaContactInfoListImpl(ORB orb, IOR targetIOR)
+ {
+ this(orb);
+ setTargetIOR(targetIOR);
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.ContactInfoList
+ //
+
+ public synchronized Iterator iterator()
+ {
+ createContactInfoList();
+ return new CorbaContactInfoListIteratorImpl(
+ orb, this, primaryContactInfo,
+ effectiveTargetIORContactInfoList);
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // spi.transport.CorbaContactInfoList
+ //
+
+ public synchronized void setTargetIOR(IOR targetIOR)
+ {
+ this.targetIOR = targetIOR;
+ setEffectiveTargetIOR(targetIOR);
+ }
+
+ public synchronized IOR getTargetIOR()
+ {
+ return targetIOR;
+ }
+
+ public synchronized void setEffectiveTargetIOR(IOR effectiveTargetIOR)
+ {
+ this.effectiveTargetIOR = effectiveTargetIOR;
+ effectiveTargetIORContactInfoList = null;
+ if (primaryContactInfo != null &&
+ orb.getORBData().getIIOPPrimaryToContactInfo() != null)
+ {
+ orb.getORBData().getIIOPPrimaryToContactInfo()
+ .reset(primaryContactInfo);
+ }
+ primaryContactInfo = null;
+ setLocalSubcontract();
+ }
+
+ public synchronized IOR getEffectiveTargetIOR()
+ {
+ return effectiveTargetIOR;
+ }
+
+ public synchronized LocalClientRequestDispatcher getLocalClientRequestDispatcher()
+ {
+ return LocalClientRequestDispatcher;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // org.omg.CORBA.portable.Delegate
+ //
+
+ // REVISIT - hashCode(org.omg.CORBA.Object self)
+
+ ////////////////////////////////////////////////////
+ //
+ // java.lang.Object
+ //
+
+ public synchronized int hashCode()
+ {
+ return targetIOR.hashCode();
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation
+ //
+
+ protected void createContactInfoList()
+ {
+ if (effectiveTargetIORContactInfoList != null) {
+ return;
+ }
+
+ effectiveTargetIORContactInfoList = new ArrayList();
+
+ IIOPProfile iiopProfile = effectiveTargetIOR.getProfile();
+ String hostname =
+ ((IIOPProfileTemplate)iiopProfile.getTaggedProfileTemplate())
+ .getPrimaryAddress().getHost().toLowerCase();
+ int port =
+ ((IIOPProfileTemplate)iiopProfile.getTaggedProfileTemplate())
+ .getPrimaryAddress().getPort();
+ // For use by "sticky manager" if one is registered.
+ primaryContactInfo =
+ createContactInfo(SocketInfo.IIOP_CLEAR_TEXT, hostname, port);
+
+ if (iiopProfile.isLocal()) {
+ // NOTE: IMPORTANT:
+ // 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());
+ effectiveTargetIORContactInfoList.add(contactInfo);
+ } else {
+ addRemoteContactInfos(effectiveTargetIOR,
+ effectiveTargetIORContactInfoList);
+ }
+ }
+
+ protected void addRemoteContactInfos(
+ IOR effectiveTargetIOR,
+ List effectiveTargetIORContactInfoList)
+ {
+ ContactInfo contactInfo;
+ List socketInfos = orb.getORBData()
+ .getIORToSocketInfo().getSocketInfo(effectiveTargetIOR);
+ Iterator iterator = socketInfos.iterator();
+ while (iterator.hasNext()) {
+ SocketInfo socketInfo = (SocketInfo) iterator.next();
+ String type = socketInfo.getType();
+ String host = socketInfo.getHost().toLowerCase();
+ int port = socketInfo.getPort();
+ contactInfo = createContactInfo(type, host, port);
+ effectiveTargetIORContactInfoList.add(contactInfo);
+ }
+ }
+
+ protected ContactInfo createContactInfo(String type,
+ String hostname, int port)
+ {
+ return new SocketOrChannelContactInfoImpl(
+ 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.
+ *
+ * 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).
+ */
+ protected void setLocalSubcontract()
+ {
+ if (!effectiveTargetIOR.getProfile().isLocal()) {
+ LocalClientRequestDispatcher = new NotLocalLocalCRDImpl();
+ return;
+ }
+
+ // XXX Note that this always uses the first IIOP profile to get the
+ // scid. What about multi-profile IORs? This should perhaps be
+ // tied to the current ContactInfo in some way, together with an
+ // implementation of ClientDelegate that generally prefers co-located
+ // ContactInfo. This may in fact mean that we should do this at
+ // the ContactInfo level, rather than the IOR/profile level.
+ int scid = effectiveTargetIOR.getProfile().getObjectKeyTemplate().
+ getSubcontractId() ;
+ LocalClientRequestDispatcherFactory lcsf = orb.getRequestDispatcherRegistry().getLocalClientRequestDispatcherFactory( scid ) ;
+ LocalClientRequestDispatcher = lcsf.create( scid, effectiveTargetIOR ) ;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListIteratorImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListIteratorImpl.java
new file mode 100644
index 0000000..599752c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaContactInfoListIteratorImpl.java
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.util.Iterator;
+import java.util.List;
+
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.SystemException;
+
+import com.sun.corba.se.pept.transport.ContactInfo ;
+import com.sun.corba.se.pept.transport.ContactInfoList ;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.transport.CorbaContactInfo;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListIterator;
+import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.protocol.CorbaInvocationInfo;
+
+// REVISIT: create a unit test for this class.
+
+public class CorbaContactInfoListIteratorImpl
+ implements
+ CorbaContactInfoListIterator
+{
+ protected ORB orb;
+ protected CorbaContactInfoList contactInfoList;
+ protected CorbaContactInfo successContactInfo;
+ protected CorbaContactInfo failureContactInfo;
+ protected RuntimeException failureException;
+
+ // ITERATOR state
+ protected Iterator effectiveTargetIORIterator;
+ protected CorbaContactInfo previousContactInfo;
+ protected boolean isAddrDispositionRetry;
+ protected IIOPPrimaryToContactInfo primaryToContactInfo;
+ protected ContactInfo primaryContactInfo;
+ protected List listOfContactInfos;
+ // End ITERATOR state
+
+ public CorbaContactInfoListIteratorImpl(
+ ORB orb,
+ CorbaContactInfoList corbaContactInfoList,
+ ContactInfo primaryContactInfo,
+ List listOfContactInfos)
+ {
+ this.orb = orb;
+ 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();
+ }
+ // List is immutable so no need to synchronize access.
+ this.listOfContactInfos = listOfContactInfos;
+
+ this.previousContactInfo = null;
+ this.isAddrDispositionRetry = false;
+
+ this.successContactInfo = null;
+ this.failureContactInfo = null;
+ this.failureException = null;
+
+ primaryToContactInfo = orb.getORBData().getIIOPPrimaryToContactInfo();
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // java.util.Iterator
+ //
+
+ public boolean hasNext()
+ {
+ // REVISIT: Implement as internal closure iterator which would
+ // wraps sticky or default. Then hasNext and next just call
+ // the closure.
+
+ if (isAddrDispositionRetry) {
+ return true;
+ }
+
+ boolean result;
+
+ if (primaryToContactInfo != null) {
+ result = primaryToContactInfo.hasNext(primaryContactInfo,
+ previousContactInfo,
+ listOfContactInfos);
+ } else {
+ result = effectiveTargetIORIterator.hasNext();
+ }
+
+ return result;
+ }
+
+ public Object next()
+ {
+ if (isAddrDispositionRetry) {
+ isAddrDispositionRetry = false;
+ return previousContactInfo;
+ }
+
+ // We hold onto the last in case we get an addressing
+ // disposition retry. Then we use it again.
+
+ // We also hold onto it for the sticky manager.
+
+ if (primaryToContactInfo != null) {
+ previousContactInfo = (CorbaContactInfo)
+ primaryToContactInfo.next(primaryContactInfo,
+ previousContactInfo,
+ listOfContactInfos);
+ } else {
+ previousContactInfo = (CorbaContactInfo)
+ effectiveTargetIORIterator.next();
+ }
+
+ return previousContactInfo;
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // com.sun.corba.se.pept.transport.ContactInfoListIterator
+ //
+
+ public ContactInfoList getContactInfoList()
+ {
+ return contactInfoList;
+ }
+
+ public void reportSuccess(ContactInfo contactInfo)
+ {
+ this.successContactInfo = (CorbaContactInfo)contactInfo;
+ }
+
+ public boolean reportException(ContactInfo contactInfo,
+ RuntimeException ex)
+ {
+ this.failureContactInfo = (CorbaContactInfo)contactInfo;
+ this.failureException = ex;
+ if (ex instanceof COMM_FAILURE) {
+ SystemException se = (SystemException) ex;
+ if (se.completed == CompletionStatus.COMPLETED_NO) {
+ if (hasNext()) {
+ return true;
+ }
+ if (contactInfoList.getEffectiveTargetIOR() !=
+ contactInfoList.getTargetIOR())
+ {
+ // retry from root ior
+ updateEffectiveTargetIOR(contactInfoList.getTargetIOR());
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public RuntimeException getFailureException()
+ {
+ if (failureException == null) {
+ return
+ ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_TRANSPORT )
+ .invalidContactInfoListIteratorFailureException();
+ } else {
+ return failureException;
+ }
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // spi.CorbaContactInfoListIterator
+ //
+
+ public void reportAddrDispositionRetry(CorbaContactInfo contactInfo,
+ short disposition)
+ {
+ previousContactInfo.setAddressingDisposition(disposition);
+ isAddrDispositionRetry = true;
+ }
+
+ public void reportRedirect(CorbaContactInfo contactInfo,
+ IOR forwardedIOR)
+ {
+ updateEffectiveTargetIOR(forwardedIOR);
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // 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
+ // 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
+ // that exception.
+ //
+
+ 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
+ // InvocationStack (i.e., ThreadLocal). That way if the list iterator
+ // needs a complete update it happens right here.
+ ((CorbaInvocationInfo)orb.getInvocationInfo())
+ .setContactInfoListIterator(contactInfoList.iterator());
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaInboundConnectionCacheImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaInboundConnectionCacheImpl.java
new file mode 100644
index 0000000..1f2f855
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaInboundConnectionCacheImpl.java
@@ -0,0 +1,222 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.util.ArrayList;
+import java.util.Collection;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.InboundConnectionCache;
+
+import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase;
+import com.sun.corba.se.spi.monitoring.MonitoringConstants;
+import com.sun.corba.se.spi.monitoring.MonitoringFactories;
+import com.sun.corba.se.spi.monitoring.MonitoredObject;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaConnectionCache;
+import com.sun.corba.se.spi.transport.CorbaAcceptor;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+/**
+ * @author Harold Carr
+ */
+public class CorbaInboundConnectionCacheImpl
+ extends
+ CorbaConnectionCacheBase
+ implements
+ InboundConnectionCache
+{
+ protected Collection connectionCache;
+
+ private Acceptor acceptor;
+
+ public CorbaInboundConnectionCacheImpl(ORB orb, Acceptor acceptor)
+ {
+ super(orb, acceptor.getConnectionCacheType(),
+ ((CorbaAcceptor)acceptor).getMonitoringName());
+ this.connectionCache = new ArrayList();
+ this.acceptor = acceptor;
+ if (orb.transportDebugFlag) {
+ dprint(": " + acceptor );
+ }
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.InboundConnectionCache
+ //
+
+ public void close () {
+
+ super.close();
+ if (orb.transportDebugFlag) {
+ dprint(".close: " + acceptor );
+ }
+ this.acceptor.close();
+
+ }
+
+ public Connection get(Acceptor acceptor)
+ {
+ throw wrapper.methodShouldNotBeCalled();
+ }
+
+ public Acceptor getAcceptor () {
+ return acceptor;
+ }
+
+ public void put(Acceptor acceptor, Connection connection)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".put: " + acceptor + " " + connection);
+ }
+ synchronized (backingStore()) {
+ connectionCache.add(connection);
+ connection.setConnectionCache(this);
+ dprintStatistics();
+ }
+ }
+
+ public void remove(Connection connection)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".remove: " + connection);
+ }
+ synchronized (backingStore()) {
+ connectionCache.remove(connection);
+ dprintStatistics();
+ }
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation
+ //
+
+ public Collection values()
+ {
+ return connectionCache;
+ }
+
+ protected Object backingStore()
+ {
+ return connectionCache;
+ }
+
+ protected void registerWithMonitoring()
+ {
+ // ORB
+ MonitoredObject orbMO =
+ orb.getMonitoringManager().getRootMonitoredObject();
+
+ // REVISIT - add ORBUtil mkdir -p like operation for this.
+
+ // CONNECTION
+ MonitoredObject connectionMO =
+ orbMO.getChild(MonitoringConstants.CONNECTION_MONITORING_ROOT);
+ if (connectionMO == null) {
+ connectionMO =
+ MonitoringFactories.getMonitoredObjectFactory()
+ .createMonitoredObject(
+ MonitoringConstants.CONNECTION_MONITORING_ROOT,
+ MonitoringConstants.CONNECTION_MONITORING_ROOT_DESCRIPTION);
+ orbMO.addChild(connectionMO);
+ }
+
+ // INBOUND CONNECTION
+ MonitoredObject inboundConnectionMO =
+ connectionMO.getChild(
+ MonitoringConstants.INBOUND_CONNECTION_MONITORING_ROOT);
+ if (inboundConnectionMO == null) {
+ inboundConnectionMO =
+ MonitoringFactories.getMonitoredObjectFactory()
+ .createMonitoredObject(
+ MonitoringConstants.INBOUND_CONNECTION_MONITORING_ROOT,
+ MonitoringConstants.INBOUND_CONNECTION_MONITORING_ROOT_DESCRIPTION);
+ connectionMO.addChild(inboundConnectionMO);
+ }
+
+ // NODE FOR THIS CACHE
+ MonitoredObject thisMO =
+ inboundConnectionMO.getChild(getMonitoringName());
+ if (thisMO == null) {
+ thisMO =
+ MonitoringFactories.getMonitoredObjectFactory()
+ .createMonitoredObject(
+ getMonitoringName(),
+ MonitoringConstants.CONNECTION_MONITORING_DESCRIPTION);
+ inboundConnectionMO.addChild(thisMO);
+ }
+
+ LongMonitoredAttributeBase attribute;
+
+ // ATTRIBUTE
+ attribute = new
+ LongMonitoredAttributeBase(
+ MonitoringConstants.CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS,
+ MonitoringConstants.CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS_DESCRIPTION)
+ {
+ public Object getValue() {
+ return new Long(CorbaInboundConnectionCacheImpl.this.numberOfConnections());
+ }
+ };
+ thisMO.addAttribute(attribute);
+
+ // ATTRIBUTE
+ attribute = new
+ LongMonitoredAttributeBase(
+ MonitoringConstants.CONNECTION_NUMBER_OF_IDLE_CONNECTIONS,
+ MonitoringConstants.CONNECTION_NUMBER_OF_IDLE_CONNECTIONS_DESCRIPTION)
+ {
+ public Object getValue() {
+ return new Long(CorbaInboundConnectionCacheImpl.this.numberOfIdleConnections());
+ }
+ };
+ thisMO.addAttribute(attribute);
+
+ // ATTRIBUTE
+ attribute = new
+ LongMonitoredAttributeBase(
+ MonitoringConstants.CONNECTION_NUMBER_OF_BUSY_CONNECTIONS,
+ MonitoringConstants.CONNECTION_NUMBER_OF_BUSY_CONNECTIONS_DESCRIPTION)
+ {
+ public Object getValue() {
+ return new Long(CorbaInboundConnectionCacheImpl.this.numberOfBusyConnections());
+ }
+ };
+ thisMO.addAttribute(attribute);
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("CorbaInboundConnectionCacheImpl", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaOutboundConnectionCacheImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaOutboundConnectionCacheImpl.java
new file mode 100644
index 0000000..b248de0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaOutboundConnectionCacheImpl.java
@@ -0,0 +1,210 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.util.Collection;
+import java.util.Hashtable;
+import java.util.Iterator;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.OutboundConnectionCache;
+
+import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase;
+import com.sun.corba.se.spi.monitoring.MonitoringConstants;
+import com.sun.corba.se.spi.monitoring.MonitoringFactories;
+import com.sun.corba.se.spi.monitoring.MonitoredObject;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaConnectionCache;
+import com.sun.corba.se.spi.transport.CorbaContactInfo;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+/**
+ * @author Harold Carr
+ */
+public class CorbaOutboundConnectionCacheImpl
+ extends
+ CorbaConnectionCacheBase
+ implements
+ OutboundConnectionCache
+{
+ protected Hashtable connectionCache;
+
+ public CorbaOutboundConnectionCacheImpl(ORB orb, ContactInfo contactInfo)
+ {
+ super(orb, contactInfo.getConnectionCacheType(),
+ ((CorbaContactInfo)contactInfo).getMonitoringName());
+ this.connectionCache = new Hashtable();
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.OutboundConnectionCache
+ //
+
+ public Connection get(ContactInfo contactInfo)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".get: " + contactInfo + " " + contactInfo.hashCode());
+ }
+ synchronized (backingStore()) {
+ dprintStatistics();
+ return (Connection) connectionCache.get(contactInfo);
+ }
+ }
+
+ public void put(ContactInfo contactInfo, Connection connection)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".put: " + contactInfo + " " + contactInfo.hashCode() + " "
+ + connection);
+ }
+ synchronized (backingStore()) {
+ connectionCache.put(contactInfo, connection);
+ connection.setConnectionCache(this);
+ dprintStatistics();
+ }
+ }
+
+ public void remove(ContactInfo contactInfo)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".remove: " + contactInfo + " " + contactInfo.hashCode());
+ }
+ synchronized (backingStore()) {
+ if (contactInfo != null) {
+ connectionCache.remove(contactInfo);
+ }
+ dprintStatistics();
+ }
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation
+ //
+
+ public Collection values()
+ {
+ return connectionCache.values();
+ }
+
+ protected Object backingStore()
+ {
+ return connectionCache;
+ }
+
+ protected void registerWithMonitoring()
+ {
+ // ORB
+ MonitoredObject orbMO =
+ orb.getMonitoringManager().getRootMonitoredObject();
+
+ // CONNECTION
+ MonitoredObject connectionMO =
+ orbMO.getChild(MonitoringConstants.CONNECTION_MONITORING_ROOT);
+ if (connectionMO == null) {
+ connectionMO =
+ MonitoringFactories.getMonitoredObjectFactory()
+ .createMonitoredObject(
+ MonitoringConstants.CONNECTION_MONITORING_ROOT,
+ MonitoringConstants.CONNECTION_MONITORING_ROOT_DESCRIPTION);
+ orbMO.addChild(connectionMO);
+ }
+
+ // OUTBOUND CONNECTION
+ MonitoredObject outboundConnectionMO =
+ connectionMO.getChild(
+ MonitoringConstants.OUTBOUND_CONNECTION_MONITORING_ROOT);
+ if (outboundConnectionMO == null) {
+ outboundConnectionMO =
+ MonitoringFactories.getMonitoredObjectFactory()
+ .createMonitoredObject(
+ MonitoringConstants.OUTBOUND_CONNECTION_MONITORING_ROOT,
+ MonitoringConstants.OUTBOUND_CONNECTION_MONITORING_ROOT_DESCRIPTION);
+ connectionMO.addChild(outboundConnectionMO);
+ }
+
+ // NODE FOR THIS CACHE
+ MonitoredObject thisMO =
+ outboundConnectionMO.getChild(getMonitoringName());
+ if (thisMO == null) {
+ thisMO =
+ MonitoringFactories.getMonitoredObjectFactory()
+ .createMonitoredObject(
+ getMonitoringName(),
+ MonitoringConstants.CONNECTION_MONITORING_DESCRIPTION);
+ outboundConnectionMO.addChild(thisMO);
+ }
+
+ LongMonitoredAttributeBase attribute;
+
+ // ATTRIBUTE
+ attribute = new
+ LongMonitoredAttributeBase(
+ MonitoringConstants.CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS,
+ MonitoringConstants.CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS_DESCRIPTION)
+ {
+ public Object getValue() {
+ return new Long(CorbaOutboundConnectionCacheImpl.this.numberOfConnections());
+ }
+ };
+ thisMO.addAttribute(attribute);
+
+ // ATTRIBUTE
+ attribute = new
+ LongMonitoredAttributeBase(
+ MonitoringConstants.CONNECTION_NUMBER_OF_IDLE_CONNECTIONS,
+ MonitoringConstants.CONNECTION_NUMBER_OF_IDLE_CONNECTIONS_DESCRIPTION)
+ {
+ public Object getValue() {
+ return new Long(CorbaOutboundConnectionCacheImpl.this.numberOfIdleConnections());
+ }
+ };
+ thisMO.addAttribute(attribute);
+
+ // ATTRIBUTE
+ attribute = new
+ LongMonitoredAttributeBase(
+ MonitoringConstants.CONNECTION_NUMBER_OF_BUSY_CONNECTIONS,
+ MonitoringConstants.CONNECTION_NUMBER_OF_BUSY_CONNECTIONS_DESCRIPTION)
+ {
+ public Object getValue() {
+ return new Long(CorbaOutboundConnectionCacheImpl.this.numberOfBusyConnections());
+ }
+ };
+ thisMO.addAttribute(attribute);
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("CorbaOutboundConnectionCacheImpl", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaResponseWaitingRoomImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaResponseWaitingRoomImpl.java
new file mode 100644
index 0000000..57104f2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaResponseWaitingRoomImpl.java
@@ -0,0 +1,337 @@
+/*
+ * Copyright (c) 2001, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.SystemException;
+
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom;
+
+import com.sun.corba.se.impl.encoding.BufferManagerReadStream;
+import com.sun.corba.se.impl.encoding.CDRInputObject;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyOrReplyMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
+
+/**
+ * @author Harold Carr
+ */
+public class CorbaResponseWaitingRoomImpl
+ implements
+ CorbaResponseWaitingRoom
+{
+ final static class OutCallDesc
+ {
+ java.lang.Object done = new java.lang.Object();
+ Thread thread;
+ MessageMediator messageMediator;
+ SystemException exception;
+ InputObject inputObject;
+ }
+
+ private ORB orb;
+ private ORBUtilSystemException wrapper ;
+
+ private CorbaConnection connection;
+ // Maps requestId to an OutCallDesc.
+ final private Map<Integer, OutCallDesc> out_calls;
+
+ public CorbaResponseWaitingRoomImpl(ORB orb, CorbaConnection connection)
+ {
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_TRANSPORT ) ;
+ this.connection = connection;
+ out_calls =
+ Collections.synchronizedMap(new HashMap<Integer, OutCallDesc>());
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.ResponseWaitingRoom
+ //
+
+ public void registerWaiter(MessageMediator mediator)
+ {
+ CorbaMessageMediator messageMediator = (CorbaMessageMediator) mediator;
+
+ if (orb.transportDebugFlag) {
+ dprint(".registerWaiter: " + opAndId(messageMediator));
+ }
+
+ Integer requestId = messageMediator.getRequestIdInteger();
+
+ OutCallDesc call = new OutCallDesc();
+ call.thread = Thread.currentThread();
+ call.messageMediator = messageMediator;
+ out_calls.put(requestId, call);
+ }
+
+ public void unregisterWaiter(MessageMediator mediator)
+ {
+ CorbaMessageMediator messageMediator = (CorbaMessageMediator) mediator;
+
+ if (orb.transportDebugFlag) {
+ dprint(".unregisterWaiter: " + opAndId(messageMediator));
+ }
+
+ Integer requestId = messageMediator.getRequestIdInteger();
+
+ out_calls.remove(requestId);
+ }
+
+ public InputObject waitForResponse(MessageMediator mediator)
+ {
+ CorbaMessageMediator messageMediator = (CorbaMessageMediator) mediator;
+
+ try {
+
+ InputObject returnStream = null;
+
+ if (orb.transportDebugFlag) {
+ dprint(".waitForResponse->: " + opAndId(messageMediator));
+ }
+
+ Integer requestId = messageMediator.getRequestIdInteger();
+
+ if (messageMediator.isOneWay()) {
+ // The waiter is removed in releaseReply in the same
+ // way as a normal request.
+
+ if (orb.transportDebugFlag) {
+ dprint(".waitForResponse: one way - not waiting: "
+ + opAndId(messageMediator));
+ }
+
+ return null;
+ }
+
+ OutCallDesc call = out_calls.get(requestId);
+ if (call == null) {
+ throw wrapper.nullOutCall(CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ synchronized(call.done) {
+
+ while (call.inputObject == null && call.exception == null) {
+ // Wait for the reply from the server.
+ // The ReaderThread reads in the reply IIOP message
+ // and signals us.
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".waitForResponse: waiting: "
+ + opAndId(messageMediator));
+ }
+ call.done.wait();
+ } catch (InterruptedException ie) {};
+ }
+
+ if (call.exception != null) {
+ if (orb.transportDebugFlag) {
+ dprint(".waitForResponse: exception: "
+ + opAndId(messageMediator));
+ }
+ throw call.exception;
+ }
+
+ returnStream = call.inputObject;
+ }
+
+ // 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();
+ }
+
+ return returnStream;
+
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".waitForResponse<-: " + opAndId(messageMediator));
+ }
+ }
+ }
+
+ public void responseReceived(InputObject is)
+ {
+ CDRInputObject inputObject = (CDRInputObject) is;
+ LocateReplyOrReplyMessage header = (LocateReplyOrReplyMessage)
+ inputObject.getMessageHeader();
+ Integer requestId = new Integer(header.getRequestId());
+ OutCallDesc call = out_calls.get(requestId);
+
+ if (orb.transportDebugFlag) {
+ dprint(".responseReceived: id/"
+ + requestId + ": "
+ + header);
+ }
+
+ // 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) {
+ if (orb.transportDebugFlag) {
+ dprint(".responseReceived: id/"
+ + requestId
+ + ": no waiter: "
+ + header);
+ }
+ return;
+ }
+
+ // Set the reply InputObject and signal the client thread
+ // that the reply has been received.
+ // 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.
+ synchronized (call.done) {
+ CorbaMessageMediator messageMediator = (CorbaMessageMediator)
+ call.messageMediator;
+
+ if (orb.transportDebugFlag) {
+ dprint(".responseReceived: "
+ + opAndId(messageMediator)
+ + ": notifying waiters");
+ }
+
+ messageMediator.setReplyHeader(header);
+ messageMediator.setInputObject(is);
+ inputObject.setMessageMediator(messageMediator);
+ call.inputObject = is;
+ call.done.notify();
+ }
+ }
+
+ public int numberRegistered()
+ {
+ return out_calls.size();
+ }
+
+ //////////////////////////////////////////////////
+ //
+ // CorbaResponseWaitingRoom
+ //
+
+ public void signalExceptionToAllWaiters(SystemException systemException)
+ {
+
+ if (orb.transportDebugFlag) {
+ dprint(".signalExceptionToAllWaiters: " + systemException);
+ }
+
+ synchronized (out_calls) {
+ if (orb.transportDebugFlag) {
+ dprint(".signalExceptionToAllWaiters: out_calls size :" +
+ out_calls.size());
+ }
+
+ for (OutCallDesc call : out_calls.values()) {
+ if (orb.transportDebugFlag) {
+ dprint(".signalExceptionToAllWaiters: signaling " +
+ call);
+ }
+ synchronized(call.done) {
+ try {
+ // anything waiting for BufferManagerRead's fragment queue
+ // needs to be cancelled
+ CorbaMessageMediator corbaMsgMediator =
+ (CorbaMessageMediator)call.messageMediator;
+ CDRInputObject inputObject =
+ (CDRInputObject)corbaMsgMediator.getInputObject();
+ // IMPORTANT: If inputObject is null, then no need to tell
+ // BufferManagerRead to cancel request processing.
+ if (inputObject != null) {
+ BufferManagerReadStream bufferManager =
+ (BufferManagerReadStream)inputObject.getBufferManager();
+ int requestId = corbaMsgMediator.getRequestId();
+ bufferManager.cancelProcessing(requestId);
+ }
+ } catch (Exception e) {
+ } finally {
+ // attempt to wake up waiting threads in all cases
+ call.inputObject = null;
+ call.exception = systemException;
+ call.done.notifyAll();
+ }
+ }
+ }
+ }
+ }
+
+ public MessageMediator getMessageMediator(int requestId)
+ {
+ Integer id = new Integer(requestId);
+ OutCallDesc call = out_calls.get(id);
+ if (call == null) {
+ // This can happen when getting early reply fragments for a
+ // request which has completed (e.g., client marshaling error).
+ return null;
+ }
+ return call.messageMediator;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation.
+ //
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("CorbaResponseWaitingRoomImpl", msg);
+ }
+
+ protected String opAndId(CorbaMessageMediator mediator)
+ {
+ return ORBUtility.operationNameAndRequestId(mediator);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java
new file mode 100644
index 0000000..970fde4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/CorbaTransportManagerImpl.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.net.ServerSocket;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.ConnectionCache;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.InboundConnectionCache;
+import com.sun.corba.se.pept.transport.OutboundConnectionCache;
+import com.sun.corba.se.pept.transport.Selector;
+
+import com.sun.corba.se.spi.ior.IORTemplate;
+import com.sun.corba.se.spi.ior.ObjectAdapterId;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaAcceptor;
+import com.sun.corba.se.spi.transport.CorbaTransportManager;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ConnectionCache;
+
+// REVISIT - impl/poa specific:
+import com.sun.corba.se.impl.oa.poa.Policies;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+/**
+ * @author Harold Carr
+ */
+public class CorbaTransportManagerImpl
+ implements
+ CorbaTransportManager
+{
+ protected ORB orb;
+ protected List acceptors;
+ protected Map outboundConnectionCaches;
+ protected Map inboundConnectionCaches;
+ protected Selector selector;
+
+ public CorbaTransportManagerImpl(ORB orb)
+ {
+ this.orb = orb;
+ acceptors = new ArrayList();
+ outboundConnectionCaches = new HashMap();
+ inboundConnectionCaches = new HashMap();
+ selector = new SelectorImpl(orb);
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept TransportManager
+ //
+
+ public ByteBufferPool getByteBufferPool(int id)
+ {
+ throw new RuntimeException();
+ }
+
+ public OutboundConnectionCache getOutboundConnectionCache(
+ ContactInfo contactInfo)
+ {
+ synchronized (contactInfo) {
+ if (contactInfo.getConnectionCache() == null) {
+ OutboundConnectionCache connectionCache = null;
+ synchronized (outboundConnectionCaches) {
+ connectionCache = (OutboundConnectionCache)
+ outboundConnectionCaches.get(
+ contactInfo.getConnectionCacheType());
+ if (connectionCache == null) {
+ // REVISIT: Would like to be able to configure
+ // the connection cache type used.
+ connectionCache =
+ new CorbaOutboundConnectionCacheImpl(orb,
+ contactInfo);
+ outboundConnectionCaches.put(
+ contactInfo.getConnectionCacheType(),
+ connectionCache);
+ }
+ }
+ contactInfo.setConnectionCache(connectionCache);
+ }
+ return contactInfo.getConnectionCache();
+ }
+ }
+
+ public Collection getOutboundConnectionCaches()
+ {
+ return outboundConnectionCaches.values();
+ }
+
+ public InboundConnectionCache getInboundConnectionCache(
+ Acceptor acceptor)
+ {
+ synchronized (acceptor) {
+ if (acceptor.getConnectionCache() == null) {
+ InboundConnectionCache connectionCache = null;
+ synchronized (inboundConnectionCaches) {
+ connectionCache = (InboundConnectionCache)
+ inboundConnectionCaches.get(
+ acceptor.getConnectionCacheType());
+ if (connectionCache == null) {
+ // REVISIT: Would like to be able to configure
+ // the connection cache type used.
+ connectionCache =
+ new CorbaInboundConnectionCacheImpl(orb,
+ acceptor);
+ inboundConnectionCaches.put(
+ acceptor.getConnectionCacheType(),
+ connectionCache);
+ }
+ }
+ acceptor.setConnectionCache(connectionCache);
+ }
+ return acceptor.getConnectionCache();
+ }
+ }
+
+ public Collection getInboundConnectionCaches()
+ {
+ return inboundConnectionCaches.values();
+ }
+
+ public Selector getSelector(int id)
+ {
+ return selector;
+ }
+
+ public synchronized void registerAcceptor(Acceptor acceptor)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".registerAcceptor->: " + acceptor);
+ }
+ acceptors.add(acceptor);
+ if (orb.transportDebugFlag) {
+ dprint(".registerAcceptor<-: " + acceptor);
+ }
+ }
+
+ public Collection getAcceptors()
+ {
+ return getAcceptors(null, null);
+ }
+
+ public synchronized void unregisterAcceptor(Acceptor acceptor)
+ {
+ acceptors.remove(acceptor);
+ }
+
+ public void close()
+ {
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".close->");
+ }
+ for (Object cc : outboundConnectionCaches.values()) {
+ ((ConnectionCache)cc).close() ;
+ }
+ for (Object icc : inboundConnectionCaches.values()) {
+ ((ConnectionCache)icc).close() ;
+ unregisterAcceptor(((InboundConnectionCache)icc).getAcceptor());
+ }
+ getSelector(0).close();
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".close<-");
+ }
+ }
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // CorbaTransportManager
+ //
+
+ 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.
+ Iterator iterator = acceptors.iterator();
+ while (iterator.hasNext()) {
+ Acceptor acceptor = (Acceptor) iterator.next();
+ if (acceptor.initialize()) {
+ if (acceptor.shouldRegisterAcceptEvent()) {
+ orb.getTransportManager().getSelector(0)
+ .registerForEvent(acceptor.getEventHandler());
+ }
+ }
+ }
+ return acceptors;
+ }
+
+ // REVISIT - POA specific policies
+ public void addToIORTemplate(IORTemplate iorTemplate,
+ Policies policies,
+ String codebase,
+ String objectAdapterManagerId,
+ ObjectAdapterId objectAdapterId)
+ {
+ Iterator iterator =
+ getAcceptors(objectAdapterManagerId, objectAdapterId).iterator();
+ while (iterator.hasNext()) {
+ CorbaAcceptor acceptor = (CorbaAcceptor) iterator.next();
+ acceptor.addToIORTemplate(iorTemplate, policies, codebase);
+ }
+ }
+
+
+ ////////////////////////////////////////////////////
+ //
+ // implemenation
+ //
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("CorbaTransportManagerImpl", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/DefaultIORToSocketInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/DefaultIORToSocketInfoImpl.java
new file mode 100644
index 0000000..b899682
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/DefaultIORToSocketInfoImpl.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.omg.IOP.TAG_ALTERNATE_IIOP_ADDRESS ;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent;
+import com.sun.corba.se.spi.transport.IORToSocketInfo;
+import com.sun.corba.se.spi.transport.SocketInfo;
+
+public class DefaultIORToSocketInfoImpl
+ implements IORToSocketInfo
+{
+ public List getSocketInfo(IOR ior)
+ {
+ SocketInfo socketInfo;
+ List result = new ArrayList();
+
+ 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
+ // 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
+ // instructive as leaving a ContactInfo with a 0 port in the list.
+ socketInfo = createSocketInfo(hostname, port);
+ result.add(socketInfo);
+
+ Iterator iterator = iiopProfileTemplate.iteratorById(
+ TAG_ALTERNATE_IIOP_ADDRESS.value);
+
+ while (iterator.hasNext()) {
+ AlternateIIOPAddressComponent alternate =
+ (AlternateIIOPAddressComponent) iterator.next();
+ hostname = alternate.getAddress().getHost().toLowerCase();
+ port = alternate.getAddress().getPort();
+ socketInfo= createSocketInfo(hostname, port);
+ result.add(socketInfo);
+ }
+ return result;
+ }
+
+ 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; }};
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java
new file mode 100644
index 0000000..14536c6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/DefaultSocketFactoryImpl.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 2004, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.ServerSocket;
+import java.nio.channels.SocketChannel;
+import java.nio.channels.ServerSocketChannel;
+import java.security.PrivilegedAction;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.ORBSocketFactory;
+
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+public class DefaultSocketFactoryImpl
+ implements ORBSocketFactory
+{
+ private ORB orb;
+ private static final boolean keepAlive;
+
+ static {
+ keepAlive = java.security.AccessController.doPrivileged(
+ new PrivilegedAction<Boolean>() {
+ @Override
+ public Boolean run () {
+ String value =
+ System.getProperty("com.sun.CORBA.transport.enableTcpKeepAlive");
+ if (value != null)
+ return new Boolean(!"false".equalsIgnoreCase(value));
+
+ return Boolean.FALSE;
+ }
+ });
+ }
+
+ public void setORB(ORB orb)
+ {
+ this.orb = orb;
+ }
+
+ public ServerSocket createServerSocket(String type,
+ InetSocketAddress inetSocketAddress)
+ throws IOException
+ {
+ ServerSocketChannel serverSocketChannel = null;
+ ServerSocket serverSocket = null;
+
+ if (orb.getORBData().acceptorSocketType().equals(ORBConstants.SOCKETCHANNEL)) {
+ serverSocketChannel = ServerSocketChannel.open();
+ serverSocket = serverSocketChannel.socket();
+ } else {
+ serverSocket = new ServerSocket();
+ }
+ serverSocket.bind(inetSocketAddress);
+ return serverSocket;
+ }
+
+ public Socket createSocket(String type,
+ InetSocketAddress inetSocketAddress)
+ throws IOException
+ {
+ SocketChannel socketChannel = null;
+ Socket socket = null;
+
+ if (orb.getORBData().connectionSocketType().equals(ORBConstants.SOCKETCHANNEL)) {
+ socketChannel = SocketChannel.open(inetSocketAddress);
+ socket = socketChannel.socket();
+ } else {
+ socket = new Socket(inetSocketAddress.getHostName(),
+ inetSocketAddress.getPort());
+ }
+
+ // Disable Nagle's algorithm (i.e., always send immediately).
+ socket.setTcpNoDelay(true);
+
+ if (keepAlive)
+ socket.setKeepAlive(true);
+
+ return socket;
+ }
+
+ public void setAcceptedSocketOptions(Acceptor acceptor,
+ ServerSocket serverSocket,
+ Socket socket)
+ throws SocketException
+ {
+ // Disable Nagle's algorithm (i.e., always send immediately).
+ socket.setTcpNoDelay(true);
+ if (keepAlive)
+ socket.setKeepAlive(true);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/EventHandlerBase.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/EventHandlerBase.java
new file mode 100644
index 0000000..62fd7d1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/EventHandlerBase.java
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.nio.channels.SelectionKey;
+
+import org.omg.CORBA.INTERNAL;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.EventHandler;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException;
+import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException;
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+public abstract class EventHandlerBase
+ implements
+ EventHandler
+{
+ protected ORB orb;
+ protected Work work;
+ protected boolean useWorkerThreadForEvent;
+ protected boolean useSelectThreadToWait;
+ protected SelectionKey selectionKey;
+
+ ////////////////////////////////////////////////////
+ //
+ // EventHandler methods
+ //
+
+ public void setUseSelectThreadToWait(boolean x)
+ {
+ useSelectThreadToWait = x;
+ }
+
+ public boolean shouldUseSelectThreadToWait()
+ {
+ return useSelectThreadToWait;
+ }
+
+ public void setSelectionKey(SelectionKey selectionKey)
+ {
+ this.selectionKey = selectionKey;
+ }
+
+ public SelectionKey getSelectionKey()
+ {
+ return selectionKey;
+ }
+
+ /*
+ * NOTE:
+ * This is not thread-safe by design.
+ * Only one thread should call it - a reader/listener/select thread.
+ * Not stateless: interest ops, registration.
+ */
+ public void handleEvent()
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".handleEvent->: " + this);
+ }
+ getSelectionKey().interestOps(getSelectionKey().interestOps() &
+ (~ getInterestOps()));
+ if (shouldUseWorkerThreadForEvent()) {
+ Throwable throwable = null;
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".handleEvent: addWork to pool: " + 0);
+ }
+ orb.getThreadPoolManager().getThreadPool(0)
+ .getWorkQueue(0).addWork(getWork());
+ } catch (NoSuchThreadPoolException e) {
+ throwable = e;
+ } catch (NoSuchWorkQueueException e) {
+ throwable = e;
+ }
+ // REVISIT: need to close connection.
+ if (throwable != null) {
+ if (orb.transportDebugFlag) {
+ dprint(".handleEvent: " + throwable);
+ }
+ INTERNAL i = new INTERNAL("NoSuchThreadPoolException");
+ i.initCause(throwable);
+ throw i;
+ }
+ } else {
+ if (orb.transportDebugFlag) {
+ dprint(".handleEvent: doWork");
+ }
+ getWork().doWork();
+ }
+ if (orb.transportDebugFlag) {
+ dprint(".handleEvent<-: " + this);
+ }
+ }
+
+ public boolean shouldUseWorkerThreadForEvent()
+ {
+ return useWorkerThreadForEvent;
+ }
+
+ public void setUseWorkerThreadForEvent(boolean x)
+ {
+ useWorkerThreadForEvent = x;
+ }
+
+ public void setWork(Work work)
+ {
+ this.work = work;
+ }
+
+ public Work getWork()
+ {
+ return work;
+ }
+
+ private void dprint(String msg)
+ {
+ ORBUtility.dprint("EventHandlerBase", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ListenerThreadImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ListenerThreadImpl.java
new file mode 100644
index 0000000..6205b91
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ListenerThreadImpl.java
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.io.IOException;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.ListenerThread;
+import com.sun.corba.se.pept.transport.Selector;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+
+public class ListenerThreadImpl
+ implements
+ ListenerThread,
+ Work
+{
+ private ORB orb;
+ private Acceptor acceptor;
+ private Selector selector;
+ private boolean keepRunning;
+ private long enqueueTime;
+
+ public ListenerThreadImpl(ORB orb, Acceptor acceptor, Selector selector)
+ {
+ this.orb = orb;
+ this.acceptor = acceptor;
+ this.selector = selector;
+ keepRunning = true;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // ListenerThread methods.
+ //
+
+ public Acceptor getAcceptor()
+ {
+ return acceptor;
+ }
+
+ public void close()
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".close: " + acceptor);
+ }
+
+ keepRunning = false;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Work methods.
+ //
+
+ // REVISIT - this needs alot more from previous ListenerThread
+
+ public void doWork()
+ {
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: Start ListenerThread: " + acceptor);
+ }
+ while (keepRunning) {
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: BEFORE ACCEPT CYCLE: " + acceptor);
+ }
+
+ acceptor.accept();
+
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: AFTER ACCEPT CYCLE: " + acceptor);
+ }
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: Exception in accept: " + acceptor,t);
+ }
+ orb.getTransportManager().getSelector(0)
+ .unregisterForEvent(getAcceptor().getEventHandler());
+ getAcceptor().close();
+ }
+ }
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: Terminated ListenerThread: " + acceptor);
+ }
+ }
+ }
+
+ public void setEnqueueTime(long timeInMillis)
+ {
+ enqueueTime = timeInMillis;
+ }
+
+ public long getEnqueueTime()
+ {
+ return enqueueTime;
+ }
+
+ public String getName() { return "ListenerThread"; }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation.
+ //
+
+ private void dprint(String msg)
+ {
+ ORBUtility.dprint("ListenerThreadImpl", msg);
+ }
+
+ private void dprint(String msg, Throwable t)
+ {
+ dprint(msg);
+ t.printStackTrace(System.out);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ReadTCPTimeoutsImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ReadTCPTimeoutsImpl.java
new file mode 100644
index 0000000..104e23e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ReadTCPTimeoutsImpl.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import com.sun.corba.se.spi.transport.ReadTimeouts;
+
+/**
+ * @author Charlie Hunt
+ */
+public class ReadTCPTimeoutsImpl implements ReadTimeouts
+{
+ private int initial_time_to_wait;
+ private int max_time_to_wait;
+ private int max_giop_header_time_to_wait;
+ private double backoff_factor;
+
+ // constructor
+ public ReadTCPTimeoutsImpl(int initial_time,
+ int max_time,
+ int max_giop_header_time,
+ int backoff_percent) {
+ this.initial_time_to_wait = initial_time;
+ this.max_time_to_wait = max_time;
+ this.max_giop_header_time_to_wait = max_giop_header_time;
+ this.backoff_factor = 1 + (double)(backoff_percent)/100;
+ }
+
+ 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 double get_backoff_factor() { return backoff_factor; }
+ public int get_max_giop_header_time_to_wait() {
+ return max_giop_header_time_to_wait; }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ReaderThreadImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ReaderThreadImpl.java
new file mode 100644
index 0000000..a4f6500
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/ReaderThreadImpl.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.io.IOException;
+
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ReaderThread;
+import com.sun.corba.se.pept.transport.Selector;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+public class ReaderThreadImpl
+ implements
+ ReaderThread,
+ Work
+{
+ private ORB orb;
+ private Connection connection;
+ private Selector selector;
+ private boolean keepRunning;
+ private long enqueueTime;
+
+ public ReaderThreadImpl(ORB orb,
+ Connection connection, Selector selector)
+ {
+ this.orb = orb;
+ this.connection = connection;
+ this.selector = selector;
+ keepRunning = true;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // ReaderThread methods.
+ //
+
+ public Connection getConnection()
+ {
+ return connection;
+ }
+
+ public void close()
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".close: " + connection);
+ }
+
+ keepRunning = false;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Work methods.
+ //
+
+ // REVISIT - this needs alot more from previous ReaderThread.
+ public void doWork()
+ {
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: Start ReaderThread: " + connection);
+ }
+ while (keepRunning) {
+ try {
+
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: Start ReaderThread cycle: "
+ + connection);
+ }
+
+ if (connection.read()) {
+ // REVISIT - put in pool;
+ return;
+ }
+
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: End ReaderThread cycle: "
+ + connection);
+ }
+
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: exception in read: " + connection,t);
+ }
+ orb.getTransportManager().getSelector(0)
+ .unregisterForEvent(getConnection().getEventHandler());
+ getConnection().close();
+ }
+ }
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: Terminated ReaderThread: " + connection);
+ }
+ }
+ }
+
+ public void setEnqueueTime(long timeInMillis)
+ {
+ enqueueTime = timeInMillis;
+ }
+
+ public long getEnqueueTime()
+ {
+ return enqueueTime;
+ }
+
+ public String getName() { return "ReaderThread"; }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation.
+ //
+
+ private void dprint(String msg)
+ {
+ ORBUtility.dprint("ReaderThreadImpl", msg);
+ }
+
+ protected void dprint(String msg, Throwable t)
+ {
+ dprint(msg);
+ t.printStackTrace(System.out);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java
new file mode 100644
index 0000000..ac87ef9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SelectorImpl.java
@@ -0,0 +1,615 @@
+/*
+ * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.nio.channels.ClosedChannelException;
+import java.nio.channels.SelectableChannel;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.Selector;
+import java.nio.channels.ClosedSelectorException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Iterator;
+import java.util.List;
+
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.EventHandler;
+import com.sun.corba.se.pept.transport.ListenerThread;
+import com.sun.corba.se.pept.transport.ReaderThread;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
+import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException;
+import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+/**
+ * @author Harold Carr
+ */
+class SelectorImpl
+ extends
+ Thread
+ implements
+ com.sun.corba.se.pept.transport.Selector
+{
+ private ORB orb;
+ private Selector selector;
+ private long timeout;
+ private List deferredRegistrations;
+ private List interestOpsList;
+ private HashMap listenerThreads;
+ private Map readerThreads;
+ private boolean selectorStarted;
+ private volatile boolean closed;
+ private ORBUtilSystemException wrapper;
+
+
+ public SelectorImpl(ORB orb)
+ {
+ super(null, null, "ORB-Selector-Thread", 0, false);
+ this.orb = orb;
+ selector = null;
+ selectorStarted = false;
+ timeout = 60000;
+ deferredRegistrations = new ArrayList();
+ interestOpsList = new ArrayList();
+ listenerThreads = new HashMap();
+ readerThreads = java.util.Collections.synchronizedMap(new HashMap());
+ closed = false;
+ wrapper = ORBUtilSystemException.get(orb,CORBALogDomains.RPC_TRANSPORT);
+ }
+
+ public void setTimeout(long timeout)
+ {
+ this.timeout = timeout;
+ }
+
+ public long getTimeout()
+ {
+ return timeout;
+ }
+
+ public void registerInterestOps(EventHandler eventHandler)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".registerInterestOps:-> " + eventHandler);
+ }
+
+ SelectionKey selectionKey = eventHandler.getSelectionKey();
+ if (selectionKey.isValid()) {
+ int ehOps = eventHandler.getInterestOps();
+ SelectionKeyAndOp keyAndOp = new SelectionKeyAndOp(selectionKey, ehOps);
+ synchronized(interestOpsList) {
+ interestOpsList.add(keyAndOp);
+ }
+ // tell Selector Thread there's an update to a SelectorKey's Ops
+ try {
+ if (selector != null) {
+ // wakeup Selector thread to process close request
+ selector.wakeup();
+ }
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".registerInterestOps: selector.wakeup: ", t);
+ }
+ }
+ }
+ else {
+ wrapper.selectionKeyInvalid(eventHandler.toString());
+ if (orb.transportDebugFlag) {
+ dprint(".registerInterestOps: EventHandler SelectionKey not valid " + eventHandler);
+ }
+ }
+
+ if (orb.transportDebugFlag) {
+ dprint(".registerInterestOps:<- ");
+ }
+ }
+
+ public void registerForEvent(EventHandler eventHandler)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".registerForEvent: " + eventHandler);
+ }
+
+ if (isClosed()) {
+ if (orb.transportDebugFlag) {
+ dprint(".registerForEvent: closed: " + eventHandler);
+ }
+ return;
+ }
+
+ if (eventHandler.shouldUseSelectThreadToWait()) {
+ synchronized (deferredRegistrations) {
+ deferredRegistrations.add(eventHandler);
+ }
+ if (! selectorStarted) {
+ startSelector();
+ }
+ selector.wakeup();
+ return;
+ }
+
+ switch (eventHandler.getInterestOps()) {
+ case SelectionKey.OP_ACCEPT :
+ createListenerThread(eventHandler);
+ break;
+ case SelectionKey.OP_READ :
+ createReaderThread(eventHandler);
+ break;
+ default:
+ if (orb.transportDebugFlag) {
+ dprint(".registerForEvent: default: " + eventHandler);
+ }
+ throw new RuntimeException(
+ "SelectorImpl.registerForEvent: unknown interest ops");
+ }
+ }
+
+ public void unregisterForEvent(EventHandler eventHandler)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".unregisterForEvent: " + eventHandler);
+ }
+
+ if (isClosed()) {
+ if (orb.transportDebugFlag) {
+ dprint(".unregisterForEvent: closed: " + eventHandler);
+ }
+ return;
+ }
+
+ if (eventHandler.shouldUseSelectThreadToWait()) {
+ SelectionKey selectionKey ;
+ synchronized(deferredRegistrations) {
+ selectionKey = eventHandler.getSelectionKey();
+ }
+ if (selectionKey != null) {
+ selectionKey.cancel();
+ }
+ if (selector != null) {
+ selector.wakeup();
+ }
+ return;
+ }
+
+ switch (eventHandler.getInterestOps()) {
+ case SelectionKey.OP_ACCEPT :
+ destroyListenerThread(eventHandler);
+ break;
+ case SelectionKey.OP_READ :
+ destroyReaderThread(eventHandler);
+ break;
+ default:
+ if (orb.transportDebugFlag) {
+ dprint(".unregisterForEvent: default: " + eventHandler);
+ }
+ throw new RuntimeException(
+ "SelectorImpl.uregisterForEvent: unknown interest ops");
+ }
+ }
+
+ public void close()
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".close");
+ }
+
+ if (isClosed()) {
+ if (orb.transportDebugFlag) {
+ dprint(".close: already closed");
+ }
+ return;
+ }
+
+ setClosed(true);
+
+ Iterator i;
+
+ // Kill listeners.
+
+ i = listenerThreads.values().iterator();
+ while (i.hasNext()) {
+ ListenerThread listenerThread = (ListenerThread) i.next();
+ listenerThread.close();
+ }
+
+ // Kill readers.
+
+ i = readerThreads.values().iterator();
+ while (i.hasNext()) {
+ ReaderThread readerThread = (ReaderThread) i.next();
+ readerThread.close();
+ }
+
+ clearDeferredRegistrations();
+
+ // Selector
+
+ try {
+ if (selector != null) {
+ // wakeup Selector thread to process close request
+ selector.wakeup();
+ }
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".close: selector.wakeup: ", t);
+ }
+ }
+ }
+
+ ///////////////////////////////////////////////////
+ //
+ // Thread methods.
+ //
+
+ public void run()
+ {
+ while (!closed) {
+ try {
+ int n = 0;
+ if (timeout == 0 && orb.transportDebugFlag) {
+ dprint(".run: Beginning of selection cycle");
+ }
+ handleDeferredRegistrations();
+ enableInterestOps();
+ try {
+ n = selector.select(timeout);
+ } catch (IOException e) {
+ if (orb.transportDebugFlag) {
+ dprint(".run: selector.select: ", e);
+ }
+ } catch (ClosedSelectorException csEx) {
+ if (orb.transportDebugFlag) {
+ dprint(".run: selector.select: ", csEx);
+ }
+ break;
+ }
+ if (closed) {
+ break;
+ }
+ /*
+ if (timeout == 0 && orb.transportDebugFlag) {
+ dprint(".run: selector.select() returned: " + n);
+ }
+ if (n == 0) {
+ continue;
+ }
+ */
+ Iterator iterator = selector.selectedKeys().iterator();
+ if (orb.transportDebugFlag) {
+ if (iterator.hasNext()) {
+ dprint(".run: n = " + n);
+ }
+ }
+ while (iterator.hasNext()) {
+ SelectionKey selectionKey = (SelectionKey) iterator.next();
+ iterator.remove();
+ EventHandler eventHandler = (EventHandler)
+ selectionKey.attachment();
+ try {
+ eventHandler.handleEvent();
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".run: eventHandler.handleEvent", t);
+ }
+ }
+ }
+ if (timeout == 0 && orb.transportDebugFlag) {
+ dprint(".run: End of selection cycle");
+ }
+ } catch (Throwable t) {
+ // IMPORTANT: ignore all errors so the select thread keeps running.
+ // Otherwise a guaranteed hang.
+ if (orb.transportDebugFlag) {
+ dprint(".run: ignoring", t);
+ }
+ }
+ }
+ try {
+ if (selector != null) {
+ if (orb.transportDebugFlag) {
+ dprint(".run: selector.close ");
+ }
+ selector.close();
+ }
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".run: selector.close: ", t);
+ }
+ }
+ }
+
+ /////////////////////////////////////////////////////
+ //
+ // Implementation.
+ //
+
+ private void clearDeferredRegistrations() {
+ synchronized (deferredRegistrations) {
+ int deferredListSize = deferredRegistrations.size();
+ if (orb.transportDebugFlag) {
+ dprint(".clearDeferredRegistrations:deferred list size == " + deferredListSize);
+ }
+ for (int i = 0; i < deferredListSize; i++) {
+ EventHandler eventHandler =
+ (EventHandler)deferredRegistrations.get(i);
+ if (orb.transportDebugFlag) {
+ dprint(".clearDeferredRegistrations: " + eventHandler);
+ }
+ SelectableChannel channel = eventHandler.getChannel();
+ SelectionKey selectionKey = null;
+
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".clearDeferredRegistrations:close channel == "
+ + channel);
+ dprint(".clearDeferredRegistrations:close channel class == "
+ + channel.getClass().getName());
+ }
+ channel.close();
+ selectionKey = eventHandler.getSelectionKey();
+ if (selectionKey != null) {
+ selectionKey.cancel();
+ selectionKey.attach(null);
+ }
+ } catch (IOException ioEx) {
+ if (orb.transportDebugFlag) {
+ dprint(".clearDeferredRegistrations: ", ioEx);
+ }
+ }
+ }
+ deferredRegistrations.clear();
+ }
+ }
+
+ private synchronized boolean isClosed ()
+ {
+ return closed;
+ }
+
+ private synchronized void setClosed(boolean closed)
+ {
+ this.closed = closed;
+ }
+
+ private void startSelector()
+ {
+ try {
+ selector = Selector.open();
+ } catch (IOException e) {
+ if (orb.transportDebugFlag) {
+ dprint(".startSelector: Selector.open: IOException: ", e);
+ }
+ // REVISIT - better handling/reporting
+ RuntimeException rte =
+ new RuntimeException(".startSelector: Selector.open exception");
+ rte.initCause(e);
+ throw rte;
+ }
+ setDaemon(true);
+ start();
+ selectorStarted = true;
+ if (orb.transportDebugFlag) {
+ dprint(".startSelector: selector.start completed.");
+ }
+ }
+
+ private void handleDeferredRegistrations()
+ {
+ synchronized (deferredRegistrations) {
+ int deferredListSize = deferredRegistrations.size();
+ for (int i = 0; i < deferredListSize; i++) {
+ EventHandler eventHandler =
+ (EventHandler)deferredRegistrations.get(i);
+ if (orb.transportDebugFlag) {
+ dprint(".handleDeferredRegistrations: " + eventHandler);
+ }
+ SelectableChannel channel = eventHandler.getChannel();
+ SelectionKey selectionKey = null;
+ try {
+ selectionKey =
+ channel.register(selector,
+ eventHandler.getInterestOps(),
+ (Object)eventHandler);
+ } catch (ClosedChannelException e) {
+ if (orb.transportDebugFlag) {
+ dprint(".handleDeferredRegistrations: ", e);
+ }
+ }
+ eventHandler.setSelectionKey(selectionKey);
+ }
+ deferredRegistrations.clear();
+ }
+ }
+
+ private void enableInterestOps()
+ {
+ synchronized (interestOpsList) {
+ int listSize = interestOpsList.size();
+ if (listSize > 0) {
+ if (orb.transportDebugFlag) {
+ dprint(".enableInterestOps:->");
+ }
+ SelectionKey selectionKey = null;
+ SelectionKeyAndOp keyAndOp = null;
+ int keyOp, selectionKeyOps = 0;
+ for (int i = 0; i < listSize; i++) {
+ keyAndOp = (SelectionKeyAndOp)interestOpsList.get(i);
+ selectionKey = keyAndOp.selectionKey;
+
+ // Need to check if the SelectionKey is valid because a
+ // connection's SelectionKey could be put on the list to
+ // have its OP enabled and before it's enabled be reclaimed.
+ // Otherwise, the enabling of the OP will throw an exception
+ // here and exit this method an potentially not enable all
+ // registered ops.
+ //
+ // So, we ignore SelectionKeys that are invalid. They will get
+ // cleaned up on the next Selector.select() call.
+
+ if (selectionKey.isValid()) {
+ if (orb.transportDebugFlag) {
+ dprint(".enableInterestOps: " + keyAndOp);
+ }
+ keyOp = keyAndOp.keyOp;
+ selectionKeyOps = selectionKey.interestOps();
+ selectionKey.interestOps(selectionKeyOps | keyOp);
+ }
+ }
+ interestOpsList.clear();
+ if (orb.transportDebugFlag) {
+ dprint(".enableInterestOps:<-");
+ }
+ }
+ }
+ }
+
+ private void createListenerThread(EventHandler eventHandler)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".createListenerThread: " + eventHandler);
+ }
+ Acceptor acceptor = eventHandler.getAcceptor();
+ ListenerThread listenerThread =
+ new ListenerThreadImpl(orb, acceptor, this);
+ listenerThreads.put(eventHandler, listenerThread);
+ Throwable throwable = null;
+ try {
+ orb.getThreadPoolManager().getThreadPool(0)
+ .getWorkQueue(0).addWork((Work)listenerThread);
+ } catch (NoSuchThreadPoolException e) {
+ throwable = e;
+ } catch (NoSuchWorkQueueException e) {
+ throwable = e;
+ }
+ if (throwable != null) {
+ RuntimeException rte = new RuntimeException(throwable.toString());
+ rte.initCause(throwable);
+ throw rte;
+ }
+ }
+
+ private void destroyListenerThread(EventHandler eventHandler)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".destroyListenerThread: " + eventHandler);
+ }
+ ListenerThread listenerThread = (ListenerThread)
+ listenerThreads.get(eventHandler);
+ if (listenerThread == null) {
+ if (orb.transportDebugFlag) {
+ dprint(".destroyListenerThread: cannot find ListenerThread - ignoring.");
+ }
+ return;
+ }
+ listenerThreads.remove(eventHandler);
+ listenerThread.close();
+ }
+
+ private void createReaderThread(EventHandler eventHandler)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".createReaderThread: " + eventHandler);
+ }
+ Connection connection = eventHandler.getConnection();
+ ReaderThread readerThread =
+ new ReaderThreadImpl(orb, connection, this);
+ readerThreads.put(eventHandler, readerThread);
+ Throwable throwable = null;
+ try {
+ orb.getThreadPoolManager().getThreadPool(0)
+ .getWorkQueue(0).addWork((Work)readerThread);
+ } catch (NoSuchThreadPoolException e) {
+ throwable = e;
+ } catch (NoSuchWorkQueueException e) {
+ throwable = e;
+ }
+ if (throwable != null) {
+ RuntimeException rte = new RuntimeException(throwable.toString());
+ rte.initCause(throwable);
+ throw rte;
+ }
+ }
+
+ private void destroyReaderThread(EventHandler eventHandler)
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".destroyReaderThread: " + eventHandler);
+ }
+ ReaderThread readerThread = (ReaderThread)
+ readerThreads.get(eventHandler);
+ if (readerThread == null) {
+ if (orb.transportDebugFlag) {
+ dprint(".destroyReaderThread: cannot find ReaderThread - ignoring.");
+ }
+ return;
+ }
+ readerThreads.remove(eventHandler);
+ readerThread.close();
+ }
+
+ private void dprint(String msg)
+ {
+ ORBUtility.dprint("SelectorImpl", msg);
+ }
+
+ protected void dprint(String msg, Throwable t)
+ {
+ dprint(msg);
+ t.printStackTrace(System.out);
+ }
+
+ // Private class to contain a SelectionKey and a SelectionKey op.
+ // Used only by SelectorImpl to register and enable SelectionKey
+ // Op.
+ // REVISIT - Could do away with this class and use the EventHanlder
+ // directly.
+ private class SelectionKeyAndOp
+ {
+ // A SelectionKey.[OP_READ|OP_WRITE|OP_ACCEPT|OP_CONNECT]
+ public int keyOp;
+ public SelectionKey selectionKey;
+
+ // constructor
+ public SelectionKeyAndOp(SelectionKey selectionKey, int keyOp) {
+ this.selectionKey = selectionKey;
+ this.keyOp = keyOp;
+ }
+ }
+
+// End of file.
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java
new file mode 100644
index 0000000..49f2b8a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SharedCDRContactInfoImpl.java
@@ -0,0 +1,187 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ContactInfo;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList;
+
+import com.sun.corba.se.impl.encoding.BufferManagerFactory;
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.impl.encoding.CDROutputStream;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.protocol.CorbaMessageMediatorImpl;
+import com.sun.corba.se.impl.protocol.SharedCDRClientRequestDispatcherImpl;
+
+public class SharedCDRContactInfoImpl
+ extends
+ CorbaContactInfoBase
+{
+ // 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;
+
+ protected ORBUtilSystemException wrapper;
+
+ public SharedCDRContactInfoImpl(
+ ORB orb,
+ CorbaContactInfoList contactInfoList,
+ IOR effectiveTargetIOR,
+ short addressingDisposition)
+ {
+ this.orb = orb;
+ this.contactInfoList = contactInfoList;
+ this.effectiveTargetIOR = effectiveTargetIOR;
+ this.addressingDisposition = addressingDisposition;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.ContactInfo
+ //
+
+ public ClientRequestDispatcher getClientRequestDispatcher()
+ {
+ // REVISIT - use registry
+ return new SharedCDRClientRequestDispatcherImpl();
+ }
+
+ public boolean isConnectionBased()
+ {
+ return false;
+ }
+
+ public boolean shouldCacheConnection()
+ {
+ return false;
+ }
+
+ public String getConnectionCacheType()
+ {
+ throw getWrapper().methodShouldNotBeCalled();
+ }
+
+ public Connection createConnection()
+ {
+ throw getWrapper().methodShouldNotBeCalled();
+ }
+
+ // Called when client making an invocation.
+ public MessageMediator createMessageMediator(Broker broker,
+ ContactInfo contactInfo,
+ Connection connection,
+ String methodName,
+ boolean isOneWay)
+ {
+ if (connection != null) {
+ /// XXX LOGGING
+ throw new RuntimeException("connection is not null");
+ }
+
+ CorbaMessageMediator messageMediator =
+ new CorbaMessageMediatorImpl(
+ (ORB) broker,
+ contactInfo,
+ null, // Connection;
+ GIOPVersion.chooseRequestVersion( (ORB)broker,
+ effectiveTargetIOR),
+ effectiveTargetIOR,
+ requestId++, // Fake RequestId
+ getAddressingDisposition(),
+ methodName,
+ isOneWay);
+
+ return messageMediator;
+ }
+
+ public OutputObject createOutputObject(MessageMediator messageMediator)
+ {
+ CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
+ messageMediator;
+ // NOTE: GROW.
+ OutputObject outputObject =
+ sun.corba.OutputStreamFactory.newCDROutputObject(orb, messageMediator,
+ corbaMessageMediator.getRequestHeader(),
+ corbaMessageMediator.getStreamFormatVersion(),
+ BufferManagerFactory.GROW);
+ messageMediator.setOutputObject(outputObject);
+ return outputObject;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // spi.transport.CorbaContactInfo
+ //
+
+ public String getMonitoringName()
+ {
+ throw getWrapper().methodShouldNotBeCalled();
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // java.lang.Object
+ //
+
+ ////////////////////////////////////////////////////
+ //
+ // java.lang.Object
+ //
+
+ public String toString()
+ {
+ return
+ "SharedCDRContactInfoImpl["
+ + "]";
+ }
+
+ //////////////////////////////////////////////////
+ //
+ // Implementation
+ //
+
+ protected ORBUtilSystemException getWrapper()
+ {
+ if (wrapper == null) {
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_TRANSPORT ) ;
+ }
+ return wrapper;
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java
new file mode 100644
index 0000000..4b24c6b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelAcceptorImpl.java
@@ -0,0 +1,664 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.nio.channels.SelectableChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.ServerSocketChannel;
+import java.nio.channels.SocketChannel;
+import java.util.Iterator;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.EventHandler;
+import com.sun.corba.se.pept.transport.InboundConnectionCache;
+import com.sun.corba.se.pept.transport.Selector;
+
+import com.sun.corba.se.spi.extension.RequestPartitioningPolicy;
+import com.sun.corba.se.spi.ior.IORTemplate;
+import com.sun.corba.se.spi.ior.TaggedProfileTemplate;
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.IIOPFactories;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+import com.sun.corba.se.spi.ior.iiop.AlternateIIOPAddressComponent;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.transport.CorbaAcceptor;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.transport.SocketInfo;
+import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
+
+import com.sun.corba.se.impl.encoding.CDRInputObject;
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.oa.poa.Policies; // REVISIT impl/poa specific
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+// BEGIN Legacy support.
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
+// END Legacy support.
+
+/**
+ * @author Harold Carr
+ */
+public class SocketOrChannelAcceptorImpl
+ extends
+ EventHandlerBase
+ implements
+ CorbaAcceptor,
+ SocketOrChannelAcceptor,
+ Work,
+ // BEGIN Legacy
+ SocketInfo,
+ LegacyServerSocketEndPointInfo
+ // END Legacy
+{
+ protected ServerSocketChannel serverSocketChannel;
+ protected ServerSocket serverSocket;
+ protected int port;
+ protected long enqueueTime;
+ protected boolean initialized;
+ protected ORBUtilSystemException wrapper ;
+ protected InboundConnectionCache connectionCache;
+
+ // BEGIN Legacy
+ protected String type = "";
+ protected String name = "";
+ protected String hostname;
+ protected int locatorPort;
+ // END Legacy
+
+ public SocketOrChannelAcceptorImpl(ORB orb)
+ {
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_TRANSPORT ) ;
+
+ setWork(this);
+ initialized = false;
+
+ // BEGIN Legacy support.
+ this.hostname = orb.getORBData().getORBServerHost();
+ this.name = LegacyServerSocketEndPointInfo.NO_NAME;
+ this.locatorPort = -1;
+ // END Legacy support.
+ }
+
+ public SocketOrChannelAcceptorImpl(ORB orb, int port)
+ {
+ this(orb);
+ this.port = port;
+ }
+
+ // BEGIN Legacy support.
+ public SocketOrChannelAcceptorImpl(ORB orb, int port,
+ String name, String type)
+ {
+ this(orb, port);
+ this.name = name;
+ this.type = type;
+ }
+ // END Legacy support.
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.Acceptor
+ //
+
+ public boolean initialize()
+ {
+ if (initialized) {
+ return false;
+ }
+ if (orb.transportDebugFlag) {
+ dprint(".initialize: " + this);
+ }
+ InetSocketAddress inetSocketAddress = null;
+ try {
+ if (orb.getORBData().getListenOnAllInterfaces().equals(ORBConstants.LISTEN_ON_ALL_INTERFACES)) {
+ inetSocketAddress = new InetSocketAddress(port);
+ } else {
+ String host = orb.getORBData().getORBServerHost();
+ inetSocketAddress = new InetSocketAddress(host, port);
+ }
+ serverSocket = orb.getORBData().getSocketFactory()
+ .createServerSocket(type, inetSocketAddress);
+ internalInitialize();
+ } catch (Throwable t) {
+ throw wrapper.createListenerFailed( t, Integer.toString(port) ) ;
+ }
+ initialized = true;
+ return true;
+ }
+
+ 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).
+
+ port = serverSocket.getLocalPort();
+
+ // Register with transport (also sets up monitoring).
+
+ orb.getCorbaTransportManager().getInboundConnectionCache(this);
+
+ // Finish configuation.
+
+ serverSocketChannel = serverSocket.getChannel();
+
+ if (serverSocketChannel != null) {
+ setUseSelectThreadToWait(
+ orb.getORBData().acceptorSocketUseSelectThreadToWait());
+ serverSocketChannel.configureBlocking(
+ ! orb.getORBData().acceptorSocketUseSelectThreadToWait());
+ } else {
+ // Configure to use listener and reader threads.
+ setUseSelectThreadToWait(false);
+ }
+ setUseWorkerThreadForEvent(
+ orb.getORBData().acceptorSocketUseWorkerThreadForEvent());
+
+ }
+
+ public boolean initialized()
+ {
+ return initialized;
+ }
+
+ public String getConnectionCacheType()
+ {
+ return this.getClass().toString();
+ }
+
+ public void setConnectionCache(InboundConnectionCache connectionCache)
+ {
+ this.connectionCache = connectionCache;
+ }
+
+ public InboundConnectionCache getConnectionCache()
+ {
+ return connectionCache;
+ }
+
+ public boolean shouldRegisterAcceptEvent()
+ {
+ return true;
+ }
+
+ public void accept()
+ {
+ try {
+ SocketChannel socketChannel = null;
+ Socket socket = null;
+ if (serverSocketChannel == null) {
+ socket = serverSocket.accept();
+ } else {
+ socketChannel = serverSocketChannel.accept();
+ socket = socketChannel.socket();
+ }
+ orb.getORBData().getSocketFactory()
+ .setAcceptedSocketOptions(this, serverSocket, socket);
+ if (orb.transportDebugFlag) {
+ dprint(".accept: " +
+ (serverSocketChannel == null
+ ? serverSocket.toString()
+ : serverSocketChannel.toString()));
+ }
+
+ CorbaConnection connection =
+ new SocketOrChannelConnectionImpl(orb, this, socket);
+ if (orb.transportDebugFlag) {
+ dprint(".accept: new: " + connection);
+ }
+
+ // NOTE: The connection MUST be put in the cache BEFORE being
+ // 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.
+
+ // A connection needs to be timestamped before putting to the cache.
+ // Otherwise the newly created connection (with 0 timestamp) could be
+ // incorrectly reclaimed by concurrent reclaim() call OR if there
+ // will be no events on this connection then it could be reclaimed
+ // by upcoming reclaim() call.
+ getConnectionCache().stampTime(connection);
+ getConnectionCache().put(this, connection);
+
+ if (connection.shouldRegisterServerReadEvent()) {
+ Selector selector = orb.getTransportManager().getSelector(0);
+ if (selector != null) {
+ if (orb.transportDebugFlag) {
+ dprint(".accept: registerForEvent: " + connection);
+ }
+ selector.registerForEvent(connection.getEventHandler());
+ }
+ }
+
+ getConnectionCache().reclaim();
+
+ } catch (IOException e) {
+ if (orb.transportDebugFlag) {
+ dprint(".accept:", e);
+ }
+ Selector selector = orb.getTransportManager().getSelector(0);
+ if (selector != null) {
+ selector.unregisterForEvent(this);
+ // REVISIT - need to close - recreate - then register new one.
+ selector.registerForEvent(this);
+ // NOTE: if register cycling we do not want to shut down ORB
+ // since local beans will still work. Instead one will see
+ // a growing log file to alert admin of problem.
+ }
+ }
+ }
+
+ public void close ()
+ {
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".close->:");
+ }
+ Selector selector = orb.getTransportManager().getSelector(0);
+ if (selector != null) {
+ selector.unregisterForEvent(this);
+ }
+ if (serverSocketChannel != null) {
+ serverSocketChannel.close();
+ }
+ if (serverSocket != null) {
+ serverSocket.close();
+ }
+ } catch (IOException e) {
+ if (orb.transportDebugFlag) {
+ dprint(".close:", e);
+ }
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".close<-:");
+ }
+ }
+ }
+
+ public EventHandler getEventHandler()
+ {
+ return this;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // CorbaAcceptor
+ //
+
+ public String getObjectAdapterId()
+ {
+ return null;
+ }
+
+ public String getObjectAdapterManagerId()
+ {
+ return null;
+ }
+
+ public void addToIORTemplate(IORTemplate iorTemplate,
+ Policies policies,
+ String codebase)
+ {
+ Iterator iterator = iorTemplate.iteratorById(
+ org.omg.IOP.TAG_INTERNET_IOP.value);
+
+ String hostname = orb.getORBData().getORBServerHost();
+
+ if (iterator.hasNext()) {
+ // REVISIT - how does this play with legacy ORBD port exchange?
+ IIOPAddress iiopAddress =
+ IIOPFactories.makeIIOPAddress(orb, hostname, port);
+ AlternateIIOPAddressComponent iiopAddressComponent =
+ IIOPFactories.makeAlternateIIOPAddressComponent(iiopAddress);
+
+ while (iterator.hasNext()) {
+ TaggedProfileTemplate taggedProfileTemplate =
+ (TaggedProfileTemplate) iterator.next();
+ taggedProfileTemplate.add(iiopAddressComponent);
+ }
+ } else {
+ GIOPVersion version = orb.getORBData().getGIOPVersion();
+ int templatePort;
+ if (policies.forceZeroPort()) {
+ templatePort = 0;
+ } else if (policies.isTransient()) {
+ templatePort = port;
+ } else {
+ templatePort = orb.getLegacyServerSocketManager()
+ .legacyGetPersistentServerPort(SocketInfo.IIOP_CLEAR_TEXT);
+ }
+ IIOPAddress addr =
+ IIOPFactories.makeIIOPAddress(orb, 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);
+ if (rpPolicy != null) {
+ iiopProfile.add(
+ IIOPFactories.makeRequestPartitioningComponent(
+ rpPolicy.getValue()));
+ }
+ if (codebase != null && codebase != "") {
+ iiopProfile.add(IIOPFactories. makeJavaCodebaseComponent(codebase));
+ }
+ if (orb.getORBData().isJavaSerializationEnabled()) {
+ iiopProfile.add(
+ IIOPFactories.makeJavaSerializationComponent());
+ }
+ }
+ iorTemplate.add(iiopProfile);
+ }
+ }
+
+ public String getMonitoringName()
+ {
+ return "AcceptedConnections";
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // EventHandler methods
+ //
+
+ public SelectableChannel getChannel()
+ {
+ return serverSocketChannel;
+ }
+
+ public int getInterestOps()
+ {
+ return SelectionKey.OP_ACCEPT;
+ }
+
+ public Acceptor getAcceptor()
+ {
+ return this;
+ }
+
+ public Connection getConnection()
+ {
+ throw new RuntimeException("Should not happen.");
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Work methods.
+ //
+
+ /* CONFLICT: with legacy below.
+ public String getName()
+ {
+ return this.toString();
+ }
+ */
+
+ public void doWork()
+ {
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork->: " + this);
+ }
+ if (selectionKey.isAcceptable()) {
+ accept();
+ } else {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: ! selectionKey.isAcceptable: " + this);
+ }
+ }
+ } catch (SecurityException se) {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: ignoring SecurityException: "
+ + se
+ + " " + this);
+ }
+ String permissionStr = ORBUtility.getClassSecurityInfo(getClass());
+ wrapper.securityExceptionInAccept(se, permissionStr);
+ } catch (Exception ex) {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: ignoring Exception: "
+ + ex
+ + " " + this);
+ }
+ wrapper.exceptionInAccept(ex);
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: ignoring Throwable: "
+ + t
+ + " " + this);
+ }
+ } finally {
+
+ // IMPORTANT: To avoid bug (4953599), we force the
+ // Thread that does the NIO select to also do the
+ // enable/disable of Ops using SelectionKey.interestOps().
+ // Otherwise, the SelectionKey.interestOps() may block
+ // 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.
+ // If "acceptorSocketUseWorkerThreadForEvent" is set
+ // to true, a WorkerThread will execute this method,
+ // doWork(). Hence, the registering of the enabling of
+ // the SelectionKey's interestOps is done here instead
+ // of calling SelectionKey.interestOps(<interest op>).
+
+ Selector selector = orb.getTransportManager().getSelector(0);
+ if (selector != null) {
+ selector.registerInterestOps(this);
+ }
+
+ if (orb.transportDebugFlag) {
+ dprint(".doWork<-:" + this);
+ }
+ }
+ }
+
+ public void setEnqueueTime(long timeInMillis)
+ {
+ enqueueTime = timeInMillis;
+ }
+
+ public long getEnqueueTime()
+ {
+ return enqueueTime;
+ }
+
+
+ //
+ // Factory methods.
+ //
+
+ // REVISIT: refactor into common base or delegate.
+ public MessageMediator createMessageMediator(Broker broker,
+ Connection connection)
+ {
+ // REVISIT - no factoring so cheat to avoid code dup right now.
+ // REVISIT **** COUPLING !!!!
+ ContactInfo contactInfo = new SocketOrChannelContactInfoImpl();
+ return contactInfo.createMessageMediator(broker, connection);
+ }
+
+ // REVISIT: refactor into common base or delegate.
+ public MessageMediator finishCreatingMessageMediator(Broker broker,
+ Connection connection,
+ MessageMediator messageMediator)
+ {
+ // REVISIT - no factoring so cheat to avoid code dup right now.
+ // REVISIT **** COUPLING !!!!
+ ContactInfo contactInfo = new SocketOrChannelContactInfoImpl();
+ return contactInfo.finishCreatingMessageMediator(broker,
+ connection, messageMediator);
+ }
+
+ public InputObject createInputObject(Broker broker,
+ MessageMediator messageMediator)
+ {
+ CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
+ messageMediator;
+ return new CDRInputObject((ORB)broker,
+ (CorbaConnection)messageMediator.getConnection(),
+ corbaMessageMediator.getDispatchBuffer(),
+ corbaMessageMediator.getDispatchHeader());
+ }
+
+ public OutputObject createOutputObject(Broker broker,
+ MessageMediator messageMediator)
+ {
+ CorbaMessageMediator corbaMessageMediator = (CorbaMessageMediator)
+ messageMediator;
+ return sun.corba.OutputStreamFactory.newCDROutputObject((ORB) broker,
+ corbaMessageMediator, corbaMessageMediator.getReplyHeader(),
+ corbaMessageMediator.getStreamFormatVersion());
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // SocketOrChannelAcceptor
+ //
+
+ public ServerSocket getServerSocket()
+ {
+ return serverSocket;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation.
+ //
+
+ public String toString()
+ {
+ String sock;
+ if (serverSocketChannel == null) {
+ if (serverSocket == null) {
+ sock = "(not initialized)";
+ } else {
+ sock = serverSocket.toString();
+ }
+ } else {
+ sock = serverSocketChannel.toString();
+ }
+
+ return
+ toStringName() +
+ "["
+ + sock + " "
+ + type + " "
+ + shouldUseSelectThreadToWait() + " "
+ + shouldUseWorkerThreadForEvent()
+ + "]" ;
+ }
+
+ protected String toStringName()
+ {
+ return "SocketOrChannelAcceptorImpl";
+ }
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint(toStringName(), msg);
+ }
+
+ protected void dprint(String msg, Throwable t)
+ {
+ dprint(msg);
+ t.printStackTrace(System.out);
+ }
+
+ // BEGIN Legacy support
+ ////////////////////////////////////////////////////
+ //
+ // LegacyServerSocketEndPointInfo and EndPointInfo
+ //
+
+ public String getType()
+ {
+ return type;
+ }
+
+ public String getHostName()
+ {
+ return hostname;
+ }
+
+ public String getHost()
+ {
+ return hostname;
+ }
+
+ public int getPort()
+ {
+ return port;
+ }
+
+ public int getLocatorPort()
+ {
+ return locatorPort;
+ }
+
+ public void setLocatorPort (int port)
+ {
+ locatorPort = port;
+ }
+
+ public String getName()
+ {
+ // Kluge alert:
+ // Work and Legacy both define getName.
+ // Try to make this behave best for most cases.
+ String result =
+ name.equals(LegacyServerSocketEndPointInfo.NO_NAME) ?
+ this.toString() : name;
+ return result;
+ }
+ // END Legacy support
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
new file mode 100644
index 0000000..f7c1e31
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelConnectionImpl.java
@@ -0,0 +1,1687 @@
+/*
+ * Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.nio.ByteBuffer;
+import java.nio.channels.SelectableChannel;
+import java.nio.channels.SelectionKey;
+import java.nio.channels.SocketChannel;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Collections;
+import java.util.Hashtable;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.omg.CORBA.COMM_FAILURE;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.DATA_CONVERSION;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.MARSHAL;
+import org.omg.CORBA.OBJECT_NOT_EXIST;
+import org.omg.CORBA.SystemException;
+
+import com.sun.org.omg.SendingContext.CodeBase;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ConnectionCache;
+import com.sun.corba.se.pept.transport.ContactInfo;
+import com.sun.corba.se.pept.transport.EventHandler;
+import com.sun.corba.se.pept.transport.InboundConnectionCache;
+import com.sun.corba.se.pept.transport.OutboundConnectionCache;
+import com.sun.corba.se.pept.transport.ResponseWaitingRoom;
+import com.sun.corba.se.pept.transport.Selector;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orbutil.threadpool.NoSuchThreadPoolException;
+import com.sun.corba.se.spi.orbutil.threadpool.NoSuchWorkQueueException;
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+import com.sun.corba.se.spi.transport.CorbaContactInfo;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.transport.CorbaResponseWaitingRoom;
+import com.sun.corba.se.spi.transport.ReadTimeouts;
+
+import com.sun.corba.se.impl.encoding.CachedCodeBase;
+import com.sun.corba.se.impl.encoding.CDRInputStream_1_0;
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.impl.encoding.CDROutputStream_1_0;
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
+import com.sun.corba.se.impl.encoding.OSFCodeSetRegistry;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
+import com.sun.corba.se.impl.transport.CorbaResponseWaitingRoomImpl;
+
+/**
+ * @author Harold Carr
+ */
+public class SocketOrChannelConnectionImpl
+ extends
+ EventHandlerBase
+ implements
+ CorbaConnection,
+ Work
+{
+ public static boolean dprintWriteLocks = false;
+
+ //
+ // New transport.
+ //
+
+ protected long enqueueTime;
+
+ protected SocketChannel socketChannel;
+ public SocketChannel getSocketChannel()
+ {
+ return socketChannel;
+ }
+
+ // REVISIT:
+ // protected for test: genericRPCMSGFramework.IIOPConnection constructor.
+ protected CorbaContactInfo contactInfo;
+ protected Acceptor acceptor;
+ protected ConnectionCache connectionCache;
+
+ //
+ // From iiop.Connection.java
+ //
+
+ protected Socket socket; // The socket used for this connection.
+ protected long timeStamp = 0;
+ protected boolean isServer = false;
+
+ // Start at some value other than zero since this is a magic
+ // value in some protocols.
+ protected int requestId = 5;
+ protected CorbaResponseWaitingRoom responseWaitingRoom;
+ protected int state;
+ protected java.lang.Object stateEvent = new java.lang.Object();
+ protected java.lang.Object writeEvent = new java.lang.Object();
+ protected boolean writeLocked;
+ protected int serverRequestCount = 0;
+
+ // Server request map: used on the server side of Connection
+ // Maps request ID to IIOPInputStream.
+ Map serverRequestMap = null;
+
+ // This is a flag associated per connection telling us if the
+ // initial set of sending contexts were sent to the receiver
+ // already...
+ protected boolean postInitialContexts = false;
+
+ // Remote reference to CodeBase server (supplies
+ // FullValueDescription, among other things)
+ protected IOR codeBaseServerIOR;
+
+ // 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);
+
+ protected ORBUtilSystemException wrapper ;
+
+ // transport read timeout values
+ protected ReadTimeouts readTimeouts;
+
+ protected boolean shouldReadGiopHeaderOnly;
+
+ // A message mediator used when shouldReadGiopHeaderOnly is
+ // true to maintain request message state across execution in a
+ // SelectorThread and WorkerThread.
+ protected CorbaMessageMediator partialMessageMediator = null;
+
+ // Used in genericRPCMSGFramework test.
+ protected SocketOrChannelConnectionImpl(ORB orb)
+ {
+ this.orb = orb;
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_TRANSPORT ) ;
+
+ setWork(this);
+ responseWaitingRoom = new CorbaResponseWaitingRoomImpl(orb, this);
+ setReadTimeouts(orb.getORBData().getTransportTCPReadTimeouts());
+ }
+
+ // Both client and servers.
+ protected SocketOrChannelConnectionImpl(ORB orb,
+ boolean useSelectThreadToWait,
+ boolean useWorkerThread)
+ {
+ this(orb) ;
+ setUseSelectThreadToWait(useSelectThreadToWait);
+ setUseWorkerThreadForEvent(useWorkerThread);
+ }
+
+ // Client constructor.
+ public SocketOrChannelConnectionImpl(ORB orb,
+ CorbaContactInfo contactInfo,
+ boolean useSelectThreadToWait,
+ boolean useWorkerThread,
+ String socketType,
+ String hostname,
+ int port)
+ {
+ this(orb, useSelectThreadToWait, useWorkerThread);
+
+ this.contactInfo = contactInfo;
+
+ try {
+ socket = orb.getORBData().getSocketFactory()
+ .createSocket(socketType,
+ new InetSocketAddress(hostname, port));
+ socketChannel = socket.getChannel();
+
+ if (socketChannel != null) {
+ boolean isBlocking = !useSelectThreadToWait;
+ socketChannel.configureBlocking(isBlocking);
+ } else {
+ // IMPORTANT: non-channel-backed sockets must use
+ // dedicated reader threads.
+ setUseSelectThreadToWait(false);
+ }
+ if (orb.transportDebugFlag) {
+ dprint(".initialize: connection created: " + socket);
+ }
+ } catch (Throwable t) {
+ throw wrapper.connectFailure(t, socketType, hostname,
+ Integer.toString(port));
+ }
+ state = OPENING;
+ }
+
+ // Client-side convenience.
+ public SocketOrChannelConnectionImpl(ORB orb,
+ CorbaContactInfo contactInfo,
+ String socketType,
+ String hostname,
+ int port)
+ {
+ this(orb, contactInfo,
+ orb.getORBData().connectionSocketUseSelectThreadToWait(),
+ orb.getORBData().connectionSocketUseWorkerThreadForEvent(),
+ socketType, hostname, port);
+ }
+
+ // Server-side constructor.
+ public SocketOrChannelConnectionImpl(ORB orb,
+ Acceptor acceptor,
+ Socket socket,
+ boolean useSelectThreadToWait,
+ boolean useWorkerThread)
+ {
+ this(orb, useSelectThreadToWait, useWorkerThread);
+
+ this.socket = socket;
+ socketChannel = socket.getChannel();
+ if (socketChannel != null) {
+ // REVISIT
+ try {
+ boolean isBlocking = !useSelectThreadToWait;
+ socketChannel.configureBlocking(isBlocking);
+ } catch (IOException e) {
+ RuntimeException rte = new RuntimeException();
+ rte.initCause(e);
+ throw rte;
+ }
+ }
+ this.acceptor = acceptor;
+
+ serverRequestMap = Collections.synchronizedMap(new HashMap());
+ isServer = true;
+
+ state = ESTABLISHED;
+ }
+
+ // Server-side convenience
+ public SocketOrChannelConnectionImpl(ORB orb,
+ Acceptor acceptor,
+ Socket socket)
+ {
+ this(orb, acceptor, socket,
+ (socket.getChannel() == null
+ ? false
+ : orb.getORBData().connectionSocketUseSelectThreadToWait()),
+ (socket.getChannel() == null
+ ? false
+ : orb.getORBData().connectionSocketUseWorkerThreadForEvent()));
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // framework.transport.Connection
+ //
+
+ public boolean shouldRegisterReadEvent()
+ {
+ return true;
+ }
+
+ public boolean shouldRegisterServerReadEvent()
+ {
+ return true;
+ }
+
+ public boolean read()
+ {
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".read->: " + this);
+ }
+ CorbaMessageMediator messageMediator = readBits();
+ if (messageMediator != null) {
+ // Null can happen when client closes stream
+ // causing purgecalls.
+ return dispatch(messageMediator);
+ }
+ return true;
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".read<-: " + this);
+ }
+ }
+ }
+
+ protected CorbaMessageMediator readBits()
+ {
+ try {
+
+ if (orb.transportDebugFlag) {
+ dprint(".readBits->: " + this);
+ }
+
+ MessageMediator messageMediator;
+ // REVISIT - use common factory base class.
+ if (contactInfo != null) {
+ messageMediator =
+ contactInfo.createMessageMediator(orb, this);
+ } else if (acceptor != null) {
+ messageMediator = acceptor.createMessageMediator(orb, this);
+ } else {
+ throw
+ new RuntimeException("SocketOrChannelConnectionImpl.readBits");
+ }
+ return (CorbaMessageMediator) messageMediator;
+
+ } catch (ThreadDeath td) {
+ if (orb.transportDebugFlag) {
+ dprint(".readBits: " + this + ": ThreadDeath: " + td, td);
+ }
+ try {
+ purgeCalls(wrapper.connectionAbort(td), false, false);
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".readBits: " + this + ": purgeCalls: Throwable: " + t, t);
+ }
+ }
+ throw td;
+ } catch (Throwable ex) {
+ if (orb.transportDebugFlag) {
+ dprint(".readBits: " + this + ": Throwable: " + ex, ex);
+ }
+
+ try {
+ if (ex instanceof INTERNAL) {
+ sendMessageError(GIOPVersion.DEFAULT_VERSION);
+ }
+ } catch (IOException e) {
+ if (orb.transportDebugFlag) {
+ dprint(".readBits: " + this +
+ ": sendMessageError: IOException: " + e, e);
+ }
+ }
+ // REVISIT - make sure reader thread is killed.
+ Selector selector = orb.getTransportManager().getSelector(0);
+ if (selector != null) {
+ selector.unregisterForEvent(this);
+ }
+ // Notify anyone waiting.
+ purgeCalls(wrapper.connectionAbort(ex), true, false);
+ // REVISIT
+ //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
+ // causes IBM (screen scraping) tests to fail.
+ //close();
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".readBits<-: " + this);
+ }
+ }
+ return null;
+ }
+
+ protected CorbaMessageMediator finishReadingBits(MessageMediator messageMediator)
+ {
+ try {
+
+ if (orb.transportDebugFlag) {
+ dprint(".finishReadingBits->: " + this);
+ }
+
+ // REVISIT - use common factory base class.
+ if (contactInfo != null) {
+ messageMediator =
+ contactInfo.finishCreatingMessageMediator(orb, this, messageMediator);
+ } else if (acceptor != null) {
+ messageMediator =
+ acceptor.finishCreatingMessageMediator(orb, this, messageMediator);
+ } else {
+ throw
+ new RuntimeException("SocketOrChannelConnectionImpl.finishReadingBits");
+ }
+ return (CorbaMessageMediator) messageMediator;
+
+ } catch (ThreadDeath td) {
+ if (orb.transportDebugFlag) {
+ dprint(".finishReadingBits: " + this + ": ThreadDeath: " + td, td);
+ }
+ try {
+ purgeCalls(wrapper.connectionAbort(td), false, false);
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".finishReadingBits: " + this + ": purgeCalls: Throwable: " + t, t);
+ }
+ }
+ throw td;
+ } catch (Throwable ex) {
+ if (orb.transportDebugFlag) {
+ dprint(".finishReadingBits: " + this + ": Throwable: " + ex, ex);
+ }
+
+ try {
+ if (ex instanceof INTERNAL) {
+ sendMessageError(GIOPVersion.DEFAULT_VERSION);
+ }
+ } catch (IOException e) {
+ if (orb.transportDebugFlag) {
+ dprint(".finishReadingBits: " + this +
+ ": sendMessageError: IOException: " + e, e);
+ }
+ }
+ // REVISIT - make sure reader thread is killed.
+ orb.getTransportManager().getSelector(0).unregisterForEvent(this);
+ // Notify anyone waiting.
+ purgeCalls(wrapper.connectionAbort(ex), true, false);
+ // REVISIT
+ //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
+ // causes IBM (screen scraping) tests to fail.
+ //close();
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".finishReadingBits<-: " + this);
+ }
+ }
+ return null;
+ }
+
+ protected boolean dispatch(CorbaMessageMediator messageMediator)
+ {
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".dispatch->: " + this);
+ }
+
+ //
+ // NOTE:
+ //
+ // This call is the transition from the tranport block
+ // to the protocol block.
+ //
+
+ boolean result =
+ messageMediator.getProtocolHandler()
+ .handleRequest(messageMediator);
+
+ return result;
+
+ } catch (ThreadDeath td) {
+ if (orb.transportDebugFlag) {
+ dprint(".dispatch: ThreadDeath", td );
+ }
+ try {
+ purgeCalls(wrapper.connectionAbort(td), false, false);
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".dispatch: purgeCalls: Throwable", t);
+ }
+ }
+ throw td;
+ } catch (Throwable ex) {
+ if (orb.transportDebugFlag) {
+ dprint(".dispatch: Throwable", ex ) ;
+ }
+
+ try {
+ if (ex instanceof INTERNAL) {
+ sendMessageError(GIOPVersion.DEFAULT_VERSION);
+ }
+ } catch (IOException e) {
+ if (orb.transportDebugFlag) {
+ dprint(".dispatch: sendMessageError: IOException", e);
+ }
+ }
+ purgeCalls(wrapper.connectionAbort(ex), false, false);
+ // REVISIT
+ //keepRunning = false;
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".dispatch<-: " + this);
+ }
+ }
+
+ return true;
+ }
+
+ public boolean shouldUseDirectByteBuffers()
+ {
+ return getSocketChannel() != null;
+ }
+
+ public ByteBuffer read(int size, int offset, int length, long max_wait_time)
+ throws IOException
+ {
+ if (shouldUseDirectByteBuffers()) {
+
+ ByteBuffer byteBuffer =
+ orb.getByteBufferPool().getByteBuffer(size);
+
+ if (orb.transportDebugFlag) {
+ // print address of ByteBuffer gotten from pool
+ int bbAddress = System.identityHashCode(byteBuffer);
+ StringBuffer sb = new StringBuffer(80);
+ sb.append(".read: got ByteBuffer id (");
+ sb.append(bbAddress).append(") from ByteBufferPool.");
+ String msgStr = sb.toString();
+ dprint(msgStr);
+ }
+
+ byteBuffer.position(offset);
+ byteBuffer.limit(size);
+
+ readFully(byteBuffer, length, max_wait_time);
+
+ return byteBuffer;
+ }
+
+ byte[] buf = new byte[size];
+ readFully(getSocket().getInputStream(), buf,
+ offset, length, max_wait_time);
+ ByteBuffer byteBuffer = ByteBuffer.wrap(buf);
+ byteBuffer.limit(size);
+ return byteBuffer;
+ }
+
+ public ByteBuffer read(ByteBuffer byteBuffer, int offset,
+ int length, long max_wait_time)
+ throws IOException
+ {
+ int size = offset + length;
+ if (shouldUseDirectByteBuffers()) {
+
+ if (! byteBuffer.isDirect()) {
+ throw wrapper.unexpectedNonDirectByteBufferWithChannelSocket();
+ }
+ if (size > byteBuffer.capacity()) {
+ if (orb.transportDebugFlag) {
+ // print address of ByteBuffer being released
+ int bbAddress = System.identityHashCode(byteBuffer);
+ StringBuffer bbsb = new StringBuffer(80);
+ bbsb.append(".read: releasing ByteBuffer id (")
+ .append(bbAddress).append(") to ByteBufferPool.");
+ String bbmsg = bbsb.toString();
+ dprint(bbmsg);
+ }
+ orb.getByteBufferPool().releaseByteBuffer(byteBuffer);
+ byteBuffer = orb.getByteBufferPool().getByteBuffer(size);
+ }
+ byteBuffer.position(offset);
+ byteBuffer.limit(size);
+ readFully(byteBuffer, length, max_wait_time);
+ byteBuffer.position(0);
+ byteBuffer.limit(size);
+ return byteBuffer;
+ }
+ if (byteBuffer.isDirect()) {
+ throw wrapper.unexpectedDirectByteBufferWithNonChannelSocket();
+ }
+ byte[] buf = new byte[size];
+ readFully(getSocket().getInputStream(), buf,
+ offset, length, max_wait_time);
+ return ByteBuffer.wrap(buf);
+ }
+
+ public void readFully(ByteBuffer byteBuffer, int size, long max_wait_time)
+ throws IOException
+ {
+ int n = 0;
+ int bytecount = 0;
+ long time_to_wait = readTimeouts.get_initial_time_to_wait();
+ long total_time_in_wait = 0;
+
+ // The reading of data incorporates a strategy to detect a
+ // rogue client. The strategy is implemented as follows. As
+ // long as data is being read, at least 1 byte or more, we
+ // assume we have a well behaved client. If no data is read,
+ // then we sleep for a time to wait, re-calculate a new time to
+ // wait which is lengthier than the previous time spent waiting.
+ // Then, if the total time spent waiting does not exceed a
+ // maximum time we are willing to wait, we attempt another
+ // read. If the maximum amount of time we are willing to
+ // spend waiting for more data is exceeded, we throw an
+ // IOException.
+
+ // NOTE: Reading of GIOP headers are treated with a smaller
+ // maximum time to wait threshold. Based on extensive
+ // performance testing, all GIOP headers are being
+ // read in 1 read access.
+
+ do {
+ bytecount = getSocketChannel().read(byteBuffer);
+
+ if (bytecount < 0) {
+ throw new IOException("End-of-stream");
+ }
+ else if (bytecount == 0) {
+ try {
+ Thread.sleep(time_to_wait);
+ total_time_in_wait += time_to_wait;
+ time_to_wait =
+ (long)(time_to_wait*readTimeouts.get_backoff_factor());
+ }
+ catch (InterruptedException ie) {
+ // ignore exception
+ if (orb.transportDebugFlag) {
+ dprint("readFully(): unexpected exception "
+ + ie.toString());
+ }
+ }
+ }
+ else {
+ n += bytecount;
+ }
+ }
+ while (n < size && total_time_in_wait < max_wait_time);
+
+ if (n < size && total_time_in_wait >= max_wait_time)
+ {
+ // failed to read entire message
+ throw wrapper.transportReadTimeoutExceeded(new Integer(size),
+ new Integer(n), new Long(max_wait_time),
+ new Long(total_time_in_wait));
+ }
+
+ getConnectionCache().stampTime(this);
+ }
+
+ // To support non-channel connections.
+ public void readFully(java.io.InputStream is, byte[] buf,
+ int offset, int size, long max_wait_time)
+ throws IOException
+ {
+ int n = 0;
+ int bytecount = 0;
+ long time_to_wait = readTimeouts.get_initial_time_to_wait();
+ long total_time_in_wait = 0;
+
+ // The reading of data incorporates a strategy to detect a
+ // rogue client. The strategy is implemented as follows. As
+ // long as data is being read, at least 1 byte or more, we
+ // assume we have a well behaved client. If no data is read,
+ // then we sleep for a time to wait, re-calculate a new time to
+ // wait which is lengthier than the previous time spent waiting.
+ // Then, if the total time spent waiting does not exceed a
+ // maximum time we are willing to wait, we attempt another
+ // read. If the maximum amount of time we are willing to
+ // spend waiting for more data is exceeded, we throw an
+ // IOException.
+
+ // NOTE: Reading of GIOP headers are treated with a smaller
+ // maximum time to wait threshold. Based on extensive
+ // performance testing, all GIOP headers are being
+ // read in 1 read access.
+
+ do {
+ bytecount = is.read(buf, offset + n, size - n);
+ if (bytecount < 0) {
+ throw new IOException("End-of-stream");
+ }
+ else if (bytecount == 0) {
+ try {
+ Thread.sleep(time_to_wait);
+ total_time_in_wait += time_to_wait;
+ time_to_wait =
+ (long)(time_to_wait*readTimeouts.get_backoff_factor());
+ }
+ catch (InterruptedException ie) {
+ // ignore exception
+ if (orb.transportDebugFlag) {
+ dprint("readFully(): unexpected exception "
+ + ie.toString());
+ }
+ }
+ }
+ else {
+ n += bytecount;
+ }
+ }
+ while (n < size && total_time_in_wait < max_wait_time);
+
+ if (n < size && total_time_in_wait >= max_wait_time)
+ {
+ // failed to read entire message
+ throw wrapper.transportReadTimeoutExceeded(new Integer(size),
+ new Integer(n), new Long(max_wait_time),
+ new Long(total_time_in_wait));
+ }
+
+ getConnectionCache().stampTime(this);
+ }
+
+ public void write(ByteBuffer byteBuffer)
+ throws IOException
+ {
+ if (shouldUseDirectByteBuffers()) {
+ /* NOTE: cannot perform this test. If one ask for a
+ ByteBuffer from the pool which is bigger than the size
+ of ByteBuffers managed by the pool, then the pool will
+ return a HeapByteBuffer.
+ if (byteBuffer.hasArray()) {
+ throw wrapper.unexpectedNonDirectByteBufferWithChannelSocket();
+ }
+ */
+ // IMPORTANT: For non-blocking SocketChannels, there's no guarantee
+ // all bytes are written on first write attempt.
+ do {
+ getSocketChannel().write(byteBuffer);
+ }
+ while (byteBuffer.hasRemaining());
+
+ } else {
+ if (! byteBuffer.hasArray()) {
+ throw wrapper.unexpectedDirectByteBufferWithNonChannelSocket();
+ }
+ byte[] tmpBuf = byteBuffer.array();
+ getSocket().getOutputStream().write(tmpBuf, 0, byteBuffer.limit());
+ getSocket().getOutputStream().flush();
+ }
+
+ // TimeStamp connection to indicate it has been used
+ // Note granularity of connection usage is assumed for
+ // now to be that of a IIOP packet.
+ getConnectionCache().stampTime(this);
+ }
+
+ /**
+ * Note:it is possible for this to be called more than once
+ */
+ public synchronized void close()
+ {
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".close->: " + this);
+ }
+ writeLock();
+
+ // REVISIT It will be good to have a read lock on the reader thread
+ // before we proceed further, to avoid the reader thread (server side)
+ // from processing requests. This avoids the risk that a new request
+ // will be accepted by ReaderThread while the ListenerThread is
+ // attempting to close this connection.
+
+ if (isBusy()) { // we are busy!
+ writeUnlock();
+ if (orb.transportDebugFlag) {
+ dprint(".close: isBusy so no close: " + this);
+ }
+ return;
+ }
+
+ try {
+ try {
+ sendCloseConnection(GIOPVersion.V1_0);
+ } catch (Throwable t) {
+ wrapper.exceptionWhenSendingCloseConnection(t);
+ }
+
+ synchronized ( stateEvent ){
+ state = CLOSE_SENT;
+ stateEvent.notifyAll();
+ }
+
+ // stop the reader without causing it to do purgeCalls
+ //Exception ex = new Exception();
+ //reader.stop(ex); // REVISIT
+
+ // NOTE: !!!!!!
+ // This does writeUnlock().
+ purgeCalls(wrapper.connectionRebind(), false, true);
+
+ } catch (Exception ex) {
+ if (orb.transportDebugFlag) {
+ dprint(".close: exception: " + this, ex);
+ }
+ }
+ try {
+ Selector selector = orb.getTransportManager().getSelector(0);
+ if (selector != null) {
+ selector.unregisterForEvent(this);
+ }
+ if (socketChannel != null) {
+ socketChannel.close();
+ }
+ socket.close();
+ } catch (IOException e) {
+ if (orb.transportDebugFlag) {
+ dprint(".close: " + this, e);
+ }
+ }
+ closeConnectionResources();
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".close<-: " + this);
+ }
+ }
+ }
+
+ public void closeConnectionResources() {
+ if (orb.transportDebugFlag) {
+ dprint(".closeConnectionResources->: " + this);
+ }
+ Selector selector = orb.getTransportManager().getSelector(0);
+ if (selector != null) {
+ selector.unregisterForEvent(this);
+ }
+ try {
+ if (socketChannel != null)
+ socketChannel.close() ;
+ if (socket != null && !socket.isClosed())
+ socket.close() ;
+ } catch (IOException e) {
+ if (orb.transportDebugFlag) {
+ dprint( ".closeConnectionResources: " + this, e ) ;
+ }
+ }
+ if (orb.transportDebugFlag) {
+ dprint(".closeConnectionResources<-: " + this);
+ }
+ }
+
+
+ public Acceptor getAcceptor()
+ {
+ return acceptor;
+ }
+
+ public ContactInfo getContactInfo()
+ {
+ return contactInfo;
+ }
+
+ public EventHandler getEventHandler()
+ {
+ return this;
+ }
+
+ public OutputObject createOutputObject(MessageMediator messageMediator)
+ {
+ // REVISIT - remove this method from Connection and all it subclasses.
+ throw new RuntimeException("*****SocketOrChannelConnectionImpl.createOutputObject - should not be called.");
+ }
+
+ // 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
+ public boolean isServer()
+ {
+ return isServer;
+ }
+
+ public boolean isBusy()
+ {
+ if (serverRequestCount > 0 ||
+ getResponseWaitingRoom().numberRegistered() > 0)
+ {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ public long getTimeStamp()
+ {
+ return timeStamp;
+ }
+
+ public void setTimeStamp(long time)
+ {
+ timeStamp = time;
+ }
+
+ public void setState(String stateString)
+ {
+ synchronized (stateEvent) {
+ if (stateString.equals("ESTABLISHED")) {
+ state = ESTABLISHED;
+ stateEvent.notifyAll();
+ } else {
+ // REVISIT: ASSERT
+ }
+ }
+ }
+
+ /**
+ * 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.
+ */
+ public void writeLock()
+ {
+ try {
+ if (dprintWriteLocks && orb.transportDebugFlag) {
+ dprint(".writeLock->: " + this);
+ }
+ // Keep looping till we can set the writeLock.
+ while ( true ) {
+ int localState = state;
+ switch ( localState ) {
+
+ case OPENING:
+ synchronized (stateEvent) {
+ if (state != OPENING) {
+ // somebody has changed 'state' so be careful
+ break;
+ }
+ try {
+ stateEvent.wait();
+ } catch (InterruptedException ie) {
+ if (orb.transportDebugFlag) {
+ dprint(".writeLock: OPENING InterruptedException: " + this);
+ }
+ }
+ }
+ // 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 (state == ESTABLISHED && writeLocked) {
+ writeEvent.wait(100);
+ }
+ } catch (InterruptedException ie) {
+ if (orb.transportDebugFlag) {
+ dprint(".writeLock: ESTABLISHED InterruptedException: " + this);
+ }
+ }
+ }
+ // Loop back
+ break;
+
+ //
+ // XXX
+ // Need to distinguish between client and server roles
+ // here probably.
+ //
+ case ABORT:
+ synchronized ( stateEvent ){
+ if (state != ABORT) {
+ break;
+ }
+ throw wrapper.writeErrorSend() ;
+ }
+
+ case CLOSE_RECVD:
+ // the connection has been closed or closing
+ // ==> throw rebind exception
+ synchronized ( stateEvent ){
+ if (state != CLOSE_RECVD) {
+ break;
+ }
+ throw wrapper.connectionCloseRebind() ;
+ }
+
+ default:
+ if (orb.transportDebugFlag) {
+ dprint(".writeLock: default: " + this);
+ }
+ // REVISIT
+ throw new RuntimeException(".writeLock: bad state");
+ }
+ }
+ } finally {
+ if (dprintWriteLocks && orb.transportDebugFlag) {
+ dprint(".writeLock<-: " + this);
+ }
+ }
+ }
+
+ public void writeUnlock()
+ {
+ try {
+ if (dprintWriteLocks && orb.transportDebugFlag) {
+ dprint(".writeUnlock->: " + this);
+ }
+ synchronized (writeEvent) {
+ writeLocked = false;
+ writeEvent.notify(); // wake up one guy waiting to write
+ }
+ } finally {
+ if (dprintWriteLocks && orb.transportDebugFlag) {
+ dprint(".writeUnlock<-: " + this);
+ }
+ }
+ }
+
+ // Assumes the caller handles writeLock and writeUnlock
+ public void sendWithoutLock(OutputObject outputObject)
+ {
+ // Don't we need to check for CloseConnection
+ // here? REVISIT
+
+ // XREVISIT - Shouldn't the MessageMediator
+ // be the one to handle writing the data here?
+
+ try {
+
+ // Write the fragment/message
+
+ CDROutputObject cdrOutputObject = (CDROutputObject) outputObject;
+ cdrOutputObject.writeTo(this);
+ // REVISIT - no flush?
+ //socket.getOutputStream().flush();
+
+ } catch (IOException e1) {
+
+ /*
+ * ADDED(Ram J) 10/13/2000 In the event of an IOException, try
+ * sending a CancelRequest for regular requests / locate requests
+ */
+
+ // Since IIOPOutputStream's msgheader is set only once, and not
+ // 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.
+
+ /* REVISIT: MOVE TO SUBCONTRACT
+ Message msg = os.getMessage();
+ if (msg.getType() == Message.GIOPRequest ||
+ msg.getType() == Message.GIOPLocateRequest) {
+ GIOPVersion requestVersion = msg.getGIOPVersion();
+ int requestId = MessageBase.getRequestId(msg);
+ try {
+ sendCancelRequest(requestVersion, requestId);
+ } catch (IOException e2) {
+ // most likely an abortive connection closure.
+ // ignore, since nothing more can be done.
+ if (orb.transportDebugFlag) {
+
+ }
+ }
+ */
+
+ // REVISIT When a send failure happens, purgeCalls() need to be
+ // called to ensure that the connection is properly removed from
+ // further usage (ie., cancelling pending requests with COMM_FAILURE
+ // with an appropriate minor_code CompletionStatus.MAY_BE).
+
+ // Relying on the IIOPOutputStream (as noted below) is not
+ // sufficient as it handles COMM_FAILURE only for the final
+ // fragment (during invoke processing). Note that COMM_FAILURE could
+ // happen while sending the initial fragments.
+ // Also the IIOPOutputStream does not properly close the connection.
+ // It simply removes the connection from the table. An orderly
+ // closure is needed (ie., cancel pending requests on the connection
+ // COMM_FAILURE as well.
+
+ // IIOPOutputStream will cleanup the connection info when it
+ // sees this exception.
+ SystemException exc = wrapper.writeErrorSend(e1);
+ purgeCalls(exc, false, true);
+ throw exc;
+ }
+ }
+
+ public void registerWaiter(MessageMediator messageMediator)
+ {
+ responseWaitingRoom.registerWaiter(messageMediator);
+ }
+
+ public void unregisterWaiter(MessageMediator messageMediator)
+ {
+ responseWaitingRoom.unregisterWaiter(messageMediator);
+ }
+
+ public InputObject waitForResponse(MessageMediator messageMediator)
+ {
+ return responseWaitingRoom.waitForResponse(messageMediator);
+ }
+
+ public void setConnectionCache(ConnectionCache connectionCache)
+ {
+ this.connectionCache = connectionCache;
+ }
+
+ public ConnectionCache getConnectionCache()
+ {
+ return connectionCache;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // EventHandler methods
+ //
+
+ public void setUseSelectThreadToWait(boolean x)
+ {
+ useSelectThreadToWait = x;
+ // REVISIT - Reading of a GIOP header only is information
+ // that should be passed into the constructor
+ // from the SocketOrChannelConnection factory.
+ setReadGiopHeaderOnly(shouldUseSelectThreadToWait());
+ }
+
+ public void handleEvent()
+ {
+ if (orb.transportDebugFlag) {
+ dprint(".handleEvent->: " + this);
+ }
+ getSelectionKey().interestOps(getSelectionKey().interestOps() &
+ (~ getInterestOps()));
+
+ if (shouldUseWorkerThreadForEvent()) {
+ Throwable throwable = null;
+ try {
+ int poolToUse = 0;
+ if (shouldReadGiopHeaderOnly()) {
+ partialMessageMediator = readBits();
+ poolToUse =
+ partialMessageMediator.getThreadPoolToUse();
+ }
+
+ if (orb.transportDebugFlag) {
+ dprint(".handleEvent: addWork to pool: " + poolToUse);
+ }
+ orb.getThreadPoolManager().getThreadPool(poolToUse)
+ .getWorkQueue(0).addWork(getWork());
+ } catch (NoSuchThreadPoolException e) {
+ throwable = e;
+ } catch (NoSuchWorkQueueException e) {
+ throwable = e;
+ }
+ // REVISIT: need to close connection.
+ if (throwable != null) {
+ if (orb.transportDebugFlag) {
+ dprint(".handleEvent: " + throwable);
+ }
+ INTERNAL i = new INTERNAL("NoSuchThreadPoolException");
+ i.initCause(throwable);
+ throw i;
+ }
+ } else {
+ if (orb.transportDebugFlag) {
+ dprint(".handleEvent: doWork");
+ }
+ getWork().doWork();
+ }
+ if (orb.transportDebugFlag) {
+ dprint(".handleEvent<-: " + this);
+ }
+ }
+
+ public SelectableChannel getChannel()
+ {
+ return socketChannel;
+ }
+
+ public int getInterestOps()
+ {
+ return SelectionKey.OP_READ;
+ }
+
+ // public Acceptor getAcceptor() - already defined above.
+
+ public Connection getConnection()
+ {
+ return this;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Work methods.
+ //
+
+ public String getName()
+ {
+ return this.toString();
+ }
+
+ public void doWork()
+ {
+ try {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork->: " + this);
+ }
+
+ // IMPORTANT: Sanity checks on SelectionKeys such as
+ // SelectorKey.isValid() should not be done
+ // here.
+ //
+
+ if (!shouldReadGiopHeaderOnly()) {
+ read();
+ }
+ else {
+ // get the partialMessageMediator
+ // created by SelectorThread
+ CorbaMessageMediator messageMediator =
+ this.getPartialMessageMediator();
+
+ // read remaining info needed in a MessageMediator
+ messageMediator = finishReadingBits(messageMediator);
+
+ if (messageMediator != null) {
+ // Null can happen when client closes stream
+ // causing purgecalls.
+ dispatch(messageMediator);
+ }
+ }
+ } catch (Throwable t) {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork: ignoring Throwable: "
+ + t
+ + " " + this);
+ }
+ } finally {
+ if (orb.transportDebugFlag) {
+ dprint(".doWork<-: " + this);
+ }
+ }
+ }
+
+ public void setEnqueueTime(long timeInMillis)
+ {
+ enqueueTime = timeInMillis;
+ }
+
+ public long getEnqueueTime()
+ {
+ return enqueueTime;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // spi.transport.CorbaConnection.
+ //
+
+ // IMPORTANT: Reader Threads must NOT read Giop header only.
+ public boolean shouldReadGiopHeaderOnly() {
+ return shouldReadGiopHeaderOnly;
+ }
+
+ protected void setReadGiopHeaderOnly(boolean shouldReadHeaderOnly) {
+ shouldReadGiopHeaderOnly = shouldReadHeaderOnly;
+ }
+
+ public ResponseWaitingRoom getResponseWaitingRoom()
+ {
+ return responseWaitingRoom;
+ }
+
+ // REVISIT - inteface defines isServer but already defined in
+ // higher interface.
+
+ public void serverRequestMapPut(int requestId,
+ CorbaMessageMediator messageMediator)
+ {
+ serverRequestMap.put(new Integer(requestId), messageMediator);
+ }
+
+ public CorbaMessageMediator serverRequestMapGet(int requestId)
+ {
+ return (CorbaMessageMediator)
+ serverRequestMap.get(new Integer(requestId));
+ }
+
+ public void serverRequestMapRemove(int requestId)
+ {
+ serverRequestMap.remove(new Integer(requestId));
+ }
+
+
+ // REVISIT: this is also defined in:
+ // com.sun.corba.se.spi.legacy.connection.Connection
+ public java.net.Socket getSocket()
+ {
+ return socket;
+ }
+
+ /** 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++;
+ }
+
+ public synchronized void serverRequestProcessingEnds()
+ {
+ serverRequestCount--;
+ }
+
+ //
+ //
+ //
+
+ public synchronized int getNextRequestId()
+ {
+ return requestId++;
+ }
+
+ // Negotiated code sets for char and wchar data
+ protected CodeSetComponentInfo.CodeSetContext codeSetContext = null;
+
+ public ORB getBroker()
+ {
+ return orb;
+ }
+
+ public CodeSetComponentInfo.CodeSetContext getCodeSetContext() {
+ // Needs to be synchronized for the following case when the client
+ // doesn't send the code set context twice, and we have two threads
+ // in ServerRequestDispatcher processCodeSetContext.
+ //
+ // Thread A checks to see if there is a context, there is none, so
+ // it calls setCodeSetContext, getting the synch lock.
+ // Thread B checks to see if there is a context. If we didn't synch,
+ // it might decide to outlaw wchar/wstring.
+ if (codeSetContext == null) {
+ synchronized(this) {
+ return codeSetContext;
+ }
+ }
+
+ return codeSetContext;
+ }
+
+ public synchronized void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc) {
+ // Double check whether or not we need to do this
+ if (codeSetContext == 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.
+ throw wrapper.badCodesetsFromClient() ;
+ }
+
+ codeSetContext = csc;
+ }
+ }
+
+ //
+ // from iiop.IIOPConnection.java
+ //
+
+ // Map request ID to an InputObject.
+ // 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,
+ // so it doesn't incur synchronization overhead.
+
+ public MessageMediator clientRequestMapGet(int requestId)
+ {
+ return responseWaitingRoom.getMessageMediator(requestId);
+ }
+
+ protected MessageMediator clientReply_1_1;
+
+ public void clientReply_1_1_Put(MessageMediator x)
+ {
+ clientReply_1_1 = x;
+ }
+
+ public MessageMediator clientReply_1_1_Get()
+ {
+ return clientReply_1_1;
+ }
+
+ public void clientReply_1_1_Remove()
+ {
+ clientReply_1_1 = null;
+ }
+
+ protected MessageMediator serverRequest_1_1;
+
+ public void serverRequest_1_1_Put(MessageMediator x)
+ {
+ serverRequest_1_1 = x;
+ }
+
+ public MessageMediator serverRequest_1_1_Get()
+ {
+ return serverRequest_1_1;
+ }
+
+ public void serverRequest_1_1_Remove()
+ {
+ serverRequest_1_1 = null;
+ }
+
+ 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 "???" ;
+ }
+ }
+ }
+
+ public synchronized boolean isPostInitialContexts() {
+ return postInitialContexts;
+ }
+
+ // Can never be unset...
+ public synchronized void setPostInitialContexts(){
+ postInitialContexts = true;
+ }
+
+ /**
+ * 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.
+
+ * Note that this should only ever be called by the Reader thread for
+ * this connection.
+ *
+ * @param minor_code The minor code for the COMM_FAILURE major code.
+ * @param die Kill the reader thread (this thread) before exiting.
+ */
+ public void purgeCalls(SystemException systemException,
+ boolean die, boolean lockHeld)
+ {
+ int minor_code = systemException.minor;
+
+ try{
+ if (orb.transportDebugFlag) {
+ dprint(".purgeCalls->: "
+ + minor_code + "/" + die + "/" + lockHeld
+ + " " + this);
+ }
+
+ // If this invocation is a result of ThreadDeath caused
+ // by a previous execution of this routine, just exit.
+
+ synchronized ( stateEvent ){
+ if ((state == ABORT) || (state == CLOSE_RECVD)) {
+ if (orb.transportDebugFlag) {
+ dprint(".purgeCalls: exiting since state is: "
+ + getStateString(state)
+ + " " + this);
+ }
+ return;
+ }
+ }
+
+ // Grab the writeLock (freeze the calls)
+ try {
+ if (!lockHeld) {
+ writeLock();
+ }
+ } catch (SystemException ex) {
+ if (orb.transportDebugFlag)
+ dprint(".purgeCalls: SystemException" + ex
+ + "; continuing " + this);
+ }
+
+ // Mark the state of the connection
+ // and determine the request status
+ org.omg.CORBA.CompletionStatus completion_status;
+ synchronized ( stateEvent ){
+ if (minor_code == ORBUtilSystemException.CONNECTION_REBIND) {
+ state = CLOSE_RECVD;
+ systemException.completed = CompletionStatus.COMPLETED_NO;
+ } else {
+ state = ABORT;
+ systemException.completed = CompletionStatus.COMPLETED_MAYBE;
+ }
+ stateEvent.notifyAll();
+ }
+
+ try {
+ socket.getInputStream().close();
+ socket.getOutputStream().close();
+ socket.close();
+ } catch (Exception ex) {
+ if (orb.transportDebugFlag) {
+ dprint(".purgeCalls: Exception closing socket: " + ex
+ + " " + this);
+ }
+ }
+
+ // Signal all threads with outstanding requests on this
+ // connection and give them the SystemException;
+
+ responseWaitingRoom.signalExceptionToAllWaiters(systemException);
+ } finally {
+ if (contactInfo != null) {
+ ((OutboundConnectionCache)getConnectionCache()).remove(contactInfo);
+ } else if (acceptor != null) {
+ ((InboundConnectionCache)getConnectionCache()).remove(this);
+ }
+
+ //
+ // REVISIT: Stop the reader thread
+ //
+
+ // Signal all the waiters of the writeLock.
+ // There are 4 types of writeLock waiters:
+ // 1. Send waiters:
+ // 2. SendReply waiters:
+ // 3. cleanUp waiters:
+ // 4. purge_call waiters:
+ //
+
+ writeUnlock();
+
+ if (orb.transportDebugFlag) {
+ dprint(".purgeCalls<-: "
+ + minor_code + "/" + die + "/" + lockHeld
+ + " " + this);
+ }
+ }
+ }
+
+ /*************************************************************************
+ * 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
+ {
+ Message msg = MessageBase.createCloseConnection(giopVersion);
+ sendHelper(giopVersion, msg);
+ }
+
+ 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.
+ * @exception IOException - could be due to abortive connection closure.
+ */
+ 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
+ {
+ // REVISIT: See comments in CDROutputObject constructor.
+ CDROutputObject outputObject =
+ sun.corba.OutputStreamFactory.newCDROutputObject((ORB)orb, null, giopVersion,
+ this, msg, ORBConstants.STREAM_FORMAT_VERSION_1);
+ msg.write(outputObject);
+
+ outputObject.writeTo(this);
+ }
+
+ public void sendCancelRequestWithLock(GIOPVersion giopVersion,
+ int requestId)
+ throws IOException
+ {
+ writeLock();
+ try {
+ sendCancelRequest(giopVersion, requestId);
+ } finally {
+ writeUnlock();
+ }
+ }
+
+ // 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
+ // 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
+ // getting the IOR out of the SendingContext service context.
+ // Our ORBs always send this, but it's optional in CORBA.
+
+ public final void setCodeBaseIOR(IOR ior) {
+ codeBaseServerIOR = ior;
+ }
+
+ public final IOR getCodeBaseIOR() {
+ return codeBaseServerIOR;
+ }
+
+ // 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;
+ }
+
+ // End Code Base methods -----------------------------------------
+
+ // set transport read thresholds
+ protected void setReadTimeouts(ReadTimeouts readTimeouts) {
+ this.readTimeouts = readTimeouts;
+ }
+
+ protected void setPartialMessageMediator(CorbaMessageMediator messageMediator) {
+ partialMessageMediator = messageMediator;
+ }
+
+ protected CorbaMessageMediator getPartialMessageMediator() {
+ return partialMessageMediator;
+ }
+
+ public String toString()
+ {
+ synchronized ( stateEvent ){
+ return
+ "SocketOrChannelConnectionImpl[" + " "
+ + (socketChannel == null ?
+ socket.toString() : socketChannel.toString()) + " "
+ + getStateString( state ) + " "
+ + shouldUseSelectThreadToWait() + " "
+ + shouldUseWorkerThreadForEvent() + " "
+ + shouldReadGiopHeaderOnly()
+ + "]" ;
+ }
+ }
+
+ // Must be public - used in encoding.
+ public void dprint(String msg)
+ {
+ ORBUtility.dprint("SocketOrChannelConnectionImpl", msg);
+ }
+
+ protected void dprint(String msg, Throwable t)
+ {
+ dprint(msg);
+ t.printStackTrace(System.out);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelContactInfoImpl.java b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelContactInfoImpl.java
new file mode 100644
index 0000000..3970c32
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/transport/SocketOrChannelContactInfoImpl.java
@@ -0,0 +1,217 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.transport;
+
+import com.sun.corba.se.pept.transport.Connection;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList;
+import com.sun.corba.se.spi.transport.CorbaTransportManager;
+import com.sun.corba.se.spi.transport.SocketInfo;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.transport.CorbaContactInfoBase;
+
+/**
+ * @author Harold Carr
+ */
+public class SocketOrChannelContactInfoImpl
+ extends CorbaContactInfoBase
+ implements SocketInfo
+{
+ protected boolean isHashCodeCached = false;
+ protected int cachedHashCode;
+
+ protected String socketType;
+ protected String hostname;
+ protected int port;
+
+ // XREVISIT
+ // See SocketOrChannelAcceptorImpl.createMessageMediator
+ // See SocketFactoryContactInfoImpl.constructor()
+ // See SocketOrChannelContactInfoImpl.constructor()
+ protected SocketOrChannelContactInfoImpl()
+ {
+ }
+
+ protected SocketOrChannelContactInfoImpl(
+ ORB orb,
+ CorbaContactInfoList contactInfoList)
+ {
+ this.orb = orb;
+ this.contactInfoList = contactInfoList;
+ }
+
+ public SocketOrChannelContactInfoImpl(
+ ORB orb,
+ CorbaContactInfoList contactInfoList,
+ String socketType,
+ String hostname,
+ int port)
+ {
+ this(orb, contactInfoList);
+ this.socketType = socketType;
+ this.hostname = hostname;
+ this.port = port;
+ }
+
+ // XREVISIT
+ public SocketOrChannelContactInfoImpl(
+ ORB orb,
+ CorbaContactInfoList contactInfoList,
+ IOR effectiveTargetIOR,
+ short addressingDisposition,
+ String socketType,
+ String hostname,
+ int port)
+ {
+ this(orb, contactInfoList, socketType, hostname, port);
+ this.effectiveTargetIOR = effectiveTargetIOR;
+ this.addressingDisposition = addressingDisposition;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.ContactInfo
+ //
+
+ public boolean isConnectionBased()
+ {
+ return true;
+ }
+
+ public boolean shouldCacheConnection()
+ {
+ return true;
+ }
+
+ public String getConnectionCacheType()
+ {
+ return CorbaTransportManager.SOCKET_OR_CHANNEL_CONNECTION_CACHE;
+ }
+
+ public Connection createConnection()
+ {
+ Connection connection =
+ new SocketOrChannelConnectionImpl(orb, this,
+ socketType, hostname, port);
+ return connection;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // spi.transport.CorbaContactInfo
+ //
+
+ public String getMonitoringName()
+ {
+ return "SocketConnections";
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // pept.transport.ContactInfo
+ //
+
+ public String getType()
+ {
+ return socketType;
+ }
+
+ public String getHost()
+ {
+ return hostname;
+ }
+
+ public int getPort()
+ {
+ return port;
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // java.lang.Object
+ //
+
+ public int hashCode()
+ {
+ if (! isHashCodeCached) {
+ cachedHashCode = socketType.hashCode() ^ hostname.hashCode() ^ port;
+ isHashCodeCached = true;
+ }
+ return cachedHashCode;
+ }
+
+ public boolean equals(Object obj)
+ {
+ if (obj == null) {
+ return false;
+ } else if (!(obj instanceof SocketOrChannelContactInfoImpl)) {
+ return false;
+ }
+
+ SocketOrChannelContactInfoImpl other =
+ (SocketOrChannelContactInfoImpl) obj;
+
+ if (port != other.port) {
+ return false;
+ }
+ if (!hostname.equals(other.hostname)) {
+ return false;
+ }
+ if (socketType == null) {
+ if (other.socketType != null) {
+ return false;
+ }
+ } else if (!socketType.equals(other.socketType)) {
+ return false;
+ }
+ return true;
+ }
+
+ public String toString()
+ {
+ return
+ "SocketOrChannelContactInfoImpl["
+ + socketType + " "
+ + hostname + " "
+ + port
+ + "]";
+ }
+
+ ////////////////////////////////////////////////////
+ //
+ // Implementation
+ //
+
+ protected void dprint(String msg)
+ {
+ ORBUtility.dprint("SocketOrChannelContactInfoImpl", msg);
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtable.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtable.java
new file mode 100644
index 0000000..c4ff397
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtable.java
@@ -0,0 +1,373 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.util;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+
+/**
+ * IdentityHashtable is a modified copy of the 1.1.6 Hashtable class which
+ * does not rely on the hashCode() and equals() methods of the key or value;
+ * instead, it uses the System.identityHashcode() method and pointer comparison.
+ * In addition, all synchronization has been removed.
+ */
+public final class IdentityHashtable extends Dictionary {
+ /**
+ * The hash table data.
+ */
+ private transient IdentityHashtableEntry table[];
+
+ /**
+ * The total number of entries in the hash table.
+ */
+ private transient int count;
+
+ /**
+ * Rehashes the table when count exceeds this threshold.
+ */
+ private int threshold;
+
+ /**
+ * The load factor for the hashtable.
+ */
+ private float loadFactor;
+
+ /**
+ * Constructs a new, empty hashtable with the specified initial
+ * capacity and the specified load factor.
+ *
+ * @param initialCapacity the initial capacity of the hashtable.
+ * @param loadFactor a number between 0.0 and 1.0.
+ * @exception IllegalArgumentException if the initial capacity is less
+ * than or equal to zero, or if the load factor is less than
+ * or equal to zero.
+ * @since JDK1.0
+ */
+ public IdentityHashtable(int initialCapacity, float loadFactor) {
+ if ((initialCapacity <= 0) || (loadFactor <= 0.0)) {
+ throw new IllegalArgumentException();
+ }
+ this.loadFactor = loadFactor;
+ table = new IdentityHashtableEntry[initialCapacity];
+ threshold = (int)(initialCapacity * loadFactor);
+ }
+
+ /**
+ * Constructs a new, empty hashtable with the specified initial capacity
+ * and default load factor.
+ *
+ * @param initialCapacity the initial capacity of the hashtable.
+ * @since JDK1.0
+ */
+ public IdentityHashtable(int initialCapacity) {
+ this(initialCapacity, 0.75f);
+ }
+
+ /**
+ * Constructs a new, empty hashtable with a default capacity and load
+ * factor.
+ *
+ * @since JDK1.0
+ */
+ public IdentityHashtable() {
+ this(101, 0.75f);
+ }
+
+ /**
+ * Returns the number of keys in this hashtable.
+ *
+ * @return the number of keys in this hashtable.
+ * @since JDK1.0
+ */
+ public int size() {
+ return count;
+ }
+
+ /**
+ * Tests if this hashtable maps no keys to values.
+ *
+ * @return <code>true</code> if this hashtable maps no keys to values;
+ * <code>false</code> otherwise.
+ * @since JDK1.0
+ */
+ public boolean isEmpty() {
+ return count == 0;
+ }
+
+ /**
+ * Returns an enumeration of the keys in this hashtable.
+ *
+ * @return an enumeration of the keys in this hashtable.
+ * @see java.util.Enumeration
+ * @see java.util.Hashtable#elements()
+ * @since JDK1.0
+ */
+ public Enumeration keys() {
+ return new IdentityHashtableEnumerator(table, true);
+ }
+
+ /**
+ * Returns an enumeration of the values in this hashtable.
+ * Use the Enumeration methods on the returned object to fetch the elements
+ * sequentially.
+ *
+ * @return an enumeration of the values in this hashtable.
+ * @see java.util.Enumeration
+ * @see java.util.Hashtable#keys()
+ * @since JDK1.0
+ */
+ public Enumeration elements() {
+ return new IdentityHashtableEnumerator(table, false);
+ }
+
+ /**
+ * Tests if some key maps into the specified value in this hashtable.
+ * This operation is more expensive than the <code>containsKey</code>
+ * method.
+ *
+ * @param value a value to search for.
+ * @return <code>true</code> if some key maps to the
+ * <code>value</code> argument in this hashtable;
+ * <code>false</code> otherwise.
+ * @exception NullPointerException if the value is <code>null</code>.
+ * @see java.util.Hashtable#containsKey(java.lang.Object)
+ * @since JDK1.0
+ */
+ public boolean contains(Object value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ IdentityHashtableEntry tab[] = table;
+ for (int i = tab.length ; i-- > 0 ;) {
+ for (IdentityHashtableEntry e = tab[i] ; e != null ; e = e.next) {
+ if (e.value == value) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Tests if the specified object is a key in this hashtable.
+ *
+ * @param key possible key.
+ * @return <code>true</code> if the specified object is a key in this
+ * hashtable; <code>false</code> otherwise.
+ * @see java.util.Hashtable#contains(java.lang.Object)
+ * @since JDK1.0
+ */
+ public boolean containsKey(Object key) {
+ IdentityHashtableEntry tab[] = table;
+ int hash = System.identityHashCode(key);
+ int index = (hash & 0x7FFFFFFF) % tab.length;
+ for (IdentityHashtableEntry e = tab[index] ; e != null ; e = e.next) {
+ if ((e.hash == hash) && e.key == key) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Returns the value to which the specified key is mapped in this hashtable.
+ *
+ * @param key a key in the hashtable.
+ * @return the value to which the key is mapped in this hashtable;
+ * <code>null</code> if the key is not mapped to any value in
+ * this hashtable.
+ * @see java.util.Hashtable#put(java.lang.Object, java.lang.Object)
+ * @since JDK1.0
+ */
+ public Object get(Object key) {
+ IdentityHashtableEntry tab[] = table;
+ int hash = System.identityHashCode(key);
+ int index = (hash & 0x7FFFFFFF) % tab.length;
+ for (IdentityHashtableEntry e = tab[index] ; e != null ; e = e.next) {
+ if ((e.hash == hash) && e.key == key) {
+ return e.value;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Rehashes the contents of the hashtable into a hashtable with a
+ * larger capacity. This method is called automatically when the
+ * number of keys in the hashtable exceeds this hashtable's capacity
+ * and load factor.
+ *
+ * @since JDK1.0
+ */
+ protected void rehash() {
+ int oldCapacity = table.length;
+ IdentityHashtableEntry oldTable[] = table;
+
+ int newCapacity = oldCapacity * 2 + 1;
+ IdentityHashtableEntry newTable[] = new IdentityHashtableEntry[newCapacity];
+
+ threshold = (int)(newCapacity * loadFactor);
+ table = newTable;
+
+ //System.out.println("rehash old=" + oldCapacity + ", new=" + newCapacity + ", thresh=" + threshold + ", count=" + count);
+
+ for (int i = oldCapacity ; i-- > 0 ;) {
+ for (IdentityHashtableEntry old = oldTable[i] ; old != null ; ) {
+ IdentityHashtableEntry e = old;
+ old = old.next;
+
+ int index = (e.hash & 0x7FFFFFFF) % newCapacity;
+ e.next = newTable[index];
+ newTable[index] = e;
+ }
+ }
+ }
+
+ /**
+ * Maps the specified <code>key</code> to the specified
+ * <code>value</code> in this hashtable. Neither the key nor the
+ * value can be <code>null</code>.
+ * <p>
+ * The value can be retrieved by calling the <code>get</code> method
+ * with a key that is equal to the original key.
+ *
+ * @param key the hashtable key.
+ * @param value the value.
+ * @return the previous value of the specified key in this hashtable,
+ * or <code>null</code> if it did not have one.
+ * @exception NullPointerException if the key or value is
+ * <code>null</code>.
+ * @see java.util.Hashtable#get(java.lang.Object)
+ * @since JDK1.0
+ */
+ public Object put(Object key, Object value) {
+ // Make sure the value is not null
+ if (value == null) {
+ throw new NullPointerException();
+ }
+
+ // Makes sure the key is not already in the hashtable.
+ IdentityHashtableEntry tab[] = table;
+ int hash = System.identityHashCode(key);
+ int index = (hash & 0x7FFFFFFF) % tab.length;
+ for (IdentityHashtableEntry e = tab[index] ; e != null ; e = e.next) {
+ if ((e.hash == hash) && e.key == key) {
+ Object old = e.value;
+ e.value = value;
+ return old;
+ }
+ }
+
+ if (count >= threshold) {
+ // Rehash the table if the threshold is exceeded
+ rehash();
+ return put(key, value);
+ }
+
+ // Creates the new entry.
+ IdentityHashtableEntry e = new IdentityHashtableEntry();
+ e.hash = hash;
+ e.key = key;
+ e.value = value;
+ e.next = tab[index];
+ tab[index] = e;
+ count++;
+ return null;
+ }
+
+ /**
+ * Removes the key (and its corresponding value) from this
+ * hashtable. This method does nothing if the key is not in the hashtable.
+ *
+ * @param key the key that needs to be removed.
+ * @return the value to which the key had been mapped in this hashtable,
+ * or <code>null</code> if the key did not have a mapping.
+ * @since JDK1.0
+ */
+ public Object remove(Object key) {
+ IdentityHashtableEntry tab[] = table;
+ int hash = System.identityHashCode(key);
+ int index = (hash & 0x7FFFFFFF) % tab.length;
+ for (IdentityHashtableEntry e = tab[index], prev = null ; e != null ; prev = e, e = e.next) {
+ if ((e.hash == hash) && e.key == key) {
+ if (prev != null) {
+ prev.next = e.next;
+ } else {
+ tab[index] = e.next;
+ }
+ count--;
+ return e.value;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Clears this hashtable so that it contains no keys.
+ *
+ * @since JDK1.0
+ */
+ public void clear() {
+ IdentityHashtableEntry tab[] = table;
+ for (int index = tab.length; --index >= 0; )
+ tab[index] = null;
+ count = 0;
+ }
+
+ /**
+ * Returns a rather long string representation of this hashtable.
+ *
+ * @return a string representation of this hashtable.
+ * @since JDK1.0
+ */
+ public String toString() {
+ int max = size() - 1;
+ StringBuffer buf = new StringBuffer();
+ Enumeration k = keys();
+ Enumeration e = elements();
+ buf.append("{");
+
+ for (int i = 0; i <= max; i++) {
+ String s1 = k.nextElement().toString();
+ String s2 = e.nextElement().toString();
+ buf.append(s1 + "=" + s2);
+ if (i < max) {
+ buf.append(", ");
+ }
+ }
+ buf.append("}");
+ return buf.toString();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtableEntry.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtableEntry.java
new file mode 100644
index 0000000..cb4198d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtableEntry.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.util;
+
+/**
+ * IdentityHashtable collision list.
+ */
+class IdentityHashtableEntry {
+ int hash;
+ Object key;
+ Object value;
+ IdentityHashtableEntry next;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtableEnumerator.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtableEnumerator.java
new file mode 100644
index 0000000..7b5c987
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/IdentityHashtableEnumerator.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.util;
+
+import java.util.Dictionary;
+import java.util.Enumeration;
+import java.util.NoSuchElementException;
+
+/**
+ * A hashtable enumerator class. This class should remain opaque
+ * to the client. It will use the Enumeration interface.
+ */
+class IdentityHashtableEnumerator implements Enumeration {
+ boolean keys;
+ int index;
+ IdentityHashtableEntry table[];
+ IdentityHashtableEntry entry;
+
+ IdentityHashtableEnumerator(IdentityHashtableEntry table[], boolean keys) {
+ this.table = table;
+ this.keys = keys;
+ this.index = table.length;
+ }
+
+ public boolean hasMoreElements() {
+ if (entry != null) {
+ return true;
+ }
+ while (index-- > 0) {
+ if ((entry = table[index]) != null) {
+ return true;
+ }
+ }
+ return false;
+}
+
+public Object nextElement() {
+ if (entry == null) {
+ while ((index-- > 0) && ((entry = table[index]) == null));
+ }
+ if (entry != null) {
+ IdentityHashtableEntry e = entry;
+ entry = e.next;
+ return keys ? e.key : e.value;
+ }
+ throw new NoSuchElementException("IdentityHashtableEnumerator");
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/JDKBridge.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/JDKBridge.java
new file mode 100644
index 0000000..9088f79
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/JDKBridge.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 1995, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.util;
+
+import java.rmi.Remote;
+import java.rmi.NoSuchObjectException;
+import java.rmi.server.RMIClassLoader;
+import java.rmi.server.UnicastRemoteObject;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.CompletionStatus;
+import java.util.Properties;
+import java.io.File;
+import java.io.FileInputStream;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.net.MalformedURLException;
+import com.sun.corba.se.impl.orbutil.GetPropertyAction;
+
+/**
+ * Utility methods for doing various method calls which are used
+ * by multiple classes
+ */
+public class JDKBridge {
+
+ /**
+ * Get local codebase System property (java.rmi.server.codebase).
+ * May be null or a space separated array of URLS.
+ */
+ public static String getLocalCodebase () {
+ return localCodebase;
+ }
+
+ /**
+ * Return true if the system property "java.rmi.server.useCodebaseOnly"
+ * is set, false otherwise.
+ */
+ public static boolean useCodebaseOnly () {
+ return useCodebaseOnly;
+ }
+
+ /**
+ * 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.
+ * @return the <code>Class</code> object representing the loaded class.
+ * @exception throws ClassNotFoundException if class cannot be loaded.
+ */
+ public static Class loadClass (String className,
+ String remoteCodebase,
+ ClassLoader loader)
+ throws ClassNotFoundException {
+
+ if (loader == null) {
+ return loadClassM(className,remoteCodebase,useCodebaseOnly);
+ } else {
+ try {
+ return loadClassM(className,remoteCodebase,useCodebaseOnly);
+ } catch (ClassNotFoundException e) {
+ return loader.loadClass(className);
+ }
+ }
+ }
+
+ /**
+ * 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.
+ * @return the <code>Class</code> object representing the loaded class.
+ * @exception throws ClassNotFoundException if class cannot be loaded.
+ */
+ public static Class loadClass (String className,
+ String remoteCodebase)
+ throws ClassNotFoundException {
+ return loadClass(className,remoteCodebase,null);
+ }
+
+ /**
+ * Returns a class instance for the specified class.
+ * @param className the name of the class
+ * @return the <code>Class</code> object representing the loaded class.
+ * @exception throws ClassNotFoundException if class cannot be loaded.
+ */
+ public static Class loadClass (String className)
+ throws ClassNotFoundException {
+ return loadClass(className,null,null);
+ }
+
+ private static final String LOCAL_CODEBASE_KEY = "java.rmi.server.codebase";
+ private static final String USE_CODEBASE_ONLY_KEY = "java.rmi.server.useCodebaseOnly";
+ private static String localCodebase = null;
+ private static boolean useCodebaseOnly;
+
+ static {
+ setCodebaseProperties();
+ }
+
+ public static final void main (String[] args) {
+ System.out.println("1.2 VM");
+
+ /*
+ // If on 1.2, use a policy with all permissions.
+ System.setSecurityManager (new javax.rmi.download.SecurityManager());
+ String targetClass = "[[Lrmic.Typedef;";
+ System.out.println("localCodebase = "+localCodebase);
+ System.out.println("Trying to load "+targetClass);
+ try {
+ Class clz = loadClass(targetClass,null,localCodebase);
+ System.out.println("Loaded: "+clz);
+ } catch (ClassNotFoundException e) {
+ System.out.println("Caught "+e);
+ }
+ */
+ }
+
+ /**
+ * 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)
+ );
+ if (prop != null && prop.trim().length() > 0) {
+ localCodebase = prop;
+ }
+
+ prop = (String)AccessController.doPrivileged(
+ new GetPropertyAction(USE_CODEBASE_ONLY_KEY)
+ );
+ if (prop != null && prop.trim().length() > 0) {
+ useCodebaseOnly = Boolean.valueOf(prop).booleanValue();
+ }
+ }
+
+ /**
+ * Set the default code base. This method is here only
+ * for test code.
+ */
+ public static synchronized void setLocalCodebase(String codebase) {
+ localCodebase = codebase;
+ }
+
+ private static Class loadClassM (String className,
+ String remoteCodebase,
+ boolean useCodebaseOnly)
+ throws ClassNotFoundException {
+
+ try {
+ return JDKClassLoader.loadClass(null,className);
+ } catch (ClassNotFoundException e) {}
+ try {
+ if (!useCodebaseOnly && remoteCodebase != null) {
+ return RMIClassLoader.loadClass(remoteCodebase,
+ className);
+ } else {
+ return RMIClassLoader.loadClass(className);
+ }
+ } catch (MalformedURLException e) {
+ className = className + ": " + e.toString();
+ }
+
+ throw new ClassNotFoundException(className);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/JDKClassLoader.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/JDKClassLoader.java
new file mode 100644
index 0000000..2ba7896
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/JDKClassLoader.java
@@ -0,0 +1,192 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.util;
+
+import sun.corba.Bridge ;
+
+import java.util.Map ;
+import java.util.WeakHashMap ;
+import java.util.Collections ;
+
+import java.security.AccessController ;
+import java.security.PrivilegedAction ;
+
+/**
+ * Utility method for crawling call stack to load class
+ */
+class JDKClassLoader {
+
+ private static final JDKClassLoaderCache classCache
+ = new JDKClassLoaderCache();
+
+ 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 {
+
+ // Maintain the same error semantics as Class.forName()
+ if (className == null) {
+ throw new NullPointerException();
+ }
+ if (className.length() == 0) {
+ throw new ClassNotFoundException();
+ }
+
+ // It would be nice to bypass JDKClassLoader's attempts completely
+ // if it's known that the latest user defined ClassLoader will
+ // 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
+ // on the length of the classpath.
+
+ // Note: Looking at the only place in JDKBridge where this code
+ // is invoked, it is clear that aClass will always be null.
+ ClassLoader loader;
+ if (aClass != null) {
+ loader = aClass.getClassLoader();
+ } else {
+ loader = bridge.getLatestUserDefinedLoader();
+ }
+ // See createKey for a description of what's involved
+ Object key = classCache.createKey(className, loader);
+
+ if (classCache.knownToFail(key)) {
+ throw new ClassNotFoundException(className);
+ } else {
+ try {
+ // Loading this class with the call stack
+ // loader isn't known to fail, so try
+ // to load it.
+ return Class.forName(className, false, loader);
+ } catch(ClassNotFoundException cnfe) {
+ // Record that we failed to find the class
+ // 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
+ {
+ // JDKClassLoader couldn't find the class with the located
+ // 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);
+ }
+
+ // Factory for a key (CacheKey is an implementation detail
+ // of JDKClassLoaderCache).
+ //
+ // 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) {
+ return new CacheKey(className, latestLoader);
+ }
+
+ // Determine whether or not this combination of class name
+ // and ClassLoader is known to fail.
+ public final boolean knownToFail(Object key) {
+ return cache.get(key) == JDKClassLoaderCache.KNOWN_TO_FAIL;
+ }
+
+ // Synchronized 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
+ // key
+ private static final Object KNOWN_TO_FAIL = new Object();
+
+ // Key consisting of the class name and the latest
+ // user defined class loader
+ private static class CacheKey
+ {
+ String className;
+ ClassLoader loader;
+
+ public CacheKey(String className, ClassLoader loader) {
+ this.className = className;
+ this.loader = loader;
+ }
+
+ // Try to incorporate both class name and loader
+ // into the hashcode
+ public int hashCode() {
+ if (loader == null)
+ return className.hashCode();
+ else
+ return className.hashCode() ^ loader.hashCode();
+ }
+
+ public boolean equals(Object obj) {
+ try {
+
+ // WeakHashMap may compare null keys
+ if (obj == null)
+ return false;
+
+ CacheKey other = (CacheKey)obj;
+
+ // I've made a decision to actually compare the
+ // 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);
+
+ } catch (ClassCastException cce) {
+ return false;
+ }
+ }
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/ORBProperties.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/ORBProperties.java
new file mode 100644
index 0000000..dd74851
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/ORBProperties.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.util;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.PrintWriter;
+
+public class ORBProperties {
+
+ public static final String ORB_CLASS =
+ "org.omg.CORBA.ORBClass=com.sun.corba.se.impl.orb.ORBImpl";
+ public static final String ORB_SINGLETON_CLASS =
+ "org.omg.CORBA.ORBSingletonClass=com.sun.corba.se.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");
+
+ if (propFile.exists())
+ return;
+
+ // Write properties to orb.properties
+ FileOutputStream out = new FileOutputStream(propFile);
+ PrintWriter pw = new PrintWriter(out);
+
+ try {
+ pw.println(ORB_CLASS);
+ pw.println(ORB_SINGLETON_CLASS);
+ } finally {
+ pw.close();
+ out.close();
+ }
+
+ } catch (Exception ex) { }
+
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/PackagePrefixChecker.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/PackagePrefixChecker.java
new file mode 100644
index 0000000..7c78731
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/PackagePrefixChecker.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.impl.util;
+
+import java.io.File;
+
+/**
+ * PackagePrefixChecker provides static utility methods for getting package prefixes.
+ * @author M. Mortazavi
+ */
+
+public final class PackagePrefixChecker {
+
+
+ private static final String PACKAGE_PREFIX = "org.omg.stub.";
+
+ public static String packagePrefix(){ return PACKAGE_PREFIX;}
+
+ public static String correctPackageName (String p){
+ if (p==null) return p;
+ if ( hasOffendingPrefix(p))
+ {
+ return PACKAGE_PREFIX+p;
+ }
+ return p;
+ }
+
+ public static boolean isOffendingPackage(String p){
+ return
+ !(p==null)
+ &&
+ ( false || hasOffendingPrefix(p) );
+ }
+
+ public static boolean hasOffendingPrefix(String p){
+ return
+ ( p.startsWith("java.") || p.equals("java")
+ // || p.startsWith("com.sun.") || p.equals("com.sun")
+ || p.startsWith("net.jini.") || p.equals("net.jini")
+ || p.startsWith("jini.") || p.equals("jini")
+ || p.startsWith("javax.") || p.equals("javax")
+ );
+ }
+
+ public static boolean hasBeenPrefixed(String p){
+ return p.startsWith(packagePrefix());
+ }
+
+ public static String withoutPackagePrefix(String p){
+ if(hasBeenPrefixed(p)) return p.substring(packagePrefix().length());
+ else return p;
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/RepositoryId.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/RepositoryId.java
new file mode 100644
index 0000000..6bedab3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/RepositoryId.java
@@ -0,0 +1,993 @@
+/*
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.util;
+
+import java.util.StringTokenizer;
+import java.util.Hashtable;
+import java.io.IOException;
+import java.lang.reflect.Method;
+
+// Imports for using codebase URL to load class
+import java.net.MalformedURLException;
+import org.omg.CORBA.portable.ValueBase;
+import org.omg.CORBA.portable.IDLEntity;
+
+//d11638 files in the same package, therefore remove their reference
+//import com.sun.corba.se.impl.util.JDKBridge;
+//import com.sun.corba.se.impl.util.IdentityHashtable;
+import com.sun.corba.se.impl.io.ObjectStreamClass;
+
+import javax.rmi.CORBA.Util;
+
+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
+ // qualified Java name with '.' package separators
+ // uniformly, and is safe because that is the only
+ // legal use of '.' in a Java name.
+
+ private 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
+ };
+
+
+ private static final long serialVersionUID = 123456789L;
+
+ private static String defaultServerURL = null;
+ private static boolean useCodebaseOnly = false;
+
+ static {
+ if (defaultServerURL == null)
+ defaultServerURL = (String)JDKBridge.getLocalCodebase();
+ useCodebaseOnly = JDKBridge.useCodebaseOnly();
+
+ }
+
+ private static IdentityHashtable classToRepStr = new IdentityHashtable();
+ private static IdentityHashtable classIDLToRepStr = new IdentityHashtable();
+ private static IdentityHashtable classSeqToRepStr = new IdentityHashtable();
+
+ private static final IdentityHashtable repStrToByteArray = new IdentityHashtable();
+ private static Hashtable repStrToClass = new Hashtable();
+
+ private String repId = null;
+ private boolean isSupportedFormat = true;
+ private String typeString = null;
+ private String versionString = null;
+ private boolean isSequence = false;
+ private boolean isRMIValueType = false;
+ private boolean isIDLType = false;
+ private String completeClassName = null;
+ private String unqualifiedName = null;
+ private String definedInId = null;
+ private Class clazz = null;
+ private String suid = null, actualSuid = null;
+ private long suidLong = ObjectStreamClass.kDefaultUID, actualSuidLong = ObjectStreamClass.kDefaultUID;
+
+ // Repository ID fragments
+ private static final String kSequenceKeyword = "seq";
+ private static final String kValuePrefix = "RMI:";
+ private static final String kIDLPrefix = "IDL:";
+ private static final String kIDLNamePrefix = "omg.org/";
+ 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 int kValuePrefixLength = kValuePrefix.length();
+ private static final int kIDLPrefixLength = kIDLPrefix.length();
+ private static final int kSequencePrefixLength = kSequencePrefix.length();
+ private static final String kInterfaceHashCode = ":0000000000000000";
+ private static final String kInterfaceOnlyHashStr = "0000000000000000";
+ private static final String kExternalizableHashStr = "0000000000000001";
+
+ // Value tag utility methods and constants
+ 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, well known repository IDs
+
+ // _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 kWStringStubValue = "WStringValue";
+ 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
+ // Anita4: convert to uppercase
+ 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;
+
+ // Object
+ public static final String kObjectValueHash = ":1.0";
+ public static final String kObjectStubValue = "Object";
+
+ // Sequence
+ public static final String kSequenceValueHash = ":1.0";
+ public static final String kPrimitiveSequenceValueHash = ":0000000000000000";
+
+ // Serializable
+ public static final String kSerializableValueHash = ":1.0";
+ public static final String kSerializableStubValue = "Serializable";
+
+ // Externalizable
+ public static final String kExternalizableValueHash = ":1.0";
+ public static final String kExternalizableStubValue = "Externalizable";
+
+ // Remote (The empty string is used for java.rmi.Remote)
+ public static final String kRemoteValueHash = "";
+ public static final String kRemoteStubValue = "";
+ public static final String kRemoteTypeStr = "";
+ public static final String kRemoteValueRepID = "";
+
+ private static final Hashtable kSpecialArrayTypeStrings = new Hashtable();
+
+ static {
+ kSpecialArrayTypeStrings.put("CORBA.WStringValue", new StringBuffer(java.lang.String.class.getName()));
+ kSpecialArrayTypeStrings.put("javax.rmi.CORBA.ClassDesc", new StringBuffer(java.lang.Class.class.getName()));
+ kSpecialArrayTypeStrings.put("CORBA.Object", new StringBuffer(java.rmi.Remote.class.getName()));
+
+ }
+
+ private static final Hashtable kSpecialCasesRepIDs = new Hashtable();
+
+ static {
+ kSpecialCasesRepIDs.put(java.lang.String.class, kWStringValueRepID);
+ kSpecialCasesRepIDs.put(java.lang.Class.class, kClassDescValueRepID);
+ kSpecialCasesRepIDs.put(java.rmi.Remote.class, kRemoteValueRepID);
+ }
+
+ private static final Hashtable kSpecialCasesStubValues = new Hashtable();
+
+ static {
+ kSpecialCasesStubValues.put(java.lang.String.class, kWStringStubValue);
+ kSpecialCasesStubValues.put(java.lang.Class.class, kClassDescStubValue);
+ kSpecialCasesStubValues.put(java.lang.Object.class, kObjectStubValue);
+ kSpecialCasesStubValues.put(java.io.Serializable.class, kSerializableStubValue);
+ kSpecialCasesStubValues.put(java.io.Externalizable.class, kExternalizableStubValue);
+ kSpecialCasesStubValues.put(java.rmi.Remote.class, kRemoteStubValue);
+ }
+
+
+ private static final Hashtable kSpecialCasesVersions = new Hashtable();
+
+ static {
+ kSpecialCasesVersions.put(java.lang.String.class, kWStringValueHash);
+ kSpecialCasesVersions.put(java.lang.Class.class, kClassDescValueHash);
+ kSpecialCasesVersions.put(java.lang.Object.class, kObjectValueHash);
+ kSpecialCasesVersions.put(java.io.Serializable.class, kSerializableValueHash);
+ kSpecialCasesVersions.put(java.io.Externalizable.class, kExternalizableValueHash);
+ kSpecialCasesVersions.put(java.rmi.Remote.class, kRemoteValueHash);
+ }
+
+ private static final Hashtable kSpecialCasesClasses = new Hashtable();
+
+ static {
+ kSpecialCasesClasses.put(kWStringTypeStr, java.lang.String.class);
+ kSpecialCasesClasses.put(kClassDescTypeStr, java.lang.Class.class);
+ kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class);
+
+ kSpecialCasesClasses.put("org.omg.CORBA.WStringValue", java.lang.String.class);
+ kSpecialCasesClasses.put("javax.rmi.CORBA.ClassDesc", java.lang.Class.class);
+ //kSpecialCasesClasses.put(kRemoteTypeStr, java.rmi.Remote.class);
+ }
+
+ private static final Hashtable 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);
+ }
+
+ private static final Hashtable kSpecialPrimitives = new Hashtable();
+
+ static {
+ 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',
+ };
+
+
+ // bug fix for 4328952; to eliminate possibility of overriding this
+ // in a subclass.
+ public static final RepositoryIdCache cache = new RepositoryIdCache();
+
+ // Interface Rep ID Strings
+ public static final String kjava_rmi_Remote = createForAnyType(java.rmi.Remote.class);
+ public static final String korg_omg_CORBA_Object = createForAnyType(org.omg.CORBA.Object.class);
+
+ // Dummy arguments for getIdFromHelper method
+ public static final Class kNoParamTypes[] ={};
+ public static final Object kNoArgs[] = {};
+
+
+ // To create a RepositoryID, use code similar to the following:
+ // RepositoryId.cache.getId( id );
+
+ 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;
+ typeString = "";
+ isRMIValueType = true;
+ suid = kInterfaceOnlyHashStr;
+ return this;
+ } else if (aRepId.equals(kWStringValueRepID)) {
+ 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.
+ completeClassName = "java.lang.String";
+ versionString = kWStringValueVersion;
+ return this;
+ } else {
+ String repId = convertFromISOLatin1(aRepId);
+
+ int firstIndex = repId.indexOf(':') ;
+ if (firstIndex == -1)
+ throw new IllegalArgumentException( "RepsitoryId must have the form <type>:<body>" ) ;
+ int secondIndex = repId.indexOf( ':', firstIndex + 1 ) ;
+
+ if (secondIndex == -1)
+ versionString = "" ;
+ else
+ versionString = repId.substring(secondIndex) ;
+
+ if (repId.startsWith(kIDLPrefix)) {
+ typeString =
+ repId.substring(kIDLPrefixLength, repId.indexOf(':', kIDLPrefixLength));
+ isIDLType = true;
+
+ if (typeString.startsWith(kIDLNamePrefix))
+ completeClassName = kIDLClassnamePrefix +
+ typeString.substring(kIDLNamePrefix.length()).replace('/','.');
+ else
+ completeClassName = typeString.replace('/','.');
+
+ } else if (repId.startsWith(kValuePrefix)) {
+ 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;
+ // actualSuid = suid.substring(pos);
+ // suid = suid.substring(0, pos-1);
+ suid = actualSuid.substring(pos);
+ actualSuid = actualSuid.substring(0, pos-1);
+ }
+ } else {
+ // _REVISIT_ : Special case version failure ?
+ }
+ } else {
+ isSupportedFormat = false;
+ typeString = "" ;
+ }
+
+ if (typeString.startsWith(kSequencePrefix)) {
+ isSequence = true;
+ }
+
+ return this;
+ }
+ }
+
+ public final String getUnqualifiedName() {
+ if (unqualifiedName == null){
+ String className = getClassName();
+ int index = className.lastIndexOf('.');
+ if (index == -1){
+ unqualifiedName = className;
+ definedInId = "IDL::1.0";
+ }
+ else {
+ unqualifiedName = className.substring(index);
+ definedInId = "IDL:" + className.substring(0, index).replace('.','/') + ":1.0";
+ }
+ }
+
+ return unqualifiedName;
+ }
+
+ public final String getDefinedInId() {
+ if (definedInId == null){
+ getUnqualifiedName();
+ }
+
+ return definedInId;
+ }
+
+ public final String getTypeString() {
+ return typeString;
+ }
+
+ public final String getVersionString() {
+ return versionString;
+ }
+
+ public final String getSerialVersionUID() {
+ return suid;
+ }
+
+ public final String getActualSerialVersionUID() {
+ return actualSuid;
+ }
+ public final long getSerialVersionUIDAsLong() {
+ return suidLong;
+ }
+
+ public final long getActualSerialVersionUIDAsLong() {
+ return actualSuidLong;
+ }
+
+ public final boolean isRMIValueType() {
+ return isRMIValueType;
+ }
+
+ public final boolean isIDLType() {
+ return isIDLType;
+ }
+
+ public final String getRepositoryId() {
+ return repId;
+ }
+
+ public static byte[] getByteArray(String repStr) {
+ synchronized (repStrToByteArray){
+ return (byte[]) repStrToByteArray.get(repStr);
+ }
+ }
+
+ public static void setByteArray(String repStr, byte[] repStrBytes) {
+ synchronized (repStrToByteArray){
+ repStrToByteArray.put(repStr, repStrBytes);
+ }
+ }
+
+ public final boolean isSequence() {
+ return isSequence;
+ }
+
+ 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, then the matching real classname is returned.
+ public final String getClassName() {
+
+ if (isRMIValueType)
+ return typeString;
+ else if (isIDLType)
+ return completeClassName;
+ 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
+ // given repid is an acceptable result.
+ public final Class getAnyClassFromType() throws ClassNotFoundException {
+ try {
+ return getClassFromType();
+ } catch (ClassNotFoundException cnfe) {
+ Class clz = (Class)repStrToClass.get(repId);
+ if (clz != null)
+ return clz;
+ else
+ throw cnfe;
+ }
+ }
+
+ public final Class getClassFromType()
+ throws ClassNotFoundException {
+ if (clazz != null)
+ return clazz;
+
+ Class specialCase = (Class)kSpecialCasesClasses.get(getClassName());
+
+ if (specialCase != null){
+ clazz = specialCase;
+ return specialCase;
+ }
+ else
+ {
+ try{
+ return Util.loadClass(getClassName(), null, null);
+ }
+ catch(ClassNotFoundException cnfe){
+ if (defaultServerURL != null) {
+ try{
+ return getClassFromType(defaultServerURL);
+ }
+ catch(MalformedURLException mue){
+ throw cnfe;
+ }
+ }
+ else throw cnfe;
+ }
+ }
+
+ }
+
+ public final Class getClassFromType(Class expectedType, String codebase)
+ throws ClassNotFoundException {
+ if (clazz != null)
+ return clazz;
+
+ 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);
+ }
+
+ }
+
+ public final Class getClassFromType(String url)
+ throws ClassNotFoundException, MalformedURLException {
+ return Util.loadClass(getClassName(), url, null);
+ }
+
+ public final String toString() {
+ return repId;
+ }
+
+ /**
+ * Checks to see if the FullValueDescription should be retrieved.
+ * @exception 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{
+
+ String clazzRepIDStr = createForAnyType(clazz);
+
+ if (clazzRepIDStr.equals(repositoryID))
+ return false;
+
+ RepositoryId targetRepid;
+ RepositoryId clazzRepid;
+
+ 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
+
+ targetRepid = cache.getId(repositoryID);
+ clazzRepid = cache.getId(clazzRepIDStr);
+ }
+ //ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);
+
+ 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();
+ //com.sun.corba.se.impl.io.ValueUtility.log("RepositoryId",mssg);
+ 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 +")");
+ }
+ }
+
+ private static String createHashString(java.io.Serializable ser) {
+
+ return createHashString(ser.getClass());
+ }
+
+ private static String createHashString(java.lang.Class clazz) {
+
+ if (clazz.isInterface() || !java.io.Serializable.class.isAssignableFrom(clazz))
+ return kInterfaceHashCode;
+
+ //ObjectStreamClass osc = ObjectStreamClass.lookup(clazz);
+
+ long actualLong = ObjectStreamClass.getActualSerialVersionUID(clazz);
+ String hash = null;
+ if (actualLong == 0)
+ hash = kInterfaceOnlyHashStr;
+ else if (actualLong == 1)
+ hash = kExternalizableHashStr;
+ else
+ hash = Long.toHexString(actualLong).toUpperCase();
+ while(hash.length() < 16){
+ hash = "0" + hash;
+ }
+
+ long declaredLong = ObjectStreamClass.getSerialVersionUID(clazz);
+ String declared = null;
+ if (declaredLong == 0)
+ declared = kInterfaceOnlyHashStr;
+ else if (declaredLong == 1)
+ declared = kExternalizableHashStr;
+ else
+ declared = Long.toHexString(declaredLong).toUpperCase();
+ while (declared.length() < 16){
+ declared = "0" + declared;
+ }
+ hash = hash + ":" + declared;
+
+ return ":" + hash;
+ }
+
+ /**
+ * 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
+ **/
+ 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.
+ * @param clazz The Java class to create a repository ID for
+ **/
+ public static String createSequenceRepID(java.lang.Class clazz){
+ synchronized (classSeqToRepStr){
+
+ String repid = (String)classSeqToRepStr.get(clazz);
+ if (repid != null)
+ return repid;
+
+ Class originalClazz = clazz;
+
+ Class type = null;
+ int numOfDims = 0;
+
+ while ((type = clazz.getComponentType()) != null) {
+ numOfDims++;
+ clazz = type;
+ }
+
+ if (clazz.isPrimitive())
+ repid = kValuePrefix + originalClazz.getName() + kPrimitiveSequenceValueHash;
+ else {
+ StringBuffer buf = new StringBuffer();
+ buf.append(kValuePrefix);
+ while(numOfDims-- > 0) {
+ buf.append("[");
+ }
+ buf.append("L");
+ buf.append(convertToISOLatin1(clazz.getName()));
+ buf.append(";");
+ buf.append(createHashString(clazz));
+ repid = buf.toString();
+ }
+ classSeqToRepStr.put(originalClazz,repid);
+ return repid;
+ }
+
+ }
+
+
+ public static String createForSpecialCase(java.lang.Class clazz){
+ if (clazz.isArray()){
+ return createSequenceRepID(clazz);
+ }
+ else {
+ return (String)kSpecialCasesRepIDs.get(clazz);
+ }
+ }
+
+ public static String createForSpecialCase(java.io.Serializable ser){
+ Class clazz = ser.getClass();
+ if (clazz.isArray()){
+ return createSequenceRepID(ser);
+ }
+ else
+ return createForSpecialCase(clazz);
+ }
+
+ /**
+ * Creates a repository ID for a normal Java Type.
+ * @param ser The Java object to create a repository ID for
+ * @exception com.sun.corba.se.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.se.impl.io.TypeMismatchException
+ {
+ synchronized (classToRepStr) {
+ String repid = createForSpecialCase(ser);
+ if (repid != null)
+ return repid;
+ Class clazz = ser.getClass();
+ repid = (String)classToRepStr.get(clazz);
+
+ if (repid != null)
+ return repid;
+
+ repid = kValuePrefix + convertToISOLatin1(clazz.getName()) +
+ createHashString(clazz);
+
+ classToRepStr.put(clazz, repid);
+ repStrToClass.put(repid, clazz);
+ return repid;
+ }
+ }
+
+ /**
+ * Creates a repository ID for a normal Java Type.
+ * @param clz The Java class to create a repository ID for
+ * @exception com.sun.corba.se.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)
+ throws com.sun.corba.se.impl.io.TypeMismatchException
+ {
+ synchronized (classToRepStr){
+ String repid = createForSpecialCase(clz);
+ if (repid != null)
+ return repid;
+
+ repid = (String)classToRepStr.get(clz);
+ if (repid != null)
+ return repid;
+
+ repid = kValuePrefix + convertToISOLatin1(clz.getName()) +
+ createHashString(clz);
+
+ classToRepStr.put(clz, repid);
+ repStrToClass.put(repid, clz);
+ return repid;
+ }
+ }
+
+ /**
+ * 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
+ * @exception com.sun.corba.se.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.se.impl.io.TypeMismatchException
+ {
+ synchronized (classIDLToRepStr){
+ String repid = (String)classIDLToRepStr.get(ser);
+ if (repid != null)
+ return repid;
+
+ repid = kIDLPrefix + convertToISOLatin1(ser.getName()).replace('.','/') +
+ ":" + major + "." + minor;
+ classIDLToRepStr.put(ser, repid);
+ return repid;
+ }
+ }
+
+ private static String getIdFromHelper(Class clazz){
+ try {
+ Class helperClazz = Utility.loadClassForClass(clazz.getName()+"Helper", null,
+ clazz.getClassLoader(), clazz, clazz.getClassLoader());
+ Method idMethod = helperClazz.getDeclaredMethod("id", kNoParamTypes);
+ return (String)idMethod.invoke(null, kNoArgs);
+ }
+ catch(java.lang.ClassNotFoundException cnfe)
+ {
+ throw new org.omg.CORBA.MARSHAL(cnfe.toString());
+ }
+ catch(java.lang.NoSuchMethodException nsme)
+ {
+ throw new org.omg.CORBA.MARSHAL(nsme.toString());
+ }
+ catch(java.lang.reflect.InvocationTargetException ite)
+ {
+ throw new org.omg.CORBA.MARSHAL(ite.toString());
+ }
+ catch(java.lang.IllegalAccessException iae)
+ {
+ throw new org.omg.CORBA.MARSHAL(iae.toString());
+ }
+ }
+
+ /**
+ * 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
+ * @return The rep. id.
+ **/
+ public static String createForAnyType(Class type) {
+ try{
+ if (type.isArray())
+ return createSequenceRepID(type);
+ else if (IDLEntity.class.isAssignableFrom(type))
+ {
+ try{
+ return getIdFromHelper(type);
+ }
+ catch(Throwable t) {
+ return createForIDLType(type, 1, 0);
+ }
+ }
+ else return createForJavaType(type);
+ }
+ catch(com.sun.corba.se.impl.io.TypeMismatchException e){
+ return null;
+ }
+
+ }
+
+ public static boolean isAbstractBase(Class clazz) {
+ return (clazz.isInterface() &&
+ IDLEntity.class.isAssignableFrom(clazz) &&
+ (!ValueBase.class.isAssignableFrom(clazz)) &&
+ (!org.omg.CORBA.Object.class.isAssignableFrom(clazz)));
+
+ }
+
+ public static boolean isAnyRequired(Class clazz) {
+ return ((clazz == java.lang.Object.class) ||
+ (clazz == java.io.Serializable.class) ||
+ (clazz == java.io.Externalizable.class));
+ }
+
+ public static long fromHex(String hexNumber) {
+ if (hexNumber.startsWith("0x"))
+ return Long.valueOf(hexNumber.substring(2), 16).longValue();
+ else return Long.valueOf(hexNumber, 16).longValue();
+ }
+
+ /**
+ * Convert strings with illegal IDL identifier characters.
+ * <p>
+ * Section 5.5.7 of OBV spec.
+ */
+ public static String convertToISOLatin1 (String name) {
+
+ int length = name.length();
+ if (length == 0) {
+ return name;
+ }
+ StringBuffer buffer = null;
+
+ for (int i = 0; i < length; i++) {
+
+ 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 StringBuffer(name.substring(0,i));
+ }
+
+ // Convert the character into the IDL escape syntax...
+ buffer.append(
+ "\\U" +
+ (char)ASCII_HEX[(c & 0xF000) >>> 12] +
+ (char)ASCII_HEX[(c & 0x0F00) >>> 8] +
+ (char)ASCII_HEX[(c & 0x00F0) >>> 4] +
+ (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.
+ * <p>
+ * Section 5.5.7 of OBV spec.
+ */
+ private static String convertFromISOLatin1 (String name) {
+
+ int index = -1;
+ StringBuffer buf = new StringBuffer(name);
+
+ 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 StringBuffer(delete(buf.toString(), index, index+6));
+ buf.insert(index, (char)buffer[1]);
+ }
+
+ 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 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 = new String(left+source+right);
+ i = target.indexOf(arg);
+ }
+ return target;
+ }
+
+ 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)
+ value_tag = value_tag | kChunkedMask;
+
+ return value_tag;
+ }
+
+ public static boolean isCodeBasePresent(int value_tag){
+ return ((value_tag & 0x00000001) == 1);
+ }
+
+ 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 String getServerURL(){
+ return defaultServerURL;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/RepositoryIdCache.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/RepositoryIdCache.java
new file mode 100644
index 0000000..17a82f6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/RepositoryIdCache.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.util;
+
+import java.util.Stack;
+import java.util.Hashtable;
+import java.util.EmptyStackException;
+import java.util.Enumeration;
+
+// Really limited pool - in this case just creating several at a time...
+class RepositoryIdPool extends Stack {
+
+ private static int MAX_CACHE_SIZE = 4;
+ private RepositoryIdCache cache;
+
+ public final synchronized RepositoryId popId() {
+
+ try {
+ return (RepositoryId)super.pop();
+ }
+ catch(EmptyStackException e) {
+ increasePool(5);
+ return (RepositoryId)super.pop();
+ }
+
+ }
+
+ // Pool management
+ final void increasePool(int size) {
+ //if (cache.size() <= MAX_CACHE_SIZE)
+ for (int i = size; i > 0; i--)
+ push(new RepositoryId());
+ /*
+ // _REVISIT_ This will not work w/out either thread tracing or weak references. I am
+ // betting that thread tracing almost completely negates benefit of reuse. Until either
+ // 1.2 only inclusion or proof to the contrary, I'll leave it this way...
+ else {
+ int numToReclaim = cache.size() / 2;
+ Enumeration keys = cache.keys();
+ Enumeration elements = cache.elements();
+ for (int i = numToReclaim; i > 0; i--) {
+ Object key = keys.nextElement();
+ Object element = elements.nextElement();
+
+ push(element);
+ cache.remove(key);
+ }
+ }
+ */
+ }
+
+ final void setCaches(RepositoryIdCache cache) {
+ this.cache = cache;
+ }
+
+}
+
+public class RepositoryIdCache extends Hashtable {
+
+ private RepositoryIdPool pool = new RepositoryIdPool();
+
+ public RepositoryIdCache() {
+ pool.setCaches(this);
+ }
+
+ public final synchronized RepositoryId getId(String key) {
+ RepositoryId repId = (RepositoryId)super.get(key);
+
+ if (repId != null)
+ return repId;
+ else {
+ //repId = pool.popId().init(key);
+ repId = new RepositoryId(key);
+ put(key, repId);
+ return repId;
+ }
+
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/SUNVMCID.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/SUNVMCID.java
new file mode 100644
index 0000000..93216a2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/SUNVMCID.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.impl.util;
+
+/**
+ * The vendor minor code ID reserved for Sun by the OMG.
+ * All VMCIDs occupy the high order 20 bits.
+ */
+
+public interface SUNVMCID {
+
+ /**
+ * The vendor minor code ID reserved for Sun. This value is or'd with
+ * the high order 20 bits of the minor code to produce the minor value
+ * in a system exception.
+ */
+ static final int value = 0x53550000;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/impl/util/Utility.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/Utility.java
new file mode 100644
index 0000000..d2327f8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/Utility.java
@@ -0,0 +1,1002 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.impl.util;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.BAD_INV_ORDER;
+import org.omg.CORBA.BAD_PARAM;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.BoxedValueHelper;
+import org.omg.CORBA.portable.ValueFactory;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.Delegate;
+
+
+import java.util.Hashtable;
+import java.util.NoSuchElementException;
+
+import java.rmi.Remote;
+import java.rmi.NoSuchObjectException;
+import java.rmi.RemoteException;
+import java.rmi.server.RemoteStub;
+
+import javax.rmi.PortableRemoteObject;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.Util;
+
+import java.io.Serializable;
+import java.io.File;
+import java.io.FileInputStream;
+
+import org.omg.PortableServer.POA;
+
+import com.sun.org.omg.SendingContext.CodeBase;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
+import com.sun.corba.se.spi.presentation.rmi.StubAdapter ;
+
+import com.sun.corba.se.impl.logging.UtilSystemException ;
+import com.sun.corba.se.impl.logging.OMGSystemException ;
+
+/**
+ * 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 IDL_STUB_SUFFIX = "Stub";
+ public static final String TIE_SUFIX = "_Tie";
+ private static IdentityHashtable tieCache = new IdentityHashtable();
+ private static IdentityHashtable tieToStubCache = new IdentityHashtable();
+ private static IdentityHashtable stubToTieCache = new IdentityHashtable();
+ private static Object CACHE_MISS = new Object();
+ private static UtilSystemException wrapper = UtilSystemException.get(
+ CORBALogDomains.UTIL ) ;
+ private static OMGSystemException omgWrapper = OMGSystemException.get(
+ CORBALogDomains.UTIL ) ;
+
+ /**
+ * 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.
+ * @return the connected object.
+ * @exception NoSuchObjectException if obj is an implementation
+ * which has not been exported.
+ */
+ public static Object autoConnect(Object obj, ORB orb, boolean convertToStub)
+ {
+ if (obj == null) {
+ return obj;
+ }
+
+ if (StubAdapter.isStub(obj)) {
+ try {
+ StubAdapter.getDelegate(obj) ;
+ } catch (BAD_OPERATION okay) {
+ try {
+ 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() ) ;
+ }
+ }
+
+ return obj;
+ }
+
+ if (obj instanceof Remote) {
+ Remote remoteObj = (Remote)obj;
+ Tie theTie = Util.getTie(remoteObj);
+ if (theTie != null) {
+ try {
+ theTie.orb();
+ } catch (SystemException okay) {
+ theTie.orb(orb);
+ }
+
+ if (convertToStub) {
+ Object result = loadStub(theTie,null,null,true);
+ if (result != null) {
+ return result;
+ } else {
+ throw wrapper.couldNotLoadStub(obj.getClass().getName());
+ }
+ } else {
+ 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() ) ;
+ }
+ }
+
+ // 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.
+ */
+ 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);
+ }
+ } catch (Exception ex) {
+ wrapper.loadTieFailed( ex, objClass.getName() ) ;
+ }
+
+ // Did we get it?
+
+ if (result == null) {
+
+ // Nope, so cache that fact...
+
+ tieCache.put(obj,CACHE_MISS);
+
+ } else {
+
+ // Yes, so cache it...
+
+ 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();
+ } catch (Exception e) {
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * Load an RMI-IIOP Tie
+ */
+ private static Tie loadTie(Class theClass)
+ {
+ return com.sun.corba.se.spi.orb.ORB.getStubFactoryFactory().
+ getTie( theClass ) ;
+ }
+
+ /*
+ * Clear the stub/tie caches. Intended for use by
+ * test code.
+ */
+ public static void clearCaches() {
+ synchronized (tieToStubCache) {
+ tieToStubCache.clear();
+ }
+ synchronized (tieCache) {
+ tieCache.clear();
+ }
+ synchronized (stubToTieCache) {
+ 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
+ {
+ 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.
+ if (!PackagePrefixChecker.hasOffendingPrefix(
+ PackagePrefixChecker.withoutPackagePrefix(className))){
+ loadedClass = Util.loadClass(
+ PackagePrefixChecker.withoutPackagePrefix(className),
+ remoteCodebase,
+ loader);
+ } else {
+ loadedClass = Util.loadClass(className, remoteCodebase,
+ loader);
+ }
+ } catch (ClassNotFoundException cnfe) {
+ loadedClass = Util.loadClass(className, remoteCodebase,
+ loader);
+ }
+ if (expectedType == null)
+ return loadedClass;
+ } catch (ClassNotFoundException cnfe) {
+ if (expectedType == null)
+ throw cnfe;
+ }
+
+ // 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 (expectedType.getClassLoader() != expectedTypeClassLoader)
+ throw new IllegalArgumentException(
+ "expectedTypeClassLoader not class loader of " +
+ "expected Type.");
+
+ if (expectedTypeClassLoader != null)
+ loadedClass = expectedTypeClassLoader.loadClass(className);
+ else {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null)
+ cl = ClassLoader.getSystemClassLoader();
+
+ loadedClass = cl.loadClass(className);
+ }
+ }
+
+ return loadedClass;
+ }
+
+ /*
+ * 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 loadingContext the loading context. May be null.
+ * @param relatedType the related type. May be null.
+ * @return the loaded class.
+ */
+ public static Class loadClassForClass (String className,
+ String remoteCodebase,
+ ClassLoader loader,
+ Class relatedType,
+ ClassLoader relatedTypeClassLoader)
+ throws ClassNotFoundException
+ {
+ if (relatedType == null)
+ return Util.loadClass(className, remoteCodebase, loader);
+
+ Class loadedClass = null;
+ try {
+ loadedClass = Util.loadClass(className, remoteCodebase, loader);
+ } catch (ClassNotFoundException cnfe) {
+ if (relatedType.getClassLoader() == null)
+ throw cnfe;
+ }
+
+ // 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 (relatedType.getClassLoader() != relatedTypeClassLoader)
+ throw new IllegalArgumentException(
+ "relatedTypeClassLoader not class loader of relatedType.");
+
+ if (relatedTypeClassLoader != null)
+ loadedClass = relatedTypeClassLoader.loadClass(className);
+ }
+
+ return loadedClass;
+ }
+
+ /**
+ * Get the helper for an IDLValue
+ *
+ * Throws MARSHAL exception if no helper found.
+ */
+ public static BoxedValueHelper getHelper(Class clazz, String codebase,
+ String repId)
+ {
+ String className = null;
+ if (clazz != null) {
+ className = clazz.getName();
+ if (codebase == null)
+ codebase = Util.getCodebase(clazz);
+ } else {
+ if (repId != null)
+ className = RepositoryId.cache.getId(repId).getClassName();
+ if (className == null) // no repId or unrecognized repId
+ throw wrapper.unableLocateValueHelper(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ try {
+ ClassLoader clazzLoader =
+ (clazz == null ? null : clazz.getClassLoader());
+ Class helperClass =
+ loadClassForClass(className+"Helper", codebase, clazzLoader,
+ clazz, clazzLoader);
+ return (BoxedValueHelper)helperClass.newInstance();
+
+ } catch (ClassNotFoundException cnfe) {
+ throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
+ cnfe );
+ } catch (IllegalAccessException iae) {
+ throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
+ iae );
+ } catch (InstantiationException ie) {
+ throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
+ ie );
+ } catch (ClassCastException cce) {
+ throw wrapper.unableLocateValueHelper( CompletionStatus.COMPLETED_MAYBE,
+ cce );
+ }
+ }
+
+ /**
+ * Get the factory for an IDLValue
+ *
+ * Throws MARSHAL exception if no factory found.
+ */
+ 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);
+ } catch (org.omg.CORBA.BAD_PARAM ex) {
+ // Try other way
+ }
+ }
+
+ String className = null;
+ if (clazz != null) {
+ className = clazz.getName();
+ if (codebase == null)
+ codebase = Util.getCodebase(clazz);
+ } else {
+ if (repId != null)
+ className = RepositoryId.cache.getId(repId).getClassName();
+ if (className == null) // no repId or unrecognized repId
+ throw omgWrapper.unableLocateValueFactory(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ // 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)))
+ return factory;
+
+ try {
+ ClassLoader clazzLoader =
+ (clazz == null ? null : clazz.getClassLoader());
+ Class factoryClass =
+ loadClassForClass(className+"DefaultFactory", codebase,
+ clazzLoader, clazz, clazzLoader);
+ return (ValueFactory)factoryClass.newInstance();
+
+ } catch (ClassNotFoundException cnfe) {
+ throw omgWrapper.unableLocateValueFactory(
+ CompletionStatus.COMPLETED_MAYBE, cnfe);
+ } catch (IllegalAccessException iae) {
+ throw omgWrapper.unableLocateValueFactory(
+ CompletionStatus.COMPLETED_MAYBE, iae);
+ } catch (InstantiationException ie) {
+ throw omgWrapper.unableLocateValueFactory(
+ CompletionStatus.COMPLETED_MAYBE, ie);
+ } catch (ClassCastException cce) {
+ throw omgWrapper.unableLocateValueFactory(
+ CompletionStatus.COMPLETED_MAYBE, cce);
+ }
+ }
+
+ /*
+ * Load an RMI-IIOP Stub given a Tie.
+ * @param tie the tie.
+ * @param stubClass the stub class. 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.
+ * @return the stub or null if not found.
+ */
+
+ public static Remote loadStub(Tie tie,
+ PresentationManager.StubFactory stubFactory,
+ String remoteCodebase,
+ boolean onlyMostDerived)
+ {
+ StubEntry entry = null;
+
+ // Do we already have it cached?
+ synchronized (tieToStubCache) {
+ Object cached = tieToStubCache.get(tie);
+ if (cached == null) {
+ // No, so go try to load it...
+ entry = loadStubAndUpdateCache(
+ tie, stubFactory, remoteCodebase, onlyMostDerived);
+ } else {
+ // 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
+ // a specific stub type, we don't have to check
+ // any further because the cached type is good
+ // enough...
+ if (!entry.mostDerived && onlyMostDerived) {
+ // We must reload because we do not have
+ // the most derived cached already...
+ // 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]) )
+ {
+ // 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);
+
+ // If that failed, try again with the exact type
+ // we need...
+ if (entry == null) {
+ entry = loadStubAndUpdateCache(tie,stubFactory,
+ remoteCodebase,onlyMostDerived);
+ }
+ } else {
+ // Use the cached stub. Is the delegate set?
+ try {
+ 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) {}
+ }
+ }
+ }
+ }
+ }
+
+ if (entry != null) {
+ 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.
+ * @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.
+ * @return the StubEntry or null if not found.
+ */
+ 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 ) ;
+
+ if (stubFactory != null) {
+ try {
+ stub = stubFactory.makeStub();
+ } catch (Throwable e) {
+ wrapper.stubFactoryCouldNotMakeStub( e ) ;
+ if (e instanceof ThreadDeath) {
+ throw (ThreadDeath) e;
+ }
+ }
+ } else {
+ String[] ids = null;
+ if (tieIsStub) {
+ ids = StubAdapter.getTypeIds( tie ) ;
+ } else {
+ // This will throw an exception if the tie
+ // is not a Servant. XXX Handle this better?
+ ids = ((org.omg.PortableServer.Servant)tie).
+ _all_interfaces( null, null );
+ }
+
+ if (remoteCodebase == null) {
+ remoteCodebase = Util.getCodebase(tie.getClass());
+ }
+
+ if (ids.length == 0) {
+ stub = new org.omg.stub.java.rmi._Remote_Stub();
+ } else {
+ // Now walk all the RepIDs till we find a stub or fail...
+ for (int i = 0; i < ids.length; i++) {
+ if (ids[i].length() == 0) {
+ stub = new org.omg.stub.java.rmi._Remote_Stub();
+ break;
+ }
+
+ try {
+ PresentationManager.StubFactoryFactory stubFactoryFactory =
+ com.sun.corba.se.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,
+ tie.getClass().getClassLoader() ) ;
+ stub = stubFactory.makeStub();
+ break;
+ } catch (Exception e) {
+ wrapper.errorInMakeStubFromRepositoryId( e ) ;
+ }
+
+ if (onlyMostDerived)
+ break;
+ }
+ }
+ }
+
+ if (stub == null) {
+ // Stub == null, so cache the miss...
+ tieToStubCache.put(tie,CACHE_MISS);
+ } else {
+ if (tieIsStub) {
+ try {
+ 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);
+ }
+ }
+ } else {
+ // Tie extends Servant
+ try {
+ Delegate delegate = StubAdapter.getDelegate( tie ) ;
+ StubAdapter.setDelegate( stub, delegate ) ;
+ } catch( org.omg.CORBA.BAD_INV_ORDER bad) {
+ synchronized (stubToTieCache) {
+ stubToTieCache.put(stub,tie);
+ }
+ } catch( Exception e ) {
+ // Exception is caught because of any of the
+ // following reasons
+ // 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 ) ;
+ }
+ }
+ // Update the cache...
+ 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.
+ */
+ 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) {
+ StubEntry entry;
+ synchronized (tieToStubCache) {
+ entry = (StubEntry)tieToStubCache.remove(tie);
+ }
+ if (entry != null) {
+ synchronized (stubToTieCache) {
+ stubToTieCache.remove(entry.stub);
+ }
+ }
+ }
+
+ /*
+ * Remove cached tie/servant pair.
+ */
+ public static void purgeTieAndServant (Tie tie) {
+ synchronized (tieCache) {
+ Object target = tie.getTarget();
+ if (target != null)
+ tieCache.remove(target);
+ }
+ }
+
+ /*
+ * Convert a RepId to a stubName...
+ */
+ 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 {
+ className = stubName(className);
+ }
+ return className;
+ }
+
+
+ /*
+ * Load an RMI-IIOP Stub. This is used in PortableRemoteObject.narrow.
+ */
+ 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;
+ 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
+ // the ClassCastException otherwise.
+ Delegate delegate = StubAdapter.getDelegate( narrowFrom ) ;
+ codebase = ((org.omg.CORBA_2_3.portable.Delegate)delegate).
+ get_codebase(narrowFrom);
+
+ } catch (ClassCastException e) {
+ wrapper.classCastExceptionInLoadStub( e ) ;
+ }
+
+ PresentationManager.StubFactoryFactory sff =
+ com.sun.corba.se.spi.orb.ORB.getStubFactoryFactory() ;
+ 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 ) ;
+ }
+
+ return result;
+ }
+
+ /*
+ * 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
+ {
+ // 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();
+ }
+
+ // 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());
+
+ try {
+ return loadClassOfType(className,
+ remoteCodebase,
+ expectedTypeClassLoader,
+ expectedType,
+ expectedTypeClassLoader);
+ } catch (ClassNotFoundException e) {
+ return loadClassOfType(PackagePrefixChecker.packagePrefix() + className,
+ remoteCodebase,
+ expectedTypeClassLoader,
+ expectedType,
+ expectedTypeClassLoader);
+ }
+ }
+
+ /**
+ * Create an RMI stub name.
+ */
+ public static String stubName (String className)
+ {
+ return stubName( className, false ) ;
+ }
+
+ 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 ;
+ return name ;
+ }
+
+ public static String stubNameForCompiler (String className)
+ {
+ return stubNameForCompiler( className, false ) ;
+ }
+
+ 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 ;
+
+ if (index > 0) {
+ return className.substring(0,index+1) + STUB_PREFIX +
+ className.substring(index+1) + suffix;
+ } else {
+ return STUB_PREFIX + className + suffix;
+ }
+ }
+
+ /**
+ * Create an RMI tie name.
+ */
+ public static String tieName (String className)
+ {
+ return
+ PackagePrefixChecker.hasOffendingPrefix(tieNameForCompiler(className)) ?
+ PackagePrefixChecker.packagePrefix() + tieNameForCompiler(className) :
+ tieNameForCompiler(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;
+ } else {
+ return STUB_PREFIX +
+ className +
+ TIE_SUFIX;
+ }
+ }
+
+ /**
+ * Throws the CORBA equivalent of a java.io.NotSerializableException
+ */
+ public static void throwNotSerializableForCorba(String className) {
+ throw omgWrapper.notSerializable( CompletionStatus.COMPLETED_MAYBE,
+ className ) ;
+ }
+
+ /**
+ * Create an IDL stub name.
+ */
+ 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;
+ } else {
+ result = STUB_PREFIX +
+ className +
+ IDL_STUB_SUFFIX;
+ }
+ return result;
+ }
+
+ 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.
+ * @param in the stream to read from.
+ * @throws ClassCastException if narrowFrom cannot be cast to narrowTo.
+ */
+ public static Object readObjectAndNarrow(InputStream in,
+ Class narrowTo)
+ throws ClassCastException
+ {
+ Object result = in.read_Object();
+ if (result != null)
+ return PortableRemoteObject.narrow(result, narrowTo);
+ else
+ return null;
+ }
+
+ /**
+ * Read an abstract interface type from the input stream and narrow
+ * it to the desired type.
+ * @param in the stream to read from.
+ * @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
+ {
+ Object result = in.read_abstract_interface();
+ if (result != null)
+ return PortableRemoteObject.narrow(result, narrowTo);
+ else
+ return null;
+ }
+
+
+ /** Converts an Ascii Character into Hexadecimal digit
+ */
+ static int hexOf( char x )
+ {
+ int val;
+
+ val = x - '0';
+ if (val >=0 && val <= 9)
+ return val;
+
+ val = (x - 'a') + 10;
+ if (val >= 10 && val <= 15)
+ return val;
+
+ val = (x - 'A') + 10;
+ if (val >= 10 && val <= 15)
+ return val;
+
+ 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/src/java.corba/share/classes/com/sun/corba/se/impl/util/Version.java b/src/java.corba/share/classes/com/sun/corba/se/impl/util/Version.java
new file mode 100644
index 0000000..45360cb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/impl/util/Version.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package com.sun.corba.se.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 () {
+ return FULL;
+ }
+
+ public static void main (String[] args) {
+ System.out.println(FULL);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/internal/CosNaming/BootstrapServer.java b/src/java.corba/share/classes/com/sun/corba/se/internal/CosNaming/BootstrapServer.java
new file mode 100644
index 0000000..e450195
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/internal/CosNaming/BootstrapServer.java
@@ -0,0 +1,133 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.internal.CosNaming;
+
+import java.util.Enumeration;
+import java.util.Properties;
+
+import java.io.File;
+import java.io.FileInputStream;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.resolver.Resolver ;
+import com.sun.corba.se.spi.resolver.LocalResolver ;
+import com.sun.corba.se.spi.resolver.ResolverDefault ;
+
+import com.sun.corba.se.impl.orbutil.CorbaResourceUtil;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+
+/**
+ * Class BootstrapServer is the main entry point for the bootstrap server
+ * implementation. The BootstrapServer makes all object references
+ * defined in a configurable file available using the old
+ * naming bootstrap protocol.
+ */
+public class BootstrapServer
+{
+ private ORB orb;
+
+ /**
+ * Main startup routine for the bootstrap server.
+ * It first determines the port on which to listen, checks that the
+ * specified file is available, and then creates the resolver
+ * that will be used to service the requests in the
+ * BootstrapServerRequestDispatcher.
+ * @param args the command-line arguments to the main program.
+ */
+ public static final void main(String[] args)
+ {
+ String propertiesFilename = null;
+ int initialPort = ORBConstants.DEFAULT_INITIAL_PORT;
+
+ // Process arguments
+ for (int i=0;i<args.length;i++) {
+ // Look for the filename
+ if (args[i].equals("-InitialServicesFile") && i < args.length -1) {
+ propertiesFilename = args[i+1];
+ }
+
+ // Was the initial port specified? If so, override
+ // This property normally is applied for the client side
+ // configuration of resolvers. Here we are using it to
+ // define the server port that the with which the resolvers
+ // communicate.
+ if (args[i].equals("-ORBInitialPort") && i < args.length-1) {
+ initialPort = java.lang.Integer.parseInt(args[i+1]);
+ }
+ }
+
+ if (propertiesFilename == null) {
+ System.out.println( CorbaResourceUtil.getText("bootstrap.usage",
+ "BootstrapServer"));
+ return;
+ }
+
+ // Create a file
+ File file = new File(propertiesFilename);
+
+ // Verify that if it exists, it is readable
+ if (file.exists() == true && file.canRead() == false) {
+ System.err.println(CorbaResourceUtil.getText(
+ "bootstrap.filenotreadable", file.getAbsolutePath()));
+ return;
+ }
+
+ // Success: start up
+ System.out.println(CorbaResourceUtil.getText(
+ "bootstrap.success", Integer.toString(initialPort),
+ file.getAbsolutePath()));
+
+ Properties props = new Properties() ;
+
+ // Use the SERVER_PORT to create an Acceptor using the
+ // old legacy code in ORBConfiguratorImpl. When (if?)
+ // the legacy support is removed, this code will need
+ // to create an Acceptor directly.
+ props.put( ORBConstants.SERVER_PORT_PROPERTY,
+ Integer.toString( initialPort ) ) ;
+
+ ORB orb = (ORB) org.omg.CORBA.ORB.init(args,props);
+
+ LocalResolver lres = orb.getLocalResolver() ;
+ Resolver fres = ResolverDefault.makeFileResolver( orb, file ) ;
+ Resolver cres = ResolverDefault.makeCompositeResolver( fres, lres ) ;
+ LocalResolver sres = ResolverDefault.makeSplitLocalResolver( cres, lres ) ;
+
+ orb.setLocalResolver( sres ) ;
+
+ try {
+ // This causes the acceptors to start listening.
+ orb.resolve_initial_references(ORBConstants.ROOT_POA_NAME);
+ } catch (org.omg.CORBA.ORBPackage.InvalidName e) {
+ RuntimeException rte = new RuntimeException("This should not happen");
+ rte.initCause(e);
+ throw rte;
+ }
+
+ orb.run() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/internal/Interceptors/PIORB.java b/src/java.corba/share/classes/com/sun/corba/se/internal/Interceptors/PIORB.java
new file mode 100644
index 0000000..d025ef3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/internal/Interceptors/PIORB.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.internal.Interceptors;
+
+import com.sun.corba.se.internal.POA.POAORB;
+
+/**
+ * Deprecated class for backward compatibility.
+ */
+public class PIORB
+ extends POAORB
+{
+ public PIORB() {
+ super();
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/internal/POA/POAORB.java b/src/java.corba/share/classes/com/sun/corba/se/internal/POA/POAORB.java
new file mode 100644
index 0000000..614b1a7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/internal/POA/POAORB.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.internal.POA;
+
+/**
+ * Deprecated class for backward compatibility.
+ */
+public class POAORB extends com.sun.corba.se.internal.iiop.ORB
+{
+ public POAORB( )
+ {
+ super();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/internal/corba/ORBSingleton.java b/src/java.corba/share/classes/com/sun/corba/se/internal/corba/ORBSingleton.java
new file mode 100644
index 0000000..ca59437
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/internal/corba/ORBSingleton.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.internal.corba;
+
+/**
+ *
+ * Deprecated class for backward compatibility.
+ */
+public class ORBSingleton extends com.sun.corba.se.impl.orb.ORBSingleton
+{
+ public ORBSingleton()
+ {
+ super();
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/internal/iiop/ORB.java b/src/java.corba/share/classes/com/sun/corba/se/internal/iiop/ORB.java
new file mode 100644
index 0000000..88c588c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/internal/iiop/ORB.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 1995, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.internal.iiop;
+
+/**
+ * Deprecated class for backward compatibility.
+ */
+public class ORB extends /* 1.4 value: com.sun.corba.se.internal.corba.ORB */
+ com.sun.corba.se.impl.orb.ORBImpl
+{
+ public ORB()
+ {
+ super();
+ }
+} // Class ORB
diff --git a/src/java.corba/share/classes/com/sun/corba/se/org/omg/CORBA/ORB.java b/src/java.corba/share/classes/com/sun/corba/se/org/omg/CORBA/ORB.java
new file mode 100644
index 0000000..3e3c63b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/org/omg/CORBA/ORB.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.org.omg.CORBA ;
+
+import org.omg.CORBA.ORBPackage.InvalidName ;
+
+/** This ORB class is defined to provide a home for the
+* register_initial_reference operation, which is added by
+* portable interceptors and CORBA 2.4. It is added here
+* until there is an official Java language mapping for the
+* method.
+*/
+abstract public class ORB extends org.omg.CORBA_2_3.ORB
+{
+ /**
+ * If this operation is called with an id, <code>"Y"</code>, and an
+ * object, <code>YY</code>, then a subsequent call to
+ * <code>ORB.resolve_initial_references( "Y" )</code> will
+ * return object <code>YY</code>.
+ *
+ * @param id The ID by which the initial reference will be known.
+ * @param obj The initial reference itself.
+ * @throws InvalidName if this operation is called with an empty string id
+ * or this operation is called with an id that is already registered,
+ * including the default names defined by OMG.
+ * @throws BAD_PARAM if the obj parameter is null.
+ */
+ public void register_initial_reference( String id,
+ org.omg.CORBA.Object obj )
+ throws InvalidName
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/broker/Broker.java b/src/java.corba/share/classes/com/sun/corba/se/pept/broker/Broker.java
new file mode 100644
index 0000000..0f0e211
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/broker/Broker.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.broker;
+
+import com.sun.corba.se.pept.protocol.ClientInvocationInfo;
+import com.sun.corba.se.pept.transport.TransportManager;
+
+/**
+ * @author Harold Carr
+ */
+public interface Broker
+{
+ public ClientInvocationInfo createOrIncrementInvocationInfo();
+ public ClientInvocationInfo getInvocationInfo();
+ public void releaseOrDecrementInvocationInfo();
+
+ public abstract TransportManager getTransportManager();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/encoding/InputObject.java b/src/java.corba/share/classes/com/sun/corba/se/pept/encoding/InputObject.java
new file mode 100644
index 0000000..1e6eec1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/encoding/InputObject.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.encoding;
+
+import java.io.IOException;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+/**
+ * <p> An <code>InputObject</code> is the interface used by the
+ * presentation block to get programming language typed data from data
+ * encoded in a message. </p>
+ *
+ * <p> The implementation of an <code>InputObject</code> contains the
+ * encoded data. When the presentation block asks for data the
+ * implementation of <code>InputObject</code> is responsible for converting
+ * the encoded representation of the data to the types expected by the
+ * programming language.</p>
+ *
+ * <p>A particular <em>encoding</em> would subclass
+ * <code>InputObject</code>. The subclass would provide methods to get
+ * the data types appropriate to the presentation block (e.g., simple
+ * types such as int or boolean, all the way to any type derived from
+ * <code>java.io.Serializable</code>.).</p>
+ *
+ * <p>Note: the protocol block may also use the <code>InputObject</code> to
+ * obtain header metadata.</p>
+ *
+ * @author Harold Carr
+*/
+public interface InputObject
+{
+ public void setMessageMediator(MessageMediator messageMediator);
+
+ public MessageMediator getMessageMediator();
+
+ public void close() throws IOException;
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/encoding/OutputObject.java b/src/java.corba/share/classes/com/sun/corba/se/pept/encoding/OutputObject.java
new file mode 100644
index 0000000..cb6b60f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/encoding/OutputObject.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.encoding;
+
+import java.io.IOException;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+/**
+ * <p> An <code>OutputObject</code> is the interface used by the
+ * presentation block to give programming language typed data to
+ * the encoding block to be encoded and sent in a message. </p>
+ *
+ * <p> The implementation of an <code>OutputObject</code> contains the
+ * encoded data. When the presentation block gives programming language
+ * typed data to
+ * <code>OutputObject</code>, the
+ * implementation of <code>OutputObject</code> is responsible for converting
+ * that data to the encoded representation of the data for a particular
+ * encoding.</p>
+ *
+ * <p>A particular <em>encoding</em> would subclass
+ * <code>OutputObject</code>. The subclass would provide methods to set
+ * the data types appropriate to the presentation block (e.g., simple
+ * types such as int or boolean, all the way to any type derived from
+ * <code>java.io.Serializable</code>.).</p>
+ *
+ * <p>Note: the protocol block may also use the <code>OutputObject</code> to
+ * set header metadata.</p>
+ *
+ * @author Harold Carr
+*/
+public interface OutputObject
+{
+ public void setMessageMediator(MessageMediator messageMediator);
+
+ public MessageMediator getMessageMediator();
+
+ public void close() throws IOException;
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/package.html b/src/java.corba/share/classes/com/sun/corba/se/pept/package.html
new file mode 100644
index 0000000..b96935e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/package.html
@@ -0,0 +1,359 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+</head>
+<body bgcolor="white">
+
+<p>This package is the top-level package for the <b>PEPt Remoting
+Architecture</b>. PEPt enables remoting (i.e., RPC and Messaging)
+systems to <em>dynamically use alternate encodings, protocols and
+transports</em>.</p>
+
+<h2>Related Documentation</h2>
+
+<p>
+For papers, slides and examples of the PEPt architecture, please see:
+<ul>
+ <li><a href="http://javaweb.sfbay/~hcarr/rpcMsgFramework/index.html">
+ Harold Carr's Sun internal PEPt web page</a></li>
+</ul>
+</p>
+
+<h2>PEPt Architecture</h2>
+
+<p>
+PEPt stands for:
+<ul>
+
+<li><b>Presentation</b>: the data types that may be passed and the
+APIs used to interact with the remoting system.</li>
+
+<li><b>Encoding</b>: the process of transforming those programming
+language data types into an underlying "wire" representation (and the
+wire representation itself).</li>
+
+<li><b>Protocol</b>: The metadata which accompanies a message and the
+use of that metadata.</li>
+
+<li><b>transport</b>: The mechanism used to move the encoded data and
+metadata from one location to another.</li>
+
+</ul>
+</p>
+
+<h3>Key PEPt Interfaces</h3>
+<ul>
+
+<li>{@link com.sun.corba.se.pept.transport.ContactInfoList ContactInfoList}
+ - Client-side address selection mechanism and factory for
+ alternate encodings, protocols and transports (EPT).</li>
+
+<li>{@link com.sun.corba.se.pept.transport.Acceptor Acceptor}
+ - Server-side endpoint, addressing and factory for alternate EPTs.</li>
+
+</ul>
+</p>
+
+<h3>PEPt Client-side Interfaces</h3>
+<ul>
+<li><b>Protocol</b>
+ <ul>
+
+ <li>{@link com.sun.corba.se.pept.protocol.ClientDelegate ClientDelegate}
+ - The presentation block interacts with <code>ClientDelegate</code>
+ to initiate and complete a message send (and a possible
+ response). <code>ClientDelegate</code> is a "portability" interface,
+ to allow different vendors to plug in their implementation into a
+ standard presentation block.</li>
+
+ <li>{@link com.sun.corba.se.pept.protocol.ClientRequestDispatcher
+ ClientRequestDispatcher} - This interface controls the client-side
+ dispatch for a given EPT.</li>
+
+ </ul>
+</li>
+<li><b>Transport</b>
+ <ul>
+
+ <li>{@link com.sun.corba.se.pept.protocol.ContactInfoList
+ ContactInfoList} - A list of <code>ContactInfo</code> associated
+ with a <em>ClientDelegate</em></li>.
+
+ <li>{@link com.sun.corba.se.pept.protocol.ContactInfoListIterator
+ ContactInfoListIterator} - An iterator which chooses the "next"
+ EPT-specific <code>ContactInfo</code>.</li>
+
+ <li>{@link com.sun.corba.se.pept.protocol.ContactInfoList
+ ContactInfo} - <em><b>The key PEPt client-side interface.</b></em> The
+ presentation block uses a <code>ClientDelegate</code> to select an
+ EPT-specific <code>ContactInfo</em>. That <code>ContactInfo</em>
+ serves as a factory for EPT-specifc
+ <code>ClientRequestDispatcher</code>,
+ <code>Input/OutputObjects</code> and <code>Connection</code>.</li>
+
+ </ul>
+</li>
+</ul>
+</p>
+
+<h3>PEPt Server-side Interfaces</h3>
+<ul>
+<li><b>Protocol</b>
+ <ul>
+
+ <li>{@link com.sun.corba.se.pept.protocol.ServerRequestDispatcher
+ ServerRequestDispatcher} - This interface controls the server-side
+ dispatch for a given EPT.</li>
+
+ </ul>
+</li>
+<li><b>Transport</b>
+ <ul>
+
+ <li>{@link com.sun.corba.se.pept.protocol.Acceptor Acceptor}
+ - <em><b>The key PEPt server-side interface.</b></em> <code>Aceptor</code>
+ serves as a factory for EPT-specifc
+ <code>ServerRequestDispatcher</code>,
+ <code>Input/OutputObjects</code> and <code>Connection</code>.</li>
+
+ </ul>
+</li>
+</ul>
+</p>
+
+<h3>PEPt Client and Server Interfaces</h3>
+<ul>
+<li><b>Presentation</b>
+ <ul>
+
+ <li>PEPt, at this time, does not provide interfaces for the
+ presentation level. PEPt is the architecture underlying Sun's CORBA
+ implementation. In that implementation the CORBA system provides
+ stubs, ties, DII and DSI presentation artifacts that interact with
+ the underlying PEPt interfaces.</li>
+
+ </ul>
+</li>
+<li><b>Encoding</b>
+ <ul>
+
+ <li>{@link com.sun.corba.se.pept.encoding.InputObject InputObject}
+ - The presentation block uses an <code>InputObject</code> to
+ retrieve programming language typed data from encoded data sent in a
+ message.</li>
+
+ <li>{@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ - The presentation block uses an <code>OutputObject</code> to
+ post programming language typed data to be encoded and sent in a
+ message.</li>
+
+ </ul>
+</li>
+<li><b>Protocol</b>
+ <ul>
+
+ <li>{@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator}
+ - A "repository" of data associated with a message to be sent or one
+ received. It is the main object used as an argument for methods of
+ the interfaces of the PEPt architecture.</li>
+
+ <li>{@link com.sun.corba.se.pept.protocol.ProtocolHandler ProtocolHandler}
+ - Used to determine an incoming message and dispatch it
+ appropriately.</li>
+
+ </ul>
+</li>
+<li><b>transport</b>
+ <ul>
+
+ <li>{@link com.sun.corba.se.pept.protocol.Connection Connection}
+ - The top-level abstraction of a "connection" between two PEPt
+ peers. Concreate instances may be TCP/IP sockets, Solaris Doors,
+ Shared Memory, ATM, etc.</li>
+
+ </ul>
+</li>
+</ul>
+</p>
+
+<h2>High-level view of PEPt Operation</h2>
+
+<h3>PEPt Client-side Operation</h3>
+
+<ol>
+<li> Presentation asks <code>ClientDelegate</code> for an
+<code>OutputObject</code>.</li>
+ <ol>
+ <li> <code>ClientDelegate</code> gets an EPT-specific
+ <code>ContactInfo</code>.</li>
+ <li> <code>ClientDelegate</code> uses the chosen
+ <code>ContactInfo</code> as a factory to get an EPT-specific
+ <code>ClientRequestDispatcher</code>.</li>
+ <li> <code>ClientDelegate</code> transfers control to the
+ EPT-specific <code>ClientRequestDispatcher.beginRequest</code>.
+ <ol>
+ <li> <code>ClientRequestDispatcher.beginRequest</code> uses
+ <code>ContactInfo</code> as a factory to get EPT-specific
+ <code>OutputObject</code>, <code>MessageMediator</code> and
+ <code>Connection</code>.</li>
+ <li> <code>ClientRequestDispatcher.beginRequest</code> may marshal
+ or set header information on the <code>OutputObject</code> and it
+ may execute interceptors (which may add additional header
+ information) before returning the <code>OutputObject</code> to the
+ presentation block. </li>
+ </ol>
+ </ol>
+<li> Presentation block sets data objects to be sent by calling
+<code>OutputObject</em> methods.</li>
+<li> Presentation block signals the PEPt architecture to send the
+message by calling
+<code>ClientRequestDispatcher.marshalingComplete</code>.</li>
+<li> <code>ClientRequestDispatcher.marshalingComplete</code> sends the
+headers and data encoded in <code>OutputObject</code> on the
+<code>Connection</code>. </li>
+<li> Depending on the EPT,
+<code>ClientRequestDispatcher.marshalingComplete</code> may return
+immediately (i.e., an asynchronous message send with no
+acknowledgment), may wait to get an indication that the message send
+was successfully (i.e., an acknowledged asynchronous send) or wait for
+a response (a synchronous message send). The following steps assume
+waiting for a response.</li>
+<li> <code>ClientRequestDispatcher.marshalingComplete</code> waits for a
+response. This may mean blocking on a read of the
+<code>Connection</code> (e.g., SOAP/HTTP), or putting the client
+thread to sleep while another thread demultiplexes replies (e.g.,
+RMI-IIOP), or using the client thread itself to perform the
+server-side operation (e.g., colocation optimization).</li>
+<li> When a response arrives on the <code>Connection</code> it gives
+the raw bits of the response to <code>ContactInfo</code> which creates
+an EPT-specific <code>InputObject</code> and calls
+<code>ProtocolHandler.handleRequest</code> to determine the message
+type.</li>
+ <ol>
+ <li> <code>ProtocolHandler.handleRequest</code> determines the
+ message type (e.g., Request, Response, Error, Cancel, Close, ...).</li>
+ <li> Suppose it is a response to an RMI-IIOP request. In that case
+ it would find the thread and <code>MessageMediator</code> which
+ originated the request and wake it up, after having passed it the
+ response <code>InputObject</code>.</li>
+ </ol>
+<li> <code>ClientRequestDispatcher.marshalingComplete</code> may run
+interceptors and use reply header metadata befor returning control to
+the presentation block.</li>
+<li> The presentation block call to
+<code>ClientRequestDispatcher.marshalingComplete</code> would return
+the response <code>InputObject</code>.</li>
+<li> The presentation block would get response data objects from the
+<code>InputObject</code>.</li>
+<li> The presentation block would signal the PEPt architecture that
+the invocation is complete by calling
+<code>ClientRequestDispatcher.endRequest</code>.</li>
+<li> <code>ClientRequestDispatcher.endRequest</code> may clean up
+resources used in the invocation.</li>
+</ol>
+
+<h3>PEPt Server-side Operation</h3>
+
+<p> Suppose a server support several EPTs.</p>
+
+<ol>
+<li> For each EPT, register an <code>Acceptor</code>.</li>
+<li> If the system supports the concept of an "object reference" then
+the <code>Acceptor</code> is responsible for adding its EPT
+information (e.g., address information) to the object reference.</li>
+<li> The <code>Acceptor</code> acts as a "listener" for client
+connection requests.</li>
+<li> When the <code>Acceptor</code> receives a connection request it
+creates an EPT-specific <code>Connection</code> on which to receive
+messages.</li>
+<li> When <code>Connection</code> receives a message, it gives the raw
+bits of the message to <code>Acceptor</code> which creates an
+EPT-specific <code>InputObject</code> and calls
+<code>ProtocolHandler.handleRequest</code> to determine the message
+type.</li>
+ <ol>
+ <li> <code>ProtocolHandler.handleRequest</code> determines the
+ message type.</li>
+ <li> Suppose it is a request. In that case it would read enough
+ header information to give to <code>Acceptor</code> to get an
+ EPT-specific <code>InputObject</code>,
+ <code>ServerRequestDispatcher</code> and <code>MessageMediator</code>.</li>
+ <li> Control would then transfer to
+ <code>ServerRequestDispatcher.dispatch</code>.</li>
+ <ol>
+ <li> <code>ServerRequestDispatcher.dispatch</code> uses header
+ information to obtain appropriate presentation block artifacts
+ (e.g., Ties, DSI handlers).</li>
+ <li> As an example, a Tie would be given the <code>InputObject</code>.</li>
+ <ol>
+ <li> The Tie would get the request data from the
+ <code>InputObject</code> and make it available to user
+ code.</li>
+ <li> In the case of a synchronous message, the Tie would ask the
+ <code>ServerRequestDispatcher</code> for an
+ <code>OutputObject</code>.</li>
+ <ol>
+ <li> The <code>ServerRequestDispatcher</code> would use the
+ <code>Acceptor</code> as a factory to create the EPT-specific
+ <code>OutputObject</code>.</li>
+ </ol>
+ <li> The Tie would set the response data (normal or error) on
+ the <code>OutputObject</code>. </li>
+ </ol>
+ <li> <code>ServerRequestDispatcher.dispatch</code> would send the
+ header and response data encoded in <code>OutputObject</code> on
+ the <code>Connection</code>.</li>
+ </ol>
+ <li> <code>ServerRequestDispatcher.dispatch</code> may clean up
+ any resources used in the invocation.</li>
+ </ol>
+ </ol>
+</ol>
+
+<h2>Initial ContactInfo and Acceptor Creation</h2>
+
+<p> <code>ContactInfo</code> and <code>Acceptor</code> are the
+factories for all other objects involved in a message for a particular
+EPT. The question naturally arises, how are these created?</p>
+
+<ul>
+<li> From a tool reading service descriptions (e.g., WSDL). </li>
+<li> By reading the contents of an object reference (e.g., CORBA IOR). </li>
+<li> From a configuration file. </li>
+</ul>
+
+<h2>Other PEPt Interfaces</h2>
+
+<ul>
+<li>{@link com.sun.corba.se.pept.broker.Broker Broker} - A repository
+of resources such as transport managers, thread pools, thread local
+data structures, etc.</li>
+</ul>
+
+</body>
+</html>
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientDelegate.java b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientDelegate.java
new file mode 100644
index 0000000..13649f6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientDelegate.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.protocol;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.transport.ContactInfoList;
+
+/**
+ * <p>The presentation block interacts with the PEPt architecture
+ * via the <code>ClientDelegate</code>.</p>
+ *
+ * @author Harold Carr
+ */
+public interface ClientDelegate
+{
+ /**
+ * The {@link com.sun.corba.se.pept.broker.Broker Broker} associated
+ * with an invocation.
+ *
+ * @return {@link com.sun.corba.se.pept.broker.Broker Broker}
+ */
+ public Broker getBroker();
+
+ /**
+ * Get the
+ * {@link com.sun.corba.se.pept.transport.ContactInfoList ContactInfoList}
+ * which represents they encoding/protocol/transport combinations that
+ * may be used to contact the service.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.transport.ContactInfoList ContactInfoList}
+ */
+ public ContactInfoList getContactInfoList();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientInvocationInfo.java b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientInvocationInfo.java
new file mode 100644
index 0000000..e1b0e2c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientInvocationInfo.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.protocol;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
+import java.util.Iterator;
+
+/**
+ * @author Harold Carr
+ */
+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);
+
+ public ClientRequestDispatcher getClientRequestDispatcher();
+
+ public void setMessageMediator(MessageMediator messageMediator);
+
+ public MessageMediator getMessageMediator();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientRequestDispatcher.java b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientRequestDispatcher.java
new file mode 100644
index 0000000..25db65b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ClientRequestDispatcher.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.protocol;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.transport.ContactInfo;
+
+/**
+ * <code>ClientRequestDispatcher</code> coordinates the request (and possible
+ * response) processing for a specific <em>protocol</em>.
+ *
+ * @author Harold Carr
+ */
+public interface ClientRequestDispatcher
+{
+ /**
+ * At the beginning of a request the presentation block uses this
+ * to obtain an
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ * to set data to be sent on a message.
+ *
+ * @param self -
+ * @param methodName - the remote method name
+ * @param isOneWay - <code>true</code> if the message is asynchronous
+ * @param contactInfo - the
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}
+ * which which created/chose this <code>ClientRequestDispatcher</code>
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ */
+ public OutputObject beginRequest(Object self,
+ String methodName,
+ boolean isOneWay,
+ ContactInfo contactInfo);
+
+ /**
+ * After the presentation block has set data on the
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ * it signals the PEPt runtime to send the encoded data by calling this
+ * method.
+ *
+ * @param self -
+ * @param outputObject
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
+ * if the message is synchronous.
+ *
+ * @throws
+ * {@link org.omg.CORBA.portable.ApplicationException ApplicationException}
+ * if the remote side raises an exception declared in the remote interface.
+ *
+ * @throws
+ * {@link org.omg.CORBA.portable.RemarshalException RemarshalException}
+ * if the PEPt runtime would like the presentation block to start over.
+ */
+ public InputObject marshalingComplete(java.lang.Object self,
+ OutputObject 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.
+ *
+ * This method may release resources. In some cases it may cause
+ * control or error messages to be sent.
+ *
+ * @param broker -
+ * @param inputObject -
+ */
+ public void endRequest(Broker broker,
+ java.lang.Object self,
+ InputObject inputObject);
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/MessageMediator.java b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/MessageMediator.java
new file mode 100644
index 0000000..4480146
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/MessageMediator.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.protocol;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ContactInfo;
+
+import java.io.IOException;
+
+/**
+ * <code>MessageMediator</code> is a central repository for artifacts
+ * associated with an individual message.
+ *
+ * @author Harold Carr
+ */
+public interface MessageMediator
+{
+ /**
+ * The {@link com.sun.corba.se.pept.broker.Broker Broker} associated
+ * with an invocation.
+ *
+ * @return {@link com.sun.corba.se.pept.broker.Broker Broker}
+ */
+ public Broker getBroker();
+
+ /**
+ * Get the
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}
+ * which created this <code>MessageMediator</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}
+ */
+ public ContactInfo getContactInfo();
+
+ /**
+ * Get the
+ * {@link com.sun.corba.se.pept.transport.Connection Connection}
+ * on which this message is sent or received.
+ */
+ public Connection getConnection();
+
+ /**
+ * Used to initialize message headers.
+ *
+ * Note: this should be moved to a <code>RequestDispatcher</code>.
+ */
+ public void initializeMessage();
+
+ /**
+ * Used to send the message (or its last fragment).
+ *
+ * Note: this should be moved to a <code>RequestDispatcher</code>.
+ */
+ public void finishSendingRequest();
+
+ /**
+ * Used to wait for a response for synchronous messages.
+ *
+ * @deprecated
+ */
+ @Deprecated
+ public InputObject waitForResponse();
+
+ /**
+ * Used to set the
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ * used for the message.
+ *
+ * @param outputObject
+ */
+ public void setOutputObject(OutputObject outputObject);
+
+ /**
+ * Used to get the
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ * used for the message.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ */
+ public OutputObject getOutputObject();
+
+ /**
+ * Used to set the
+ * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
+ * used for the message.
+ *
+ * @param inputObject
+ */
+ public void setInputObject(InputObject inputObject);
+
+ /**
+ * Used to get the
+ * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
+ * used for the message.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
+ */
+ public InputObject getInputObject();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ProtocolHandler.java b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ProtocolHandler.java
new file mode 100644
index 0000000..a820fa3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ProtocolHandler.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.protocol;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+/**
+ * <code>ProtocolHandler</code> is used to determine the
+ * type of an incoming message.
+ *
+ * @author Harold Carr
+ */
+public interface ProtocolHandler
+{
+ // REVISIT - return type
+ /**
+ * This method determines the type of an incoming message and
+ * dispatches it appropriately.
+ *
+ * For example, on the server side, it may find a
+ * {@link com.sun.corba.se.pept.protocol.ServerRequestDispatcher
+ * ServerRequestDispatcher} to handle the request. On the client-side
+ * it may signal a waiting thread to handle a reply.
+ *
+ * @return deprecated
+ */
+ public boolean handleRequest(MessageMediator messageMediator);
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ServerRequestDispatcher.java b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ServerRequestDispatcher.java
new file mode 100644
index 0000000..3677e3c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/protocol/ServerRequestDispatcher.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.protocol;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+/**
+ * <code>ServerRequestDispatcher</code> coordinates the request (and possible
+ * response) processing for a specific <em>protocol</em>.
+
+ * @author Harold Carr
+ */
+public interface ServerRequestDispatcher
+{
+ /**
+ * This method coordinates the processing of a message received
+ * on the server side.
+ *
+ * For example, this may involve finding an "object adapter" which
+ * would return Ties/Servants to handle the request.
+ */
+ public void dispatch(MessageMediator messageMediator);
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Acceptor.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Acceptor.java
new file mode 100644
index 0000000..16e69d0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Acceptor.java
@@ -0,0 +1,212 @@
+/*
+ * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.EventHandler;
+
+/**
+ * <p>The <b><em>primary</em></b> PEPt server-side plug-in point and enabler
+ * for <b><em>altenate encodings, protocols and transports</em></b>.</p>
+ *
+ * <p><code>Acceptor</code> is a <em>factory</em> for client-side
+ * artifacts used to receive a message (and possibly send a response).</p>
+ *
+ * @author Harold Carr
+ */
+public interface Acceptor
+{
+ /**
+ * Used to initialize an <code>Acceptor</code>.
+ *
+ * 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 <code>true</code> when it performs initializatin
+ * actions (typically the first call.
+ */
+ public boolean initialize();
+
+ /**
+ * Used to determine if an <code>Acceptor</code> has been initialized.
+ *
+ * @return <code>true</code> if the <code>Acceptor</code> has been
+ * initialized.
+ */
+ public boolean initialized();
+
+ /**
+ * PEPt uses separate caches for each type of <code>Acceptor</code>
+ * as given by <code>getConnectionCacheType</code>.
+ *
+ * @return {@link java.lang.String}
+ */
+ public String getConnectionCacheType();
+
+ /**
+ * Set the
+ * {@link com.sun.corba.se.pept.transport.InboundConnectionCache InboundConnectionCache}
+ * to be used by this <code>Acceptor</code>.
+ *
+ * PEPt uses separate caches for each type of <code>Acceptor</code>
+ * as given by {@link #getConnectionCacheType}.
+ * {@link #setConnectionCache} and {@link #getConnectionCache} support
+ * an optimzation to avoid hashing to find that cache.
+ *
+ * @param connectionCache.
+ */
+ public void setConnectionCache(InboundConnectionCache connectionCache);
+
+ /**
+ * Get the
+ * {@link com.sun.corba.se.pept.transport.InboundConnectionCache InboundConnectionCache}
+ * used by this <code>Acceptor</code>
+ *
+ * PEPt uses separate caches for each type of <code>Acceptor</code>
+ * as given by {@link #getConnectionCacheType}.
+ * {@link #setConnectionCache} and {@link #getConnectionCache} support
+ * an optimzation to avoid hashing to find that cache.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.transport.ConnectionCache ConnectionCache}
+ */
+ public InboundConnectionCache getConnectionCache();
+
+ /**
+ * Used to determine if the <code>Acceptor</code> should register
+ * with
+ * {@link com.sun.corba.se.pept.transport.Selector Selector}
+ * to handle accept events.
+ *
+ * For example, this may be <em>false</em> in the case of Solaris Doors
+ * which do not actively listen.
+ *
+ * @return <code>true</code> if the <code>Acceptor</code> should be
+ * registered with
+ * {@link com.sun.corba.se.pept.transport.Selector Selector}
+ */
+ public boolean shouldRegisterAcceptEvent();
+
+ /**
+ * Accept a connection request.
+ *
+ * This is called either when the selector gets an accept event
+ * for this <code>Acceptor</code> or by a
+ * {@link com.sun.corba.se.pept.transport.ListenerThread ListenerThread}.
+ *
+ * It results in a
+ * {@link com.sun.corba.se.pept.transport.Connection Connection}
+ * being created.
+ */
+ public void accept();
+
+ /**
+ * Close the <code>Acceptor</code>.
+ */
+ public void close();
+
+ /**
+ * Get the
+ * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler}
+ * associated with this <code>Acceptor</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler}
+ */
+ public EventHandler getEventHandler();
+
+ //
+ // Factory methods
+ //
+
+ // REVISIT: Identical to ContactInfo method. Refactor into base interface.
+
+ /**
+ * Used to get a
+ * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
+ * to hold internal data for a message received using the specific
+ * encoding, protocol, transport combination represented by this
+ * <code>Acceptor</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
+ */
+ public MessageMediator createMessageMediator(Broker xbroker,
+ Connection xconnection);
+
+ // REVISIT: Identical to ContactInfo method. Refactor into base interface.
+
+ /**
+ * Used to finish creating a
+ * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
+ * to with internal data for a message received using the specific
+ * encoding, protocol, transport combination represented by this
+ * <code>Acceptor</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator}
+ */
+
+ public MessageMediator finishCreatingMessageMediator(Broker broker,
+ Connection xconnection,
+ MessageMediator messageMediator);
+
+ /**
+ * Used to get a
+ * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
+ * for the specific <em>encoding</em> represented by this
+ * <code>Acceptor</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
+ */
+ public InputObject createInputObject(Broker broker,
+ MessageMediator messageMediator);
+
+ /**
+ * Used to get a
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ * for the specific <em>encoding</em> represented by this
+ * <code>Acceptor</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ */
+ public OutputObject createOutputObject(Broker broker,
+ MessageMediator messageMediator);
+
+ //
+ // Usage dictates implementation equals and hashCode.
+ //
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ByteBufferPool.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ByteBufferPool.java
new file mode 100644
index 0000000..667f833
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ByteBufferPool.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+import java.nio.ByteBuffer;
+
+/**
+ * @author Charlie Hunt
+ */
+public interface ByteBufferPool
+{
+ public ByteBuffer getByteBuffer(int theSize);
+ public void releaseByteBuffer(ByteBuffer thebb);
+ public int activeCount();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Connection.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Connection.java
new file mode 100644
index 0000000..be756bc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Connection.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+import java.io.IOException;
+
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.EventHandler;
+
+
+/**
+ * <p><code>Connection</code> represents a <em>transport</em> in the
+ * PEPt architecture.</p>
+ *
+ * @author Harold Carr
+*/
+public interface Connection
+{
+ /**
+ * Used to determine if the <code>Connection</code> should register
+ * with the
+ * {@link com.sun.corba.se.pept.transport.TransportManager
+ * TransportManager}
+ * {@link com.sun.corba.se.pept.transport.Selector 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.
+ *
+ * @return <code>true</code> if it should be registered.
+ */
+ public boolean shouldRegisterReadEvent();
+
+ /**
+ * Used to determine if the <code>Connection</code> should register
+ * with the
+ * {@link com.sun.corba.se.pept.transport.TransportManager
+ * TransportManager}
+ * {@link com.sun.corba.se.pept.transport.Selector 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.
+ *
+ * @return <code>true</code> if it should be registered.
+ */
+ public boolean shouldRegisterServerReadEvent(); // REVISIT - why special?
+
+ /**
+ * Called to read incoming messages.
+ *
+ * @return <code>true</code> if the thread calling read can be released.
+ */
+ public boolean read();
+
+ /**
+ * Close the <code>Connection</code>.
+ *
+ */
+ public void close();
+
+ // REVISIT: replace next two with PlugInFactory (implemented by ContactInfo
+ // and Acceptor).
+
+ /**
+ * Get the
+ * {@link com.sun.corba.se.pept.transport.Acceptor Acceptor}
+ * that created this <code>Connection</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.transport.Acceptor Acceptor}
+ */
+ public Acceptor getAcceptor();
+
+ /**
+ * Get the
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}
+ * that created this <code>Connection</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}
+ */
+ public ContactInfo getContactInfo();
+
+ /**
+ * Get the
+ * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler}
+ * associated with this <code>Acceptor</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.transport.EventHandler EventHandler}
+ */
+ public EventHandler getEventHandler();
+
+ /**
+ * Indicates whether a
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}
+ * or a
+ * {@link com.sun.corba.se.pept.transport.Acceptor Acceptor}
+ * created the
+ * <code>Connection</code>.
+ *
+ * @return <code>true</code> if <code>Connection</code> an
+ * {@link com.sun.corba.se.pept.transport.Acceptor Acceptor}
+ * created the <code>Connection</code>.
+ */
+ public boolean isServer();
+
+ /**
+ * Indicates if the <code>Connection</code> is in the process of
+ * sending or receiving a message.
+ *
+ * @return <code>true</code> if the <code>Connection</code> is busy.
+ */
+ public boolean isBusy();
+
+ /**
+ * Timestamps are used for connection management, in particular, for
+ * reclaiming idle <code>Connection</code>s.
+ *
+ * @return the "time" the <code>Connection</code> was last used.
+ */
+ public long getTimeStamp();
+
+ /**
+ * Timestamps are used for connection management, in particular, for
+ * reclaiming idle <code>Connection</code>s.
+ *
+ * @param time - the "time" the <code>Connection</code> was last used.
+ */
+ public void setTimeStamp(long time);
+
+ /**
+ * The "state" of the <code>Connection</code>.
+ *
+ * param state
+ */
+ public void setState(String state);
+
+ /**
+ * Grab a write lock on the <code>Connection</code>.
+ *
+ * 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();
+
+ /**
+ * Release a write lock on the <code>Connection</code>.
+ */
+ public void writeUnlock();
+
+ /*
+ * Send the data encoded in
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ * on the <code>Connection</code>.
+ *
+ * @param outputObject
+ */
+ public void sendWithoutLock(OutputObject outputObject);
+
+ /**
+ * Register an invocation's
+ * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator}
+ * with the <code>Connection</code>.
+ *
+ * This is useful in protocols which support fragmentation.
+ *
+ * @param messageMediator
+ */
+ public void registerWaiter(MessageMediator messageMediator);
+
+ /**
+ * 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).
+ *
+ * @param messageMediator
+ */
+ public InputObject waitForResponse(MessageMediator messageMediator);
+
+ /**
+ * Unregister an invocation's
+ * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator}
+ * with the <code>Connection</code>.
+ *
+ * @param messageMediator
+ */
+ public void unregisterWaiter(MessageMediator messageMediator);
+
+ public void setConnectionCache(ConnectionCache connectionCache);
+
+ public ConnectionCache getConnectionCache();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ConnectionCache.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ConnectionCache.java
new file mode 100644
index 0000000..7d32050
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ConnectionCache.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2001, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+/**
+ * @author Harold Carr
+ */
+public interface ConnectionCache
+{
+ public String getCacheType();
+
+ public void stampTime(Connection connection);
+
+ public long numberOfConnections();
+
+ public long numberOfIdleConnections();
+
+ public long numberOfBusyConnections();
+
+ 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.
+ */
+ public void close();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfo.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfo.java
new file mode 100644
index 0000000..5e50a23
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfo.java
@@ -0,0 +1,231 @@
+/*
+ * Copyright (c) 2001, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
+import com.sun.corba.se.pept.transport.ConnectionCache;
+
+/**
+ * <p>The <b><em>primary</em></b> PEPt client-side plug-in point and enabler
+ * for <b><em>altenate encodings, protocols and transports</em></b>.</p>
+ *
+ * <p><code>ContactInfo</code> is a <em>factory</em> for client-side
+ * artifacts used
+ * to construct and send a message (and possibly receive and process a
+ * response).</p>
+ *
+ * @author Harold Carr
+ */
+public interface ContactInfo
+{
+ /**
+ * The {@link com.sun.corba.se.pept.broker.Broker Broker} associated
+ * with an invocation.
+ *
+ * @return {@link com.sun.corba.se.pept.broker.Broker Broker}
+ */
+ public Broker getBroker();
+
+ /**
+ * The parent
+ * {@link com.sun.corba.se.pept.broker.ContactInfoList ContactInfoList}
+ * for this <code>ContactInfo</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.broker.ContactInfoList ContactInfoList}
+ */
+ public ContactInfoList getContactInfoList();
+
+ /**
+ * Used to get a
+ * {@link com.sun.corba.se.pept.protocol.ClientRequestDispatcher
+ * ClientRequestDispatcher}
+ * used to handle the specific <em>protocol</em> represented by this
+ * <code>ContactInfo</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.protocol.ClientRequestDispatcher
+ * ClientRequestDispatcher} */
+ public ClientRequestDispatcher getClientRequestDispatcher();
+
+ /**
+ * Used to determine if a
+ * {@link com.sun.corba.se.pept.transport.Connection Connection}
+ * will be present in an invocation.
+ *
+ * For example, it may be
+ * <code>false</code> in the case of shared-memory
+ * <code>Input/OutputObjects</code>.
+ *
+ * @return <code>true</code> if a
+ * {@link com.sun.corba.se.pept.transport.Connection Connection}
+ * will be used for an invocation.
+ */
+ public boolean isConnectionBased();
+
+ /**
+ * Used to determine if the
+ * {@link com.sun.corba.se.pept.transport.Connection Connection}
+ * used for a request should be cached.
+ *
+ * If <code>true</code> then PEPt will attempt to reuse an existing
+ * {@link com.sun.corba.se.pept.transport.Connection Connection}. If
+ * one is not found it will create a new one and cache it for future use.
+ *
+ *
+ * @return <code>true</code> if
+ * {@link com.sun.corba.se.pept.transport.Connection Connection}s
+ * created by this <code>ContactInfo</code> should be cached.
+ */
+ public boolean shouldCacheConnection();
+
+ /**
+ * PEPt uses separate caches for each type of <code>ContactInfo</code>
+ * as given by <code>getConnectionCacheType</code>.
+ *
+ * @return {@link java.lang.String}
+ */
+ public String getConnectionCacheType();
+
+ /**
+ * Set the
+ * {@link com.sun.corba.se.pept.transport.Outbound.ConnectionCache OutboundConnectionCache}
+ * to be used by this <code>ContactInfo</code>.
+ *
+ * PEPt uses separate caches for each type of <code>ContactInfo</code>
+ * as given by {@link #getConnectionCacheType}.
+ * {@link #setConnectionCache} and {@link #getConnectionCache} support
+ * an optimzation to avoid hashing to find that cache.
+ *
+ * @param connectionCache.
+ */
+ public void setConnectionCache(OutboundConnectionCache connectionCache);
+
+ /**
+ * Get the
+ * {@link com.sun.corba.se.pept.transport.Outbound.ConnectionCache OutboundConnectionCache}
+ * used by this <code>ContactInfo</code>
+ *
+ * PEPt uses separate caches for each type of <code>ContactInfo</code>
+ * as given by {@link #getConnectionCacheType}.
+ * {@link #setConnectionCache} and {@link #getConnectionCache} support
+ * an optimzation to avoid hashing to find that cache.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.transport.ConnectionCache ConnectionCache}
+ */
+ public OutboundConnectionCache getConnectionCache();
+
+ /**
+ * Used to get a
+ * {@link com.sun.corba.se.pept.transport.Connection Connection}
+ * to send and receive messages on the specific <em>transport</em>
+ * represented by this <code>ContactInfo</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.transport.Connection Connection}
+ */
+ public Connection createConnection();
+
+ /**
+ * Used to get a
+ * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
+ * to hold internal data for a message to be sent using the specific
+ * encoding, protocol, transport combination represented by this
+ * <code>ContactInfo</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator}
+ */
+ public MessageMediator createMessageMediator(Broker broker,
+ ContactInfo contactInfo,
+ Connection connection,
+ String methodName,
+ boolean isOneWay);
+
+ /**
+ * Used to get a
+ * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
+ * to hold internal data for a message received using the specific
+ * encoding, protocol, transport combination represented by this
+ * <code>ContactInfo</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
+ */
+ public MessageMediator createMessageMediator(Broker broker,
+ Connection connection);
+
+ /**
+ * Used to finish creating a
+ * {@link com.sun.corba.se.pept.protocol.MessageMeidator MessageMediator}
+ * with internal data for a message received using the specific
+ * encoding, protocol, transport combination represented by this
+ * <code>ContactInfo</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.protocol.MessageMediator MessageMediator}
+ */
+ public MessageMediator finishCreatingMessageMediator(Broker broker,
+ Connection connection,
+ MessageMediator messageMediator);
+
+ /**
+ * Used to get a
+ * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
+ * for the specific <em>encoding</em> represented by this
+ * <code>ContactInfo</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.encoding.InputObject InputObject}
+ */
+ public InputObject createInputObject(Broker broker,
+ MessageMediator messageMediator);
+
+ /**
+ * Used to get a
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ * for the specific <em>encoding</em> represented by this
+ * <code>ContactInfo</code>.
+ *
+ * @return
+ * {@link com.sun.corba.se.pept.encoding.OutputObject OutputObject}
+ */
+ public OutputObject createOutputObject(MessageMediator messageMediator);
+
+ /**
+ * Used to lookup artifacts associated with this <code>ContactInfo</code>.
+ *
+ * @return the hash value.
+ */
+ public int hashCode();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfoList.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfoList.java
new file mode 100644
index 0000000..f5448b9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfoList.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+import java.util.Iterator;
+
+/**
+ * <p> <code>ContactInfoList</code> contains one or more
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}.
+ *
+ * @author Harold Carr
+ */
+public interface ContactInfoList
+{
+ /**
+ * Used to get a
+ * {@link com.sun.corba.se.pept.transport.ContactInfoListIterator
+ * ContactInfoListIterator} to retrieve individual
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}
+ * from the list.
+ *
+ * @return A
+ * {@link com.sun.corba.se.pept.transport.ContactInfoListIterator
+ * ContactInfoListIterator}.
+ */
+ public Iterator iterator();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfoListIterator.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfoListIterator.java
new file mode 100644
index 0000000..445bc42
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ContactInfoListIterator.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+import java.util.Iterator;
+
+/**
+ * <code>ContactInfoIterator</code> is used to retrieve individual
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}.
+ *
+ * @author Harold Carr
+ */
+public interface ContactInfoListIterator
+ extends
+ Iterator
+{
+ /**
+ * The underlying list for this iterator.
+ *
+ * @return The underlying list for this iterator.
+ */
+ public ContactInfoList getContactInfoList();
+
+ /**
+ * Used to report information to the iterator to be used
+ * in future invocations.
+ *
+ * @param contactInfo The
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}
+ * obtained from this iterator which resulted in a successful invocation.
+ */
+ public void reportSuccess(ContactInfo contactInfo);
+
+ /**
+ * Used to report information to the iterator to be used
+ * in future invocations.
+ *
+ * @param contactInfo The
+ * {@link com.sun.corba.se.pept.transport.ContactInfo ContactInfo}
+ * in effect when an invocation exception occurs.
+ * @param exception The
+ * {@link java.lang.RuntimeException RuntimeException}.
+ *
+ * @return Returns true if the request should be retried.
+ */
+ public boolean reportException(ContactInfo contactInfo,
+ RuntimeException exception);
+
+ /**
+ * The exception to report to the presentation block.
+ *
+ * @return If the iterator reaches the end before the invocation
+ * is successful one returns this exception (previously reported to
+ * the iterator via {@link #reportException}).
+
+ */
+ public RuntimeException getFailureException();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/EventHandler.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/EventHandler.java
new file mode 100644
index 0000000..f79cd5f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/EventHandler.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+import java.nio.channels.SelectableChannel;
+import java.nio.channels.SelectionKey;
+
+import com.sun.corba.se.spi.orbutil.threadpool.Work;
+
+/**
+ * @author Harold Carr
+ *
+ * This should only be registered with ONE selector.
+ */
+public interface EventHandler
+{
+ public void setUseSelectThreadToWait(boolean x);
+ public boolean shouldUseSelectThreadToWait();
+
+ public SelectableChannel getChannel();
+
+ public int getInterestOps();
+
+ public void setSelectionKey(SelectionKey selectionKey);
+ public SelectionKey getSelectionKey();
+
+ public void handleEvent();
+
+ // NOTE: if there is more than one interest op this does not
+ // 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/src/java.corba/share/classes/com/sun/corba/se/pept/transport/InboundConnectionCache.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/InboundConnectionCache.java
new file mode 100644
index 0000000..3aee071
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/InboundConnectionCache.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+/**
+ * @author Harold Carr
+ */
+public interface InboundConnectionCache
+ extends ConnectionCache
+{
+ public Connection get(Acceptor acceptor); // REVISIT
+
+ public void put(Acceptor acceptor, Connection connection);
+
+ public void remove(Connection connection);
+
+ public Acceptor getAcceptor();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ListenerThread.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ListenerThread.java
new file mode 100644
index 0000000..18aa9a2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ListenerThread.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+/**
+ * @author Harold Carr
+ */
+public interface ListenerThread
+{
+ public Acceptor getAcceptor();
+ public void close();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/OutboundConnectionCache.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/OutboundConnectionCache.java
new file mode 100644
index 0000000..e72ddbb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/OutboundConnectionCache.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+/**
+ * @author Harold Carr
+ */
+public interface OutboundConnectionCache
+ extends ConnectionCache
+{
+ public Connection get(ContactInfo contactInfo);
+
+ public void put(ContactInfo contactInfo, Connection connection);
+
+ public void remove(ContactInfo contactInfo);
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ReaderThread.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ReaderThread.java
new file mode 100644
index 0000000..d1fd2a7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ReaderThread.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+/**
+ * @author Harold Carr
+ */
+public interface ReaderThread {
+ public Connection getConnection();
+ public void close();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ResponseWaitingRoom.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ResponseWaitingRoom.java
new file mode 100644
index 0000000..51573f5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/ResponseWaitingRoom.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.encoding.InputObject;
+
+/**
+ * @author Harold Carr
+ */
+public interface ResponseWaitingRoom
+{
+ public void registerWaiter(MessageMediator messageMediator);
+
+ // REVISIT: maybe return void (or MessageMediator).
+ public InputObject waitForResponse(MessageMediator messageMediator);
+
+ public void responseReceived(InputObject inputObject);
+
+ public void unregisterWaiter(MessageMediator messageMediator);
+
+ public int numberRegistered();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Selector.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Selector.java
new file mode 100644
index 0000000..dbd54d3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/Selector.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+/**
+ * @author Harold Carr
+ */
+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/src/java.corba/share/classes/com/sun/corba/se/pept/transport/TransportManager.java b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/TransportManager.java
new file mode 100644
index 0000000..f6240d5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/pept/transport/TransportManager.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.pept.transport;
+
+import java.util.Collection;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+import com.sun.corba.se.pept.transport.ConnectionCache;
+import com.sun.corba.se.pept.transport.Selector;
+
+/**
+ * @author Harold Carr
+ */
+public interface TransportManager
+{
+ public ByteBufferPool getByteBufferPool(int id);
+
+ public OutboundConnectionCache getOutboundConnectionCache(
+ ContactInfo contactInfo);
+
+ public Collection getOutboundConnectionCaches();
+
+ public InboundConnectionCache getInboundConnectionCache(Acceptor acceptor);
+
+ public Collection getInboundConnectionCaches();
+
+ public Selector getSelector(int id);
+
+ public void registerAcceptor(Acceptor acceptor);
+
+ public Collection getAcceptors();
+
+ public void unregisterAcceptor(Acceptor acceptor);
+
+ public void close();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/activation/activation.idl b/src/java.corba/share/classes/com/sun/corba/se/spi/activation/activation.idl
new file mode 100644
index 0000000..3d58a29
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/activation/activation.idl
@@ -0,0 +1,305 @@
+/*
+ * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+//
+
+module activation {
+ // Possible values for endpointType argument on Server.getEndpoint()
+ // If you change the value of this constant then update
+ // core.EndPoint accordingly. It has a duplicate definition
+ // to avoid a compilation dependency.
+ const string IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT";
+
+ // REVISIT Use the CORBA 2.3 ORBid if we ever get the Java ORB ID
+ // issue resolved.
+ typedef string ORBid;
+ typedef long ServerId ;
+ typedef sequence<string> POAName ;
+
+ /** Raised if getEndpoint is called on a server callback object for
+ * an invalid endpoint type
+ */
+ exception NoSuchEndPoint {} ;
+
+ /**
+ * Raised if an attempt is made to retrieve ports corresponding to
+ * non-registered ORB
+ */
+
+ exception InvalidORBid {} ;
+
+ /** Raised if an operation is attempted against an invalid server ID.
+ */
+ exception ServerNotRegistered {
+ ServerId serverId ;
+ };
+
+ /** Raised if an operation is attempted for a server that is not running,
+ * and the server is required to be running for the operation.
+ */
+ exception ServerNotActive {
+ ServerId serverId ;
+ };
+
+ /** Raised if an operation is attempted against a server that is in a
+ * hold down state. A server becomes held down if it fails to activate
+ * within 10 seconds.
+ */
+ exception ServerHeldDown {
+ ServerId serverId ;
+ };
+
+ /** Raised if an attempt is made to activate a server that is already
+ * running.
+ */
+ exception ServerAlreadyActive{
+ ServerId serverId ;
+ };
+
+ /** Raised if an attempt is made to register a serverdef with the
+ * same applicationName as an existing serverdef.
+ */
+ exception ServerAlreadyRegistered {
+ ServerId serverId;
+ };
+
+ /** Raised if an attempt is made to install a server that is currently
+ * installed. Note that a newly created server starts out in an uninstalled
+ * state.
+ */
+ exception ServerAlreadyInstalled {
+ ServerId serverId;
+ } ;
+
+ /** Raised if an attempt is made to uninstall a server that is currently
+ * uninstalled. Note that a newly created server starts out in an
+ * uninstalled
+ * state.
+ */
+ exception ServerAlreadyUninstalled {
+ ServerId serverId;
+ } ;
+
+ /** Raised if an attempt is made to register an invalid serverdef.
+ */
+ exception BadServerDefinition {
+ string reason;
+ };
+
+ /** Raised if an attempt is made to register endpoints for the
+ * same ORB again
+ */
+ exception ORBAlreadyRegistered {
+ ORBid orbId;
+ };
+
+ typedef long TCPPort ;
+ typedef sequence<ServerId> ServerIds;
+
+ // passing a struct containing endpointType and port-#s
+ struct EndPointInfo {
+ string endpointType;
+ TCPPort port;
+ };
+
+ typedef sequence<EndPointInfo> EndpointInfoList;
+
+ // struct contain ORB and port info
+ struct ORBPortInfo {
+ ORBid orbId;
+ TCPPort port;
+ };
+
+ typedef sequence<ORBPortInfo> ORBPortInfoList;
+
+ typedef sequence<ORBid> ORBidList;
+
+ /** Server callback API, passed to Activator in active method.
+ */
+ interface Server {
+ /** Shutdown this server. Returns after orb.shutdown() completes.
+ */
+ void shutdown();
+
+ /** Install the server. Returns after the install hook completes
+ * execution in the server.
+ */
+ void install();
+
+ /** Uninstall the server. Returns after the uninstall hook
+ * completes execution.
+ */
+ void uninstall();
+ };
+
+ interface Activator {
+ // A new ORB started server registers itself with the Activator
+ void active(in ServerId serverId, in Server serverObj)
+ raises (ServerNotRegistered);
+
+ // Install a particular kind of endpoint
+ void registerEndpoints( in ServerId serverId, in ORBid orbId,
+ in EndpointInfoList endPointInfo)
+ raises (ServerNotRegistered,NoSuchEndPoint, ORBAlreadyRegistered) ;
+
+ // list active servers
+ ServerIds getActiveServers();
+
+ // If the server is not running, start it up.
+ void activate(in ServerId serverId)
+ raises (ServerAlreadyActive, ServerNotRegistered, ServerHeldDown);
+
+ // If the server is running, shut it down
+ void shutdown(in ServerId serverId)
+ raises (ServerNotActive, ServerNotRegistered);
+
+ // Invoke the server install hook. If the server is not
+ // currently running, this method will activate it.
+ void install(in ServerId serverId)
+ raises (ServerNotRegistered, ServerHeldDown,
+ ServerAlreadyInstalled);
+
+ // list all registered ORBs for a server
+ ORBidList getORBNames(in ServerId serverId)
+ raises (ServerNotRegistered);
+
+ // Invoke the server uninstall hook. If the server is not
+ // currently running, this method will activate it.
+ // After this hook completes, the server may still be running.
+ void uninstall(in ServerId serverId)
+ raises (ServerNotRegistered, ServerHeldDown,
+ ServerAlreadyUninstalled);
+ };
+
+ interface Locator {
+
+ // struct to return the list of endpoints for a server for a specific
+ // endpoint
+ struct ServerLocation {
+ string hostname;
+ ORBPortInfoList ports;
+ };
+
+ // struct to return the list of endpoints for a server for a specific
+ // ORB
+ struct ServerLocationPerORB {
+ string hostname;
+ EndpointInfoList ports;
+ };
+
+ // locate server - returns the port with a specific type for all registered
+ // ORBs of an active server.
+ // Starts the server if it is not already running.
+ ServerLocation locateServer(
+ in ServerId serverId,
+ in string endPoint)
+ raises(NoSuchEndPoint, ServerNotRegistered, ServerHeldDown);
+
+ // locate server - returns all ports registered with a specified ORB for
+ // an active server
+ // Starts the server if it is not already running.
+ ServerLocationPerORB locateServerForORB(
+ in ServerId serverId,
+ in ORBid orbId)
+ raises(InvalidORBid, ServerNotRegistered, ServerHeldDown);
+
+ // get the port for the endpoint of the locator
+ TCPPort getEndpoint(in string endPointType)
+ raises(NoSuchEndPoint);
+
+ // Useful from external BadServerIdHandlers which need
+ // to pick a particular port type.
+ TCPPort getServerPortForType(
+ in ServerLocationPerORB location,
+ in string endPointType)
+ raises(NoSuchEndPoint);
+ };
+
+ interface ServerManager : Activator, Locator { };
+
+ interface InitialNameService {
+ exception NameAlreadyBound {};
+
+ // bind initial name
+ void bind (
+ in string name,
+ in Object obj,
+ in boolean isPersistant) raises (NameAlreadyBound);
+
+ };
+
+ interface Repository {
+ // server program definition. We should make this a ValueType.
+ struct ServerDef {
+ string applicationName; // alias used for servers with identical
+ // serverName values.
+ string serverName; // Class name of server's main class.
+ string serverClassPath; // class path used to run the server.
+ string serverArgs;
+ string serverVmArgs;
+ };
+
+ // register server definition
+ // This returns the serverId of the server. A newly created server is
+ // always uninstalled.
+ ServerId registerServer (in ServerDef serverDef)
+ raises (ServerAlreadyRegistered, BadServerDefinition);
+
+ // unregister server definition
+ void unregisterServer (in ServerId serverId)
+ raises (ServerNotRegistered);
+
+ // get server definition
+ ServerDef getServer(in ServerId serverId)
+ raises (ServerNotRegistered);
+
+ // Return whether the server has been installed
+ boolean isInstalled( in ServerId serverId )
+ raises (ServerNotRegistered);
+
+ // Mark the server as being installed. Raises ServerAlreadyInstalled
+ // if the server is currently marked as installed.
+ void install( in ServerId serverId )
+ raises (ServerNotRegistered, ServerAlreadyInstalled) ;
+
+ // Mark the server as being uninstalled. Raises ServerAlreadyUninstalled
+ // if the server is currently marked as uninstalled.
+ void uninstall( in ServerId serverId )
+ raises (ServerNotRegistered, ServerAlreadyUninstalled) ;
+
+ // list registered servers
+ ServerIds listRegisteredServers ();
+
+ typedef sequence<string> StringSeq ;
+
+ // Returns list of ALL applicationNames defined in ServerDefs of registered
+ // servers.
+ StringSeq getApplicationNames();
+
+ // Find the ServerID associated with the given application name.
+ ServerId getServerID( in string applicationName )
+ raises (ServerNotRegistered) ;
+ };
+};
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/CopierManager.java b/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/CopierManager.java
new file mode 100644
index 0000000..abae75e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/CopierManager.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.copyobject ;
+
+/** 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.
+ */
+ 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.
+ */
+ int getDefaultId() ;
+
+ ObjectCopierFactory getObjectCopierFactory( int id ) ;
+
+ ObjectCopierFactory getDefaultObjectCopierFactory() ;
+
+ /** Register an ObjectCopierFactory under a particular id. This can be retrieved
+ * later by getObjectCopierFactory.
+ */
+ void registerObjectCopierFactory( ObjectCopierFactory factory, int id ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/CopyobjectDefaults.java b/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/CopyobjectDefaults.java
new file mode 100644
index 0000000..1c58e6e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/CopyobjectDefaults.java
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.copyobject ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.copyobject.ReferenceObjectCopierImpl ;
+import com.sun.corba.se.impl.copyobject.FallbackObjectCopierImpl ;
+import com.sun.corba.se.impl.copyobject.ORBStreamObjectCopierImpl ;
+import com.sun.corba.se.impl.copyobject.JavaStreamObjectCopierImpl ;
+
+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).
+ */
+ public static ObjectCopierFactory makeORBStreamObjectCopierFactory( final ORB orb )
+ {
+ return new ObjectCopierFactory() {
+ public ObjectCopier make( )
+ {
+ return new ORBStreamObjectCopierImpl( orb ) ;
+ }
+ } ;
+ }
+
+ public static ObjectCopierFactory makeJavaStreamObjectCopierFactory( final ORB orb )
+ {
+ return new ObjectCopierFactory() {
+ public ObjectCopier make( )
+ {
+ return new JavaStreamObjectCopierImpl( orb ) ;
+ }
+ } ;
+ }
+
+ private static final ObjectCopier referenceObjectCopier = new ReferenceObjectCopierImpl() ;
+
+ 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.
+ */
+ 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.
+ */
+ 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 ) ;
+ }
+ } ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ObjectCopier.java b/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ObjectCopier.java
new file mode 100644
index 0000000..8df5491
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ObjectCopier.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.copyobject ;
+
+/** Provides an interface for a variety of means to copy an arbitrary
+ * object. Any implementation of this interface must return an exact
+ * copy of obj, preserving all aliasing across all objects reachable
+ * from obj. ReflectiveCopyException must be thrown if the implementation
+ * cannot copy obj for some reason. Note that a trivial implementation
+ * of this interface is possible (always return obj), but this is often
+ * not the desired implementation.
+ */
+public interface ObjectCopier {
+ Object copy( Object obj ) throws ReflectiveCopyException ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ObjectCopierFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ObjectCopierFactory.java
new file mode 100644
index 0000000..e0f398e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ObjectCopierFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.copyobject ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+/** ObjectCopier factory interface used for registration.
+ */
+public interface ObjectCopierFactory {
+ /** Create a new instance of an ObjectCopier.
+ */
+ ObjectCopier make() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ReflectiveCopyException.java b/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ReflectiveCopyException.java
new file mode 100644
index 0000000..86d5516
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/copyobject/ReflectiveCopyException.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.copyobject ;
+
+public class ReflectiveCopyException extends Exception {
+ public ReflectiveCopyException()
+ {
+ super() ;
+ }
+
+ public ReflectiveCopyException( String msg )
+ {
+ super( msg ) ;
+ }
+
+ public ReflectiveCopyException( String msg, Throwable t )
+ {
+ super( msg, t ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/encoding/CorbaInputObject.java b/src/java.corba/share/classes/com/sun/corba/se/spi/encoding/CorbaInputObject.java
new file mode 100644
index 0000000..2bac77a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/encoding/CorbaInputObject.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.encoding ;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream ;
+import com.sun.corba.se.pept.encoding.InputObject ;
+
+public abstract class CorbaInputObject
+ extends CDRInputStream
+ implements InputObject
+{
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/encoding/CorbaOutputObject.java b/src/java.corba/share/classes/com/sun/corba/se/spi/encoding/CorbaOutputObject.java
new file mode 100644
index 0000000..152fe82
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/encoding/CorbaOutputObject.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.encoding ;
+
+import com.sun.corba.se.pept.encoding.OutputObject ;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+
+import com.sun.corba.se.impl.encoding.CDROutputStream ;
+import com.sun.corba.se.impl.encoding.BufferManagerWrite ;
+
+
+public abstract class CorbaOutputObject
+ extends CDROutputStream
+ implements OutputObject
+{
+ public CorbaOutputObject(
+ ORB orb, GIOPVersion version, byte encodingVersion,
+ boolean littleEndian, BufferManagerWrite bufferManager,
+ byte streamFormatVersion, boolean usePooledByteBuffers)
+ {
+ super(orb, version, encodingVersion, littleEndian, bufferManager,
+ streamFormatVersion, usePooledByteBuffers);
+ }
+
+ public abstract void writeTo(CorbaConnection connection)
+ throws java.io.IOException;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/extension/CopyObjectPolicy.java b/src/java.corba/share/classes/com/sun/corba/se/spi/extension/CopyObjectPolicy.java
new file mode 100644
index 0000000..59f4ff6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/extension/CopyObjectPolicy.java
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.extension ;
+
+import org.omg.CORBA.Policy ;
+import org.omg.CORBA.LocalObject ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+/** 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 int getValue()
+ {
+ return value ;
+ }
+
+ public int policy_type ()
+ {
+ return ORBConstants.COPY_OBJECT_POLICY ;
+ }
+
+ public org.omg.CORBA.Policy copy ()
+ {
+ return this ;
+ }
+
+ public void destroy ()
+ {
+ // NO-OP
+ }
+
+ public String toString()
+ {
+ return "CopyObjectPolicy[" + value + "]" ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/extension/RequestPartitioningPolicy.java b/src/java.corba/share/classes/com/sun/corba/se/spi/extension/RequestPartitioningPolicy.java
new file mode 100644
index 0000000..10cf9f8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/extension/RequestPartitioningPolicy.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.extension ;
+
+import org.omg.CORBA.Policy ;
+import org.omg.CORBA.LocalObject ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.orbutil.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.get( CORBALogDomains.OA_IOR ) ;
+ 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(
+ new Integer(value),
+ new Integer(
+ ORBConstants.REQUEST_PARTITIONING_MIN_THREAD_POOL_ID),
+ new Integer(
+ ORBConstants.REQUEST_PARTITIONING_MAX_THREAD_POOL_ID));
+ }
+ this.value = value;
+ }
+
+ public int getValue()
+ {
+ return value;
+ }
+
+ public int policy_type()
+ {
+ return ORBConstants.REQUEST_PARTITIONING_POLICY;
+ }
+
+ public org.omg.CORBA.Policy copy()
+ {
+ return this;
+ }
+
+ public void destroy()
+ {
+ // NO-OP
+ }
+
+ public String toString()
+ {
+ return "RequestPartitioningPolicy[" + value + "]" ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/extension/ServantCachingPolicy.java b/src/java.corba/share/classes/com/sun/corba/se/spi/extension/ServantCachingPolicy.java
new file mode 100644
index 0000000..35f225d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/extension/ServantCachingPolicy.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.extension ;
+
+import org.omg.CORBA.Policy ;
+import org.omg.CORBA.LocalObject ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+/** Policy used to implement servant caching optimization in the POA.
+* Creating a POA with an instance pol of this policy where
+* pol.getType() &gt; 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.
+* <p>
+* If servant caching is used, there are two different additional
+* features of the POA that are expensive:
+* <ol>
+* <li>POA current semantics
+* <li>Proper handling of POA destroy.
+* </ol>
+* 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 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 + ")" ;
+ }
+ }
+
+ public String toString()
+ {
+ return "ServantCachingPolicy[" + typeToName() + "]" ;
+ }
+
+ private ServantCachingPolicy( int type )
+ {
+ this.type = type ;
+ }
+
+ public int getType()
+ {
+ return type ;
+ }
+
+ /** Return the default servant caching policy.
+ */
+ public synchronized static ServantCachingPolicy getPolicy()
+ {
+ return getFullPolicy() ;
+ }
+
+ public synchronized static ServantCachingPolicy getFullPolicy()
+ {
+ if (policy == null)
+ policy = new ServantCachingPolicy( FULL_SEMANTICS ) ;
+
+ return policy ;
+ }
+
+ public synchronized static ServantCachingPolicy getInfoOnlyPolicy()
+ {
+ if (infoOnlyPolicy == null)
+ infoOnlyPolicy = new ServantCachingPolicy( INFO_ONLY_SEMANTICS ) ;
+
+ return infoOnlyPolicy ;
+ }
+
+ public synchronized static ServantCachingPolicy getMinimalPolicy()
+ {
+ if (minimalPolicy == null)
+ minimalPolicy = new ServantCachingPolicy( MINIMAL_SEMANTICS ) ;
+
+ return minimalPolicy ;
+ }
+
+ public int policy_type ()
+ {
+ return ORBConstants.SERVANT_CACHING_POLICY ;
+ }
+
+ public org.omg.CORBA.Policy copy ()
+ {
+ return this ;
+ }
+
+ public void destroy ()
+ {
+ // NO-OP
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/extension/ZeroPortPolicy.java b/src/java.corba/share/classes/com/sun/corba/se/spi/extension/ZeroPortPolicy.java
new file mode 100644
index 0000000..37a6286
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/extension/ZeroPortPolicy.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.extension ;
+
+import org.omg.CORBA.Policy ;
+import org.omg.CORBA.LocalObject ;
+import com.sun.corba.se.impl.orbutil.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 ) ;
+
+ private boolean flag = true ;
+
+ private ZeroPortPolicy( boolean type )
+ {
+ this.flag = type ;
+ }
+
+ public String toString()
+ {
+ return "ZeroPortPolicy[" + flag + "]" ;
+ }
+
+ public boolean forceZeroPort()
+ {
+ return flag ;
+ }
+
+ public synchronized static ZeroPortPolicy getPolicy()
+ {
+ return policy ;
+ }
+
+ public int policy_type ()
+ {
+ return ORBConstants.ZERO_PORT_POLICY ;
+ }
+
+ public org.omg.CORBA.Policy copy ()
+ {
+ return this ;
+ }
+
+ public void destroy ()
+ {
+ // NO-OP
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/EncapsulationFactoryBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/EncapsulationFactoryBase.java
new file mode 100644
index 0000000..e823016
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/EncapsulationFactoryBase.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import com.sun.corba.se.impl.ior.EncapsulationUtility ;
+
+public abstract class EncapsulationFactoryBase implements IdentifiableFactory {
+ private int id ;
+
+ public int getId()
+ {
+ return id ;
+ }
+
+ public EncapsulationFactoryBase( int id )
+ {
+ this.id = id ;
+ }
+
+ public final Identifiable create( InputStream in )
+ {
+ InputStream is = EncapsulationUtility.getEncapsulationStream( in ) ;
+ return readContents( is ) ;
+ }
+
+ protected abstract Identifiable readContents( InputStream is ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IOR.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IOR.java
new file mode 100644
index 0000000..62f21e8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IOR.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import java.util.List ;
+import java.util.Iterator ;
+
+import com.sun.corba.se.spi.orb.ORBVersion ;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+/** An IOR is represented as a list of profiles.
+* Only instances of TaggedProfile are contained in the list.
+*/
+public interface IOR extends List, Writeable, MakeImmutable
+{
+ ORB getORB() ;
+
+ /** Return the type id string from 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.
+ */
+ Iterator iteratorById( int id ) ;
+
+ /** Return a representation of this IOR in the standard GIOP stringified
+ * format that begins with "IOR:".
+ */
+ String stringify() ;
+
+ /** Return a representation of this IOR in the standard GIOP marshalled
+ * form.
+ */
+ org.omg.IOP.IOR getIOPIOR() ;
+
+ /** Return true if this IOR has no profiles.
+ */
+ 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.
+ */
+ boolean isEquivalent(IOR ior) ;
+
+ /** Return the IORTemplate for this IOR. This is simply a list
+ * of all TaggedProfileTemplates derived from the TaggedProfiles
+ * of the IOR.
+ */
+ IORTemplateList getIORTemplates() ;
+
+ /** Return the first IIOPProfile in this IOR.
+ * XXX THIS IS TEMPORARY FOR BACKWARDS COMPATIBILITY AND WILL BE REMOVED
+ * SOON!
+ */
+ IIOPProfile getProfile() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORFactories.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORFactories.java
new file mode 100644
index 0000000..f19cf88
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORFactories.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior ;
+
+import java.io.Serializable ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import org.omg.CORBA.BAD_PARAM ;
+import org.omg.CORBA.portable.ValueFactory ;
+
+import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
+import org.omg.PortableInterceptor.ObjectReferenceFactory ;
+
+import com.sun.corba.se.impl.ior.ObjectIdImpl ;
+import com.sun.corba.se.impl.ior.ObjectKeyImpl ;
+import com.sun.corba.se.impl.ior.IORImpl ;
+import com.sun.corba.se.impl.ior.IORTemplateImpl ;
+import com.sun.corba.se.impl.ior.IORTemplateListImpl ;
+import com.sun.corba.se.impl.ior.ObjectReferenceProducerBase ;
+import com.sun.corba.se.impl.ior.ObjectReferenceFactoryImpl ;
+import com.sun.corba.se.impl.ior.ObjectReferenceTemplateImpl ;
+import com.sun.corba.se.impl.ior.ObjectKeyFactoryImpl ;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+import com.sun.corba.se.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:
+ * <ul>
+ * <li>ObjectId</li>
+ * <li>ObjectKey</li>
+ * <li>IOR</li>
+ * <li>IORTemplate</li>
+ * </ul>
+ */
+public class IORFactories {
+ private IORFactories() {}
+
+ /** Create an ObjectId for the given byte sequence.
+ */
+ public static ObjectId makeObjectId( byte[] id )
+ {
+ return new ObjectIdImpl( id ) ;
+ }
+
+ /** Create an ObjectKey for the given ObjectKeyTemplate and
+ * ObjectId.
+ */
+ 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.
+ */
+ 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.
+ */
+ public static IOR makeIOR( ORB orb )
+ {
+ return new IORImpl( orb ) ;
+ }
+
+ /** Read an IOR from an InputStream. ObjectKeys are not shared.
+ */
+ public static IOR makeIOR( InputStream is )
+ {
+ return new IORImpl( is ) ;
+ }
+
+ /** Create an IORTemplate with the given ObjectKeyTemplate. The result
+ * is mutable.
+ */
+ public static IORTemplate makeIORTemplate( ObjectKeyTemplate oktemp )
+ {
+ return new IORTemplateImpl( oktemp ) ;
+ }
+
+ /** Read an IORTemplate from an InputStream.
+ */
+ public static IORTemplate makeIORTemplate( InputStream is )
+ {
+ return new IORTemplateImpl( is ) ;
+ }
+
+ public static IORTemplateList makeIORTemplateList()
+ {
+ return new IORTemplateListImpl() ;
+ }
+
+ public static IORTemplateList makeIORTemplateList( InputStream is )
+ {
+ return new IORTemplateListImpl( is ) ;
+ }
+
+ public static IORFactory getIORFactory( ObjectReferenceTemplate ort )
+ {
+ if (ort instanceof ObjectReferenceTemplateImpl) {
+ ObjectReferenceTemplateImpl orti =
+ (ObjectReferenceTemplateImpl)ort ;
+ return orti.getIORFactory() ;
+ }
+
+ throw new BAD_PARAM() ;
+ }
+
+ public static IORTemplateList getIORTemplateList( ObjectReferenceFactory orf )
+ {
+ if (orf instanceof ObjectReferenceProducerBase) {
+ ObjectReferenceProducerBase base =
+ (ObjectReferenceProducerBase)orf ;
+ return base.getIORTemplateList() ;
+ }
+
+ throw new BAD_PARAM() ;
+ }
+
+ 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 ObjectKeyFactory makeObjectKeyFactory( ORB orb )
+ {
+ return new ObjectKeyFactoryImpl( orb ) ;
+ }
+
+ public static IOR getIOR( org.omg.CORBA.Object obj )
+ {
+ return ORBUtility.getIOR( obj ) ;
+ }
+
+ 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.
+ */
+ 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 ) ;
+ }
+ } ;
+
+ 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 ) ;
+ }
+ } ;
+
+ orb.register_value_factory( ObjectReferenceFactoryImpl.repositoryId, vf ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORFactory.java
new file mode 100644
index 0000000..e6b6ad3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORFactory.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior ;
+
+import com.sun.corba.se.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.
+ */
+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.
+ */
+ 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.
+ */
+ boolean isEquivalent( IORFactory other ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTemplate.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTemplate.java
new file mode 100644
index 0000000..91ea5d9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTemplate.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior ;
+
+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. It is a list of TaggedProfileTemplates.
+ */
+public interface IORTemplate extends List, IORFactory, MakeImmutable {
+ /** Iterate over all TaggedProfileTemplates in this IORTemplate
+ * with the given id.
+ */
+ Iterator iteratorById( int id ) ;
+
+ ObjectKeyTemplate getObjectKeyTemplate() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTemplateList.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTemplateList.java
new file mode 100644
index 0000000..5ee8949
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IORTemplateList.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior ;
+
+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.
+ */
+public interface IORTemplateList extends List, IORFactory, MakeImmutable {
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/Identifiable.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/Identifiable.java
new file mode 100644
index 0000000..01279d7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/Identifiable.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package com.sun.corba.se.spi.ior;
+
+
+/** 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.
+ * @return int
+ */
+ public int getId();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableBase.java
new file mode 100644
index 0000000..a8e896a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableBase.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.Writeable ;
+import com.sun.corba.se.spi.ior.WriteContents ;
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.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 ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableContainerBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableContainerBase.java
new file mode 100644
index 0000000..ca902ea
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableContainerBase.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import com.sun.corba.se.impl.ior.FreezableList ;
+
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+import com.sun.corba.se.spi.ior.Identifiable ;
+
+/** 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 IdentifiableContainerBase()
+ {
+ super( new ArrayList() ) ;
+ }
+
+ /** Return an iterator which iterates over all contained Identifiables
+ * with type given by id.
+ */
+ public Iterator iteratorById( final int id)
+ {
+ return new Iterator() {
+ Iterator iter = IdentifiableContainerBase.this.iterator() ;
+ Object current = advance() ;
+
+ private Object advance()
+ {
+ while (iter.hasNext()) {
+ Identifiable ide = (Identifiable)(iter.next()) ;
+ if (ide.getId() == id)
+ return ide ;
+ }
+
+ return null ;
+ }
+
+ public boolean hasNext()
+ {
+ return current != null ;
+ }
+
+ public Object next()
+ {
+ Object result = current ;
+ current = advance() ;
+ return result ;
+ }
+
+ public void remove()
+ {
+ iter.remove() ;
+ }
+ } ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableFactory.java
new file mode 100644
index 0000000..ccb8e8d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableFactory.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import com.sun.corba.se.spi.ior.Identifiable ;
+
+/** 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.
+ */
+ public int getId() ;
+
+ /** Construct the appropriate Identifiable object with the
+ * given id from the InputStream is.
+ */
+ public Identifiable create( InputStream in ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableFactoryFinder.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableFactoryFinder.java
new file mode 100644
index 0000000..d3aaeb6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/IdentifiableFactoryFinder.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+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.
+ * @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.
+ */
+ Identifiable create(int id, InputStream is);
+
+ /** Register a factory for the given id.
+ */
+ void registerFactory( IdentifiableFactory factory ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/MakeImmutable.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/MakeImmutable.java
new file mode 100644
index 0000000..2af1293
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/MakeImmutable.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior ;
+
+public interface MakeImmutable {
+ void makeImmutable() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectAdapterId.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectAdapterId.java
new file mode 100644
index 0000000..1486901
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectAdapterId.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior ;
+
+import java.util.Iterator ;
+
+/** 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.
+*/
+public interface ObjectAdapterId extends Writeable {
+ /** Return the number of elements in the adapter ID.
+ */
+ int getNumLevels() ;
+
+ /** Return an iterator that iterates over the components
+ * of this adapter ID. Each element is returned as a String.
+ */
+ Iterator iterator() ;
+
+ /** Get the adapter name simply as an array of strings.
+ */
+ String[] getAdapterName() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectId.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectId.java
new file mode 100644
index 0000000..93f42aa
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectId.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public interface ObjectId extends Writeable
+{
+ public byte[] getId() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKey.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKey.java
new file mode 100644
index 0000000..b96fdd8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKey.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+/** 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.
+ */
+ ObjectId getId() ;
+
+ /** Return the template for this object key.
+ */
+ ObjectKeyTemplate getTemplate() ;
+
+ byte[] getBytes( org.omg.CORBA.ORB orb ) ;
+
+ CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKeyFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKeyFactory.java
new file mode 100644
index 0000000..7254ea0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKeyFactory.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import com.sun.corba.se.spi.ior.ObjectKey ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+
+/** Construct ObjectKey and ObjectKeyTemplate instances from their
+ * CDR-marshalled representation.
+ */
+public interface ObjectKeyFactory
+{
+ /** Create an ObjectKey from its octet sequence representation.
+ */
+ ObjectKey create( byte[] key ) ;
+
+ /** Create an ObjectKeyTemplate from its representation
+ * in an InputStream.
+ */
+ ObjectKeyTemplate createTemplate( InputStream is ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKeyTemplate.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKeyTemplate.java
new file mode 100644
index 0000000..348cd15
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/ObjectKeyTemplate.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+
+/** 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.
+ */
+public interface ObjectKeyTemplate extends Writeable
+{
+ 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.
+ */
+ 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.
+ */
+ public int getServerId() ;
+
+ /** Return the ORB ID for this template.
+ */
+ public String getORBId() ;
+
+ /** Return the object adapter ID for this template.
+ */
+ 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.
+ */
+ public byte[] getAdapterId() ;
+
+ public void write(ObjectId objectId, OutputStream os);
+
+ public CorbaServerRequestDispatcher getServerRequestDispatcher( ORB orb, ObjectId id ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponent.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponent.java
new file mode 100644
index 0000000..790029d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponent.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+import org.omg.CORBA.ORB ;
+
+/** 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.
+*/
+public interface TaggedComponent extends Identifiable
+{
+ org.omg.IOP.TaggedComponent getIOPComponent( ORB orb ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java
new file mode 100644
index 0000000..7461723
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponentBase.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+
+/** 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 =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)orb);
+ write( os ) ;
+ InputStream is = (InputStream)(os.create_input_stream() ) ;
+ return org.omg.IOP.TaggedComponentHelper.read( is ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponentFactoryFinder.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponentFactoryFinder.java
new file mode 100644
index 0000000..0f29523
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedComponentFactoryFinder.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.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.
+ */
+ TaggedComponent create( org.omg.CORBA.ORB orb,
+ org.omg.IOP.TaggedComponent comp ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfile.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfile.java
new file mode 100644
index 0000000..94bc80d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfile.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+/** 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.
+ */
+public interface TaggedProfile extends Identifiable, MakeImmutable
+{
+ TaggedProfileTemplate getTaggedProfileTemplate() ;
+
+ ObjectId getObjectId() ;
+
+ ObjectKeyTemplate getObjectKeyTemplate() ;
+
+ 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() ).
+ */
+ boolean isEquivalent( TaggedProfile prof ) ;
+
+ /** Return the TaggedProfile as a CDR encapsulation in the standard
+ * format. This is required for Portable interceptors.
+ */
+ org.omg.IOP.TaggedProfile getIOPProfile();
+
+ /** Return true if this TaggedProfile was created in orb.
+ * Caches the result.
+ */
+ boolean isLocal() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfileTemplate.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfileTemplate.java
new file mode 100644
index 0000000..bac3308
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfileTemplate.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import java.util.List ;
+import java.util.Iterator ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.Identifiable ;
+import com.sun.corba.se.spi.ior.Writeable ;
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.WriteContents ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+/** 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
+*/
+public interface TaggedProfileTemplate extends List, Identifiable,
+ WriteContents, MakeImmutable
+{
+ /** Return an iterator that iterates over tagged components with
+ * identifier id. It is not possible to modify the list through this
+ * iterator.
+ */
+ public Iterator iteratorById( int id ) ;
+
+ /** Create a TaggedProfile from this template.
+ */
+ TaggedProfile create( ObjectKeyTemplate oktemp, ObjectId id ) ;
+
+ /** Write the profile create( oktemp, id ) to the 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.
+ */
+ 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
+ * components.
+ */
+ org.omg.IOP.TaggedComponent[] getIOPComponents(
+ ORB orb, int id );
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfileTemplateBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfileTemplateBase.java
new file mode 100644
index 0000000..23f4c3e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/TaggedProfileTemplateBase.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import java.util.Iterator ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.ior.EncapsulationUtility ;
+
+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 ) ;
+ while (iter.hasNext()) {
+ iter.next() ;
+ count++ ;
+ }
+
+ org.omg.IOP.TaggedComponent[] result = new
+ org.omg.IOP.TaggedComponent[count] ;
+
+ int index = 0 ;
+ iter = iteratorById( id ) ;
+ while (iter.hasNext()) {
+ TaggedComponent comp = (TaggedComponent)(iter.next()) ;
+ result[index++] = comp.getIOPComponent( orb ) ;
+ }
+
+ return result ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/WriteContents.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/WriteContents.java
new file mode 100644
index 0000000..b4d7e93
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/WriteContents.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+public interface WriteContents {
+ void writeContents( OutputStream os ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/Writeable.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/Writeable.java
new file mode 100644
index 0000000..dff85be
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/Writeable.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior;
+
+import org.omg.CORBA_2_3.portable.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.
+ */
+ void write(OutputStream arg0);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/AlternateIIOPAddressComponent.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/AlternateIIOPAddressComponent.java
new file mode 100644
index 0000000..8992d1c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/AlternateIIOPAddressComponent.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior.iiop;
+
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public interface AlternateIIOPAddressComponent extends TaggedComponent
+{
+ public IIOPAddress getAddress() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/CodeSetsComponent.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/CodeSetsComponent.java
new file mode 100644
index 0000000..78f42e8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/CodeSetsComponent.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior.iiop;
+
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public interface CodeSetsComponent extends TaggedComponent
+{
+ public CodeSetComponentInfo getCodeSetComponentInfo() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/GIOPVersion.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/GIOPVersion.java
new file mode 100644
index 0000000..a82f8dd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/GIOPVersion.java
@@ -0,0 +1,219 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior.iiop ;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.orb.ORBVersion;
+import com.sun.corba.se.spi.orb.ORBVersionFactory;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+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);
+
+ // Major version 13 indicates Java serialization,
+ // Minor version [00-FF] is the version number.
+ public static final GIOPVersion V13_XX =
+ new GIOPVersion((byte)13, (byte)Message.JAVA_ENC_VERSION);
+
+ public static final GIOPVersion DEFAULT_VERSION = V1_2;
+
+ public static final int VERSION_1_0 = 0x0100;
+ 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 =
+ ((0x0D << 8) & 0x0000FF00) | Message.JAVA_ENC_VERSION;
+
+ // Instance variables
+
+ private byte major = (byte) 0;
+ private byte minor = (byte) 0;
+
+ // Constructor
+
+ public GIOPVersion() {}
+
+ public GIOPVersion(byte majorB, byte minorB) {
+ this.major = majorB;
+ this.minor = minorB;
+ }
+
+ public GIOPVersion(int major, int minor) {
+ this.major = (byte)major;
+ this.minor = (byte)minor;
+ }
+
+ // Accessor methods
+
+ public byte getMajor() {
+ return this.major;
+ }
+
+ public byte getMinor() {
+ return this.minor;
+ }
+
+ // General methods
+
+ public boolean equals(GIOPVersion gv){
+ return gv.major == this.major && gv.minor == this.minor ;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj != null && (obj instanceof GIOPVersion))
+ return equals((GIOPVersion)obj);
+ else
+ return false;
+ }
+
+ public int hashCode()
+ {
+ return 37*major + minor ;
+ }
+
+ public boolean lessThan(GIOPVersion gv) {
+ if (this.major < gv.major) {
+ return true;
+ } else if (this.major == gv.major) {
+ if (this.minor < gv.minor) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public int intValue()
+ {
+ return (major << 8 | minor);
+ }
+
+ 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 parseVersion(String s)
+ {
+ int dotIdx = s.indexOf('.');
+
+ if (dotIdx < 1 || dotIdx == s.length() - 1)
+ throw new NumberFormatException("GIOP major, minor, and decimal point required: " + 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);
+ }
+
+ /**
+ * This chooses the appropriate GIOP version.
+ *
+ * @return the GIOP version 13.00 if Java serialization is enabled, or
+ * smallest(profGIOPVersion, orbGIOPVersion)
+ */
+ public static GIOPVersion chooseRequestVersion(ORB orb, IOR ior ) {
+
+ GIOPVersion orbVersion = orb.getORBData().getGIOPVersion();
+ 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())) {
+ // 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;
+ }
+
+ // Now the target has to be (FOREIGN | NEWER*)
+
+ byte prof_major = profVersion.getMajor();
+ byte prof_minor = profVersion.getMinor();
+
+ byte orb_major = orbVersion.getMajor();
+ byte orb_minor = orbVersion.getMinor();
+
+ if (orb_major < prof_major) {
+ return orbVersion;
+ } else if (orb_major > prof_major) {
+ return profVersion;
+ } else { // both major version are the same
+ if (orb_minor <= prof_minor) {
+ return orbVersion;
+ } else {
+ return profVersion;
+ }
+ }
+ }
+
+ public boolean supportsIORIIOPProfileComponents()
+ {
+ return getMinor() > 0 || getMajor() > 1;
+ }
+
+ // IO methods
+
+ public void read(org.omg.CORBA.portable.InputStream istream) {
+ this.major = istream.read_octet();
+ this.minor = istream.read_octet();
+ }
+
+ public void write(org.omg.CORBA.portable.OutputStream ostream) {
+ ostream.write_octet(this.major);
+ ostream.write_octet(this.minor);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPAddress.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPAddress.java
new file mode 100644
index 0000000..4c1175d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPAddress.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior.iiop;
+
+import com.sun.corba.se.spi.ior.Writeable ;
+
+/** IIOPAddress represents the host and port used to establish a
+ * TCP connection for an IIOP request.
+ */
+public interface IIOPAddress extends Writeable
+{
+ public String getHost() ;
+
+ public int getPort() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPFactories.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPFactories.java
new file mode 100644
index 0000000..23403eb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPFactories.java
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior.iiop ;
+
+import org.omg.CORBA_2_3.portable.InputStream ;
+
+import com.sun.corba.se.spi.ior.Identifiable ;
+import com.sun.corba.se.spi.ior.IdentifiableFactory ;
+import com.sun.corba.se.spi.ior.EncapsulationFactoryBase ;
+import com.sun.corba.se.spi.ior.ObjectId ;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+
+import com.sun.corba.se.spi.ior.iiop.IIOPAddress ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfileTemplate ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.impl.encoding.MarshalInputStream ;
+
+import com.sun.corba.se.impl.ior.iiop.IIOPAddressImpl ;
+import com.sun.corba.se.impl.ior.iiop.CodeSetsComponentImpl ;
+import com.sun.corba.se.impl.ior.iiop.AlternateIIOPAddressComponentImpl ;
+import com.sun.corba.se.impl.ior.iiop.JavaCodebaseComponentImpl ;
+import com.sun.corba.se.impl.ior.iiop.MaxStreamFormatVersionComponentImpl ;
+import com.sun.corba.se.impl.ior.iiop.JavaSerializationComponent;
+import com.sun.corba.se.impl.ior.iiop.ORBTypeComponentImpl ;
+import com.sun.corba.se.impl.ior.iiop.IIOPProfileImpl ;
+import com.sun.corba.se.impl.ior.iiop.IIOPProfileTemplateImpl ;
+import com.sun.corba.se.impl.ior.iiop.RequestPartitioningComponentImpl ;
+import com.sun.corba.se.impl.orbutil.ORBConstants;
+import com.sun.corba.se.impl.orbutil.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.
+ */
+public abstract class IIOPFactories {
+ private IIOPFactories() {}
+
+ public static IdentifiableFactory makeRequestPartitioningComponentFactory()
+ {
+ return new EncapsulationFactoryBase(ORBConstants.TAG_REQUEST_PARTITIONING_ID) {
+ public Identifiable readContents(InputStream in)
+ {
+ int threadPoolToUse = in.read_ulong();
+ Identifiable comp =
+ new RequestPartitioningComponentImpl(threadPoolToUse);
+ return comp;
+ }
+ };
+ }
+
+ public static RequestPartitioningComponent makeRequestPartitioningComponent(
+ int threadPoolToUse)
+ {
+ return new RequestPartitioningComponentImpl(threadPoolToUse);
+ }
+
+ 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 static AlternateIIOPAddressComponent makeAlternateIIOPAddressComponent(
+ IIOPAddress addr )
+ {
+ return new AlternateIIOPAddressComponentImpl( addr ) ;
+ }
+
+ public static IdentifiableFactory makeCodeSetsComponentFactory()
+ {
+ return new EncapsulationFactoryBase(TAG_CODE_SETS.value) {
+ public Identifiable readContents( InputStream in )
+ {
+ return new CodeSetsComponentImpl( in ) ;
+ }
+ } ;
+ }
+
+ public static CodeSetsComponent makeCodeSetsComponent( ORB orb )
+ {
+ return new CodeSetsComponentImpl( orb ) ;
+ }
+
+ 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 static JavaCodebaseComponent makeJavaCodebaseComponent(
+ String codebase )
+ {
+ return new JavaCodebaseComponentImpl( codebase ) ;
+ }
+
+ 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 static ORBTypeComponent makeORBTypeComponent( int type )
+ {
+ return new ORBTypeComponentImpl( type ) ;
+ }
+
+ public static IdentifiableFactory makeMaxStreamFormatVersionComponentFactory()
+ {
+ return new EncapsulationFactoryBase(TAG_RMI_CUSTOM_MAX_STREAM_FORMAT.value) {
+ public Identifiable readContents(InputStream in)
+ {
+ byte version = in.read_octet() ;
+ Identifiable comp = new MaxStreamFormatVersionComponentImpl(version);
+ return comp ;
+ }
+ };
+ }
+
+ public static MaxStreamFormatVersionComponent makeMaxStreamFormatVersionComponent()
+ {
+ return new MaxStreamFormatVersionComponentImpl() ;
+ }
+
+ public static IdentifiableFactory makeJavaSerializationComponentFactory() {
+ return new EncapsulationFactoryBase(
+ ORBConstants.TAG_JAVA_SERIALIZATION_ID) {
+ public Identifiable readContents(InputStream in) {
+ byte version = in.read_octet();
+ Identifiable cmp = new JavaSerializationComponent(version);
+ return cmp;
+ }
+ };
+ }
+
+ public static JavaSerializationComponent makeJavaSerializationComponent() {
+ return JavaSerializationComponent.singleton();
+ }
+
+ public static IdentifiableFactory makeIIOPProfileFactory()
+ {
+ return new EncapsulationFactoryBase(TAG_INTERNET_IOP.value) {
+ 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,
+ org.omg.IOP.TaggedProfile profile )
+ {
+ return new IIOPProfileImpl( orb, profile ) ;
+ }
+
+ public static IdentifiableFactory makeIIOPProfileTemplateFactory()
+ {
+ return new EncapsulationFactoryBase(TAG_INTERNET_IOP.value) {
+ 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 IIOPAddress makeIIOPAddress( ORB orb, String host, int port )
+ {
+ return new IIOPAddressImpl( orb, host, port ) ;
+ }
+
+ public static IIOPAddress makeIIOPAddress( InputStream is )
+ {
+ return new IIOPAddressImpl( is ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPProfile.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPProfile.java
new file mode 100644
index 0000000..0a42160
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPProfile.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior.iiop;
+
+import com.sun.corba.se.spi.ior.TaggedProfile ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.ORBVersion ;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+
+/** 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.
+*/
+public interface IIOPProfile extends TaggedProfile
+{
+ 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.
+ * XXX move this to the ObjectKeyTemplate
+ */
+ java.lang.Object getServant() ;
+
+ /** Return the GIOPVersion of this profile. Caches the result.
+ */
+ GIOPVersion getGIOPVersion() ;
+
+ /** Return the Codebase of this profile. Caches the result.
+ */
+ String getCodebase() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPProfileTemplate.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPProfileTemplate.java
new file mode 100644
index 0000000..939ec30
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/IIOPProfileTemplate.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior.iiop;
+
+import java.util.List ;
+import java.util.Iterator ;
+
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.ior.TaggedProfileTemplate ;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+import com.sun.corba.se.spi.orb.ORB ;
+
+/**
+ * IIOPProfileTemplate represents the parts of an IIOPProfile that are independent
+ * of the object identifier. It is a container of tagged components.
+ */
+public interface IIOPProfileTemplate extends TaggedProfileTemplate
+{
+ /** Return the GIOP version of this profile.
+ */
+ 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.
+ */
+ public IIOPAddress getPrimaryAddress() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/JavaCodebaseComponent.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/JavaCodebaseComponent.java
new file mode 100644
index 0000000..11106e5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/JavaCodebaseComponent.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior.iiop;
+
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public interface JavaCodebaseComponent extends TaggedComponent
+{
+ public String getURLs() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/MaxStreamFormatVersionComponent.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/MaxStreamFormatVersionComponent.java
new file mode 100644
index 0000000..c67e942
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/MaxStreamFormatVersionComponent.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.ior.iiop;
+
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+
+// Java to IDL ptc 02-01-12 1.4.11
+// TAG_RMI_CUSTOM_MAX_STREAM_FORMAT
+public interface MaxStreamFormatVersionComponent extends TaggedComponent
+{
+ public byte getMaxStreamFormatVersion() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/ORBTypeComponent.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/ORBTypeComponent.java
new file mode 100644
index 0000000..d9dabe0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/ORBTypeComponent.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.ior.iiop;
+
+import com.sun.corba.se.spi.ior.TaggedComponent ;
+
+/**
+ * @author Ken Cavanaugh
+ */
+public interface ORBTypeComponent extends TaggedComponent
+{
+ public int getORBType() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/RequestPartitioningComponent.java b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/RequestPartitioningComponent.java
new file mode 100644
index 0000000..a6716d9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iiop/RequestPartitioningComponent.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.ior.iiop;
+
+import com.sun.corba.se.spi.ior.TaggedComponent;
+
+public interface RequestPartitioningComponent extends TaggedComponent
+{
+ public int getRequestPartitioningId();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iornotes b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iornotes
new file mode 100644
index 0000000..9784546
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/iornotes
@@ -0,0 +1,107 @@
+Implementation hierarchies in the IOR code
+
+Utility classes:
+ impl.ior.ByteBuffer class used to speed up computation of the adapter id
+ impl.ior.EncapsulationUtility misc. utilities for dealing with CDR encapsulation
+ impl.ior.FreezableList special list class that can change from mutable to immutable (one way only)
+ impl.ior.MinorCodes minor codes for all IOR errors
+ impl.ior.ORTImpl wrapper around IORTemplate for ORT
+ spi.ior.IORFactories factory for all basic IOR types
+ spi.ior.IIOP.???Factories factory for IIOP IOR factory types (IIOPProfile, IIOPProfileTemplate,
+ and all of the supported IIOP tagged component factories)
+ This needs to provide access to all of the IdentifiableFactory instances
+ we need for registration. It also needs to provide factory methods for
+ creating all of these types.
+ impl.ior.iiop.TaggedComponentFactories needs to be absorbed here.
+
+
+Support for non-registered (unknown) TaggedComponent and TaggedProfile instances
+ impl.ior.GenericIdEncapsulation
+ impl.ior.GenericTaggedComponent
+ impl.ior.GenericTaggedProfile
+
+Basic common representation for writing, getting ids, inherited lists:
+ spi.ior.IdentifiableContainerBase
+ spi.ior.Writeable
+ spi.ior.Identifiable
+ spi.ior.IdentifiableBase
+
+Some basic IOR types and their implementation:
+ spi.ior.IOR
+ impl.ior.IORImpl
+
+ spi.ior.IORTemplate
+ impl.ior.IORTemplateImpl
+
+ spi.ior.IdentifiableFactory (the basic factory type, which is never created in the spi.ior package.
+ All instances of this factory are necessarily protocol dependent, for example IIOP in the
+ spi.ior.iiop package).
+ spi.ior.IdentifiableFactoryFinder
+ impl.ior.IdentifiableFactoryFinderBase
+ impl.ior.TaggedComponentFactoryFinderImpl
+ impl.ior.TaggedProfileFactoryFinderImpl
+
+ spi.ior.ObjectAdapterId
+ impl.ior.ObjectAdapterIdBase
+ impl.ior.ObjectAdapterIdArray
+ impl.ior.ObjectAdapterIdNumber
+
+ spi.ior.ObjectId
+ impl.ior.ObjectIdImpl
+
+ spi.ior.ObjectKey
+ impl.ior.ObjectKeyImpl
+
+The ObjectKeyTemplate family, which needs some work for pluggability yet:
+ impl.ior.ObjectKeyFactory
+ impl.ior.ObjectKeyTemplateFactory : should this be in the SPI?
+ spi.ior.ObjectKeyTemplate
+ impl.ior.WireObjectKeyTemplate
+ impl.ior.ObjectKeyTemplateBase
+ impl.ior.OldObjectKeyTemplateBase
+ impl.ior.OldJIDLObjectKeyTemplate
+ impl.ior.OldPOAObjectKeyTemplate
+ impl.ior.NewObjectKeyTemplateBase
+ impl.ior.JIDLObjectKeyTemplate
+ impl.ior.POAObjectKeyTemplate
+
+IIOP types and their implementations:
+ spi.ior.TaggedComponent
+ spi.ior.TaggedComponentBase
+ impl.ior.iiop.AlternateIIOPAddressComponent
+ impl.ior.iiop.CodeSetsComponent
+ impl.ior.iiop.JavaCodebaseComponent
+ impl.ior.iiop.MaxStreamFormatVersionComponent
+ impl.ior.iiop.ORBTypeComponent
+ impl.ior.iiop.PoliciesComponent
+
+ spi.ior.TaggedProfile
+ spi.ior.iiop.IIOPProfile
+ impl.ior.iiop.IIOPProfileImpl
+
+ spi.ior.TaggedProfileTemplate
+ spi.ior.iiop.IIOPProfileTemplate
+ impl.ior.iiop.IIOPProfileTemplateImpl
+
+ spi.ior.iiop.IIOPAddress
+ impl.ior.iiop.IIOPAddressBase
+ impl.ior.iiop.IIOPAddressFutureImpl
+ impl.ior.iiop.IIOPAddressImpl
+
+Issues:
+
+1. GIOPVersion.chooseRequestVersion( ORB, IOR ) is not well-defined: it should be
+ (ORB, IIOPProfile).
+ Call sites:
+ Connection.locate: not used
+ Called from GIOPImpl.locate: not used
+ CorbaContactInfoImpl.createMessageMediator
+ This needs a version that looks only at a single profile.
+
+2. MessageBase.createRequest takes an IOR instead of an IIOPProfile.
+
+3. CDRInputStream_1_0.read_Object( Class ) calls IOR.getCodebase() in
+ a call to Utility.loadStubClass, which is
+ only defined on a profile. What do we do here?
+ Similar problem in same class internalIORToObject, which call IOR.getServant
+ and IOR.getCodebase. IOR.getCodeBase is called in loadStub.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/ior/package.html b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/package.html
new file mode 100644
index 0000000..e3784dc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/ior/package.html
@@ -0,0 +1,64 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+-->
+
+</head>
+<body bgcolor="white">
+<p>
+Provides access to the components and profiles in an IOR without the overhead
+of CDR encoding.
+<p>
+The abstract model of IORs works as follows:
+
+<ul>
+<li>An IOR has a type ID string, and contains TaggedProfile instances.</li>
+<li>An IIOPProfile isA TaggedProfile.</li>
+<li>An IIOPProfile is composed of an IIOPProfileTemplate and an object ID.</li>
+<li>An IIOPProfileTemplate has an ObjectKeyTemplate, and contains TaggedComponents.</li>
+<li>A TaggedComponent has an ID, and can be written to an OuputStream.</li>
+<li>A TaggedComponentFactory reads a TaggedComponent from an InputStream.</li>
+</ul>
+<p>
+In all cases, containment is represented by having the appropriate interface (IOR and
+IIOPProfileTemplate above) extend java.util.List. This makes it easy to use all of the
+facilities in the Java collections framework with IORs. However, note that all
+objects available through these APIs are immutable. Thus all list update operations
+through UnsupportedOperationException, and list iterators cannot modify the underlying
+list.
+<p>
+Templates are used because the basic object adapter model for object creation is to
+establish all properties of an IOR (except for type and object ID) when the object
+adapter is created. This has been present for the POA essentially from the beginning,
+since policies can only be passed to create_POA, and cannot be changed on an existing
+POA. The Portable Interceptors work has also made this clear, since the IOR interceptor
+runs only when an object adapter is created, which is the only time that user code
+can add tagged components to an IOR.
+
+</body>
+</html>
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/Connection.java b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/Connection.java
new file mode 100644
index 0000000..653d776
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/Connection.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.legacy.connection;
+
+/**
+ * This interface represents the connection on which a request is made.
+ */
+
+public interface Connection
+{
+ public java.net.Socket getSocket();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/GetEndPointInfoAgainException.java b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/GetEndPointInfoAgainException.java
new file mode 100644
index 0000000..f81b0a5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/GetEndPointInfoAgainException.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.legacy.connection;
+
+import com.sun.corba.se.spi.transport.SocketInfo;
+
+/**
+ * This exception is raised by <code>ORBSocketFactory.createSocket</code>.
+ * It informs the ORB that it should call
+ * <code>ORBSocketFactory.getEndPointInfo</code> again with the
+ * given <code>socketInfo</code> object as an argument (i.e., a cookie).
+ *
+ */
+
+public class GetEndPointInfoAgainException
+ extends Exception
+{
+ private SocketInfo socketInfo;
+
+ public GetEndPointInfoAgainException(SocketInfo socketInfo)
+ {
+ this.socketInfo = socketInfo;
+ }
+
+ public SocketInfo getEndPointInfo()
+ {
+ return socketInfo;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/LegacyServerSocketEndPointInfo.java b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/LegacyServerSocketEndPointInfo.java
new file mode 100644
index 0000000..012ce2a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/LegacyServerSocketEndPointInfo.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.legacy.connection;
+
+/**
+ * LegacyServerSocketEndPointInfo is an abstraction of a port.
+ */
+public interface LegacyServerSocketEndPointInfo
+{
+ /**
+ * e.g.: "CLEAR_TEXT", "SSL", ...
+ */
+ 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.
+ */
+ public String getHostName();
+
+ public int getPort();
+
+ /**
+ * The ORBD's proxy port of this end point.
+ * Note: Pre-ORT "port-exchange" model.
+ */
+ public int getLocatorPort();
+ public void setLocatorPort(int port);
+
+ // NAME is used while we still have a "port-exchange" ORBD
+ // to get what used to be called "default" or "bootstrap" endpoints.
+
+ public static final String DEFAULT_ENDPOINT = "DEFAULT_ENDPOINT";
+ public static final String BOOT_NAMING = "BOOT_NAMING";
+ public static final String NO_NAME = "NO_NAME";
+
+ public String getName();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/LegacyServerSocketManager.java b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/LegacyServerSocketManager.java
new file mode 100644
index 0000000..f30a4c3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/LegacyServerSocketManager.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.legacy.connection;
+
+import java.util.Collection;
+
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketEndPointInfo;
+import com.sun.corba.se.spi.transport.SocketOrChannelAcceptor;
+
+/**
+ * @author Harold Carr
+ */
+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/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/ORBSocketFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/ORBSocketFactory.java
new file mode 100644
index 0000000..d75aaa1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/ORBSocketFactory.java
@@ -0,0 +1,358 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.legacy.connection;
+
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.io.IOException;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.transport.SocketInfo;
+
+/**
+ *
+ * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. <p>
+ * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. <p>
+ *
+ * This interface gives one the ability to plug in their own socket
+ * factory class to an ORB. <p>
+ *
+ * Usage: <p>
+ *
+ * One specifies a class which implements this interface via the
+ *
+ * <code>ORBConstants.SOCKET_FACTORY_CLASS_PROPERTY</code>
+ *
+ * property. <p>
+ *
+ * Example:
+
+ * <pre>
+ * -Dcom.sun.CORBA.connection.ORBSocketFactoryClass=MySocketFactory
+ * </pre> <p>
+ *
+ * Typically one would use the same socket factory class on both the
+ * server side and the client side (but this is not required). <p>
+ *
+ * A <code>ORBSocketFactory</code> class should have a public default
+ * constructor which is called once per instantiating ORB.init call.
+ * That ORB then calls the methods of that <code>ORBSocketFactory</code>
+ * to obtain client and server sockets. <p>
+ *
+ * This interface also supports multiple server end points. See the
+ * documentation on <code>createServerSocket</code> below.
+ *
+ */
+
+public interface ORBSocketFactory
+{
+ /**
+ * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. <p>
+ *
+ * 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. <p>
+ *
+ * If
+ *
+ * <code>createServerSocket(String type, int port)</code>
+ *
+ * is passed <code>IIOP_CLEAR_TEXT</code> as a <code>type</code>
+ * argument it should then call and return
+ *
+ * <code>new java.net.ServerSocket(int port)</code> <p>
+ *
+ * If
+ *
+ * <code>createSocket(SocketInfo socketInfo)</code>
+ *
+ * is passed <code>IIOP_CLEAR_TEXT</code> in
+ * <code>socketInfo.getType()</code> it should
+ * then call and return
+ *
+ * <pre>
+ * new java.net.Socket(socketInfo.getHost(),
+ * socketInfo.getPort())
+ * </pre>
+ *
+ */
+ public static final String IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT";
+
+
+ /**
+ * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. <p>
+ *
+ * This method is used by a server side ORB. <p>
+ *
+ * When an ORB needs to create a listen socket on which connection
+ * requests are accepted it calls
+ *
+ * <code>createServerSocket(String type, int port)</code>.
+ *
+ * The type argument says which type of socket should be created. <p>
+ *
+ * The interpretation of the type argument is the responsibility of
+ * an instance of <code>ORBSocketFactory</code>, except in the case
+ * of <code>IIOP_CLEAR_TEXT</code>, in which case a standard server
+ * socket should be created. <p>
+ *
+ *
+ * Multiple Server Port API: <p>
+ *
+ * In addition to the IIOP_CLEAR_TEXT listening port, it is possible
+ * to specify that an ORB listen on additional port of specific types. <p>
+ *
+ * This API allows one to specify that an ORB should create an X,
+ * or an X and a Y listen socket. <p>
+ *
+ * If X, to the user, means SSL, then one just plugs in an SSL
+ * socket factory. <p>
+ *
+ * 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
+ *
+ * <code>createServerSocket(String type, int port)</code>. <p>
+ *
+ * One specifies multiple listening ports (in addition to the
+ * default IIOP_CLEAR_TEXT port) using the
+ *
+ * <code>ORBConstants.LISTEN_SOCKET_PROPERTY</code>
+ *
+ * property. <p>
+ *
+ * Example usage:
+ *
+ * <pre>
+ * ... \
+ * -Dcom.sun.CORBA.connection.ORBSocketFactoryClass=com.my.MySockFact \
+ * -Dcom.sun.CORBA.connection.ORBListenSocket=SSL:0,foo:1 \
+ * ...
+ * </pre>
+ *
+ * The meaning of the "type" (SSL and foo above) is controlled
+ * by the user. <p>
+ *
+ * ORBListenSocket is only meaningful for servers. <p>
+ *
+ * The property value is interpreted as follows. For each
+ * type/number pair: <p>
+ *
+ * If number is 0 then use an emphemeral port for the listener of
+ * the associated type. <p>
+ *
+ * If number is greater than 0 use that port number. <p>
+ *
+ * An ORB creates a listener socket for each type
+ * specified by the user by calling
+ *
+ * <code>createServerSocket(String type, int port)</code>
+ *
+ * with the type specified by the user. <p>
+ *
+ * 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. <p>
+ *
+ * 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 <code>PortableInterceptor::IORInterceptor</code>. <p>
+ *
+ * Using PortableInterceptors (with a non-standard extension): <p>
+ *
+ * Register an <code>IORInterceptor</code>. Inside its
+ * <code>establish_components</code> operation:
+ *
+ * <pre>
+ *
+ * com.sun.corba.se.spi.legacy.interceptor.IORInfoExt ext;
+ * ext = (com.sun.corba.se.spi.legacy.interceptor.IORInfoExt)info;
+ *
+ * int port = ext.getServerPort("myType");
+ *
+ * </pre>
+ *
+ * Once you have the port you may add information to references
+ * created by the associated adapter by calling
+ *
+ * <code>IORInfo::add_ior_component</code><p>
+ *
+ *
+ * Note: if one is using a POA and the lifespan policy of that
+ * POA is persistent then the port number returned
+ * by <code>getServerPort</code> <em>may</em>
+ * 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.) <p>
+ *
+ *
+ * Persistent object reference support: <p>
+ *
+ * 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: <p>
+ *
+ * - Give the ORBD the same socket factory you gave to the client
+ * and server. <p>
+ *
+ * - 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. <p>
+ *
+ * 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. <p>
+ *
+ *
+ * - specify your <code>BadServerIdHandler</code> (discussed below)
+ * using the
+ *
+ * <code>ORBConstants.BAD_SERVER_ID_HANDLER_CLASS_PROPERTY</code> <p>
+ *
+ * Example:
+ *
+ * <pre>
+ *
+ * -Dcom.sun.CORBA.POA.ORBBadServerIdHandlerClass=corba.socketPersistent.MyBadServerIdHandler
+ *
+ * </pre>
+ *
+ * The <code>BadServerIdHandler</code> ...<p>
+ *
+ * See <code>com.sun.corba.se.impl.activation.ServerManagerImpl.handle</code>
+ * for example code on writing a bad server id handler. NOTE: This
+ * is an unsupported internal API. It will not exist in future releases.
+ * <p>
+ *
+ *
+ * Secure connections to other services: <p>
+ *
+ * If one wants secure connections to other services such as
+ * Naming then one should configure them with the same
+ *
+ * <code>SOCKET_FACTORY_CLASS_PROPERTY</code> and
+ * <code>LISTEN_SOCKET_PROPERTY</code>
+ *
+ * as used by other clients and servers in your distributed system.
+ *
+ */
+ public ServerSocket createServerSocket(String type, int port)
+ throws
+ IOException;
+
+
+
+ /**
+ * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. <p>
+ *
+ * This method is used by a client side ORB. <p>
+ *
+ * Each time a client invokes on an object reference, the reference's
+ * associated ORB will call
+ *
+ * <pre>
+ * getEndPointInfo(ORB orb,
+ * IOR ior,
+ * SocketInfo socketInfo)
+ * </pre>
+ *
+ * NOTE: The type of the <code>ior</code> argument is an internal
+ * representation for efficiency. If the <code>ORBSocketFactory</code>
+ * interface ever becomes standardized then the <code>ior</code> will
+ * most likely change to a standard type (e.g., a stringified ior,
+ * an <code>org.omg.IOP.IOR</code>, or ...). <p>
+ *
+ * Typically, this method will look at tagged components in the
+ * given <code>ior</code> to determine what type of socket to create. <p>
+ *
+ * Typically, the <code>ior</code> will contain a tagged component
+ * specifying an alternate port type and number. <p>
+ *
+ * This method should return an <code>SocketInfo</code> 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 <code>SocketInfo</code> object with the type
+ * <code>IIOP_CLEAR_TEXT</code> and host/port from the ior's IOP
+ * profile. <p>
+ *
+ * If the ORB already has an existing connection to the returned
+ * type/host/port, then that connection is used. Otherwise the ORB calls
+ *
+ * <code>createSocket(SocketInfo socketInfo)</code> <p>
+ *
+ * The <code>orb</code> argument is useful for handling
+ * the <code>ior</code> argument. <p>
+ *
+ * The <code>SocketInfo</code> given to <code>getEndPointInfo</code>
+ * is either null or an object obtained
+ * from <code>GetEndPointInfoAgainException</code>
+ *
+ */
+ public SocketInfo getEndPointInfo(org.omg.CORBA.ORB orb,
+ IOR ior,
+ SocketInfo socketInfo);
+
+
+ /**
+ * DEPRECATED. DEPRECATED. DEPRECATED. DEPRECATED. <p>
+ *
+ * This method is used by a client side ORB. <p>
+ *
+ * This method should return a client socket of the given
+ * type/host/port. <p>
+ *
+ * Note: the <code>SocketInfo</code> is the same instance as was
+ * returned by <code>getSocketInfo</code> so extra cookie info may
+ * be attached. <p>
+ *
+ * If this method throws GetEndPointInfoAgainException then the
+ * ORB calls <code>getEndPointInfo</code> again, passing it the
+ * <code>SocketInfo</code> object contained in the exception.
+ *
+ */
+ public Socket createSocket(SocketInfo socketInfo)
+ throws
+ IOException,
+ GetEndPointInfoAgainException;
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/README.txt b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/README.txt
new file mode 100644
index 0000000..c8b528b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/connection/README.txt
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+Summary and suggested reading order:
+
+==============================================================================
+Connection interceptor (called an ORBSocketFactory):
+
+Summary:
+
+The server side part of the ORBSocketFactory is told the type to
+create as well as a port number.
+
+The client side part of the ORBSocketFactory is called on every client
+request. An ORB first asks the factory for type/host/port information
+(given an IOR). If the ORB already has a connection of the
+type/host/port it will use the existing connection. Otherwise it will
+then ask the factory to create a client socket, giving it that
+type/host/port. Finally, the createSocket method may throw an
+exception to tell the ORB to ask it for type/host/port info again.
+The information passed back and forth between the ORB and factory can
+act as a cookie for the factory if desired.
+
+Interfaces:
+
+ com.sun.corba.se.spi.legacy.connection.ORBSocketFactory
+ com.sun.corba.se.spi.legacy.connection.EndPointInfo
+ com.sun.corba.se.spi.legacy.connection.GetEndPointInfoAgainException
+
+==============================================================================
+Access to a request's socket:
+
+Summary:
+
+The request's socket is available via ClientRequestInfo and
+ServerRequestInfo. We enable this by having them implement the
+RequestInfoExt interface.
+
+Interfaces:
+
+ com.sun.corba.se.spi.legacy.interceptor.RequestInfoExt
+ com.sun.corba.se.spi.legacy.connection.Connection
+
+==============================================================================
+Extending IORInfo to support the multiple server port API:
+
+Summary:
+
+We support the multiple server port API in PortableInterceptors by
+having IORInfo implement the IORInfoExt interface. The description on
+how to use the multiple server port APIs is found in
+ORBSocketFactory.java.
+
+Interfaces:
+
+ com.sun.corba.se.spi.legacy.interceptor.IORInfoExt
+ com.sun.corba.se.spi.legacy.interceptor.UnknownType
+
+;; End.
+
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/IORInfoExt.java b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/IORInfoExt.java
new file mode 100644
index 0000000..fdf2239
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/IORInfoExt.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.legacy.interceptor;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter;
+
+public interface IORInfoExt
+{
+ public int getServerPort(String type)
+ throws
+ UnknownType;
+
+ public ObjectAdapter getObjectAdapter();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/ORBInitInfoExt.java b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/ORBInitInfoExt.java
new file mode 100644
index 0000000..9e6d4b5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/ORBInitInfoExt.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.legacy.interceptor;
+
+import com.sun.corba.se.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.
+ */
+public interface ORBInitInfoExt
+{
+ ORB getORB() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/RequestInfoExt.java b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/RequestInfoExt.java
new file mode 100644
index 0000000..e57f952
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/RequestInfoExt.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.legacy.interceptor;
+
+import com.sun.corba.se.spi.legacy.connection.Connection;
+
+/**
+ * This interface is implemented by our implementation of
+ * PortableInterceptor.ClientRequestInfo and
+ * PortableInterceptor.ServerRequestInfo.
+ */
+
+public interface RequestInfoExt
+{
+ /**
+ * @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/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/UnknownType.java b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/UnknownType.java
new file mode 100644
index 0000000..651892e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/legacy/interceptor/UnknownType.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.legacy.interceptor;
+
+public class UnknownType
+ extends
+ Exception
+{
+ public UnknownType()
+ {
+ super();
+ }
+
+ public UnknownType(String msg)
+ {
+ super(msg);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java
new file mode 100644
index 0000000..978b967
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/CORBALogDomains.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.logging ;
+
+/** Defines constants for all of the logging domains used in the ORB.
+ * Note that this is the suffix to the log domain. The full domain is given by
+ * <code>javax.enterprise.resource.corba.{ORBId}.{Log domain}</code>
+ * where {ORBId} is the ORB ID of the ORB instance doing the logging.
+ * <P>
+ * The ORB implementation packages are mapped into these domains as follows:
+ * <ul>
+ * <li>activation: orbd.*
+ * <li>corba: rpc.presentation (CORBA API, typecode/any), oa.invocation (DII)
+ * <li>core: service context code in rpc.protocol (will eventually move to its own package)
+ * <li>dynamicany: rpc.presentation
+ * <li>encoding: rpc.encoding
+ * <li>iiop: rmiiop.delegate (ShutdownUtilDelegate needs to move somewhere)
+ * <li>interceptors: rpc.protocol
+ * <li>io: rpc.encoding
+ * <li>ior: oa.ior
+ * <li>javax: rmiiiop.delegate
+ * <li>logging: logging does not have a domain
+ * <li>naming: naming
+ * <li>oa: oa
+ * <li>orb: orb.lifecycle
+ * <li>orbutil: util
+ * <li>protocol: rpc.protocol
+ * <li>resolver: orb.resolver
+ * <li>transport: rpc.transport
+ * <li>txpoa: this will be removed in the future.
+ * <li>util: util
+ * </ul>
+ */
+public abstract class CORBALogDomains {
+ private CORBALogDomains() {}
+
+ // Top level log domain for CORBA
+ public static final String TOP_LEVEL_DOMAIN = "javax.enterprise.resource.corba";
+
+ public static final String RPC = "rpc" ;
+
+ /** Log domain for code directly implementing the CORBA API and
+ * the typecode/any machinery.
+ */
+ public static final String RPC_PRESENTATION = "rpc.presentation" ;
+
+ /** Log domain for any sort of wire encoding used in marshalling
+ */
+ public static final String RPC_ENCODING = "rpc.encoding" ;
+
+ /** Log domain for the code used to handle any kind of invocation
+ * protocol. This includes client and server delegates, client and
+ * server request dispatchers, service contexts, portable interceptors,
+ * and the GIOP protocol (but not CDR representation of data).
+ */
+ public static final String RPC_PROTOCOL = "rpc.protocol" ;
+
+ /** Log domain for low-level transport details, which are
+ * independent of encoding and presentation details. This
+ * includes selectors, acceptors, connections, connection management,
+ * and any other transport management functions.
+ */
+ public static final String RPC_TRANSPORT = "rpc.transport" ;
+
+ public static final String NAMING = "naming" ;
+
+ /** Log domain for naming context creation and destruction.
+ */
+ public static final String NAMING_LIFECYCLE = "naming.lifecycle" ;
+
+ /** Log domain for name service lookup.
+ */
+ public static final String NAMING_READ = "naming.read" ;
+
+ /** Log domain for name service bind, rebind, destroy, and other state
+ * change operations.
+ */
+ public static final String NAMING_UPDATE = "naming.update" ;
+
+ public static final String ORBD = "orbd" ;
+
+ /** Log domain for the ORBD locator function, which forwards
+ * client requests to their current server incarnation.
+ */
+ public static final String ORBD_LOCATOR = "orbd.locator" ;
+
+ /** Log domain for the ORBD activator function, which starts
+ * server instances on demand.
+ */
+ public static final String ORBD_ACTIVATOR = "orbd.activator" ;
+
+ /** Log domain for the Implementation Repository.
+ */
+ public static final String ORBD_REPOSITORY = "orbd.repository" ;
+
+ /** Log domain for the servertool utilitiy used to update the
+ * implementation repository.
+ */
+ public static final String ORBD_SERVERTOOL = "orbd.servertool" ;
+
+ public static final String ORB = "orb" ;
+
+ /** Log domain for ORB initialization, configuration, startup,
+ * and shutdown.
+ */
+ public static final String ORB_LIFECYCLE = "orb.lifecycle" ;
+
+ /** Log domain for ORB client side name resolution and supporting
+ * functions such as INS.
+ */
+ public static final String ORB_RESOLVER = "orb.resolver" ;
+
+ public static final String OA = "oa" ;
+
+ /** Log domain for creation, destruction, and state change of
+ * Object Adapters and related classes (e.g. POAManager).
+ */
+ public static final String OA_LIFECYCLE = "oa.lifecycle" ;
+
+ /** Log domain for all IOR related code.
+ */
+ public static final String OA_IOR = "oa.ior" ;
+
+ /** Log domain for object adapter request dispatch.
+ */
+ public static final String OA_INVOCATION = "oa.invocation" ;
+
+ public static final String RMIIIOP = "rmiiiop" ;
+
+ /** Log domain for the RMI-IIOP implementation in the Stub, Util, and
+ * PortableRemoteObject delegates.
+ */
+ public static final String RMIIIOP_DELEGATE = "rmiiiop.delegate" ;
+
+ /** Log domain for utility classes.
+ */
+ public static final String UTIL = "util" ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/LogWrapperBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/LogWrapperBase.java
new file mode 100644
index 0000000..bc24147
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/LogWrapperBase.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.logging ;
+
+import java.util.logging.Level ;
+import java.util.logging.Logger ;
+import java.util.logging.LogRecord ;
+
+public abstract class LogWrapperBase {
+ protected Logger logger ;
+
+ protected String loggerName ;
+
+ protected LogWrapperBase( Logger logger )
+ {
+ this.logger = logger ;
+ this.loggerName = logger.getName( );
+ }
+
+ protected void doLog( Level level, String key, Object[] params, Class wrapperClass,
+ Throwable thr )
+ {
+ LogRecord lrec = new LogRecord( level, key ) ;
+ if (params != null)
+ lrec.setParameters( params ) ;
+ inferCaller( wrapperClass, lrec ) ;
+ lrec.setThrown( thr ) ;
+ lrec.setLoggerName( loggerName );
+ lrec.setResourceBundle( logger.getResourceBundle() ) ;
+ logger.log( lrec ) ;
+ }
+
+ private void inferCaller( Class wrapperClass, LogRecord lrec )
+ {
+ // Private method to infer the caller's class and method names
+
+ // Get the stack trace.
+ StackTraceElement stack[] = (new Throwable()).getStackTrace();
+ StackTraceElement frame = null ;
+ String wcname = wrapperClass.getName() ;
+ String baseName = LogWrapperBase.class.getName() ;
+
+ // The top of the stack should always be a method in the wrapper class,
+ // or in this base class.
+ // Search back to the first method not in the wrapper class or this class.
+ int ix = 0;
+ while (ix < stack.length) {
+ frame = stack[ix];
+ String cname = frame.getClassName();
+ if (!cname.equals(wcname) && !cname.equals(baseName)) {
+ break;
+ }
+
+ ix++;
+ }
+
+ // Set the class and method if we are not past the end of the stack
+ // trace
+ if (ix < stack.length) {
+ lrec.setSourceClassName(frame.getClassName());
+ lrec.setSourceMethodName(frame.getMethodName());
+ }
+ }
+
+ protected void doLog( Level level, String key, Class wrapperClass, Throwable thr )
+ {
+ doLog( level, key, null, wrapperClass, thr ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/LogWrapperFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/LogWrapperFactory.java
new file mode 100644
index 0000000..0444496
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/LogWrapperFactory.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.logging ;
+
+import java.util.logging.Logger ;
+
+import com.sun.corba.se.spi.logging.LogWrapperBase ;
+
+public interface LogWrapperFactory {
+ LogWrapperBase create( Logger logger ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc
new file mode 100644
index 0000000..1286d5d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Activation.mc
@@ -0,0 +1,36 @@
+;
+; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+;
+; This code is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License version 2 only, as
+; published by the Free Software Foundation. Oracle designates this
+; particular file as subject to the "Classpath" exception as provided
+; by Oracle in the LICENSE file that accompanied this code.
+;
+; This code is distributed in the hope that it will be useful, but WITHOUT
+; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+; version 2 for more details (a copy is included in the LICENSE file that
+; accompanied this code).
+;
+; You should have received a copy of the GNU General Public License version
+; 2 along with this work; if not, write to the Free Software Foundation,
+; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+;
+; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+; or visit www.oracle.com if you need additional information or have any
+; questions.
+;
+("com.sun.corba.se.impl.logging" "ActivationSystemException" ACTIVATION
+ (
+ (INITIALIZE
+ (CANNOT_READ_REPOSITORY_DB 1 WARNING "Cannot read repository datastore")
+ (CANNOT_ADD_INITIAL_NAMING 2 WARNING "Cannot add initial naming"))
+ (INTERNAL
+ (CANNOT_WRITE_REPOSITORY_DB 1 WARNING "Cannot write repository datastore")
+ (SERVER_NOT_EXPECTED_TO_REGISTER 3 WARNING "Server not expected to register")
+ (UNABLE_TO_START_PROCESS 4 WARNING "Unable to start server process")
+ (SERVER_NOT_RUNNING 6 WARNING "Server is not running"))
+ (OBJECT_NOT_EXIST
+ (ERROR_IN_BAD_SERVER_ID_HANDLER 1 WARNING "Error in BadServerIdHandler"))))
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc
new file mode 100644
index 0000000..3527c84
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/IOR.mc
@@ -0,0 +1,45 @@
+;
+; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+;
+; This code is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License version 2 only, as
+; published by the Free Software Foundation. Oracle designates this
+; particular file as subject to the "Classpath" exception as provided
+; by Oracle in the LICENSE file that accompanied this code.
+;
+; This code is distributed in the hope that it will be useful, but WITHOUT
+; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+; version 2 for more details (a copy is included in the LICENSE file that
+; accompanied this code).
+;
+; You should have received a copy of the GNU General Public License version
+; 2 along with this work; if not, write to the Free Software Foundation,
+; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+;
+; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+; or visit www.oracle.com if you need additional information or have any
+; questions.
+;
+("com.sun.corba.se.impl.logging" "IORSystemException" IOR
+ (
+ (INTERNAL
+ (ORT_NOT_INITIALIZED 1 WARNING "ObjectReferenceTemplate is not initialized")
+ (NULL_POA 2 WARNING "Null POA")
+ (BAD_MAGIC 3 WARNING "Bad magic number {0} in ObjectKeyTemplate")
+ (STRINGIFY_WRITE_ERROR 4 WARNING "Error while stringifying an object reference")
+ (TAGGED_PROFILE_TEMPLATE_FACTORY_NOT_FOUND 5 WARNING "Could not find a TaggedProfileTemplateFactory for id {0}")
+ (INVALID_JDK1_3_1_PATCH_LEVEL 6 WARNING "Found a JDK 1.3.1 patch level indicator with value {0} less than JDK 1.3.1_01 value of 1")
+ (GET_LOCAL_SERVANT_FAILURE 7 FINE "Exception occurred while looking for ObjectAdapter {0} in IIOPProfileImpl.getServant"))
+ (BAD_OPERATION
+ (ADAPTER_ID_NOT_AVAILABLE 1 WARNING "Adapter ID not available")
+ (SERVER_ID_NOT_AVAILABLE 2 WARNING "Server ID not available")
+ (ORB_ID_NOT_AVAILABLE 3 WARNING "ORB ID not available")
+ (OBJECT_ADAPTER_ID_NOT_AVAILABLE 4 WARNING "Object adapter ID not available"))
+ (BAD_PARAM
+ (BAD_OID_IN_IOR_TEMPLATE_LIST 1 WARNING "Profiles in IOR do not all have the same Object ID, so conversion to IORTemplateList is impossible")
+ (INVALID_TAGGED_PROFILE 2 WARNING "Error in reading IIOP TaggedProfile")
+ (BAD_IIOP_ADDRESS_PORT 3 WARNING "Attempt to create IIOPAdiress with port {0}, which is out of range"))
+ (INV_OBJREF
+ (IOR_MUST_HAVE_IIOP_PROFILE 1 WARNING "IOR must have at least one IIOP profile"))))
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc
new file mode 100644
index 0000000..c067712
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Interceptors.mc
@@ -0,0 +1,68 @@
+;
+; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+;
+; This code is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License version 2 only, as
+; published by the Free Software Foundation. Oracle designates this
+; particular file as subject to the "Classpath" exception as provided
+; by Oracle in the LICENSE file that accompanied this code.
+;
+; This code is distributed in the hope that it will be useful, but WITHOUT
+; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+; version 2 for more details (a copy is included in the LICENSE file that
+; accompanied this code).
+;
+; You should have received a copy of the GNU General Public License version
+; 2 along with this work; if not, write to the Free Software Foundation,
+; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+;
+; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+; or visit www.oracle.com if you need additional information or have any
+; questions.
+;
+("com.sun.corba.se.impl.logging" "InterceptorsSystemException" INTERCEPTORS
+ (
+ (BAD_PARAM
+ (TYPE_OUT_OF_RANGE 1 WARNING "Interceptor type {0} is out of range")
+ (NAME_NULL 2 WARNING "Interceptor's name is null: use empty string for anonymous interceptors"))
+ (BAD_INV_ORDER
+ (RIR_INVALID_PRE_INIT 1 WARNING "resolve_initial_reference is invalid during pre_init")
+ (BAD_STATE1 2 WARNING "Expected state {0}, but current state is {1}")
+ (BAD_STATE2 3 WARNING "Expected state {0} or {1}, but current state is {2}"))
+ (COMM_FAILURE
+ (IOEXCEPTION_DURING_CANCEL_REQUEST 1 WARNING "IOException during cancel request"))
+ (INTERNAL
+ (EXCEPTION_WAS_NULL 1 WARNING "Exception was null")
+ (OBJECT_HAS_NO_DELEGATE 2 WARNING "Object has no delegate")
+ (DELEGATE_NOT_CLIENTSUB 3 WARNING "Delegate was not a ClientRequestDispatcher")
+ (OBJECT_NOT_OBJECTIMPL 4 WARNING "Object is not an ObjectImpl")
+ (EXCEPTION_INVALID 5 WARNING "Assertion failed: Interceptor set exception to UserException or ApplicationException")
+ (REPLY_STATUS_NOT_INIT 6 WARNING "Assertion failed: Reply status is initialized but not SYSTEM_EXCEPTION or LOCATION_FORWARD")
+ (EXCEPTION_IN_ARGUMENTS 7 WARNING "Exception in arguments")
+ (EXCEPTION_IN_EXCEPTIONS 8 WARNING "Exception in exceptions")
+ (EXCEPTION_IN_CONTEXTS 9 WARNING "Exception in contexts")
+ (EXCEPTION_WAS_NULL_2 10 WARNING "Another exception was null")
+ (SERVANT_INVALID 11 WARNING "Servant invalid")
+ (CANT_POP_ONLY_PICURRENT 12 WARNING "Can't pop only PICurrent")
+ (CANT_POP_ONLY_CURRENT_2 13 WARNING "Can't pop another PICurrent")
+ (PI_DSI_RESULT_IS_NULL 14 WARNING "DSI result is null")
+ (PI_DII_RESULT_IS_NULL 15 WARNING "DII result is null")
+ (EXCEPTION_UNAVAILABLE 16 WARNING "Exception is unavailable")
+ (CLIENT_INFO_STACK_NULL 17 WARNING "Assertion failed: client request info stack is null")
+ (SERVER_INFO_STACK_NULL 18 WARNING "Assertion failed: Server request info stack is null")
+ (MARK_AND_RESET_FAILED 19 WARNING "Mark and reset failed")
+ (SLOT_TABLE_INVARIANT 20 WARNING "currentIndex > tableContainer.size(): {0} > {1}")
+ (INTERCEPTOR_LIST_LOCKED 21 WARNING "InterceptorList is locked")
+ (SORT_SIZE_MISMATCH 22 WARNING "Invariant: sorted size + unsorted size == total size was violated"))
+ (NO_IMPLEMENT
+ (PI_ORB_NOT_POLICY_BASED 1 WARNING "Policies not implemented"))
+ (OBJECT_NOT_EXIST
+ (ORBINITINFO_INVALID 1 FINE "ORBInitInfo object is only valid during ORB_init"))
+ (UNKNOWN
+ (UNKNOWN_REQUEST_INVOKE
+ 1 FINE "Unknown request invocation error"))
+ ))
+
+;;; End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc
new file mode 100644
index 0000000..605e4f3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Naming.mc
@@ -0,0 +1,53 @@
+;
+; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+;
+; This code is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License version 2 only, as
+; published by the Free Software Foundation. Oracle designates this
+; particular file as subject to the "Classpath" exception as provided
+; by Oracle in the LICENSE file that accompanied this code.
+;
+; This code is distributed in the hope that it will be useful, but WITHOUT
+; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+; version 2 for more details (a copy is included in the LICENSE file that
+; accompanied this code).
+;
+; You should have received a copy of the GNU General Public License version
+; 2 along with this work; if not, write to the Free Software Foundation,
+; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+;
+; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+; or visit www.oracle.com if you need additional information or have any
+; questions.
+;
+("com.sun.corba.se.impl.logging" "NamingSystemException" NAMING
+ (
+ (BAD_PARAM
+ (TRANSIENT_NAME_SERVER_BAD_PORT 0 WARNING "Port 0 is not a valid port in the transient name server")
+ (TRANSIENT_NAME_SERVER_BAD_HOST 1 WARNING "A null hostname is not a valid hostname in the transient name server")
+ (OBJECT_IS_NULL 2 WARNING "Invalid object reference passed in rebind or bind operation")
+ (INS_BAD_ADDRESS 3 WARNING "Bad host address in -ORBInitDef"))
+ (UNKNOWN
+ (BIND_UPDATE_CONTEXT_FAILED 0 WARNING "Updated context failed for bind")
+ (BIND_FAILURE 1 WARNING "bind failure")
+ (RESOLVE_CONVERSION_FAILURE 2 WARNING "Resolve conversion failed")
+ (RESOLVE_FAILURE 3 WARNING "Resolve failure")
+ (UNBIND_FAILURE 4 WARNING "Unbind failure"))
+ (INITIALIZE
+ (TRANS_NS_CANNOT_CREATE_INITIAL_NC_SYS 50 WARNING "SystemException in transient name service while initializing")
+ (TRANS_NS_CANNOT_CREATE_INITIAL_NC 51 WARNING "Java exception in transient name service while initializing"))
+ (INTERNAL
+ (NAMING_CTX_REBIND_ALREADY_BOUND 0 WARNING "Unexpected AlreadyBound exception iun rebind")
+ (NAMING_CTX_REBINDCTX_ALREADY_BOUND 1 WARNING "Unexpected AlreadyBound exception in rebind_context")
+ (NAMING_CTX_BAD_BINDINGTYPE 2 WARNING "Bad binding type in internal binding implementation")
+ (NAMING_CTX_RESOLVE_CANNOT_NARROW_TO_CTX 3 WARNING "Object reference that is not CosNaming::NamingContext bound as a context")
+ (NAMING_CTX_BINDING_ITERATOR_CREATE 4 WARNING "Error in creating POA for BindingIterator")
+ (TRANS_NC_BIND_ALREADY_BOUND 100 WARNING "Bind implementation encountered a previous bind")
+ (TRANS_NC_LIST_GOT_EXC 101 WARNING "list operation caught an unexpected Java exception while creating list iterator")
+ (TRANS_NC_NEWCTX_GOT_EXC 102 WARNING "new_context operation caught an unexpected Java excpetion creating the NewContext servant")
+ (TRANS_NC_DESTROY_GOT_EXC 103 WARNING "Destroy operation caught a Java exception while disconnecting from ORB")
+ (INS_BAD_SCHEME_NAME 105 WARNING "Stringified object reference with unknown protocol specified")
+ (INS_BAD_SCHEME_SPECIFIC_PART 107 WARNING "Malformed URL in -ORBInitDef")
+ (INS_OTHER 108 WARNING "Malformed URL in -ORBInitDef"))))
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc
new file mode 100644
index 0000000..9af41dd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/OMG.mc
@@ -0,0 +1,177 @@
+;
+; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+;
+; This code is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License version 2 only, as
+; published by the Free Software Foundation. Oracle designates this
+; particular file as subject to the "Classpath" exception as provided
+; by Oracle in the LICENSE file that accompanied this code.
+;
+; This code is distributed in the hope that it will be useful, but WITHOUT
+; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+; version 2 for more details (a copy is included in the LICENSE file that
+; accompanied this code).
+;
+; You should have received a copy of the GNU General Public License version
+; 2 along with this work; if not, write to the Free Software Foundation,
+; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+;
+; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+; or visit www.oracle.com if you need additional information or have any
+; questions.
+;
+("com.sun.corba.se.impl.logging" "OMGSystemException" OMG
+ (
+ (BAD_CONTEXT
+ (IDL_CONTEXT_NOT_FOUND 1 WARNING "IDL context not found")
+ (NO_MATCHING_IDL_CONTEXT 2 WARNING "No matching IDL context property"))
+ (BAD_INV_ORDER
+ (DEP_PREVENT_DESTRUCTION 1 WARNING "Dependency exists in IFR preventing destruction of this object")
+ (DESTROY_INDESTRUCTIBLE 2 WARNING "Attempt to destroy indestructible objects in IFR")
+ (SHUTDOWN_WAIT_FOR_COMPLETION_DEADLOCK 3 WARNING "Operation would deadlock")
+ (BAD_OPERATION_AFTER_SHUTDOWN 4 WARNING "ORB has shutdown")
+ (BAD_INVOKE 5 WARNING "Attempt to invoke send or invoke operation of the same Request object more than once ")
+ (BAD_SET_SERVANT_MANAGER 6 WARNING "Attempt to set a servent manager after one has already been set")
+ (BAD_ARGUMENTS_CALL 7 WARNING "ServerRequest::arguments called more than once or after a call to ServerRequest::set_exception")
+ (BAD_CTX_CALL 8 WARNING "ServerRequest::ctx called more than once or before ServerRequest::arguments or after ServerRequest::ctx, ServerRequest::set_result or ServerRequest::set_exception")
+ (BAD_RESULT_CALL 9 WARNING "ServerRequest::set_result called more than once or before ServerRequest::arguments or after ServerRequest::set_result or ServerRequest::set_exception")
+ (BAD_SEND 10 WARNING "Attempt to send a DII request after it was sent previously")
+ (BAD_POLL_BEFORE 11 WARNING "Attempt to poll a DII request or to retrieve its result before the request was sent")
+ (BAD_POLL_AFTER 12 WARNING "Attempt to poll a DII request or to retrieve its result after the result was retrieved previously")
+ (BAD_POLL_SYNC 13 WARNING "Attempt to poll a synchronous DII request or to retrieve results from a synchronous DII request")
+ (INVALID_PI_CALL1 14 FINE "Invalid call to forward_reference() when reply status is not LOCATION_FORWARD")
+ (INVALID_PI_CALL2 14 FINE "Cannot access this attribute or method at this point")
+ (INVALID_PI_CALL3 14 FINE "Cannot call set_slot from within an ORBInitializer")
+ (INVALID_PI_CALL4 14 FINE "Cannot call get_slot from within an ORBInitializer")
+ (SERVICE_CONTEXT_ADD_FAILED 15 FINE "Service context add failed in portable interceptor because a service context with id {0} already exists")
+ (POLICY_FACTORY_REG_FAILED 16 WARNING "Registration of PolicyFactory failed because a factory already exists for the given PolicyType {0}")
+ (CREATE_POA_DESTROY 17 WARNING "POA cannot create POAs while undergoing destruction")
+ (PRIORITY_REASSIGN 18 WARNING "Attempt to reassign priority")
+ (XA_START_OUTSIZE 19 WARNING "An OTS/XA integration xa_start() call returned XAER_OUTSIDE")
+ (XA_START_PROTO 20 WARNING "An OTS/XA integration xa_ call returned XAER_PROTO"))
+ (BAD_OPERATION
+ (BAD_SERVANT_MANAGER_TYPE 1 WARNING "ServantManager returned wrong servant type")
+ (OPERATION_UNKNOWN_TO_TARGET 2 WARNING "Operation or attribute not known to target object "))
+ (BAD_PARAM
+ (UNABLE_REGISTER_VALUE_FACTORY 1 WARNING "Failure to register, unregister or lookup value factory")
+ (RID_ALREADY_DEFINED 2 WARNING "RID already defined in IFR")
+ (NAME_USED_IFR 3 WARNING "Name already used in the context in IFR ")
+ (TARGET_NOT_CONTAINER 4 WARNING "Target is not a valid container")
+ (NAME_CLASH 5 WARNING "Name clash in inherited context")
+ (NOT_SERIALIZABLE 6 WARNING "Class {0} is not Serializable")
+ (SO_BAD_SCHEME_NAME 7 WARNING "string_to_object conversion failed due to bad scheme name")
+ (SO_BAD_ADDRESS 8 WARNING "string_to_object conversion failed due to bad address")
+ (SO_BAD_SCHEMA_SPECIFIC 9 WARNING "string_to_object conversion failed due to bad bad schema specific part")
+ (SO_NON_SPECIFIC 10 WARNING "string_to_object conversion failed due to non specific reason")
+ (IR_DERIVE_ABS_INT_BASE 11 WARNING "Attempt to derive abstract interface from non-abstract base interface in the Interface Repository")
+ (IR_VALUE_SUPPORT 12 WARNING "Attempt to let a ValueDef support more than one non-abstract interface in the Interface Repository")
+ (INCOMPLETE_TYPECODE 13 WARNING "Attempt to use an incomplete TypeCode as a parameter")
+ (INVALID_OBJECT_ID 14 WARNING "Invalid object id passed to POA::create_reference_by_id ")
+ (TYPECODE_BAD_NAME 15 WARNING "Bad name argument in TypeCode operation")
+ (TYPECODE_BAD_REPID 16 WARNING "Bad RepositoryId argument in TypeCode operation")
+ (TYPECODE_INV_MEMBER 17 WARNING "Invalid member name in TypeCode operation ")
+ (TC_UNION_DUP_LABEL 18 WARNING "Duplicate label value in create_union_tc ")
+ (TC_UNION_INCOMPATIBLE 19 WARNING "Incompatible TypeCode of label and discriminator in create_union_tc ")
+ (TC_UNION_BAD_DISC 20 WARNING "Supplied discriminator type illegitimate in create_union_tc ")
+ (SET_EXCEPTION_BAD_ANY 21 WARNING "Any passed to ServerRequest::set_exception does not contain an exception ")
+ (SET_EXCEPTION_UNLISTED 22 WARNING "Unlisted user exception passed to ServerRequest::set_exception ")
+ (NO_CLIENT_WCHAR_CODESET_CTX 23 WARNING "wchar transmission code set not in service context")
+ (ILLEGAL_SERVICE_CONTEXT 24 WARNING "Service context is not in OMG-defined range")
+ (ENUM_OUT_OF_RANGE 25 WARNING "Enum value out of range")
+ (INVALID_SERVICE_CONTEXT_ID 26 FINE "Invalid service context Id in portable interceptor")
+ (RIR_WITH_NULL_OBJECT 27 WARNING "Attempt to call register_initial_reference with a null Object")
+ (INVALID_COMPONENT_ID 28 FINE "Invalid component Id {0} in portable interceptor")
+ (INVALID_PROFILE_ID 29 WARNING "Profile ID does not define a known profile or it is impossible to add components to that profile")
+ (POLICY_TYPE_DUPLICATE 30 WARNING "Two or more Policy objects with the same PolicyType value supplied to Object::set_policy_overrides or PolicyManager::set_policy_overrides")
+ (BAD_ONEWAY_DEFINITION 31 WARNING "Attempt to define a oneway operation with non-void result, out or inout parameters or user exceptions")
+ (DII_FOR_IMPLICIT_OPERATION 32 WARNING "DII asked to create request for an implicit operation")
+ (XA_CALL_INVAL 33 WARNING "An OTS/XA integration xa_ call returned XAER_INVAL")
+ (UNION_BAD_DISCRIMINATOR 34 WARNING "Union branch modifier method called with bad case label discriminator")
+ (CTX_ILLEGAL_PROPERTY_NAME 35 WARNING "Illegal IDL context property name")
+ (CTX_ILLEGAL_SEARCH_STRING 36 WARNING "Illegal IDL property search string")
+ (CTX_ILLEGAL_NAME 37 WARNING "Illegal IDL context name")
+ (CTX_NON_EMPTY 38 WARNING "Non-empty IDL context")
+ (INVALID_STREAM_FORMAT_VERSION 39 WARNING "Unsupported RMI/IDL custom value type stream format {0}")
+ (NOT_A_VALUEOUTPUTSTREAM 40 WARNING "ORB output stream does not support ValueOutputStream interface")
+ (NOT_A_VALUEINPUTSTREAM 41 WARNING "ORB input stream does not support ValueInputStream interface"))
+ (BAD_TYPECODE
+ (MARSHALL_INCOMPLETE_TYPECODE 1 WARNING "Attempt to marshal incomplete TypeCode")
+ (BAD_MEMBER_TYPECODE 2 WARNING "Member type code illegitimate in TypeCode operation")
+ (ILLEGAL_PARAMETER 3 WARNING "Illegal parameter type"))
+ (DATA_CONVERSION
+ (CHAR_NOT_IN_CODESET 1 WARNING "Character does not map to negotiated transmission code set")
+ (PRIORITY_MAP_FAILRE 2 WARNING "Failure of PriorityMapping object"))
+ (IMP_LIMIT
+ (NO_USABLE_PROFILE 1 WARNING "Unable to use any profile in IOR"))
+ (INITIALIZE
+ (PRIORITY_RANGE_RESTRICT 1 WARNING "Priority range too restricted for ORB"))
+ (INV_OBJREF
+ (NO_SERVER_WCHAR_CODESET_CMP 1 WARNING "wchar Code Set support not specified")
+ (CODESET_COMPONENT_REQUIRED 2 WARNING "Codeset component required for type using wchar or wstring data"))
+ (INV_POLICY
+ (IOR_POLICY_RECONCILE_ERROR 1 WARNING "Unable to reconcile IOR specified policy with effective policy override")
+ (POLICY_UNKNOWN 2 WARNING "Invalid PolicyType")
+ (NO_POLICY_FACTORY 3 WARNING "No PolicyFactory has been registered for the given PolicyType"))
+ (INTERNAL
+ (XA_RMERR 1 WARNING "An OTS/XA integration xa_ call returned XAER_RMERR")
+ (XA_RMFAIL 2 WARNING "An OTS/XA integration xa_ call returned XAER_RMFAIL"))
+ (INTF_REPOS
+ (NO_IR 1 WARNING "Interface Repository not available")
+ (NO_INTERFACE_IN_IR 2 WARNING "No entry for requested interface in Interface Repository"))
+ (MARSHAL
+ (UNABLE_LOCATE_VALUE_FACTORY 1 FINE "Unable to locate value factory")
+ (SET_RESULT_BEFORE_CTX 2 WARNING "ServerRequest::set_result called before ServerRequest::ctx when the operation IDL contains a context clause ")
+ (BAD_NVLIST 3 WARNING "NVList passed to ServerRequest::arguments does not describe all parameters passed by client")
+ (NOT_AN_OBJECT_IMPL 4 WARNING "Attempt to marshal Local object")
+ (WCHAR_BAD_GIOP_VERSION_SENT 5 WARNING "wchar or wstring data erroneosly sent by client over GIOP 1.0 connection ")
+ (WCHAR_BAD_GIOP_VERSION_RETURNED 6 WARNING "wchar or wstring data erroneously returned by server over GIOP 1.0 connection ")
+ (UNSUPPORTED_FORMAT_VERSION 7 WARNING "Unsupported RMI/IDL custom value type stream format")
+ (RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE1 8 WARNING "No optional data available")
+ (RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE2 8 WARNING "Not enough space left in current chunk")
+ (RMIIIOP_OPTIONAL_DATA_INCOMPATIBLE3 8 FINE "Not enough optional data available"))
+ (NO_IMPLEMENT
+ (MISSING_LOCAL_VALUE_IMPL 1 WARNING "Missing local value implementation")
+ (INCOMPATIBLE_VALUE_IMPL 2 WARNING "Incompatible value implementation version")
+ (NO_USABLE_PROFILE_2 3 WARNING "Unable to use any profile in IOR")
+ (DII_LOCAL_OBJECT 4 WARNING "Attempt to use DII on Local object")
+ (BIO_RESET 5 WARNING "Biomolecular Sequence Analysis iterator cannot be reset")
+ (BIO_META_NOT_AVAILABLE 6 WARNING "Biomolecular Sequence Analysis metadata is not available as XML")
+ (BIO_GENOMIC_NO_ITERATOR 7 WARNING "Genomic Maps iterator cannot be reset"))
+ (NO_RESOURCES
+ (PI_OPERATION_NOT_SUPPORTED1 1 FINE "The portable Java bindings do not support arguments()")
+ (PI_OPERATION_NOT_SUPPORTED2 1 FINE "The portable Java bindings do not support exceptions()")
+ (PI_OPERATION_NOT_SUPPORTED3 1 FINE "The portable Java bindings do not support contexts()")
+ (PI_OPERATION_NOT_SUPPORTED4 1 FINE "The portable Java bindings do not support operation_context()")
+ (PI_OPERATION_NOT_SUPPORTED5 1 FINE "The portable Java bindings do not support result()")
+ (PI_OPERATION_NOT_SUPPORTED6 1 FINE "The object ID was never set")
+ (PI_OPERATION_NOT_SUPPORTED7 1 FINE "The ObjectKeyTemplate was never set")
+ (PI_OPERATION_NOT_SUPPORTED8 1 FINE "ServerRequest::arguments() was never called")
+ (NO_CONNECTION_PRIORITY 2 WARNING "No connection for request's priority"))
+ (TRANSACTION_ROLLEDBACK
+ (XA_RB 1 WARNING "An OTS/XA integration xa_ call returned XAER_RB")
+ (XA_NOTA 2 WARNING "An OTS/XA integration xa_ call returned XAER_NOTA")
+ (XA_END_TRUE_ROLLBACK_DEFERRED 3 WARNING "OTS/XA integration end() was called with success set to TRUE while transaction rollback was deferred"))
+ (TRANSIENT
+ (POA_REQUEST_DISCARD 1 WARNING "Request discarded because of resource exhaustion in POA or because POA is in DISCARDING state")
+ (NO_USABLE_PROFILE_3 2 WARNING "No usable profile in IOR")
+ (REQUEST_CANCELLED 3 WARNING "Request cancelled")
+ (POA_DESTROYED 4 WARNING "POA destroyed"))
+ (OBJECT_NOT_EXIST
+ (UNREGISTERED_VALUE_AS_OBJREF 1 WARNING "Attempt to pass an unactivated (unregistered) value as an object reference")
+ (NO_OBJECT_ADAPTOR 2 FINE "Failed to create or locate Object Adaptor")
+ (BIO_NOT_AVAILABLE 3 WARNING "Biomolecular Sequence Analysis Service is no longer available")
+ (OBJECT_ADAPTER_INACTIVE 4 WARNING "Object Adapter Inactive"))
+ (OBJ_ADAPTER
+ (ADAPTER_ACTIVATOR_EXCEPTION 1 WARNING "System exception in POA::unknown_adapter for POA {0} with parent POA {1}")
+ (BAD_SERVANT_TYPE 2 WARNING "Incorrect servant type returned by servant manager ")
+ (NO_DEFAULT_SERVANT 3 WARNING "No default servant available [POA policy]")
+ (NO_SERVANT_MANAGER 4 WARNING "No servant manager available [POA Policy]")
+ (BAD_POLICY_INCARNATE 5 WARNING "Violation of POA policy by ServantActivator::incarnate")
+ (PI_EXC_COMP_ESTABLISHED 6 WARNING "Exception in PortableInterceptor::IORInterceptor.components_established")
+ (NULL_SERVANT_RETURNED 7 FINE "Null servant returned by servant manager"))
+ (UNKNOWN
+ (UNKNOWN_USER_EXCEPTION 1 FINE "Unlisted user exception received by client ")
+ (UNSUPPORTED_SYSTEM_EXCEPTION 2 WARNING "Non-standard System Exception not supported")
+ (PI_UNKNOWN_USER_EXCEPTION 3 WARNING "An unknown user exception received by a portable interceptor"))))
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc
new file mode 100644
index 0000000..da1ab4d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/ORBUtil.mc
@@ -0,0 +1,407 @@
+;
+
+; Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+;
+; This code is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License version 2 only, as
+; published by the Free Software Foundation. Oracle designates this
+; particular file as subject to the "Classpath" exception as provided
+; by Oracle in the LICENSE file that accompanied this code.
+;
+; This code is distributed in the hope that it will be useful, but WITHOUT
+; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+; version 2 for more details (a copy is included in the LICENSE file that
+; accompanied this code).
+;
+; You should have received a copy of the GNU General Public License version
+; 2 along with this work; if not, write to the Free Software Foundation,
+; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+;
+; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+; or visit www.oracle.com if you need additional information or have any
+; questions.
+;
+("com.sun.corba.se.impl.logging" "ORBUtilSystemException" ORBUTIL
+ (
+ (BAD_OPERATION
+ (ADAPTER_ID_NOT_AVAILABLE 1 WARNING "Adapter ID not available")
+ (SERVER_ID_NOT_AVAILABLE 2 WARNING "Server ID not available")
+ (ORB_ID_NOT_AVAILABLE 3 WARNING "ORB ID not available")
+ (OBJECT_ADAPTER_ID_NOT_AVAILABLE 4 WARNING "Object adapter ID not available")
+ (CONNECTING_SERVANT 5 WARNING "Error connecting servant")
+ (EXTRACT_WRONG_TYPE 6 FINE "Expected typecode kind {0} but got typecode kind {1}")
+ (EXTRACT_WRONG_TYPE_LIST 7 WARNING "Expected typecode kind to be one of {0} but got typecode kind {1}")
+ (BAD_STRING_BOUNDS 8 WARNING "String length of {0} exceeds bounded string length of {1}")
+ (INSERT_OBJECT_INCOMPATIBLE 10 WARNING "Tried to insert an object of an incompatible type into an Any for an object reference")
+ (INSERT_OBJECT_FAILED 11 WARNING "insert_Object call failed on an Any")
+ (EXTRACT_OBJECT_INCOMPATIBLE 12 WARNING "extract_Object call failed on an Any")
+ (FIXED_NOT_MATCH 13 WARNING "Fixed type does not match typecode")
+ (FIXED_BAD_TYPECODE 14 WARNING "Tried to insert Fixed type for non-Fixed typecode")
+ (SET_EXCEPTION_CALLED_NULL_ARGS 23 WARNING "set_exception(Any) called with null args for DSI ServerRequest")
+ (SET_EXCEPTION_CALLED_BAD_TYPE 24 WARNING "set_exception(Any) called with a bad (non-exception) type")
+ (CONTEXT_CALLED_OUT_OF_ORDER 25 WARNING "ctx() called out of order for DSI ServerRequest")
+ (BAD_ORB_CONFIGURATOR 26 WARNING "ORB configurator class {0} could not be instantiated")
+ (ORB_CONFIGURATOR_ERROR 27 WARNING "Error in running ORB configurator")
+ (ORB_DESTROYED 28 WARNING "This ORB instance has been destroyed, so no operations can be performed on it")
+ (NEGATIVE_BOUNDS 29 WARNING "Negative bound for string TypeCode is illegal")
+ (EXTRACT_NOT_INITIALIZED 30 WARNING "Called typecode extract on an uninitialized typecode")
+ (EXTRACT_OBJECT_FAILED 31 WARNING "extract_Object failed on an uninitialized Any")
+ (METHOD_NOT_FOUND_IN_TIE 32 FINE "Could not find method named {0} in class {1} in reflective Tie")
+ (CLASS_NOT_FOUND1 33 FINE "ClassNotFoundException while attempting to load preferred stub named {0}")
+ (CLASS_NOT_FOUND2 34 FINE "ClassNotFoundException while attempting to load alternate stub named {0}")
+ (CLASS_NOT_FOUND3 35 FINE "ClassNotFoundException while attempting to load interface {0}")
+ (GET_DELEGATE_SERVANT_NOT_ACTIVE 36 WARNING "POA ServantNotActive exception while trying get an org.omg.CORBA.Portable.Delegate for an org.omg.PortableServer.Servant")
+ (GET_DELEGATE_WRONG_POLICY 37 WARNING "POA WrongPolicy exception while trying get an org.omg.CORBA.Portable.Delegate for an org.omg.PortableServer.Servant")
+ (SET_DELEGATE_REQUIRES_STUB 38 FINE "Call to StubAdapter.setDelegate did not pass a stub")
+ (GET_DELEGATE_REQUIRES_STUB 39 WARNING "Call to StubAdapter.getDelegate did not pass a stub")
+ (GET_TYPE_IDS_REQUIRES_STUB 40 WARNING "Call to StubAdapter.getTypeIds did not pass a stub")
+ (GET_ORB_REQUIRES_STUB 41 WARNING "Call to StubAdapter.getORB did not pass a stub")
+ (CONNECT_REQUIRES_STUB 42 WARNING "Call to StubAdapter.connect did not pass a stub")
+ (IS_LOCAL_REQUIRES_STUB 43 WARNING "Call to StubAdapter.isLocal did not pass a stub")
+ (REQUEST_REQUIRES_STUB 44 WARNING "Call to StubAdapter.request did not pass a stub")
+ (BAD_ACTIVATE_TIE_CALL 45 WARNING "Call to StubAdapter.activateTie did not pass a valid Tie")
+ (IO_EXCEPTION_ON_CLOSE 46 FINE "Useless exception on call to Closeable.close()")
+ )
+ (BAD_PARAM
+ (NULL_PARAM 1 WARNING "Null parameter")
+ (UNABLE_FIND_VALUE_FACTORY 2 FINE "Unable to find value factory")
+ (ABSTRACT_FROM_NON_ABSTRACT 3 WARNING "Abstract interface derived from non-abstract interface")
+ (INVALID_TAGGED_PROFILE 4 WARNING "Error in reading IIOP TaggedProfile")
+ (OBJREF_FROM_FOREIGN_ORB 5 WARNING "Object reference came from foreign ORB")
+ (LOCAL_OBJECT_NOT_ALLOWED 6 FINE "Local object not allowed")
+ (NULL_OBJECT_REFERENCE 7 WARNING "null object reference")
+ (COULD_NOT_LOAD_CLASS 8 WARNING "Could not load class {0}")
+ (BAD_URL 9 WARNING "Malformed URL {0}")
+ (FIELD_NOT_FOUND 10 WARNING "Field {0} not found in parser data object")
+ (ERROR_SETTING_FIELD 11 WARNING "Error in setting field {0} to value {1} in parser data object")
+ (BOUNDS_ERROR_IN_DII_REQUEST 12 WARNING "Bounds error occurred in DII request")
+ (PERSISTENT_SERVER_INIT_ERROR 13 WARNING "Initialization error for persistent server")
+ (COULD_NOT_CREATE_ARRAY 14 WARNING "Could not create array for field {0} with component type {1} and size {2}")
+ (COULD_NOT_SET_ARRAY 15 WARNING "Could not set array for field {0} at index {1} with component type {2} and size {3} to value {4}")
+ (ILLEGAL_BOOTSTRAP_OPERATION 16 WARNING "Illegal bootstrap operation {0}")
+ (BOOTSTRAP_RUNTIME_EXCEPTION 17 WARNING "Runtime Exception during bootstrap operation")
+ (BOOTSTRAP_EXCEPTION 18 WARNING "Exception during bootstrap operation")
+ (STRING_EXPECTED 19 WARNING "Expected a string, but argument was not of String type")
+ (INVALID_TYPECODE_KIND 20 WARNING "{0} does not represent a valid kind of typecode")
+ (SOCKET_FACTORY_AND_CONTACT_INFO_LIST_AT_SAME_TIME
+ 21 WARNING "cannot have a SocketFactory and a ContactInfoList at the same time")
+ (ACCEPTORS_AND_LEGACY_SOCKET_FACTORY_AT_SAME_TIME
+ 22 WARNING "cannot have Acceptors and a legacy SocketFactory at the same time")
+ (BAD_ORB_FOR_SERVANT
+ 23 WARNING "Reflective POA Servant requires an instance of org.omg.CORBA_2_3.ORB")
+ (INVALID_REQUEST_PARTITIONING_POLICY_VALUE 24 WARNING
+ "Request partitioning value specified, {0}, is outside supported range, {1} - {2}")
+ (INVALID_REQUEST_PARTITIONING_COMPONENT_VALUE 25 WARNING
+ "Could not set request partitioning component value to {0}, valid values are {1} - {2}")
+ (INVALID_REQUEST_PARTITIONING_ID
+ 26 WARNING "Invalid request partitioning id {0}, valid values are {1} - {2}")
+ (ERROR_IN_SETTING_DYNAMIC_STUB_FACTORY_FACTORY
+ 27 FINE "ORBDynamicStubFactoryFactoryClass property had value {0}, which could not be loaded by the ORB ClassLoader" )
+ )
+ (BAD_INV_ORDER
+ (DSIMETHOD_NOTCALLED 1 WARNING "DSI method not called")
+ (ARGUMENTS_CALLED_MULTIPLE 2 WARNING "arguments(NVList) called more than once for DSI ServerRequest")
+ (ARGUMENTS_CALLED_AFTER_EXCEPTION 3 WARNING "arguments(NVList) called after exceptions set for DSI ServerRequest")
+ (ARGUMENTS_CALLED_NULL_ARGS 4 WARNING "arguments(NVList) called with null args for DSI ServerRequest")
+ (ARGUMENTS_NOT_CALLED 5 FINE "arguments(NVList) not called for DSI ServerRequest")
+ (SET_RESULT_CALLED_MULTIPLE 6 WARNING "set_result(Any) called more than once for DSI ServerRequest")
+ (SET_RESULT_AFTER_EXCEPTION 7 FINE "set_result(Any) called exception was set for DSI ServerRequest")
+ (SET_RESULT_CALLED_NULL_ARGS 8 WARNING "set_result(Any) called with null args for DSI ServerRequest"))
+ (BAD_TYPECODE
+ (BAD_REMOTE_TYPECODE 1 WARNING "Foreign to native typecode conversion constructor should not be called with native typecode")
+ (UNRESOLVED_RECURSIVE_TYPECODE 2 WARNING "Invoked operation on unresolved recursive TypeCode"))
+ (COMM_FAILURE
+ (CONNECT_FAILURE
+ 1 WARNING "Connection failure: socketType: {0}; hostname: {1}; port: {2}")
+ (CONNECTION_CLOSE_REBIND
+ 2 WARNING "Connection close: rebind")
+ (WRITE_ERROR_SEND
+ 3 FINE "Write error sent")
+ (GET_PROPERTIES_ERROR
+ 4 WARNING "Get properties error")
+ (BOOTSTRAP_SERVER_NOT_AVAIL
+ 5 WARNING "Bootstrap server is not available")
+ (INVOKE_ERROR
+ 6 WARNING "Invocation error")
+ (DEFAULT_CREATE_SERVER_SOCKET_GIVEN_NON_IIOP_CLEAR_TEXT
+ 7 WARNING "DefaultSocketFactory.createServerSocket only handles IIOP_CLEAR_TEXT, given {0}")
+ (CONNECTION_ABORT
+ 8 FINE "Connection abort")
+ (CONNECTION_REBIND
+ 9 FINE "Connection rebind")
+ (RECV_MSG_ERROR
+ 10 WARNING "Received a GIOP MessageError, indicating header corruption or version mismatch")
+ (IOEXCEPTION_WHEN_READING_CONNECTION
+ 11 FINE "IOException when reading connection")
+ (SELECTION_KEY_INVALID
+ 12 FINE "SelectionKey invalid on channel, {0}")
+ (EXCEPTION_IN_ACCEPT
+ 13 FINE "Unexpected {0} in accept")
+ (SECURITY_EXCEPTION_IN_ACCEPT
+ 14 FINE "Unexpected {0}, has permissions {1}")
+ (TRANSPORT_READ_TIMEOUT_EXCEEDED
+ 15 WARNING "Read of full message failed : bytes requested = {0} bytes read = {1} max wait time = {2} total time spent waiting = {3}")
+ (CREATE_LISTENER_FAILED
+ 16 SEVERE "Unable to create listener thread on the specified port: {0}")
+ (BUFFER_READ_MANAGER_TIMEOUT
+ 17 WARNING "Timeout while reading data in buffer manager")
+ )
+ (DATA_CONVERSION
+ (BAD_STRINGIFIED_IOR_LEN 1 WARNING "A character did not map to the transmission code set")
+ (BAD_STRINGIFIED_IOR 2 WARNING "Bad stringified IOR")
+ (BAD_MODIFIER 3 WARNING "Unable to perform resolve_initial_references due to bad host or port configuration")
+ (CODESET_INCOMPATIBLE 4 WARNING "Codesets incompatible")
+ (BAD_HEX_DIGIT 5 WARNING "Illegal hexadecimal digit")
+ (BAD_UNICODE_PAIR 6 WARNING "Invalid unicode pair detected during code set conversion")
+ (BTC_RESULT_MORE_THAN_ONE_CHAR 7 WARNING "Tried to convert bytes to a single java char, but conversion yielded more than one Java char (Surrogate pair?)")
+ (BAD_CODESETS_FROM_CLIENT 8 WARNING "Client sent code set service context that we do not support")
+ (INVALID_SINGLE_CHAR_CTB 9 WARNING "Char to byte conversion for a CORBA char resulted in more than one byte")
+ (BAD_GIOP_1_1_CTB 10 WARNING "Character to byte conversion did not exactly double number of chars (GIOP 1.1 only)")
+ (BAD_SEQUENCE_BOUNDS 12 WARNING "Tried to insert a sequence of length {0} into a bounded sequence of maximum length {1} in an Any")
+ (ILLEGAL_SOCKET_FACTORY_TYPE 13 WARNING "Class {0} is not a subtype of ORBSocketFactory")
+ (BAD_CUSTOM_SOCKET_FACTORY 14 WARNING "{0} is not a valid custom socket factory")
+ (FRAGMENT_SIZE_MINIMUM 15 WARNING "Fragment size {0} is too small: it must be at least {1}")
+ (FRAGMENT_SIZE_DIV 16 WARNING "Illegal valiue for fragment size ({0}): must be divisible by {1}")
+ (ORB_INITIALIZER_FAILURE
+ 17 WARNING "Could not instantiate ORBInitializer {0}")
+ (ORB_INITIALIZER_TYPE
+ 18 WARNING "orb initializer class {0} is not a subtype of ORBInitializer")
+ (ORB_INITIALREFERENCE_SYNTAX
+ 19 WARNING "Bad syntax for ORBInitialReference")
+ (ACCEPTOR_INSTANTIATION_FAILURE
+ 20 WARNING "Could not instantiate Acceptor {0}")
+ (ACCEPTOR_INSTANTIATION_TYPE_FAILURE
+ 21 WARNING "Acceptor class {0} is not a subtype of Acceptor")
+ (ILLEGAL_CONTACT_INFO_LIST_FACTORY_TYPE
+ 22 WARNING "Class {0} is not a subtype of CorbaContactInfoListFactory")
+ (BAD_CONTACT_INFO_LIST_FACTORY
+ 23 WARNING "{0} is not a valid CorbaContactInfoListFactory")
+ (ILLEGAL_IOR_TO_SOCKET_INFO_TYPE
+ 24 WARNING "Class {0} is not a subtype of IORToSocketInfo")
+ (BAD_CUSTOM_IOR_TO_SOCKET_INFO
+ 25 WARNING "{0} is not a valid custom IORToSocketInfo")
+ (ILLEGAL_IIOP_PRIMARY_TO_CONTACT_INFO_TYPE
+ 26 WARNING "Class {0} is not a subtype of IIOPPrimaryToContactInfo")
+ (BAD_CUSTOM_IIOP_PRIMARY_TO_CONTACT_INFO
+ 27 WARNING "{0} is not a valid custom IIOPPrimaryToContactInfo")
+
+ )
+ (INV_OBJREF
+ (BAD_CORBALOC_STRING 1 WARNING "Bad corbaloc: URL")
+ (NO_PROFILE_PRESENT 2 WARNING "No profile in IOR"))
+ (INITIALIZE
+ (CANNOT_CREATE_ORBID_DB 1 WARNING "Cannot create ORB ID datastore")
+ (CANNOT_READ_ORBID_DB 2 WARNING "Cannot read ORB ID datastore")
+ (CANNOT_WRITE_ORBID_DB 3 WARNING "Cannot write ORB ID datastore")
+ (GET_SERVER_PORT_CALLED_BEFORE_ENDPOINTS_INITIALIZED 4 WARNING "legacyGetServerPort called before endpoints initialized")
+ (PERSISTENT_SERVERPORT_NOT_SET 5 WARNING "Persistent server port is not set")
+ (PERSISTENT_SERVERID_NOT_SET 6 WARNING "Persistent server ID is not set"))
+ (INTERNAL
+ (NON_EXISTENT_ORBID 1 WARNING "Non-existent ORB ID")
+ (NO_SERVER_SUBCONTRACT 2 WARNING "No server request dispatcher")
+ (SERVER_SC_TEMP_SIZE 3 WARNING "server request dispatcher template size error")
+ (NO_CLIENT_SC_CLASS 4 WARNING "No client request dispatcher class")
+ (SERVER_SC_NO_IIOP_PROFILE 5 WARNING "No IIOP profile in server request dispatcher")
+ (GET_SYSTEM_EX_RETURNED_NULL 6 WARNING "getSystemException returned null")
+ (PEEKSTRING_FAILED 7 WARNING "The repository ID of a user exception had a bad length")
+ (GET_LOCAL_HOST_FAILED 8 WARNING "Unable to determine local hostname from InetAddress.getLocalHost().getHostName()")
+ ;; 9 is not used at this time - it is available for reuse.
+ (BAD_LOCATE_REQUEST_STATUS 10 WARNING "Bad locate request status in IIOP locate reply")
+ (STRINGIFY_WRITE_ERROR 11 WARNING "Error while stringifying an object reference")
+ (BAD_GIOP_REQUEST_TYPE 12 WARNING "IIOP message with bad GIOP 1.0 message type")
+ (ERROR_UNMARSHALING_USEREXC 13 WARNING "Error in unmarshalling user exception")
+ (RequestDispatcherRegistry_ERROR 14 WARNING "Overflow in RequestDispatcherRegistry")
+ (LOCATIONFORWARD_ERROR 15 WARNING "Error in processing a LocationForward")
+ (WRONG_CLIENTSC 16 WARNING "Wrong client request dispatcher")
+ (BAD_SERVANT_READ_OBJECT 17 WARNING "Bad servant in read_Object")
+ (MULT_IIOP_PROF_NOT_SUPPORTED 18 WARNING "multiple IIOP profiles not supported")
+ (GIOP_MAGIC_ERROR 20 WARNING "Error in GIOP magic")
+ (GIOP_VERSION_ERROR 21 WARNING "Error in GIOP version")
+ (ILLEGAL_REPLY_STATUS 22 WARNING "Illegal reply status in GIOP reply message")
+ (ILLEGAL_GIOP_MSG_TYPE 23 WARNING "Illegal GIOP message type")
+ (FRAGMENTATION_DISALLOWED 24 WARNING "Fragmentation not allowed for this message type")
+ (BAD_REPLYSTATUS 25 WARNING "Bad status in the IIOP reply message")
+ (CTB_CONVERTER_FAILURE 26 WARNING "character to byte converter failure")
+ (BTC_CONVERTER_FAILURE 27 WARNING "byte to character converter failure")
+ (WCHAR_ARRAY_UNSUPPORTED_ENCODING 28 WARNING "Unsupported wchar encoding: ORB only supports fixed width UTF-16 encoding")
+ (ILLEGAL_TARGET_ADDRESS_DISPOSITION 29 WARNING "Illegal target address disposition value")
+ (NULL_REPLY_IN_GET_ADDR_DISPOSITION 30 WARNING "No reply while attempting to get addressing disposition")
+ (ORB_TARGET_ADDR_PREFERENCE_IN_EXTRACT_OBJECTKEY_INVALID 31 WARNING "Invalid GIOP target addressing preference")
+ (INVALID_ISSTREAMED_TCKIND 32 WARNING "Invalid isStreamed TCKind {0}")
+ (INVALID_JDK1_3_1_PATCH_LEVEL 33 WARNING "Found a JDK 1.3.1 patch level indicator with value less than JDK 1.3.1_01 value of 1")
+ (SVCCTX_UNMARSHAL_ERROR 34 WARNING "Error unmarshalling service context data")
+ (NULL_IOR 35 WARNING "null IOR")
+ (UNSUPPORTED_GIOP_VERSION 36 WARNING "Unsupported GIOP version {0}")
+ (APPLICATION_EXCEPTION_IN_SPECIAL_METHOD 37 WARNING "Application exception in special method: should not happen")
+ (STATEMENT_NOT_REACHABLE1 38 WARNING "Assertion failed: statement not reachable (1)")
+ (STATEMENT_NOT_REACHABLE2 39 WARNING "Assertion failed: statement not reachable (2)")
+ (STATEMENT_NOT_REACHABLE3 40 WARNING "Assertion failed: statement not reachable (3)")
+ (STATEMENT_NOT_REACHABLE4 41 FINE "Assertion failed: statement not reachable (4)")
+ (STATEMENT_NOT_REACHABLE5 42 WARNING "Assertion failed: statement not reachable (5)")
+ (STATEMENT_NOT_REACHABLE6 43 WARNING "Assertion failed: statement not reachable (6)")
+ (UNEXPECTED_DII_EXCEPTION 44 WARNING "Unexpected exception while unmarshalling DII user exception")
+ (METHOD_SHOULD_NOT_BE_CALLED 45 WARNING "This method should never be called")
+ (CANCEL_NOT_SUPPORTED 46 WARNING "We do not support cancel request for GIOP 1.1")
+ (EMPTY_STACK_RUN_SERVANT_POST_INVOKE 47 WARNING "Empty stack exception while calling runServantPostInvoke")
+ (PROBLEM_WITH_EXCEPTION_TYPECODE 48 WARNING "Bad exception typecode")
+ (ILLEGAL_SUBCONTRACT_ID 49 WARNING "Illegal Subcontract id {0}")
+ (BAD_SYSTEM_EXCEPTION_IN_LOCATE_REPLY 50 WARNING "Bad system exception in locate reply")
+ (BAD_SYSTEM_EXCEPTION_IN_REPLY 51 WARNING "Bad system exception in reply")
+ (BAD_COMPLETION_STATUS_IN_LOCATE_REPLY 52 WARNING "Bad CompletionStatus {0} in locate reply")
+ (BAD_COMPLETION_STATUS_IN_REPLY 53 WARNING "Bad CompletionStatus {0} in reply")
+ (BADKIND_CANNOT_OCCUR 54 WARNING "The BadKind exception should never occur here")
+ (ERROR_RESOLVING_ALIAS 55 WARNING "Could not resolve alias typecode")
+ (TK_LONG_DOUBLE_NOT_SUPPORTED 56 WARNING "The long double type is not supported in Java")
+ (TYPECODE_NOT_SUPPORTED 57 WARNING "Illegal typecode kind")
+ (BOUNDS_CANNOT_OCCUR 59 WARNING "Bounds exception cannot occur in this context")
+ (NUM_INVOCATIONS_ALREADY_ZERO 61 WARNING "Number of invocations is already zero, but another invocation has completed")
+ (ERROR_INIT_BADSERVERIDHANDLER 62 WARNING "Error in constructing instance of bad server ID handler")
+ (NO_TOA 63 WARNING "No TOAFactory is availble")
+ (NO_POA 64 WARNING "No POAFactory is availble")
+ (INVOCATION_INFO_STACK_EMPTY 65 WARNING "Invocation info stack is unexpectedly empty")
+ (BAD_CODE_SET_STRING 66 WARNING "Empty or null code set string")
+ (UNKNOWN_NATIVE_CODESET 67 WARNING "Unknown native codeset: {0}")
+ (UNKNOWN_CONVERSION_CODE_SET 68 WARNING "Unknown conversion codset: {0}")
+ (INVALID_CODE_SET_NUMBER 69 WARNING "Invalid codeset number")
+ (INVALID_CODE_SET_STRING 70 WARNING "Invalid codeset string {0}")
+ (INVALID_CTB_CONVERTER_NAME 71 WARNING "Invalid CTB converter {0}")
+ (INVALID_BTC_CONVERTER_NAME 72 WARNING "Invalid BTC converter {0}")
+ (COULD_NOT_DUPLICATE_CDR_INPUT_STREAM 73 WARNING "Could not duplicate CDRInputStream")
+ (BOOTSTRAP_APPLICATION_EXCEPTION 74 WARNING "BootstrapResolver caught an unexpected ApplicationException")
+ (DUPLICATE_INDIRECTION_OFFSET 75 WARNING "Old entry in serialization indirection table has a different value than the value being added with the same key")
+ (BAD_MESSAGE_TYPE_FOR_CANCEL 76 WARNING "GIOP Cancel request contained a bad request ID: the request ID did not match the request that was to be cancelled")
+ (DUPLICATE_EXCEPTION_DETAIL_MESSAGE 77 WARNING "Duplicate ExceptionDetailMessage")
+ (BAD_EXCEPTION_DETAIL_MESSAGE_SERVICE_CONTEXT_TYPE 78 WARNING "Bad ExceptionDetailMessage ServiceContext type")
+ (UNEXPECTED_DIRECT_BYTE_BUFFER_WITH_NON_CHANNEL_SOCKET 79 WARNING "unexpected direct ByteBuffer with non-channel socket")
+ (UNEXPECTED_NON_DIRECT_BYTE_BUFFER_WITH_CHANNEL_SOCKET 80 WARNING "unexpected non-direct ByteBuffer with channel socket")
+ (INVALID_CONTACT_INFO_LIST_ITERATOR_FAILURE_EXCEPTION 82 WARNING "There should be at least one CorbaContactInfo to try (and fail) so this error should not be seen.")
+ (REMARSHAL_WITH_NOWHERE_TO_GO 83 WARNING "Remarshal with nowhere to go")
+ (EXCEPTION_WHEN_SENDING_CLOSE_CONNECTION 84 WARNING "Exception when sending close connection")
+ (INVOCATION_ERROR_IN_REFLECTIVE_TIE 85 WARNING "A reflective tie got an error while invoking method {0} on class {1}")
+ (BAD_HELPER_WRITE_METHOD 86 WARNING "Could not find or invoke write method on exception Helper class {0}")
+ (BAD_HELPER_READ_METHOD 87 WARNING "Could not find or invoke read method on exception Helper class {0}")
+ (BAD_HELPER_ID_METHOD 88 WARNING "Could not find or invoke id method on exception Helper class {0}")
+ (WRITE_UNDECLARED_EXCEPTION 89 WARNING "Tried to write exception of type {0} that was not declared on method")
+ (READ_UNDECLARED_EXCEPTION 90 WARNING "Tried to read undeclared exception with ID {0}")
+ (UNABLE_TO_SET_SOCKET_FACTORY_ORB 91 WARNING "Unable to setSocketFactoryORB")
+ (UNEXPECTED_EXCEPTION 92 WARNING "Unexpected exception occurred where no exception should occur")
+ (NO_INVOCATION_HANDLER 93 WARNING "No invocation handler available for {0}")
+ (INVALID_BUFF_MGR_STRATEGY 94 WARNING "{0}: invalid buffer manager strategy for Java serialization")
+ (JAVA_STREAM_INIT_FAILED 95 WARNING "Java stream initialization failed")
+ (DUPLICATE_ORB_VERSION_SERVICE_CONTEXT 96 WARNING "An ORBVersionServiceContext was already in the service context list")
+ (DUPLICATE_SENDING_CONTEXT_SERVICE_CONTEXT 97 WARNING "A SendingContextServiceContext was already in the service context list")
+ (WORK_QUEUE_THREAD_INTERRUPTED 98 FINE "Worker Thread from thread pool {0} was interrupted: closeCalled is {1}.")
+ (WORKER_THREAD_CREATED
+ 104 FINE "Worker thread {0} has been created with ClassLoader {1}")
+ (WORKER_THREAD_THROWABLE_FROM_REQUEST_WORK
+ 109 FINE "Worker thread {0} caught throwable {1} when requesting work from work queue {2}.")
+ (WORKER_THREAD_NOT_NEEDED
+ 110 FINE "Worker thread {0} will exit; current thread count, {1}, greater than minunum worker threads needed, {2}.")
+ (WORKER_THREAD_DO_WORK_THROWABLE
+ 111 FINE "Worker thread {0} caught throwable {1} while executing work.")
+ (WORKER_THREAD_CAUGHT_UNEXPECTED_THROWABLE
+ 112 WARNING "Worker thread {0} caught unexpected throwable {1}.")
+ (WORKER_THREAD_CREATION_FAILURE
+ 113 SEVERE "Worker thread creation failure; cause {0}.")
+ (WORKER_THREAD_SET_NAME_FAILURE
+ 114 WARNING "Unable to set worker thread {0} name to {1}; cause {2}.")
+ (WORK_QUEUE_REQUEST_WORK_NO_WORK_FOUND
+ 116 WARNING "Ignoring unexpected {0} when retrieving of work from work queue, {1}.")
+ (THREAD_POOL_CLOSE_ERROR 126 WARNING "Error in closing ThreadPool")
+ (THREAD_GROUP_IS_DESTROYED 127 WARNING "ThreadGroup {0} is already destroyed: can't destroy it")
+ (THREAD_GROUP_HAS_ACTIVE_THREADS_IN_CLOSE 128 WARNING "ThreadGroup {0} has {1} active threads: destroy may cause exception")
+ (THREAD_GROUP_HAS_SUB_GROUPS_IN_CLOSE 129 WARNING "ThreadGroup {0} has {1} sub-thread groups: destroy may cause exception")
+ (THREAD_GROUP_DESTROY_FAILED 130 WARNING "ThreadGroup {0} could not be destroyed")
+ (INTERRUPTED_JOIN_CALL_WHILE_CLOSING_THREAD_POOL 131 WARNING "Join was interrupted on thread {0} while closing ThreadPool {1}")
+ )
+
+ (MARSHAL
+ (CHUNK_OVERFLOW 1 WARNING "Data read past end of chunk without closing the chunk")
+ (UNEXPECTED_EOF 2 WARNING "Grow buffer strategy called underflow handler")
+ (READ_OBJECT_EXCEPTION 3 WARNING "Error in reading marshalled object")
+ (CHARACTER_OUTOFRANGE 4 WARNING "Character not IOS Latin-1 compliant in marshalling")
+ (DSI_RESULT_EXCEPTION 5 WARNING "Exception thrown during result() on ServerRequest")
+ (IIOPINPUTSTREAM_GROW 6 WARNING "grow() called on IIOPInputStream")
+ (END_OF_STREAM 7 FINE "Underflow in BufferManagerReadStream after last fragment in message")
+ (INVALID_OBJECT_KEY 8 WARNING "Invalid ObjectKey in request header")
+ (MALFORMED_URL 9 WARNING "Unable to locate value class for repository ID {0} because codebase URL {1] is malformed")
+ (VALUEHANDLER_READ_ERROR 10 WARNING "Error from readValue on ValueHandler in CDRInputStream")
+ (VALUEHANDLER_READ_EXCEPTION 11 WARNING "Exception from readValue on ValueHandler in CDRInputStream")
+ (BAD_KIND 12 WARNING "Bad kind in isCustomType in CDRInputStream")
+ (CNFE_READ_CLASS 13 WARNING "Could not find class {0} in CDRInputStream.readClass")
+ (BAD_REP_ID_INDIRECTION 14 WARNING "Bad repository ID indirection at index {0}")
+ (BAD_CODEBASE_INDIRECTION 15 WARNING "Bad codebase string indirection at index {0}")
+ (UNKNOWN_CODESET 16 WARNING "Unknown code set {0} specified by client ORB as a negotiated code set")
+ (WCHAR_DATA_IN_GIOP_1_0 17 WARNING "Attempt to marshal wide character or string data in GIOP 1.0")
+ (NEGATIVE_STRING_LENGTH 18 WARNING "String or wstring with a negative length {0}")
+ (EXPECTED_TYPE_NULL_AND_NO_REP_ID 19 WARNING "CDRInputStream.read_value(null) called, but no repository ID information on the wire")
+ (READ_VALUE_AND_NO_REP_ID 20 WARNING "CDRInputStream.read_value() called, but no repository ID information on the wire")
+ (UNEXPECTED_ENCLOSING_VALUETYPE 22 WARNING "Received end tag {0}, which is less than the expected value {1}")
+ (POSITIVE_END_TAG 23 WARNING "Read non-negative end tag {0} at offset {1} (end tags should always be negative)")
+ (NULL_OUT_CALL 24 WARNING "Out call descriptor is missing")
+ (WRITE_LOCAL_OBJECT 25 WARNING "write_Object called with a local object")
+ (BAD_INSERTOBJ_PARAM 26 WARNING "Tried to insert non-ObjectImpl {0} into an Any via insert_Object")
+ (CUSTOM_WRAPPER_WITH_CODEBASE 27 WARNING "Codebase present in RMI-IIOP stream format version 1 optional data valuetype header")
+ (CUSTOM_WRAPPER_INDIRECTION 28 WARNING "Indirection preseint in RMI-IIOP stream format version 2 optional data valuetype header")
+ (CUSTOM_WRAPPER_NOT_SINGLE_REPID 29 WARNING "0 or more than one repository ID found reading the optional data valuetype header")
+ (BAD_VALUE_TAG 30 WARNING "Bad valuetag {0} found while reading repository IDs")
+ (BAD_TYPECODE_FOR_CUSTOM_VALUE 31 WARNING "Bad typecode found for custom valuetype")
+ (ERROR_INVOKING_HELPER_WRITE 32 WARNING "An error occurred using reflection to invoke IDL Helper write method")
+ (BAD_DIGIT_IN_FIXED 33 WARNING "A bad digit was found while marshalling an IDL fixed type")
+ (REF_TYPE_INDIR_TYPE 34 WARNING "Referenced type of indirect type not marshaled")
+ (BAD_RESERVED_LENGTH 35 WARNING "Request message reserved bytes has invalid length")
+ (NULL_NOT_ALLOWED 36 WARNING "A null object is not allowed here")
+ (UNION_DISCRIMINATOR_ERROR 38 WARNING "Error in typecode union discriminator")
+ (CANNOT_MARSHAL_NATIVE 39 WARNING "Cannot marshal a native TypeCode")
+ (CANNOT_MARSHAL_BAD_TCKIND 40 WARNING "Cannot marshal an invalid TypeCode kind")
+ (INVALID_INDIRECTION 41 WARNING "Invalid indirection value {0} (>-4): probable stream corruption")
+ (INDIRECTION_NOT_FOUND 42 FINE "No type found at indirection {0}: probably stream corruption")
+ (RECURSIVE_TYPECODE_ERROR 43 WARNING "Recursive TypeCode not supported by InputStream subtype")
+ (INVALID_SIMPLE_TYPECODE 44 WARNING "TypeCode is of wrong kind to be simple")
+ (INVALID_COMPLEX_TYPECODE 45 WARNING "TypeCode is of wrong kind to be complex")
+ (INVALID_TYPECODE_KIND_MARSHAL 46 WARNING "Cannot marshal typecode of invalid kind")
+ (UNEXPECTED_UNION_DEFAULT 47 WARNING "Default union branch not expected")
+ (ILLEGAL_UNION_DISCRIMINATOR_TYPE 48 WARNING "Illegal discriminator type in union")
+ (COULD_NOT_SKIP_BYTES 49 WARNING "Could not skip over {0} bytes at offset {1}")
+ (BAD_CHUNK_LENGTH 50 WARNING "Incorrect chunk length {0} at offset {1}")
+ (UNABLE_TO_LOCATE_REP_ID_ARRAY 51 WARNING "Unable to locate array of repository IDs from indirection {0}")
+ (BAD_FIXED 52 WARNING "Fixed of length {0} in buffer of length {1}")
+ (READ_OBJECT_LOAD_CLASS_FAILURE 53 WARNING "Failed to load stub for {0} with class {1}")
+ (COULD_NOT_INSTANTIATE_HELPER 54 WARNING "Could not instantiate Helper class {0}")
+ (BAD_TOA_OAID 55 WARNING "Bad ObjectAdapterId for TOA")
+ (COULD_NOT_INVOKE_HELPER_READ_METHOD 56 WARNING "Could not invoke helper read method for helper {0}")
+ (COULD_NOT_FIND_CLASS 57 WARNING "Could not find class")
+ (BAD_ARGUMENTS_NVLIST 58 FINE "Error in arguments(NVList) for DSI ServerRequest")
+ (STUB_CREATE_ERROR 59 FINE "Could not create stub")
+ (JAVA_SERIALIZATION_EXCEPTION 60 WARNING "Java serialization exception during {0} operation"))
+ (NO_IMPLEMENT
+ (GENERIC_NO_IMPL 1 FINE "feature not implemented")
+ (CONTEXT_NOT_IMPLEMENTED 2 FINE "IDL request context is not implemented")
+ (GETINTERFACE_NOT_IMPLEMENTED 3 FINE "getInterface() is not implemented")
+ (SEND_DEFERRED_NOTIMPLEMENTED 4 FINE "send deferred is not implemented")
+ (LONG_DOUBLE_NOT_IMPLEMENTED 5 FINE "IDL type long double is not supported in Java"))
+ (OBJ_ADAPTER
+ (NO_SERVER_SC_IN_DISPATCH 1 WARNING "No server request dispatcher found when dispatching request to object adapter")
+ (ORB_CONNECT_ERROR 2 WARNING "Error in connecting servant to ORB")
+ (ADAPTER_INACTIVE_IN_ACTIVATION 3 FINE "StubAdapter.getDelegate failed to activate a Servant"))
+ (OBJECT_NOT_EXIST
+ (LOCATE_UNKNOWN_OBJECT 1 WARNING "Locate response indicated that the object was unknown")
+ (BAD_SERVER_ID 2 FINE "The server ID in the target object key does not match the server key expected by the server")
+ (BAD_SKELETON 3 WARNING "No skeleton found in the server that matches the target object key")
+ (SERVANT_NOT_FOUND 4 WARNING "Servant not found")
+ (NO_OBJECT_ADAPTER_FACTORY 5 WARNING "No object adapter factory")
+ (BAD_ADAPTER_ID 6 WARNING "Bad adapter ID")
+ (DYN_ANY_DESTROYED 7 WARNING "Dynamic Any was destroyed: all operations are invalid"))
+ (TRANSIENT
+ (REQUEST_CANCELED 1 WARNING "Request cancelled by exception"))
+ (UNKNOWN
+ (UNKNOWN_CORBA_EXC 1 WARNING "Unknown user exception while unmarshalling")
+ (RUNTIMEEXCEPTION 2 WARNING "Unknown user exception thrown by the server")
+ (UNKNOWN_SERVER_ERROR 3 WARNING "Unknown exception or error thrown by the ORB or application")
+ (UNKNOWN_DSI_SYSEX 4 WARNING "Error while marshalling SystemException after DSI-based invocation")
+ (UNKNOWN_SYSEX 5 WARNING "Error while unmarshalling SystemException")
+ (WRONG_INTERFACE_DEF 6 WARNING "InterfaceDef object of wrong type returned by server")
+ (NO_INTERFACE_DEF_STUB 7 WARNING "org.omg.CORBA._InterfaceDefStub class not available")
+ (UNKNOWN_EXCEPTION_IN_DISPATCH 9 FINE "UnknownException in dispatch"))))
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/POA.mc b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/POA.mc
new file mode 100644
index 0000000..5eb198d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/POA.mc
@@ -0,0 +1,107 @@
+;
+; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+;
+; This code is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License version 2 only, as
+; published by the Free Software Foundation. Oracle designates this
+; particular file as subject to the "Classpath" exception as provided
+; by Oracle in the LICENSE file that accompanied this code.
+;
+; This code is distributed in the hope that it will be useful, but WITHOUT
+; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+; version 2 for more details (a copy is included in the LICENSE file that
+; accompanied this code).
+;
+; You should have received a copy of the GNU General Public License version
+; 2 along with this work; if not, write to the Free Software Foundation,
+; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+;
+; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+; or visit www.oracle.com if you need additional information or have any
+; questions.
+;
+("com.sun.corba.se.impl.logging" "POASystemException" POA
+ (
+ (BAD_INV_ORDER
+ (SERVANT_MANAGER_ALREADY_SET 1 WARNING "Servant Manager already set")
+ (DESTROY_DEADLOCK 2 WARNING "Request to wait for POA destruction while servicing request would deadlock"))
+ (BAD_OPERATION
+ (SERVANT_ORB 1 WARNING "Bad operation on servant ORB???")
+ (BAD_SERVANT 2 WARNING "Bad Servant???")
+ (ILLEGAL_FORWARD_REQUEST 3 WARNING "Illegal Forward Request???"))
+ (BAD_PARAM
+ (BAD_TRANSACTION_CONTEXT 1 WARNING "Bad transaction context")
+ (BAD_REPOSITORY_ID 2 WARNING "Bad repository id"))
+ (INTERNAL
+ (INVOKESETUP 1 WARNING "invoke setup???")
+ (BAD_LOCALREPLYSTATUS 2 WARNING "bad local reply status???")
+ (PERSISTENT_SERVERPORT_ERROR 3 WARNING "persistent serverport error???")
+ (SERVANT_DISPATCH 4 WARNING "servant dispatch???")
+ (WRONG_CLIENTSC 5 WARNING "wrong client request dispatcher???")
+ (CANT_CLONE_TEMPLATE 6 WARNING "can't clone template???")
+ (POACURRENT_UNBALANCED_STACK 7 WARNING "POACurrent stack is unbalanced")
+ (POACURRENT_NULL_FIELD 8 WARNING "Null field in POACurrent")
+ (POA_INTERNAL_GET_SERVANT_ERROR 9 WARNING "POA internalGetServant error")
+ (MAKE_FACTORY_NOT_POA 10 WARNING "First Object Adapter name is {0}, should be RootPOA")
+ (DUPLICATE_ORB_VERSION_SC 11 WARNING "Duplicate ORB version service context")
+ (PREINVOKE_CLONE_ERROR 12 WARNING "preinvoke clone error")
+ (PREINVOKE_POA_DESTROYED 13 WARNING "preinvoke POA destroyed")
+ (PMF_CREATE_RETAIN 14 WARNING "Bad dispatch policy for RETAIN policy in POAPolicyMediatorFactory")
+ (PMF_CREATE_NON_RETAIN 15 WARNING "Bad dispatch policy for NON_RETAIN policy in POAPolicyMediatorFactory")
+ (POLICY_MEDIATOR_BAD_POLICY_IN_FACTORY 16 WARNING "Inconsistent policy in PolicyMediator")
+ (SERVANT_TO_ID_OAA 17 WARNING "ObjectAlreadyActive in servantToId")
+ (SERVANT_TO_ID_SAA 18 WARNING "ServantAlreadyActive in servantToId")
+ (SERVANT_TO_ID_WP 19 WARNING "WrongPolicy in servantToId")
+ (CANT_RESOLVE_ROOT_POA 20 WARNING "Can't resolve root POA")
+ (SERVANT_MUST_BE_LOCAL 21 WARNING "Call made to local client request dispatcher with non-local servant")
+ (NO_PROFILES_IN_IOR 22 WARNING "IOR does not have any profiles")
+ (AOM_ENTRY_DEC_ZERO 23 WARNING "Tried to decrement AOMEntry counter that is already 0")
+ (ADD_POA_INACTIVE 24 WARNING "Tried to add a POA to an inactive POAManager")
+ (ILLEGAL_POA_STATE_TRANS 25 WARNING "POA tried to make an illegal state transition")
+ (UNEXPECTED_EXCEPTION 26 WARNING "Unexpected exception in POA {0}"))
+ (NO_IMPLEMENT
+ (SINGLE_THREAD_NOT_SUPPORTED 1 WARNING "Single thread policy is not supported")
+ (METHOD_NOT_IMPLEMENTED 2 WARNING "This method is not implemented"))
+ (OBJ_ADAPTER
+ (POA_LOOKUP_ERROR 1 WARNING "Error in find_POA")
+ (POA_INACTIVE 2 FINE "POA is inactive")
+ (POA_NO_SERVANT_MANAGER 3 WARNING "POA has no servant manager")
+ (POA_NO_DEFAULT_SERVANT 4 WARNING "POA has no default servant")
+ (POA_SERVANT_NOT_UNIQUE 5 WARNING "POA servant is not unique")
+ (POA_WRONG_POLICY 6 WARNING "Bad policy in POA")
+ (FINDPOA_ERROR 7 WARNING "Another error in find_POA")
+ (POA_SERVANT_ACTIVATOR_LOOKUP_FAILED 9 WARNING "POA ServantActivator lookup failed")
+ (POA_BAD_SERVANT_MANAGER 10 WARNING "POA has bad servant manager")
+ (POA_SERVANT_LOCATOR_LOOKUP_FAILED 11 WARNING "POA ServantLocator lookup failed")
+ (POA_UNKNOWN_POLICY 12 WARNING "Unknown policy passed to POA")
+ (POA_NOT_FOUND 13 WARNING "POA not found")
+ (SERVANT_LOOKUP 14 WARNING "Error in servant lookup")
+ (LOCAL_SERVANT_LOOKUP 15 WARNING "Error in local servant lookup")
+ (SERVANT_MANAGER_BAD_TYPE 16 WARNING "Bad type for servant manager")
+ (DEFAULT_POA_NOT_POAIMPL 17 WARNING "Servant's _default_POA must be an instance of POAImpl")
+ (WRONG_POLICIES_FOR_THIS_OBJECT 18 WARNING "Wrong POA policies for _this_object called outside of an invocation context")
+ (THIS_OBJECT_SERVANT_NOT_ACTIVE 19 WARNING "ServantNotActive exception in _this_object")
+ (THIS_OBJECT_WRONG_POLICY 20 WARNING "WrongPolicy exception in _this_object")
+ (NO_CONTEXT 21 FINE "Operation called outside of invocation context")
+ (INCARNATE_RETURNED_NULL 22 WARNING "ServantActivator.incarnate() returned a null Servant"))
+ (INITIALIZE
+ (JTS_INIT_ERROR 1 WARNING "JTS initialization error")
+ (PERSISTENT_SERVERID_NOT_SET 2 WARNING "Persistent server ID is not set")
+ (PERSISTENT_SERVERPORT_NOT_SET 3 WARNING "Persistent server port is not set")
+ (ORBD_ERROR 4 WARNING "Error in ORBD")
+ (BOOTSTRAP_ERROR 5 WARNING "Error in bootstrap"))
+ (TRANSIENT
+ (POA_DISCARDING 1 FINE "POA is in discarding state"))
+ (UNKNOWN
+ (OTSHOOKEXCEPTION 1 WARNING "Error in OTS hook")
+ (UNKNOWN_SERVER_EXCEPTION 2 WARNING "Unknown server exception")
+ (UNKNOWN_SERVERAPP_EXCEPTION 3 WARNING "Unknown server application exception")
+ (UNKNOWN_LOCALINVOCATION_ERROR 4 WARNING "Unknon local invocation error"))
+ (OBJECT_NOT_EXIST
+ (ADAPTER_ACTIVATOR_NONEXISTENT 1 WARNING "AdapterActivator does not exist")
+ (ADAPTER_ACTIVATOR_FAILED 2 WARNING "AdapterActivator failed")
+ (BAD_SKELETON 3 WARNING "Bad skeleton")
+ (NULL_SERVANT 4 FINE "Null servant")
+ (ADAPTER_DESTROYED 5 WARNING "POA has been destroyed"))))
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Util.mc b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Util.mc
new file mode 100644
index 0000000..f46e0ef
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/logging/data/Util.mc
@@ -0,0 +1,64 @@
+;
+; Copyright (c) 2003, 2011, Oracle and/or its affiliates. All rights reserved.
+; DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+;
+; This code is free software; you can redistribute it and/or modify it
+; under the terms of the GNU General Public License version 2 only, as
+; published by the Free Software Foundation. Oracle designates this
+; particular file as subject to the "Classpath" exception as provided
+; by Oracle in the LICENSE file that accompanied this code.
+;
+; This code is distributed in the hope that it will be useful, but WITHOUT
+; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+; version 2 for more details (a copy is included in the LICENSE file that
+; accompanied this code).
+;
+; You should have received a copy of the GNU General Public License version
+; 2 along with this work; if not, write to the Free Software Foundation,
+; Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+;
+; Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+; or visit www.oracle.com if you need additional information or have any
+; questions.
+;
+("com.sun.corba.se.impl.logging" "UtilSystemException" UTIL
+ (
+ (BAD_OPERATION
+ (STUB_FACTORY_COULD_NOT_MAKE_STUB 1 FINE "StubFactory failed on makeStub call")
+ (ERROR_IN_MAKE_STUB_FROM_REPOSITORY_ID 2 FINE "Error in making stub given RepositoryId")
+ (CLASS_CAST_EXCEPTION_IN_LOAD_STUB 3 FINE "ClassCastException in loadStub")
+ (EXCEPTION_IN_LOAD_STUB 4 FINE "Exception in loadStub")
+ )
+ (BAD_PARAM
+ (NO_POA 2 WARNING "Error in loadStubAndUpdateCache caused by _this_object")
+ (CONNECT_WRONG_ORB 3 FINE "Tried to connect already connected Stub Delegate to a different ORB")
+ (CONNECT_NO_TIE 4 WARNING "Tried to connect unconnected Stub Delegate but no Tie was found")
+ (CONNECT_TIE_WRONG_ORB 5 WARNING "Tried to connect unconnected stub with Tie in a different ORB")
+ (CONNECT_TIE_NO_SERVANT 6 WARNING "Tried to connect unconnected stub to unconnected Tie")
+ (LOAD_TIE_FAILED 7 FINE "Failed to load Tie of class {0}")
+ )
+ (DATA_CONVERSION
+ (BAD_HEX_DIGIT 1 WARNING "Bad hex digit in string_to_object"))
+ (MARSHAL
+ (UNABLE_LOCATE_VALUE_HELPER 2 WARNING "Could not locate value helper")
+ (INVALID_INDIRECTION 3 WARNING "Invalid indirection {0}"))
+ (INV_OBJREF
+ (OBJECT_NOT_CONNECTED 1 WARNING "{0} did not originate from a connected object")
+ (COULD_NOT_LOAD_STUB 2 WARNING "Could not load stub for class {0}")
+ (OBJECT_NOT_EXPORTED 3 WARNING "Class {0} not exported, or else is actually a JRMP stub"))
+ (INTERNAL
+ (ERROR_SET_OBJECT_FIELD 1 WARNING "Error in setting object field {0} in {1} to {2}")
+ (ERROR_SET_BOOLEAN_FIELD 2 WARNING "Error in setting boolean field {0} in {1} to {2}")
+ (ERROR_SET_BYTE_FIELD 3 WARNING "Error in setting byte field {0} in {1} to {2}")
+ (ERROR_SET_CHAR_FIELD 4 WARNING "Error in setting char field {0} in {1} to {2}")
+ (ERROR_SET_SHORT_FIELD 5 WARNING "Error in setting short field {0} in {1} to {2}")
+ (ERROR_SET_INT_FIELD 6 WARNING "Error in setting int field {0} in {1} to {2}")
+ (ERROR_SET_LONG_FIELD 7 WARNING "Error in setting long field {0} in {1} to {2}")
+ (ERROR_SET_FLOAT_FIELD 8 WARNING "Error in setting float field {0} in {1} to {2}")
+ (ERROR_SET_DOUBLE_FIELD 9 WARNING "Error in setting double field {0} in {1} to {2}")
+ (ILLEGAL_FIELD_ACCESS 10 WARNING "IllegalAccessException while trying to write to field {0}")
+ (BAD_BEGIN_UNMARSHAL_CUSTOM_VALUE 11 WARNING "State should be saved and reset first")
+ (CLASS_NOT_FOUND 12 WARNING "Failure while loading specific Java remote exception class: {0}"))
+ (UNKNOWN
+ (UNKNOWN_SYSEX 1 WARNING "Unknown System Exception"))))
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/LongMonitoredAttributeBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/LongMonitoredAttributeBase.java
new file mode 100644
index 0000000..0b3b6b3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/LongMonitoredAttributeBase.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+import java.util.*;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * A Cleaner Abstraction to provide a Monitored Attribute of type 'Long'
+ */
+public abstract class LongMonitoredAttributeBase extends MonitoredAttributeBase {
+
+ ///////////////////////////////////////
+ // operations
+
+
+/**
+ * Constructs LongMonitoredAttribute, by creating the
+ * MonitoredAttributeInfo with 'Long' as the class type.
+ * Users are expected to extend this class and provide the implementation
+ * for getValue() and if needed clearState() as well.
+ *
+ * @param name of the MonitoredAttribute
+ * @param description of the Attribute, Please provid a well thought out
+ * description, so that the admin can make sense of the attribute supplied.
+ */
+ public LongMonitoredAttributeBase(String name, String description) {
+ super( name );
+ MonitoredAttributeInfoFactory f =
+ MonitoringFactories.getMonitoredAttributeInfoFactory();
+ MonitoredAttributeInfo maInfo = f.createMonitoredAttributeInfo(
+ description, Long.class, false, false );
+ this.setMonitoredAttributeInfo( maInfo );
+ } // end LongMonitoredAttributeBase
+
+
+} // end LongMonitoredAttributeBase
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttribute.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttribute.java
new file mode 100644
index 0000000..094b33f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttribute.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+import com.sun.corba.se.spi.monitoring.MonitoredAttributeInfo;
+import java.util.*;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * Monitored Attribute is the interface to represent a Monitorable
+ * Attribute. Using this interface, one can get the value of the attribute
+ * and set the value if it is a writeable attribute.
+ */
+public interface MonitoredAttribute {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * Gets the Monitored Attribute Info for the attribute.
+ *
+ * @return monitoredAttributeInfo for this Monitored Attribute.
+ */
+ public MonitoredAttributeInfo getAttributeInfo();
+/**
+ * Sets the value for the Monitored Attribute if isWritable() is false, the
+ * method will throw ILLEGAL Operation exception.
+ *
+ * Also, the type of 'value' should be same as specified in the
+ * MonitoredAttributeInfo for a particular instance.
+ *
+ * @param value should be any one of the Basic Java Type Objects which are
+ * Long, Double, Float, String, Integer, Short, Character, Byte.
+ */
+ public void setValue(Object value);
+
+
+/**
+ * Gets the value of the Monitored Attribute. The value can be obtained
+ * from different parts of the module. User may choose to delegate the call
+ * to getValue() to other variables.
+ *
+ * NOTE: It is important to make sure that the type of Object returned in
+ * getvalue is same as the one specified in MonitoredAttributeInfo for this
+ * attribute.
+ *
+ * @return the current value for this MonitoredAttribute
+ */
+ public Object getValue();
+/**
+ * Gets the name of the Monitored Attribute.
+ *
+ * @return name of this Attribute
+ */
+ public String getName();
+/**
+ * If this attribute needs to be cleared, the user needs to implement this
+ * method to reset the state to initial state. If the Monitored Attribute
+ * doesn't change like for example (ConnectionManager High Water Mark),
+ * then clearState() is a No Op.
+ */
+ public void clearState();
+
+} // end MonitoredAttribute
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeBase.java
new file mode 100644
index 0000000..b4456e4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeBase.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+import java.util.*;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * A Convenient class provided to help users extend and implement only
+ * getValue(), if there is no need to clear the state and the attribute is not
+ * writable.
+ */
+public abstract class MonitoredAttributeBase implements MonitoredAttribute {
+ String name;
+ MonitoredAttributeInfo attributeInfo;
+ /**
+ * Constructor.
+ */
+ public MonitoredAttributeBase( String name, MonitoredAttributeInfo info ) {
+ this.name = name;
+ this.attributeInfo = info;
+ }
+
+
+ /**
+ * A Package Private Constructor for internal use only.
+ */
+ MonitoredAttributeBase( String name ) {
+ this.name = name;
+ }
+
+
+ /**
+ * A Package Private convenience method for setting MonitoredAttributeInfo
+ * for this Monitored Attribute.
+ */
+ void setMonitoredAttributeInfo( MonitoredAttributeInfo info ) {
+ this.attributeInfo = info;
+ }
+
+ /**
+ * If the concrete class decides not to provide the implementation of this
+ * method, then it's OK. Some of the examples where we may decide to not
+ * provide the implementation is the connection state. Irrespective of
+ * the call to clearState, the connection state will be showing the
+ * currect state of the connection.
+ * NOTE: This method is only used to clear the Monitored Attribute state,
+ * not the real state of the system itself.
+ */
+ public void clearState( ) {
+ }
+
+ /**
+ * This method should be implemented by the concrete class.
+ */
+ public abstract Object getValue( );
+
+ /**
+ * This method should be implemented by the concrete class only if the
+ * attribute is writable. If the attribute is not writable and if this
+ * method called, it will result in an IllegalStateException.
+ */
+ public void setValue( Object value ) {
+ if( !attributeInfo.isWritable() ) {
+ throw new IllegalStateException(
+ "The Attribute " + name + " is not Writable..." );
+ }
+ throw new IllegalStateException(
+ "The method implementation is not provided for the attribute " +
+ name );
+ }
+
+
+ /**
+ * Gets the MonitoredAttributeInfo for the attribute.
+ */
+ public MonitoredAttributeInfo getAttributeInfo( ) {
+ return attributeInfo;
+ }
+
+ /**
+ * Gets the name of the attribute.
+ */
+ public String getName( ) {
+ return name;
+ }
+} // end MonitoredAttributeBase
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeInfo.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeInfo.java
new file mode 100644
index 0000000..45f9c4a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeInfo.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+import java.util.*;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * Monitored AttributeInfo contains the meta information of the Monitored
+ * Attribute.
+ */
+public interface MonitoredAttributeInfo {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * If the Attribute is writable from ASAdmin then isWritable() will return
+ * true.
+ *
+ * @return a boolean with true or false
+ */
+ public boolean isWritable();
+/**
+ * isStatistic() is true if the attribute is presented as a Statistic.
+ *
+ * @return a boolean with true or false
+ */
+ public boolean isStatistic();
+/**
+ * Class Type: We will allow only basic class types:
+ * <ol>
+ * <li>Boolean</li>
+ * <li>Integer</li>
+ * <li>Byte</li>
+ * <li>Long</li>
+ * <li>Float</li>
+ * <li>Double</li>
+ * <li>String</li>
+ * <li>Character</li>
+ * </ol>
+ *
+ * @return a Class Type
+ */
+ public Class type();
+/**
+ * Get's the description for the Monitored Attribute.
+ *
+ * @return a String with description
+ */
+ public String getDescription();
+
+} // end MonitoredAttributeInfo
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeInfoFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeInfoFactory.java
new file mode 100644
index 0000000..bac25fa
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredAttributeInfoFactory.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * MonitoredAttributeInfoFactory used mostly by internal classes. If the
+ * User needs to define some special MonitoredAttributes like a Character
+ * type Monitored Attribute, they can use this factory to build the meta
+ * information.
+ */
+
+public interface MonitoredAttributeInfoFactory {
+ /**
+ * A Simple Factory Method to create the Monitored Attribute Info.
+ */
+ MonitoredAttributeInfo createMonitoredAttributeInfo( String description,
+ Class type, boolean isWritable, boolean isStatistic );
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredObject.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredObject.java
new file mode 100644
index 0000000..6514a6b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredObject.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+
+import com.sun.corba.se.spi.monitoring.MonitoredAttribute;
+import java.util.*;
+import java.util.Collection;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * Monitored Object provides an Hierarchichal view of the ORB Monitoring
+ * System. It can contain multiple children and a single parent. Each
+ * Monitored Object may also contain Multiple Monitored Attributes.
+ */
+public interface MonitoredObject {
+
+ ///////////////////////////////////////
+ // operations
+/**
+ * Gets the name of this MonitoredObject
+ *
+ * @return a String with name of this Monitored Object
+ */
+ public String getName();
+/**
+ * Gets the description of MonitoredObject
+ *
+ * @return a String with Monitored Object Description.
+ */
+ public String getDescription();
+/**
+ * This method will add a child Monitored Object to this Monitored Object.
+ */
+ public void addChild( MonitoredObject m );
+/**
+ * This method will remove child Monitored Object identified by the given name
+ *
+ * @param name of the ChildMonitored Object
+ */
+ public void removeChild( String name );
+
+/**
+ * Gets the child MonitoredObject associated with this MonitoredObject
+ * instance using name as the key. The name should be fully qualified name
+ * like orb.connectionmanager
+ *
+ * @return a MonitoredObject identified by the given name
+ * @param name of the ChildMonitored Object
+ */
+ public MonitoredObject getChild(String name);
+/**
+ * Gets all the Children registered under this instance of Monitored
+ * Object.
+ *
+ * @return Collection of immediate Children associated with this MonitoredObject.
+ */
+ public Collection getChildren();
+/**
+ * Sets the parent for this Monitored Object.
+ */
+ public void setParent( MonitoredObject m );
+/**
+ * There will be only one parent for an instance of MontoredObject, this
+ * call gets parent and returns null if the Monitored Object is the root.
+ *
+ * @return a MonitoredObject which is a Parent of this Monitored Object instance
+ */
+ public MonitoredObject getParent();
+
+/**
+ * Adds the attribute with the given name.
+ *
+ * @param value is the MonitoredAttribute which will be set as one of the
+ * attribute of this MonitoredObject.
+ */
+ public void addAttribute(MonitoredAttribute value);
+/**
+ * Removes the attribute with the given name.
+ *
+ * @param name is the MonitoredAttribute name
+ */
+ public void removeAttribute(String name);
+
+/**
+ * Gets the Monitored Object registered by the given name
+ *
+ * @return a MonitoredAttribute identified by the given name
+ * @param name of the attribute
+ */
+ public MonitoredAttribute getAttribute(String name);
+/**
+ * Gets all the Monitored Attributes for this Monitored Objects. It doesn't
+ * include the Child Monitored Object, that needs to be traversed using
+ * getChild() or getChildren() call.
+ *
+ * @return Collection of all the Attributes for this MonitoredObject
+ */
+ public Collection getAttributes();
+/**
+ * Clears the state of all the Monitored Attributes associated with the
+ * Monitored Object. It will also clear the state on all it's child
+ * Monitored Object. The call to clearState will be initiated from
+ * CORBAMBean.startMonitoring() call.
+ */
+ public void clearState();
+
+} // end MonitoredObject
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredObjectFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredObjectFactory.java
new file mode 100644
index 0000000..d7b03e7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoredObjectFactory.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * MonitoredObject Factory to create Monitored Object.
+ */
+public interface MonitoredObjectFactory {
+ /**
+ * A Simple Factory Method to create the Monitored Object. The name
+ * should be the leaf level name.
+ */
+ MonitoredObject createMonitoredObject( String name, String description );
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringConstants.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringConstants.java
new file mode 100644
index 0000000..73c618d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringConstants.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.monitoring;
+
+public interface MonitoringConstants
+{
+ public static final String DEFAULT_MONITORING_ROOT = "orb";
+ public static final String DEFAULT_MONITORING_ROOT_DESCRIPTION =
+ "ORB Management and Monitoring Root";
+
+ //
+ // Connection Monitoring
+ //
+
+ public static final String CONNECTION_MONITORING_ROOT =
+ "Connections";
+ public static final String CONNECTION_MONITORING_ROOT_DESCRIPTION =
+ "Statistics on inbound/outbound connections";
+
+ public static final String INBOUND_CONNECTION_MONITORING_ROOT =
+ "Inbound";
+ public static final String INBOUND_CONNECTION_MONITORING_ROOT_DESCRIPTION=
+ "Statistics on inbound connections";
+
+ public static final String OUTBOUND_CONNECTION_MONITORING_ROOT =
+ "Outbound";
+ public static final String OUTBOUND_CONNECTION_MONITORING_ROOT_DESCRIPTION=
+ "Statistics on outbound connections";
+
+ public static final String CONNECTION_MONITORING_DESCRIPTION =
+ "Connection statistics";
+
+ public static final String CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS =
+ "NumberOfConnections";
+ public static final String CONNECTION_TOTAL_NUMBER_OF_CONNECTIONS_DESCRIPTION =
+ "The total number of connections";
+ public static final String CONNECTION_NUMBER_OF_IDLE_CONNECTIONS =
+ "NumberOfIdleConnections";
+ public static final String CONNECTION_NUMBER_OF_IDLE_CONNECTIONS_DESCRIPTION =
+ "The number of idle connections";
+ public static final String CONNECTION_NUMBER_OF_BUSY_CONNECTIONS =
+ "NumberOfBusyConnections";
+ public static final String CONNECTION_NUMBER_OF_BUSY_CONNECTIONS_DESCRIPTION =
+ "The number of busy connections";
+
+ //
+ // ThreadPool and WorkQueue monitoring constants
+ //
+
+ public static final String THREADPOOL_MONITORING_ROOT = "threadpool";
+ public static final String THREADPOOL_MONITORING_ROOT_DESCRIPTION =
+ "Monitoring for all ThreadPool instances";
+ public static final String THREADPOOL_MONITORING_DESCRIPTION =
+ "Monitoring for a ThreadPool";
+ public static final String THREADPOOL_CURRENT_NUMBER_OF_THREADS =
+ "currentNumberOfThreads";
+ public static final String THREADPOOL_CURRENT_NUMBER_OF_THREADS_DESCRIPTION =
+ "Current number of total threads in the ThreadPool";
+ public static final String THREADPOOL_NUMBER_OF_AVAILABLE_THREADS =
+ "numberOfAvailableThreads";
+ public static final String THREADPOOL_NUMBER_OF_AVAILABLE_THREADS_DESCRIPTION =
+ "Number of available threads in the ThreadPool";
+ public static final String THREADPOOL_NUMBER_OF_BUSY_THREADS =
+ "numberOfBusyThreads";
+ public static final String THREADPOOL_NUMBER_OF_BUSY_THREADS_DESCRIPTION =
+ "Number of busy threads in the ThreadPool";
+ public static final String THREADPOOL_AVERAGE_WORK_COMPLETION_TIME =
+ "averageWorkCompletionTime";
+ public static final String THREADPOOL_AVERAGE_WORK_COMPLETION_TIME_DESCRIPTION =
+ "Average elapsed time taken to complete a work item by the ThreadPool";
+ public static final String THREADPOOL_CURRENT_PROCESSED_COUNT =
+ "currentProcessedCount";
+ public static final String THREADPOOL_CURRENT_PROCESSED_COUNT_DESCRIPTION =
+ "Number of Work items processed by the ThreadPool";
+
+ public static final String WORKQUEUE_MONITORING_DESCRIPTION =
+ "Monitoring for a Work Queue";
+ public static final String WORKQUEUE_TOTAL_WORK_ITEMS_ADDED =
+ "totalWorkItemsAdded";
+ public static final String WORKQUEUE_TOTAL_WORK_ITEMS_ADDED_DESCRIPTION =
+ "Total number of Work items added to the Queue";
+ public static final String WORKQUEUE_WORK_ITEMS_IN_QUEUE =
+ "workItemsInQueue";
+ public static final String WORKQUEUE_WORK_ITEMS_IN_QUEUE_DESCRIPTION =
+ "Number of Work items in the Queue to be processed";
+ public static final String WORKQUEUE_AVERAGE_TIME_IN_QUEUE =
+ "averageTimeInQueue";
+ public static final String WORKQUEUE_AVERAGE_TIME_IN_QUEUE_DESCRIPTION =
+ "Average time a work item waits in the work queue";
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringFactories.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringFactories.java
new file mode 100644
index 0000000..f34ad37
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringFactories.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+import com.sun.corba.se.impl.monitoring.MonitoredObjectFactoryImpl;
+import com.sun.corba.se.impl.monitoring.MonitoredAttributeInfoFactoryImpl;
+import com.sun.corba.se.impl.monitoring.MonitoringManagerFactoryImpl;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * This is used for getting the default factories for
+ * MonitoredObject, MonitoredAttributeInfo and MonitoringManager. We do not
+ * expect users to use the MonitoredAttributeInfo factory most of the time
+ * because the Info is automatically built by StringMonitoredAttributeBase
+ * and LongMonitoredAttributeBase.
+ */
+public class MonitoringFactories {
+ ///////////////////////////////////////
+ // attributes
+ private static final MonitoredObjectFactoryImpl monitoredObjectFactory =
+ new MonitoredObjectFactoryImpl( );
+ private static final MonitoredAttributeInfoFactoryImpl
+ monitoredAttributeInfoFactory =
+ new MonitoredAttributeInfoFactoryImpl( );
+ private static final MonitoringManagerFactoryImpl monitoringManagerFactory =
+ new MonitoringManagerFactoryImpl( );
+
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * Gets the MonitoredObjectFactory
+ *
+ * @return a MonitoredObjectFactory
+ */
+ public static MonitoredObjectFactory getMonitoredObjectFactory( ) {
+ return monitoredObjectFactory;
+ }
+
+/**
+ * Gets the MonitoredAttributeInfoFactory. The user is not expected to use this
+ * Factory, since the MonitoredAttributeInfo is internally created by
+ * StringMonitoredAttributeBase, LongMonitoredAttributeBase and
+ * StatisticMonitoredAttribute. If User wants to create a MonitoredAttribute
+ * of some other special type like a DoubleMonitoredAttribute, they can
+ * build a DoubleMonitoredAttributeBase like LongMonitoredAttributeBase
+ * and build a MonitoredAttributeInfo required by MonitoredAttributeBase
+ * internally by using this Factory.
+ *
+ * @return a MonitoredAttributeInfoFactory
+ */
+ public static MonitoredAttributeInfoFactory
+ getMonitoredAttributeInfoFactory( )
+ {
+ return monitoredAttributeInfoFactory;
+ }
+
+/**
+ * Gets the MonitoredManagerFactory. The user is not expected to use this
+ * Factory, since the ORB will be automatically initialized with the
+ * MonitoringManager.
+ *
+ * User can get hold of MonitoringManager associated with ORB by calling
+ * orb.getMonitoringManager( )
+ *
+ * @return a MonitoredManagerFactory
+ */
+ public static MonitoringManagerFactory getMonitoringManagerFactory( ) {
+ return monitoringManagerFactory;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManager.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManager.java
new file mode 100644
index 0000000..5b5082a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManager.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+import java.io.Closeable;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.monitoring.MonitoredObject;
+import java.util.*;
+
+/**
+ * Monitoring Manager will have a 1 to 1 association with the ORB. This
+ * gives access to the top level Monitored Object, using which more
+ * Monitored Objects and Attributes can be added and traversed.
+ *
+ * @author Hemanth Puttaswamy
+ */
+public interface MonitoringManager extends Closeable {
+
+ ///////////////////////////////////////
+ // operations
+
+/**
+ * Gets the Root Monitored Object which contains a Hierarchy Of Monitored
+ * Objects exposing various Monitorable Attributes of Various modules.
+ */
+ public MonitoredObject getRootMonitoredObject();
+/**
+ * Initialize is called whenever there is a start monitoring call to CORBA
+ * MBean. This will result in triaging initialize to all the
+ * MonitoredObjects and it's Monitored Attributes.
+ */
+ public void clearState();
+
+} // end MonitoringManager
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManagerFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManagerFactory.java
new file mode 100644
index 0000000..8d11739
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/MonitoringManagerFactory.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * MonitoringObjectFactory is used internally by the ORB, It is not for
+ * general public use.
+ */
+public interface MonitoringManagerFactory {
+ /**
+ * A Simple Factory Method to create the Monitored Attribute Info.
+ */
+ MonitoringManager createMonitoringManager( String nameOfTheRoot,
+ String description );
+
+ void remove(String nameOfTheRoot);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StatisticMonitoredAttribute.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StatisticMonitoredAttribute.java
new file mode 100644
index 0000000..f28ab0e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StatisticMonitoredAttribute.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+import java.util.*;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * StatisticsMonitoredAttribute is provided as a convenience to collect the
+ * Statistics of any entity. The getValue() call will be delegated to the
+ * StatisticsAccumulator set by the user.
+ */
+public class StatisticMonitoredAttribute extends MonitoredAttributeBase {
+
+
+ // Every StatisticMonitoredAttribute will have a StatisticAccumulator. User
+ // will use Statisticsaccumulator to accumulate the samples associated with
+ // this Monitored Attribute
+ private StatisticsAccumulator statisticsAccumulator;
+
+ // Mutex is passed from the user class which is providing the sample values.
+ // getValue() and clearState() is synchronized on this user provided mutex
+ private Object mutex;
+
+
+ ///////////////////////////////////////
+ // operations
+
+
+/**
+ * Constructs the StaisticMonitoredAttribute, builds the required
+ * MonitoredAttributeInfo with Long as the class type and is always
+ * readonly attribute.
+ *
+ * @param name Of this attribute
+ * @param desc should provide a good description on the kind of statistics
+ * collected, a good example is "Connection Response Time Stats will Provide the
+ * detailed stats based on the samples provided from every request completion
+ * time"
+ * @param s is the StatisticsAcumulator that user will use to accumulate the
+ * samples and this Attribute Object will get the computed statistics values
+ * from.
+ * @param mutex using which clearState() and getValue() calls need to be locked.
+ */
+ public StatisticMonitoredAttribute(String name, String desc,
+ StatisticsAccumulator s, Object mutex)
+ {
+ super( name );
+ MonitoredAttributeInfoFactory f =
+ MonitoringFactories.getMonitoredAttributeInfoFactory();
+ MonitoredAttributeInfo maInfo = f.createMonitoredAttributeInfo(
+ desc, String.class, false, true );
+
+ this.setMonitoredAttributeInfo( maInfo );
+ this.statisticsAccumulator = s;
+ this.mutex = mutex;
+ } // end StatisticMonitoredAttribute
+
+
+
+/**
+ * Gets the value from the StatisticsAccumulator, the value will be a formatted
+ * String with the computed statistics based on the samples accumulated in the
+ * Statistics Accumulator.
+ */
+ public Object getValue( ) {
+ synchronized( mutex ) {
+ return statisticsAccumulator.getValue( );
+ }
+ }
+
+/**
+ * Clears the state on Statistics Accumulator, After this call all samples are
+ * treated fresh and the old sample computations are disregarded.
+ */
+ public void clearState( ) {
+ synchronized( mutex ) {
+ statisticsAccumulator.clearState( );
+ }
+ }
+
+/**
+ * Gets the statistics accumulator associated with StatisticMonitoredAttribute.
+ * Usually, the user don't need to use this method as they can keep the handle
+ * to Accumulator to collect the samples.
+ */
+ public StatisticsAccumulator getStatisticsAccumulator( ) {
+ return statisticsAccumulator;
+ }
+} // end StatisticMonitoredAttribute
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StatisticsAccumulator.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StatisticsAccumulator.java
new file mode 100644
index 0000000..a172216
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StatisticsAccumulator.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+import java.util.*;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * StatisticsAccumulator accumulates the samples provided by the user and
+ * computes the value of minimum, maximum, sum and sample square sum. When
+ * the StatisticMonitoredAttribute calls getValue(), it will compute all
+ * the statistics for the collected samples (Which are Minimum, Maximum,
+ * Average, StandardDeviation) and provides a nice printable record as a
+ * String.
+ *
+ * Users can easily extend this class and provide the implementation of
+ * toString() method to format the stats as desired. By default all the stats
+ * are printed in a single line.
+ */
+public class StatisticsAccumulator {
+
+ ///////////////////////////////////////
+ // attributes
+
+
+ // Users can extend this class to get access to current Max value
+ protected double max = Double.MIN_VALUE;
+
+ // Users can extend this class to get access to current Min value
+ protected double min = Double.MAX_VALUE;
+
+ private double sampleSum;
+
+ private double sampleSquareSum;
+
+ private long sampleCount;
+
+ protected String unit;
+
+
+
+ ///////////////////////////////////////
+ // operations
+
+
+
+/**
+ * User will use this method to just register a sample with the
+ * StatisticsAccumulator. This is the only method that User will use to
+ * expose the statistics, internally the StatisticMonitoredAttribute will
+ * collect the information when requested from the ASAdmin.
+ *
+ * @param value a double value to make it more precise
+ */
+ public void sample(double value) {
+ sampleCount++;
+ if( value < min ) min = value;
+ if( value > max) max = value;
+ sampleSum += value;
+ sampleSquareSum += (value * value);
+ } // end sample
+
+
+
+ /**
+ * Computes the Standard Statistic Results based on the samples collected
+ * so far and provides the complete value as a formatted String
+ */
+ public String getValue( ) {
+ return toString();
+ }
+
+ /**
+ * Users can extend StatisticsAccumulator to provide the complete
+ * Stats in the format they prefer, if the default format doesn't suffice.
+ */
+ public String toString( ) {
+ return "Minimum Value = " + min + " " + unit + " " +
+ "Maximum Value = " + max + " " + unit + " " +
+ "Average Value = " + computeAverage() + " " + unit + " " +
+ "Standard Deviation = " + computeStandardDeviation() + " " + unit +
+ " " + "Samples Collected = " + sampleCount;
+ }
+
+ /**
+ * If users choose to custom format the stats.
+ */
+ protected double computeAverage( ) {
+ return (sampleSum / sampleCount);
+ }
+
+
+ /**
+ * We use a derived Standard Deviation formula to compute SD. This way
+ * there is no need to hold on to all the samples provided.
+ *
+ * The method is protected to let users extend and format the results.
+ */
+ protected double computeStandardDeviation( ) {
+ double sampleSumSquare = sampleSum * sampleSum;
+ return Math.sqrt(
+ (sampleSquareSum-((sampleSumSquare)/sampleCount))/(sampleCount-1));
+ }
+
+/**
+ * Construct the Statistics Accumulator by providing the unit as a String.
+ * The examples of units are "Hours", "Minutes",
+ * "Seconds", "MilliSeconds", "Micro Seconds" etc.
+ *
+ * @param unit a String representing the units for the samples collected
+ */
+ public StatisticsAccumulator( String unit ) {
+ this.unit = unit;
+ sampleCount = 0;
+ sampleSum = 0;
+ sampleSquareSum = 0;
+ }
+
+
+ /**
+ * Clears the samples and starts fresh on new samples.
+ */
+ void clearState( ) {
+ min = Double.MAX_VALUE;
+ max = Double.MIN_VALUE;
+ sampleCount = 0;
+ sampleSum = 0;
+ sampleSquareSum = 0;
+ }
+
+ /**
+ * This is an internal API to test StatisticsAccumulator...
+ */
+ public void unitTestValidate( String expectedUnit, double expectedMin,
+ double expectedMax, long expectedSampleCount, double expectedAverage,
+ double expectedStandardDeviation )
+ {
+ if( !expectedUnit.equals( unit ) ){
+ throw new RuntimeException(
+ "Unit is not same as expected Unit" +
+ "\nUnit = " + unit + "ExpectedUnit = " + expectedUnit );
+ }
+ if( min != expectedMin ) {
+ throw new RuntimeException(
+ "Minimum value is not same as expected minimum value" +
+ "\nMin Value = " + min + "Expected Min Value = " + expectedMin);
+ }
+ if( max != expectedMax ) {
+ throw new RuntimeException(
+ "Maximum value is not same as expected maximum value" +
+ "\nMax Value = " + max + "Expected Max Value = " + expectedMax);
+ }
+ if( sampleCount != expectedSampleCount ) {
+ throw new RuntimeException(
+ "Sample count is not same as expected Sample Count" +
+ "\nSampleCount = " + sampleCount + "Expected Sample Count = " +
+ expectedSampleCount);
+ }
+ if( computeAverage() != expectedAverage ) {
+ throw new RuntimeException(
+ "Average is not same as expected Average" +
+ "\nAverage = " + computeAverage() + "Expected Average = " +
+ expectedAverage);
+ }
+ // We are computing Standard Deviation from two different methods
+ // for comparison. So, the values will not be the exact same to the last
+ // few digits. So, we are taking the difference and making sure that
+ // the difference is not greater than 1.
+ double difference = Math.abs(
+ computeStandardDeviation() - expectedStandardDeviation);
+ if( difference > 1 ) {
+ throw new RuntimeException(
+ "Standard Deviation is not same as expected Std Deviation" +
+ "\nStandard Dev = " + computeStandardDeviation() +
+ "Expected Standard Dev = " + expectedStandardDeviation);
+ }
+ }
+
+
+} // end StatisticsAccumulator
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StringMonitoredAttributeBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StringMonitoredAttributeBase.java
new file mode 100644
index 0000000..5b11ae6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/StringMonitoredAttributeBase.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.monitoring;
+
+import java.util.*;
+
+/**
+ * @author Hemanth Puttaswamy
+ *
+ * A Convenient Abstraction to present String type Monitored Attribute. One
+ * of the examples of StringMonitoredAttribute is the State information.
+ */
+public abstract class StringMonitoredAttributeBase
+ extends MonitoredAttributeBase
+{
+
+ ///////////////////////////////////////
+ // operations
+
+
+/**
+ * Constructs StringMonitoredAttribute with the MonitoredAttributeInfo
+ * built with the class type of String.
+ *
+ * @param name of this attribute
+ * @param description of this attribute
+ */
+ public StringMonitoredAttributeBase(String name, String description) {
+ super( name );
+ MonitoredAttributeInfoFactory f =
+ MonitoringFactories.getMonitoredAttributeInfoFactory();
+ MonitoredAttributeInfo maInfo = f.createMonitoredAttributeInfo(
+ description, String.class, false, false );
+ this.setMonitoredAttributeInfo( maInfo );
+ } // end StringMonitoredAttributeBase
+
+
+} // end StringMonitoredAttributeBase
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html
new file mode 100644
index 0000000..f73b0cb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/monitoring/package.html
@@ -0,0 +1,302 @@
+<!doctype html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.79C-CCK-MCD [en] (X11; U; SunOS 5.8 sun4u) [Netscape]">
+ <title>package</title>
+<!--
+
+Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+</head>
+<body bgcolor="#FFFFFF">
+<b><font size=+1>General Information</font></b>
+<p>Monitoring Framework SPI's is used internally by the ORB to instrument
+for JMX based Management and Monitoring. The
+<br>framework is very generic and easy to use and acts as facade to retrieve
+the information from the running CORBA system.
+<p>This framework helps in building a nice Hierarchical Structure of Monitored
+Objects that contains Monitored Attributes.
+<br>com.sun.corba.se.spi.orb.ORB has an API to get the RootMonitoredObject
+and then User can traverse through the tree to
+<br>either instrument or retrieve the information for Monitoring.
+<h1>
+<b><font size=+1>Code Snippet to Instrument Connection Monitored Object</font></b></h1>
+This example shows on how to instrument CorbaConnectionImpl 's attributes.
+It exposes two
+<br>attributes, namely
+<p>1. Connection State
+<br>2. Response time statistics to Appeserver Admin Console or CLI
+<br>&nbsp;
+<h2>
+<b><font size=+1>1. Instrumenting Connection State</font></b></h2>
+/**
+<br>&nbsp;*&nbsp; Code Snippet to Instrument Connection Monitored Object
+with
+<br>&nbsp;*&nbsp; ConnectionState Monitored Attribute. Steps to follow
+<br>&nbsp;*
+<br>&nbsp;*&nbsp; Step 1: Define a Monitored Attribute (ConnectionStateMonitoredAttribute)
+Class by extending
+<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+StringMonitoredAttributeBase
+<br>&nbsp;*
+<br>&nbsp;*&nbsp; Step 2: Create Connection Manager Monitored Object and
+add that to
+<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+Root Monitored Object.
+<br>&nbsp;*
+<br>&nbsp;*&nbsp; Step 3: Create Connection Monitored Object&nbsp; and
+add it to Connection Manager Monitored Object
+<br>&nbsp;*
+<br>&nbsp;*&nbsp; Step 4: Instantiate Concrete Attribute (ConnectionStateMonitoredAttribute)
+Class and add that to
+<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+the Connection MonitoredObject
+<br>&nbsp;*
+<br>&nbsp;*&nbsp; Step 5: Adds ConnectionMonitoredObject to ConnectionManagerMonitoredObject
+<br>&nbsp;*
+<br>&nbsp;*/
+<p>/**
+<br>&nbsp; *&nbsp; Step 1: Define a Monitored Attribute Class by extending
+<br>&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+StringMonitoredAttributeBase
+<br>&nbsp; */
+<p>/**
+<br>&nbsp; *&nbsp; ConnectionState gets the value on demand.
+<br>&nbsp; */
+<br>#import com.sun.corba.se.spi.monitoring.LongMonitoredAttributeBase
+<br>#import com.sun.corba.se.spi.transport.CorbaConnection;
+<p>public class ConnectionStateMonitoredAttribute extends StringMonitoredAttributeBase
+<br>{
+<br>&nbsp;&nbsp;&nbsp; CorbaConnection connection;
+<br>&nbsp;&nbsp;&nbsp; public ConnectionInUseMonitoredAttribute( String
+name, String desc,
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CorbaConnection con )
+<br>&nbsp;&nbsp;&nbsp; {
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; super( name, desc );
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connection = con;
+<br>&nbsp;&nbsp;&nbsp; }
+<p>&nbsp;&nbsp;&nbsp; public Object getValue( ) {
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Delegate the getValue
+call to connection
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // so, there is no state
+maintained in this attribute object itself
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // and also the locking
+will be the responsibility of Connection
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Object. By doing this
+we will avoid global locking and possibly
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // avoiding the bottleneck
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return connection.getState(
+);
+<br>&nbsp;&nbsp;&nbsp; }
+<p>&nbsp;&nbsp;&nbsp; // IMPORTANT: In this case we don't have to implement
+clearState() method
+<br>&nbsp;&nbsp;&nbsp; // If there is a need to implement this method like
+for POACounter, the
+<br>&nbsp;&nbsp;&nbsp; // call again can be delegated to the Object which
+maintains the real
+<br>&nbsp;&nbsp;&nbsp; // state. clearState() is invoked whenever there
+is a call to CORBAMBean.startMonitoring()
+<br>}
+<br>&nbsp;
+<p>/**
+<br>&nbsp;*&nbsp; Step 2: Create Connection Manager Monitored Object and
+add that to
+<br>&nbsp;*&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Root
+Monitored Object.
+<br>&nbsp;*/
+<br>import com.sun.corba.se.spi.monitoring.MonitoringFactories;
+<br>import com.sun.corba.se.spi.monitoring.MonitoredObject;
+<p>private static MonitoredObject connectionManagerMonitoredObject;
+<br>private static MonitoredObject connectionMonitoredObject;
+<br>&nbsp;
+<p>&nbsp;&nbsp;&nbsp; private void instrumentConnectionManager( ) {
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connectionManagerMonitoredObject
+=
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+MonitoringFactories.getMonitoredObjectFactory().createMonitoredObject(
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+"ConnectionManagerMonitoredObject",
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+"Used to Monitor the stats on All IIOP Connections " );
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; orb.getRootMonitoredObject().addChild(connectionManagerMonitoredObject
+);
+<br>&nbsp;&nbsp;&nbsp; }
+<br>&nbsp;
+<p>/**
+<br>&nbsp; *&nbsp; Step 3: Create Connection Monitored Object&nbsp; and
+add it to Connection Manager Monitored Object
+<br>&nbsp; *
+<br>&nbsp; *&nbsp; Step 4: Instantiate Concrete Attribute (ConnectionStateMonitoredAttribute)
+Class and add that to
+<br>&nbsp; *&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+the Connection MonitoredObject
+<br>&nbsp; *
+<br>&nbsp; *&nbsp; Step 5: Add ConnectionMonitoredObject to ConnectionManagerMonitoredObject
+<br>&nbsp; */
+<br>private void instrumentConnectionObject( CorbConnection connection
+) {
+<br>&nbsp;&nbsp;&nbsp; // Step 3
+<br>&nbsp;&nbsp;&nbsp; MonitoredObject connectionMonitoredObject =
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MonitoringFactories.getMonitoredObjectFactory().createMonitoredObject(
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+connection.getName(),
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+"Used to Monitor the stats on one connection" );
+<br>&nbsp;&nbsp;&nbsp; // Step 4
+<br>&nbsp;&nbsp;&nbsp; ConnectionStateMonitoredAttribute connectionState
+=
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new ConnectionStateMonitoredAttribute(
+"Connection_State",
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+"Provides the state of the IIOP Connection ...",&nbsp; connection );
+<br>&nbsp;&nbsp;&nbsp; connectionMonitoredObject.addAttribute( connectionState
+);
+<br>&nbsp;&nbsp;&nbsp; // Step 5
+<br>&nbsp;&nbsp;&nbsp; connectionManagerMonitoredObject.addChild( connectionMonitoredObject
+);
+<br>}
+<br>&nbsp;
+<br>&nbsp;
+<p><b><font size=+1>Code Snippet to Instrument A Statistic Type Monitored
+Attribute</font></b>
+<p>/**
+<br>&nbsp; *&nbsp; Assuming ConnectionMonitoredObject is already added
+to the MonitoredObject Hierarchy.
+<br>&nbsp; *&nbsp; This example code shows how to instrument ConnectionMonitoredObject
+with a new
+<br>&nbsp; *&nbsp;&nbsp; StatisticMonitoredAttribute.
+<br>&nbsp; *
+<br>&nbsp; *&nbsp;&nbsp;&nbsp; IMPORTANT: StatisticsMonitoredAttribute
+is mostly write mostly and read sparingly, i.e.,
+<br>&nbsp; *&nbsp;&nbsp;&nbsp; the frequency of writes(Collecting samples)
+is high.&nbsp; It is the responsibility of user to synchronize
+<br>&nbsp; *&nbsp;&nbsp;&nbsp; the sample() method and the StatisticMonitoredAttribute
+will synchronize clearState() and
+<br>&nbsp; *&nbsp;&nbsp;&nbsp; getValue() using the mutex object sent.
+<br>&nbsp; */
+<br>private void instrumentStatsToConnectionObject( MonitoredObject connectionMonitoredObject&nbsp;
+) {
+<br>&nbsp;&nbsp;&nbsp;&nbsp; // Step 4
+<br>&nbsp;&nbsp;&nbsp; StatisticsAccumulator connectRequestStatsAccumulator
+=
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Microseconds is the unit
+used for statistics measure
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new StatisticsAccumulator(
+"Micro Seconds" );
+<p>&nbsp;&nbsp;&nbsp; // Pass Name, Description, Statistic Accumulator
+Instance, Mutex (The
+<br>&nbsp;&nbsp;&nbsp; // Object on which we need to synchronize for stats
+sample collection)
+<br>&nbsp;&nbsp;&nbsp; StatisticMonitoredAttribute sm = new StatisticMonitoredAttribute(
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; connection.getName() + "Stats",
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "Connection Request Stats",
+connectRequestStatsAccumulator, this );
+<p>&nbsp;&nbsp;&nbsp; connectionMonitoredObject.addAttribute( sm );
+<br>&nbsp;
+<p>&nbsp;&nbsp;&nbsp; // Now, The user can accumulate the samples by calling
+into
+<br>&nbsp;&nbsp;&nbsp; // connectRequestStatsAccumulator.sample( &lt;value>
+);
+<br>&nbsp;&nbsp;&nbsp; // Finally When ASAdmin request for the value of
+this Stats Monitored Attribute
+<br>&nbsp;&nbsp;&nbsp; // by using standard getValue() call. It will return
+a formatted Stats Value like
+<br>&nbsp;&nbsp;&nbsp; //&nbsp; For Example
+<br>&nbsp;&nbsp;&nbsp; //
+<br>&nbsp;&nbsp;&nbsp; //&nbsp; Minimum Value = 200 Microseconds
+<br>&nbsp;&nbsp;&nbsp; //&nbsp; Maximum Value = 928 Microseconds
+<br>&nbsp;&nbsp;&nbsp; //&nbsp; Average Value = 523 Microseconds
+<br>&nbsp;&nbsp;&nbsp; //&nbsp; Standard Deviation = 53.72 Microseconds
+<br>&nbsp;&nbsp;&nbsp; //&nbsp; Sample Collected = 435
+<p>}
+<p><b><font size=+1>Caution On Global Locking (Synchronization):</font></b>
+<p>It's important to make sure that collecting Stats and other state information
+for monitoring doesn't impact performance. Please look at the following
+don'ts
+<br>to understand better.
+<p><u>Do not add a special mutex for synchronizing MonitoredObject:</u>
+<br>Let's take an example of exposing a counter that counts Requests on
+this connection and 2 possible ways of doing this
+<br>1. Define Counter by extending LongMonitoredAttributeBase
+<br>&nbsp;&nbsp;&nbsp;&nbsp; public class Counter extends LongMonitoredAttributeBase
+{
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private long counter;
+<br>&nbsp;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Counter( String name, String
+desc ) {
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+super(&nbsp;name, desc );
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
+<br>&nbsp;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public synchronized
+void increment( ) {
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+counter++;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
+<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public synchronized
+Object getValue( ) {
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+return new Long( counter );
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
+<br>&nbsp;&nbsp;&nbsp; }
+<br>&nbsp;
+<p>2. Or Define a RequestCounter by extending LongMonitoredAttributeBase
+again, but no special
+<br>&nbsp;&nbsp;&nbsp; synchronization is done
+<p>&nbsp;&nbsp;&nbsp; public class RequestCounter extends LongMonitoredAttributeBase
+{
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; private CorbaConnection
+connection;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RequestCounter( String name,
+String desc, CorbaConnection con ) {
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+super( name, desc );
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+connection = con;
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
+<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; public Object getValue( )
+{
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
+return connection.getRequestCount( );
+<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }
+<br>&nbsp;&nbsp;&nbsp; }
+<p>&nbsp;&nbsp;&nbsp; The problem with Alternative (1) is that there may
+be unneccesary extra synchronization happening for every method and it
+may become a bottle neck
+<br>&nbsp;&nbsp;&nbsp;&nbsp; particularly if this object is accessed quite
+often. In Alternative (2), the synchronization happens only in the Connection
+object and no special sync
+<br>&nbsp;&nbsp;&nbsp;&nbsp; is required in the RequestCounter object.
+<br>&nbsp;
+<p><b><font size=+1>Important Thing To Know On StatisticMonitoredAttribute
+type:</font></b>
+<br>The clearState() and getValue() call will be synchronized using the
+mutex passed by the external object, but sample() method in StatisticsAccumulator
+<br>is not synchronized. It is the responsibility of user to synchronize
+to make sure that the samples collected (The mutex passed into the StatisticsAccumulator must be the one used to synchronize calls to sample() ).
+<br>&nbsp;
+<p>@since JDK1.5 @serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/oa/NullServant.java b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/NullServant.java
new file mode 100644
index 0000000..3b3110b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/NullServant.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.oa ;
+
+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.
+ */
+public interface NullServant
+{
+ /** Obtain the exception that is associated with this
+ * NullServant instance.
+ */
+ SystemException getException() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OADefault.java b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OADefault.java
new file mode 100644
index 0000000..766ba63
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OADefault.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.oa ;
+
+import com.sun.corba.se.impl.oa.poa.POAFactory ;
+import com.sun.corba.se.impl.oa.toa.TOAFactory ;
+import com.sun.corba.se.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.
+ */
+public class OADefault {
+ 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 ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OADestroyed.java b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OADestroyed.java
new file mode 100644
index 0000000..101dc9b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OADestroyed.java
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.oa;
+
+/** 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/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OAInvocationInfo.java b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OAInvocationInfo.java
new file mode 100644
index 0000000..e2eb526
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/OAInvocationInfo.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.oa;
+
+import javax.rmi.CORBA.Tie ;
+
+import org.omg.CORBA.portable.ServantObject;
+
+import org.omg.PortableServer.Servant;
+
+import org.omg.PortableServer.ServantLocatorPackage.CookieHolder;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter ;
+import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
+
+/** 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 ;
+
+ // These fields are to support standard OMG APIs.
+ private ObjectAdapter oa;
+ private byte[] oid;
+
+ // These fields are to support the Object adapter implementation.
+ 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 ;
+
+ public OAInvocationInfo(ObjectAdapter oa, byte[] id )
+ {
+ this.oa = oa;
+ 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;
+ }
+
+ //getters
+ public ObjectAdapter oa() { return oa ; }
+ public byte[] id() { return oid ; }
+ public Object getServantContainer() { return servantContainer ; }
+
+ // Create CookieHolder on demand. This is only called by a single
+ // thread, so no synchronization is needed.
+ public CookieHolder getCookieHolder()
+ {
+ if (cookieHolder == null)
+ cookieHolder = new CookieHolder() ;
+
+ return cookieHolder;
+ }
+
+ 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 ; }
+
+ public void setServant(Object servant)
+ {
+ servantContainer = servant ;
+ if (servant instanceof Tie)
+ this.servant = ((Tie)servant).getTarget() ;
+ else
+ this.servant = servant;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapter.java b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapter.java
new file mode 100644
index 0000000..dbe1ac9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapter.java
@@ -0,0 +1,249 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.oa ;
+
+import org.omg.CORBA.Policy ;
+
+import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
+import org.omg.PortableInterceptor.ObjectReferenceFactory ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.oa.OADestroyed ;
+
+import com.sun.corba.se.spi.ior.IORTemplate ;
+
+// 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:
+* <UL>
+* <LI>Have an ORB</LI>
+* <LI>Have a name</LI>
+* <LI>Have an adapter manager (represented by an ID)</LI>
+* <LI>Have an adapter template</LI>
+* <LI>Support getting and setting their ObjectReferenceFactory</LI>
+* <LI>Provide access to their current state</LI>
+* <LI>Support adding components to their profiles expressed in the adapter template</LI>
+* </UL>
+* Other requirements:
+* <UL>
+* <LI>All object adapters must invoke ORB.AdapterCreated when they are created.
+* </LI>
+* <LI>All adapter managers must invoke ORB.AdapterManagerStateChanged when
+* their state changes, mapping the internal state to an ORT state.</LI>
+* <LI>AdapterStateChanged must be invoked (from somewhere) whenever
+* an adapter state changes that is not due to an adapter manager state change.</LI>
+* </UL>
+* <P>
+* Object adapters must also provide mechanisms for:
+* <UL>
+* <LI>Managing object reference lifecycle</LI>
+* <LI>Controlling how servants are associated with object references</LI>
+* <LI>Manage the state of the adapter, if the adapter desires to implement such mechanisms</LI>
+* </UL>
+* 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.
+* <P>
+* 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.
+* <P>
+* To be useful, this dispatch cycle must be extremely efficient. There are several
+* scenarios that matter:
+* <ol>
+* <li>A remote invocation, where the dispatch is handled in the server subcontract.</li>
+* <li>A local invocation, where the dispatch is handled in the client subcontract.</li>
+* <li>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.</li>
+* </ol>
+* <p>
+* 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.
+* <ol>
+* <li>The remote pattern:
+* <ol>
+* <li>oa = oaf.find( oaid )</li>
+* <li>oa.enter()</li>
+* <li>info = oa.makeInvocationInfo( oid )</li>
+* <li>info.setOperation( operation )</li>
+* <li>push info</li>
+* <li>oa.getInvocationServant( info )</li>
+* <li>sreq.setExecuteReturnServantInResponseConstructor( true )</li>
+* <li>dispatch to servant</li>
+* <li>oa.returnServant()</li>
+* <li>oa.exit()</li>
+* <li>pop info</li>
+* </ol>
+* </li>
+* <!-- REVISIT: Is this the required order for exit/pop? Cna 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. -->
+* <li>The local pattern:
+* <ol>
+* <li>oa = oaf.find( oaid )</li>
+* <li>oa.enter()</li>
+* <li>info = oa.makeInvocationInfo( oid )</li>
+* <li>info.setOperation( operation )</li>
+* <li>push info</li>
+* <li>oa.getInvocationServant( info )</li>
+* <li>dispatch to servant</li>
+* <li>oa.returnServant()</li>
+* <li>oa.exit()</li>
+* <li>pop info</li>
+* </ol>
+* </li>
+* <!-- This is the same as the remote case, except that setExecuteReturnServantInResponseConstructor
+* is not needed (or possible, since there is no server request). -->
+* <li>The fast local pattern: When delegate is constructed,
+* first extract ObjectKey from IOR in delegate,
+* then get ObjectId, ObjectAdapterId, and ObjectAdapterFactory (oaf). Then:
+* <ol>
+* <li>oa = oaf.find( oaid )</li>
+* <li>info = oa.makeInvocationInfo( oid ) (note: no operation!)</li>
+* <li>push info (needed for the correct functioning of getInvocationServant)</li>
+* <li>oa.getInvocationServant( info )</li>
+* <li>pop info
+* </ol>
+* The info instance (which includes the Servant) is cached in the client subcontract.
+* <p>Then, on each invocation:
+* <ol>
+* <li>newinfo = copy of info (clone)</li>
+* <li>info.setOperation( operation )</li>
+* <li>push newinfo</li>
+* <li>oa.enter()</li>
+* <li>dispatch to servant</li>
+* <li>oa.returnServant()</li> <!-- XXX This is probably wrong: remove it. -->
+* <li>oa.exit()</li>
+* <li>pop info</li>
+* </ol>
+* </li>
+* </ol>
+* XXX fast local should not call returnServant: what is correct here?
+*/
+public interface ObjectAdapter
+{
+ ////////////////////////////////////////////////////////////////////////////
+ // Basic methods for supporting interceptors
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Returns the ORB associated with this adapter.
+ */
+ ORB getORB() ;
+
+ 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.
+ */
+ IORTemplate getIORTemplate() ;
+
+ ////////////////////////////////////////////////////////////////////////////
+ // Methods needed to support ORT.
+ ////////////////////////////////////////////////////////////////////////////
+
+ /** Return the ID of the AdapterManager for this object adapter.
+ */
+ int getManagerId() ;
+
+ /** Return the current state of this object adapter (see
+ * org.omg.PortableInterceptors for states.
+ */
+ short getState() ;
+
+ ObjectReferenceTemplate getAdapterTemplate() ;
+
+ ObjectReferenceFactory getCurrentFactory() ;
+
+ /** Change the current factory. This may only be called during the
+ * AdapterCreated call.
+ */
+ 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.
+ */
+ 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 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 ;
+
+ /** exit must be called after each request has been completed. If enter
+ * is called, there must always be a corresponding exit.
+ */
+ void exit( ) ;
+
+ /** Must be called every time getInvocationServant is called after
+ * the request has completed.
+ */
+ public void returnServant() ;
+
+ /** Create an instance of InvocationInfo that is appropriate for this
+ * Object adapter.
+ */
+ OAInvocationInfo makeInvocationInfo( byte[] objectId ) ;
+
+ /** Return the most derived interface for the given servant and objectId.
+ */
+ String[] getInterfaces( Object servant, byte[] objectId ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapterBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapterBase.java
new file mode 100644
index 0000000..35893e3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapterBase.java
@@ -0,0 +1,203 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.oa ;
+
+import org.omg.PortableInterceptor.ObjectReferenceTemplate ;
+import org.omg.PortableInterceptor.ObjectReferenceFactory ;
+
+import org.omg.CORBA.Policy ;
+
+import org.omg.PortableInterceptor.ACTIVE ;
+
+import com.sun.corba.se.spi.copyobject.ObjectCopierFactory ;
+import com.sun.corba.se.spi.ior.IORFactories ;
+import com.sun.corba.se.spi.ior.IORTemplate ;
+import com.sun.corba.se.spi.ior.ObjectAdapterId;
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.spi.oa.OADestroyed ;
+import com.sun.corba.se.spi.oa.ObjectAdapter ;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.protocol.PIHandler ;
+
+import com.sun.corba.se.impl.logging.POASystemException ;
+import com.sun.corba.se.impl.logging.OMGSystemException ;
+import com.sun.corba.se.impl.oa.poa.Policies;
+
+abstract public class ObjectAdapterBase extends org.omg.CORBA.LocalObject
+ implements ObjectAdapter
+{
+ private ORB orb;
+
+ // Exception wrappers
+ private final POASystemException _iorWrapper ;
+ private final POASystemException _invocationWrapper ;
+ private final POASystemException _lifecycleWrapper ;
+ private final OMGSystemException _omgInvocationWrapper ;
+ private final OMGSystemException _omgLifecycleWrapper ;
+
+ // 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 ;
+
+ public ObjectAdapterBase( ORB orb )
+ {
+ this.orb = orb ;
+ _iorWrapper = POASystemException.get( orb,
+ CORBALogDomains.OA_IOR ) ;
+ _lifecycleWrapper = POASystemException.get( orb,
+ CORBALogDomains.OA_LIFECYCLE ) ;
+ _omgLifecycleWrapper = OMGSystemException.get( orb,
+ CORBALogDomains.OA_LIFECYCLE ) ;
+ _invocationWrapper = POASystemException.get( orb,
+ CORBALogDomains.OA_INVOCATION ) ;
+ _omgInvocationWrapper = OMGSystemException.get( orb,
+ CORBALogDomains.OA_INVOCATION ) ;
+ }
+
+ public final POASystemException iorWrapper()
+ {
+ return _iorWrapper ;
+ }
+
+ public final POASystemException lifecycleWrapper()
+ {
+ return _lifecycleWrapper ;
+ }
+
+ public final OMGSystemException omgLifecycleWrapper()
+ {
+ return _omgLifecycleWrapper ;
+ }
+
+ public final POASystemException invocationWrapper()
+ {
+ return _invocationWrapper ;
+ }
+
+ public final OMGSystemException omgInvocationWrapper()
+ {
+ return _omgInvocationWrapper ;
+ }
+
+ /*
+ * 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() ;
+
+ 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);
+
+ adapterTemplate = IORFactories.makeObjectReferenceTemplate( orb,
+ iortemp ) ;
+ currentFactory = adapterTemplate ;
+
+ if (notifyORB) {
+ PIHandler pih = orb.getPIHandler() ;
+ if (pih != null)
+ // This runs the IORInterceptors.
+ pih.objectAdapterCreated( this ) ;
+ }
+
+ iortemp.makeImmutable() ;
+ }
+
+ final public org.omg.CORBA.Object makeObject( String repId, byte[] oid )
+ {
+ return currentFactory.make_object( repId, oid ) ;
+ }
+
+ final public byte[] getAdapterId()
+ {
+ return adapterId ;
+ }
+
+ final public ORB getORB()
+ {
+ return orb ;
+ }
+
+ abstract public Policy getEffectivePolicy( int type ) ;
+
+ final public IORTemplate getIORTemplate()
+ {
+ return iortemp ;
+ }
+
+ abstract public int getManagerId() ;
+
+ abstract public short getState() ;
+
+ final public ObjectReferenceTemplate getAdapterTemplate()
+ {
+ return adapterTemplate ;
+ }
+
+ final public ObjectReferenceFactory getCurrentFactory()
+ {
+ return currentFactory ;
+ }
+
+ final public void setCurrentFactory( ObjectReferenceFactory factory )
+ {
+ currentFactory = factory ;
+ }
+
+ abstract public org.omg.CORBA.Object getLocalServant( byte[] objectId ) ;
+
+ abstract public void getInvocationServant( OAInvocationInfo info ) ;
+
+ abstract public void returnServant() ;
+
+ abstract public void enter() throws OADestroyed ;
+
+ abstract public void exit() ;
+
+ 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 ;
+ }
+
+ abstract public String[] getInterfaces( Object servant, byte[] objectId ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapterFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapterFactory.java
new file mode 100644
index 0000000..7f1964d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/oa/ObjectAdapterFactory.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.oa ;
+
+import com.sun.corba.se.spi.oa.ObjectAdapter ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.ior.ObjectAdapterId ;
+
+public interface ObjectAdapterFactory {
+ /** Initialize this object adapter factory instance.
+ */
+ void init( ORB orb ) ;
+
+ /** Shutdown all object adapters and other state associated
+ * with this factory.
+ */
+ void shutdown( boolean waitForCompletion ) ;
+
+ /** Find the ObjectAdapter instance that corresponds to the
+ * given ObjectAdapterId.
+ */
+ ObjectAdapter find( ObjectAdapterId oaid ) ;
+
+ ORB getORB() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/DataCollector.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/DataCollector.java
new file mode 100644
index 0000000..6f1e897
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/DataCollector.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.orb ;
+
+import java.applet.Applet ;
+import java.util.Properties ;
+import java.util.Vector ;
+
+/** 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ * @throws IllegalStateException if setPropertyNames has not
+ * been called.
+ */
+ Properties getProperties() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORB.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORB.java
new file mode 100644
index 0000000..a527d44
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORB.java
@@ -0,0 +1,492 @@
+/*
+ * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orb;
+
+import java.util.Map ;
+import java.util.HashMap ;
+import java.util.Properties ;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.logging.Logger ;
+
+import org.omg.CORBA.TCKind ;
+
+import com.sun.corba.se.pept.broker.Broker ;
+import com.sun.corba.se.pept.transport.ByteBufferPool;
+
+import com.sun.corba.se.spi.protocol.RequestDispatcherRegistry ;
+import com.sun.corba.se.spi.protocol.ClientDelegateFactory ;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+import com.sun.corba.se.spi.protocol.PIHandler ;
+import com.sun.corba.se.spi.resolver.LocalResolver ;
+import com.sun.corba.se.spi.resolver.Resolver ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ;
+import com.sun.corba.se.spi.legacy.connection.LegacyServerSocketManager;
+import com.sun.corba.se.spi.monitoring.MonitoringConstants;
+import com.sun.corba.se.spi.monitoring.MonitoringManager;
+import com.sun.corba.se.spi.monitoring.MonitoringFactories;
+
+import com.sun.corba.se.spi.ior.IdentifiableFactoryFinder ;
+import com.sun.corba.se.spi.ior.TaggedComponentFactoryFinder ;
+import com.sun.corba.se.spi.ior.ObjectKey ;
+import com.sun.corba.se.spi.ior.ObjectKeyFactory ;
+import com.sun.corba.se.spi.ior.IOR ;
+
+import com.sun.corba.se.spi.orbutil.threadpool.ThreadPoolManager;
+
+import com.sun.corba.se.spi.oa.OAInvocationInfo ;
+import com.sun.corba.se.spi.transport.CorbaTransportManager;
+
+import com.sun.corba.se.spi.logging.LogWrapperFactory ;
+import com.sun.corba.se.spi.logging.LogWrapperBase ;
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.spi.copyobject.CopierManager ;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager ;
+import com.sun.corba.se.spi.presentation.rmi.PresentationDefaults ;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ;
+
+// XXX needs an SPI or else it does not belong here
+import com.sun.corba.se.impl.corba.TypeCodeImpl ;
+import com.sun.corba.se.impl.corba.TypeCodeFactory ;
+
+// XXX Should there be a SPI level constants ?
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+import com.sun.corba.se.impl.oa.poa.BadServerIdHandler ;
+
+import com.sun.corba.se.impl.transport.ByteBufferPoolImpl;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.logging.OMGSystemException ;
+
+import com.sun.corba.se.impl.presentation.rmi.PresentationManagerImpl ;
+
+public abstract class ORB extends com.sun.corba.se.org.omg.CORBA.ORB
+ implements Broker, TypeCodeFactory
+{
+ // 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.
+ // 2. typeCodeMap and primitiveTypeCodeConstants are here because they
+ // 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.
+
+ // Flag set at compile time to debug flag processing: this can't
+ // be one of the xxxDebugFlags because it is used to debug the mechanism
+ // that sets the xxxDebugFlags!
+ public static boolean ORBInitDebug = false;
+
+ // 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.
+ public boolean transportDebugFlag = false ;
+ public boolean subcontractDebugFlag = false ;
+ public boolean poaDebugFlag = false ;
+ public boolean poaConcurrencyDebugFlag = false ;
+ public boolean poaFSMDebugFlag = false ;
+ public boolean orbdDebugFlag = false ;
+ public boolean namingDebugFlag = false ;
+ public boolean serviceContextDebugFlag = false ;
+ public boolean transientObjectManagerDebugFlag = false ;
+ public boolean giopVersionDebugFlag = false;
+ public boolean shutdownDebugFlag = false;
+ public boolean giopDebugFlag = false;
+ public boolean invocationTimingDebugFlag = false ;
+
+ // SystemException log wrappers. Protected so that they can be used in
+ // subclasses.
+ protected static ORBUtilSystemException staticWrapper ;
+ protected ORBUtilSystemException wrapper ;
+ protected OMGSystemException omgWrapper ;
+
+ // This map is needed for resolving recursive type code placeholders
+ // based on the unique repository id.
+ // XXX Should this be a WeakHashMap for GC?
+ private Map<String, TypeCodeImpl> typeCodeMap;
+
+ private TypeCodeImpl[] primitiveTypeCodeConstants;
+
+ // ByteBufferPool - needed by both ORBImpl and ORBSingleton
+ ByteBufferPool byteBufferPool;
+
+ // Local testing
+ // XXX clean this up, probably remove these
+ 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 CorbaTransportManager getCorbaTransportManager();
+ public abstract LegacyServerSocketManager getLegacyServerSocketManager();
+
+ // wrapperMap maintains a table of LogWrapper instances used by
+ // different classes to log exceptions. The key is a StringPair
+ // representing LogDomain and ExceptionGroup.
+ private Map<StringPair, LogWrapperBase> wrapperMap;
+
+ static class Holder {
+ static final PresentationManager defaultPresentationManager =
+ setupPresentationManager();
+ }
+
+ private static Map<StringPair, LogWrapperBase> staticWrapperMap =
+ new ConcurrentHashMap<>();
+
+ protected MonitoringManager monitoringManager;
+
+ private static PresentationManager setupPresentationManager() {
+ staticWrapper = ORBUtilSystemException.get(
+ CORBALogDomains.RPC_PRESENTATION ) ;
+
+ boolean useDynamicStub = false;
+
+ PresentationManager.StubFactoryFactory dynamicStubFactoryFactory = null;
+
+ PresentationManager pm = new PresentationManagerImpl( useDynamicStub ) ;
+ pm.setStubFactoryFactory( false,
+ PresentationDefaults.getStaticStubFactoryFactory() ) ;
+ pm.setStubFactoryFactory( true, dynamicStubFactoryFactory ) ;
+ return pm;
+ }
+
+ public void destroy() {
+ wrapper = null;
+ omgWrapper = null;
+ typeCodeMap = null;
+ primitiveTypeCodeConstants = null;
+ byteBufferPool = null;
+ }
+
+ /** Get the single instance of the PresentationManager
+ */
+ public static PresentationManager getPresentationManager()
+ {
+ return Holder.defaultPresentationManager;
+ }
+
+ /** Get the appropriate StubFactoryFactory. This
+ * will be dynamic or static depending on whether
+ * com.sun.CORBA.ORBUseDynamicStub is true or false.
+ */
+ public static PresentationManager.StubFactoryFactory
+ getStubFactoryFactory()
+ {
+ PresentationManager gPM = getPresentationManager();
+ boolean useDynamicStubs = gPM.useDynamicStubs() ;
+ return gPM.getStubFactoryFactory( useDynamicStubs ) ;
+ }
+
+ protected ORB()
+ {
+ // Initialize logging first, since it is needed nearly
+ // everywhere (for example, in TypeCodeImpl).
+ wrapperMap = new ConcurrentHashMap<>();
+ wrapper = ORBUtilSystemException.get( this,
+ CORBALogDomains.RPC_PRESENTATION ) ;
+ omgWrapper = OMGSystemException.get( this,
+ CORBALogDomains.RPC_PRESENTATION ) ;
+
+ typeCodeMap = new HashMap<>();
+
+ 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)
+ } ;
+
+ monitoringManager =
+ MonitoringFactories.getMonitoringManagerFactory( ).
+ createMonitoringManager(
+ MonitoringConstants.DEFAULT_MONITORING_ROOT,
+ MonitoringConstants.DEFAULT_MONITORING_ROOT_DESCRIPTION);
+ }
+
+ // Typecode support: needed in both ORBImpl and ORBSingleton
+ public TypeCodeImpl get_primitive_tc(int kind)
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ try {
+ return primitiveTypeCodeConstants[kind] ;
+ } catch (Throwable t) {
+ throw wrapper.invalidTypecodeKind( t, new Integer(kind) ) ;
+ }
+ }
+
+ public synchronized void setTypeCode(String id, TypeCodeImpl code)
+ {
+ checkShutdownState();
+ typeCodeMap.put(id, code);
+ }
+
+ public synchronized TypeCodeImpl getTypeCode(String id)
+ {
+ checkShutdownState();
+ return typeCodeMap.get(id);
+ }
+
+ public MonitoringManager getMonitoringManager( ) {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ return monitoringManager;
+ }
+
+ // Special non-standard set_parameters method for
+ // creating a precisely controlled ORB instance.
+ // An ORB created by this call is affected only by
+ // 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 ) ;
+
+ // ORB versioning
+ public abstract ORBVersion getORBVersion() ;
+ public abstract void setORBVersion( ORBVersion version ) ;
+
+ // XXX This needs a better name
+ 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. XXX Remove after ORT for ORBD work is integrated.
+ */
+ public abstract void handleBadServerId( ObjectKey okey ) ;
+ public abstract void setBadServerIdHandler( BadServerIdHandler handler ) ;
+ public abstract void initBadServerIdHandler() ;
+
+ public abstract void notifyORB() ;
+
+ public abstract PIHandler getPIHandler() ;
+
+ public abstract void checkShutdownState();
+
+ // 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 void startingDispatch();
+ public abstract void finishedDispatch();
+
+ /** Return this ORB's transient server ID. This is needed for
+ * initializing object adapters.
+ */
+ public abstract int getTransientServerId();
+
+ public abstract ServiceContextRegistry getServiceContextRegistry() ;
+
+ public abstract RequestDispatcherRegistry getRequestDispatcherRegistry();
+
+ public abstract ORBData getORBData() ;
+
+ public abstract void setClientDelegateFactory( ClientDelegateFactory factory ) ;
+
+ public abstract ClientDelegateFactory getClientDelegateFactory() ;
+
+ public abstract void setCorbaContactInfoListFactory( CorbaContactInfoListFactory factory ) ;
+
+ public abstract CorbaContactInfoListFactory getCorbaContactInfoListFactory() ;
+
+ // XXX These next 7 methods should be moved to a ResolverManager.
+
+ /** Set the resolver used in this ORB. This resolver will be used for list_initial_services
+ * and resolve_initial_references.
+ */
+ 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.
+ */
+ public abstract Resolver getResolver() ;
+
+ /** Set the LocalResolver used in this ORB. This LocalResolver is used for
+ * register_initial_reference only.
+ */
+ public abstract void setLocalResolver( LocalResolver resolver ) ;
+
+ /** Get the LocalResolver used in this ORB. This LocalResolver is used for
+ * register_initial_reference only.
+ */
+ 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.
+ */
+ 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.
+ */
+ public abstract Operation getURLOperation() ;
+
+ /** Set the ServerRequestDispatcher that should be used for handling INS requests.
+ */
+ public abstract void setINSDelegate( CorbaServerRequestDispatcher insDelegate ) ;
+
+ // XXX The next 5 operations should be moved to an IORManager.
+
+ /** Factory finders for the various parts of the IOR: tagged components, tagged
+ * profiles, and tagged profile templates.
+ */
+ public abstract TaggedComponentFactoryFinder getTaggedComponentFactoryFinder() ;
+ public abstract IdentifiableFactoryFinder getTaggedProfileFactoryFinder() ;
+ public abstract IdentifiableFactoryFinder getTaggedProfileTemplateFactoryFinder() ;
+
+ public abstract ObjectKeyFactory getObjectKeyFactory() ;
+ public abstract void setObjectKeyFactory( ObjectKeyFactory factory ) ;
+
+ // Logging SPI
+
+ /**
+ * Returns the logger based on the category.
+ */
+ public Logger getLogger( String domain )
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ ORBData odata = getORBData() ;
+
+ // Determine the correct ORBId. There are 3 cases:
+ // 1. odata is null, which happens if we are getting a logger before
+ // ORB initialization is complete. In this case we cannot determine
+ // the ORB ID (it's not known yet), so we set the ORBId to
+ // _INITIALIZING_.
+ // 2. odata is not null, so initialization is complete, but ORBId is set to
+ // the default "". To avoid a ".." in
+ // the log domain, we simply use _DEFAULT_ in this case.
+ // 3. odata is not null, ORBId is not "": just use the ORBId.
+ String ORBId ;
+ if (odata == null)
+ ORBId = "_INITIALIZING_" ;
+ else {
+ ORBId = odata.getORBId() ;
+ if (ORBId.equals(""))
+ ORBId = "_DEFAULT_" ;
+ }
+
+ return getCORBALogger( ORBId, domain ) ;
+ }
+
+ public static Logger staticGetLogger( String domain )
+ {
+ return getCORBALogger( "_CORBA_", domain ) ;
+ }
+
+ private static Logger getCORBALogger( String ORBId, String domain )
+ {
+ String fqLogDomain = CORBALogDomains.TOP_LEVEL_DOMAIN + "." +
+ ORBId + "." + domain;
+
+ return Logger.getLogger( fqLogDomain, ORBConstants.LOG_RESOURCE_FILE );
+ }
+
+ /** get the log wrapper class (its type is dependent on the exceptionGroup) for the
+ * given log domain and exception group in this ORB instance.
+ */
+ public LogWrapperBase getLogWrapper(String logDomain,
+ String exceptionGroup, LogWrapperFactory factory)
+ {
+ return wrapperMap.computeIfAbsent(
+ new StringPair(logDomain, exceptionGroup),
+ x -> factory.create(getLogger(logDomain)));
+ }
+
+ /** get the log wrapper class (its type is dependent on the exceptionGroup) for the
+ * given log domain and exception group in this ORB instance.
+ */
+ public static LogWrapperBase staticGetLogWrapper(String logDomain,
+ String exceptionGroup, LogWrapperFactory factory)
+ {
+ return staticWrapperMap.computeIfAbsent(
+ new StringPair(logDomain, exceptionGroup),
+ x -> factory.create(staticGetLogger(logDomain)));
+ }
+
+ // 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.
+ public ByteBufferPool getByteBufferPool()
+ {
+ synchronized (this) {
+ checkShutdownState();
+ }
+ if (byteBufferPool == null)
+ byteBufferPool = new ByteBufferPoolImpl(this);
+
+ return byteBufferPool;
+ }
+
+ public abstract void setThreadPoolManager(ThreadPoolManager mgr);
+
+ public abstract ThreadPoolManager getThreadPoolManager();
+
+ public abstract CopierManager getCopierManager() ;
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBConfigurator.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBConfigurator.java
new file mode 100644
index 0000000..b572969
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBConfigurator.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.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.
+ */
+public interface ORBConfigurator {
+ void configure( DataCollector dc, ORB orb ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBData.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBData.java
new file mode 100644
index 0000000..3311c7c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBData.java
@@ -0,0 +1,158 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orb ;
+
+import java.lang.reflect.Field ;
+
+import java.util.Map ;
+import java.util.Set ;
+import java.util.Iterator ;
+import java.util.Properties ;
+
+import org.omg.PortableInterceptor.ORBInitializer ;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory;
+import com.sun.corba.se.spi.transport.IORToSocketInfo;
+import com.sun.corba.se.spi.transport.IIOPPrimaryToContactInfo;
+import com.sun.corba.se.spi.transport.ReadTimeouts;
+
+import com.sun.corba.se.impl.legacy.connection.USLPort;
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
+
+public interface ORBData {
+ public String getORBInitialHost() ;
+
+ public int getORBInitialPort() ;
+
+ public String getORBServerHost() ;
+
+ public int getORBServerPort() ;
+
+ public String getListenOnAllInterfaces();
+
+ public com.sun.corba.se.spi.legacy.connection.ORBSocketFactory getLegacySocketFactory () ;
+
+ public com.sun.corba.se.spi.transport.ORBSocketFactory getSocketFactory();
+
+ public USLPort[] getUserSpecifiedListenPorts () ;
+
+ public IORToSocketInfo getIORToSocketInfo();
+
+ public IIOPPrimaryToContactInfo getIIOPPrimaryToContactInfo();
+
+ public String getORBId() ;
+
+ public boolean getORBServerIdPropertySpecified() ;
+
+ public boolean isLocalOptimizationAllowed() ;
+
+ public GIOPVersion getGIOPVersion() ;
+
+ public int getHighWaterMark() ;
+
+ public int getLowWaterMark() ;
+
+ public int getNumberToReclaim() ;
+
+ public int getGIOPFragmentSize() ;
+
+ public int getGIOPBufferSize() ;
+
+ 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
+ */
+ public short getGIOPTargetAddressPreference() ;
+
+ public short getGIOPAddressDisposition() ;
+
+ public boolean useByteOrderMarkers() ;
+
+ public boolean useByteOrderMarkersInEncapsulations() ;
+
+ public boolean alwaysSendCodeSetServiceContext() ;
+
+ public boolean getPersistentPortInitialized() ;
+
+ public int getPersistentServerPort();
+
+ public boolean getPersistentServerIdInitialized() ;
+
+ /** 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.se.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();
+
+ public boolean getServerIsORBActivated() ;
+
+ public Class getBadServerIdHandler();
+
+ /**
+ * Get the prefered code sets for connections. Should the client send the
+ * code set service context on every request?
+ */
+ public CodeSetComponentInfo getCodeSetComponentInfo() ;
+
+ public ORBInitializer[] getORBInitializers();
+
+ public StringPair[] getORBInitialReferences();
+
+ public String getORBDefaultInitialReference() ;
+
+ public String[] getORBDebugFlags();
+
+ public Acceptor[] getAcceptors();
+
+ public CorbaContactInfoListFactory getCorbaContactInfoListFactory();
+
+ public String acceptorSocketType();
+ public boolean acceptorSocketUseSelectThreadToWait();
+ public boolean acceptorSocketUseWorkerThreadForEvent();
+ public String connectionSocketType();
+ public boolean connectionSocketUseSelectThreadToWait();
+ public boolean connectionSocketUseWorkerThreadForEvent();
+
+ public ReadTimeouts getTransportTCPReadTimeouts();
+ public boolean disableDirectByteBufferUse() ;
+ public boolean isJavaSerializationEnabled();
+ public boolean useRepId();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBVersion.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBVersion.java
new file mode 100644
index 0000000..ce74c58
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBVersion.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orb ;
+
+import org.omg.CORBA.portable.OutputStream ;
+
+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
+
+ byte getORBType() ;
+
+ void write( OutputStream os ) ;
+
+ public boolean lessThan( ORBVersion version ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBVersionFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBVersionFactory.java
new file mode 100644
index 0000000..e024b2c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ORBVersionFactory.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orb ;
+
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.impl.orb.ORBVersionImpl ;
+import org.omg.CORBA.portable.InputStream ;
+import org.omg.CORBA.INTERNAL ;
+
+public class ORBVersionFactory {
+ private ORBVersionFactory() {} ;
+
+ public static ORBVersion getFOREIGN()
+ {
+ return ORBVersionImpl.FOREIGN ;
+ }
+
+ public static ORBVersion getOLD()
+ {
+ return ORBVersionImpl.OLD ;
+ }
+
+ public static ORBVersion getNEW()
+ {
+ return ORBVersionImpl.NEW ;
+ }
+
+ public static ORBVersion getJDK1_3_1_01()
+ {
+ return ORBVersionImpl.JDK1_3_1_01 ;
+ }
+
+ public static ORBVersion getNEWER()
+ {
+ return ORBVersionImpl.NEWER ;
+ }
+
+ public static ORBVersion getPEORB()
+ {
+ return ORBVersionImpl.PEORB ;
+ }
+
+ /** Return the current version of this ORB
+ */
+ public static ORBVersion getORBVersion()
+ {
+ return ORBVersionImpl.PEORB ;
+ }
+
+ 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() ;
+ */
+
+ /**
+ * 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);
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/Operation.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/Operation.java
new file mode 100644
index 0000000..f917393
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/Operation.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.orb ;
+
+/** 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.
+ */
+ Object operate( Object value ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java
new file mode 100644
index 0000000..d84523b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/OperationFactory.java
@@ -0,0 +1,567 @@
+/*
+ * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.orb ;
+
+import java.util.StringTokenizer ;
+import java.util.Arrays ;
+
+import java.lang.reflect.Array ;
+
+import java.net.URL ;
+import java.net.MalformedURLException ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.orbutil.ObjectUtility ;
+
+import sun.corba.SharedSecrets;
+
+/** This is a static factory class for commonly used operations
+* for property parsing. The following operations are supported:
+* <ul>
+* <li>maskErrorAction( Operation op ) executes op and returns the result. If op throws an
+* exception, the result is null.
+* <li>indexAction( int arg ) returns the [arg] element of value, which must be an Object[]</li>
+* <li>identityAction() return the value</li>
+* <li>booleanAction() return a Boolean representing true or false values of the String value</li>
+* <li>integerAction() returns an Integer for the String value, which must be a decimal integer</li>
+* <li>stringAction() returns the String value</li>
+* <li>classAction() returns a class for the String value, as loaded by the ORB classloader</li>
+* <li>setFlagAction() always return Boolean.TRUE</li>
+* <li>URLAction() returns a java.net.URL for the String value, which must be a valid URL</li>
+* <li>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</li>
+* <li>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</li>
+* <li>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</li>
+* <li>compose( Operation op1, Operation op2 ) is the operation that applies op2 to the result of applying
+* op1 to the value</li>
+* <li>mapAction( Operation ) applies the Operation to each element of an array of objects, and returns
+* an array of the results</li>
+* <li>mapSequenceAction( Operation[] ) applies the corresponding element of the Operation array to an
+* element of the Object[] value, and returns an array of the results</li>
+* <li>convertIntegerToShort coerces an Integer into a Short.</li>
+* </ul>
+* Other operations can be directly defined, and combined using these basic operations.
+*/
+public abstract class OperationFactory {
+ private OperationFactory() {}
+
+ private static String getString( Object obj )
+ {
+ if (obj instanceof String)
+ return (String)obj ;
+ else
+ throw new Error( "String expected" ) ;
+ }
+
+ private static Object[] getObjectArray( Object obj )
+ {
+ if (obj instanceof Object[])
+ return (Object[])obj ;
+ else
+ throw new Error( "Object[] expected" ) ;
+ }
+
+ private static StringPair getStringPair( Object obj )
+ {
+ if (obj instanceof StringPair)
+ return (StringPair)obj ;
+ else
+ throw new Error( "StringPair expected" ) ;
+ }
+
+ private static abstract class OperationBase implements Operation{
+ public boolean equals( Object obj )
+ {
+ if (this==obj)
+ return true ;
+
+ if (!(obj instanceof OperationBase))
+ return false ;
+
+ OperationBase other = (OperationBase)obj ;
+
+ return toString().equals( other.toString() ) ;
+ }
+
+ public int hashCode()
+ {
+ return toString().hashCode() ;
+ }
+ }
+
+ private static class MaskErrorAction extends OperationBase
+ {
+ private Operation op ;
+
+ public MaskErrorAction( Operation op )
+ {
+ this.op = op ;
+ }
+
+ public Object operate( Object arg )
+ {
+ try {
+ return op.operate( arg ) ;
+ } catch (java.lang.Exception exc) {
+ return null ;
+ }
+ }
+
+ public String toString()
+ {
+ return "maskErrorAction(" + op + ")" ;
+ }
+ }
+
+ public static Operation maskErrorAction( Operation op )
+ {
+ return new MaskErrorAction( op ) ;
+ }
+
+ private static class IndexAction extends OperationBase
+ {
+ private int index ;
+
+ public IndexAction( int index )
+ {
+ this.index = index ;
+ }
+
+ public Object operate( Object value )
+ {
+ return getObjectArray( value )[ index ] ;
+ }
+
+ public String toString()
+ {
+ return "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 ).getFirst() ;
+ }
+
+ public String toString() { return "suffixAction" ; }
+ }
+
+ private static Operation suffixActionImpl = new SuffixAction() ;
+
+ private static class ValueAction extends OperationBase
+ {
+ public Object operate( Object value )
+ {
+ return getStringPair( value ).getSecond() ;
+ }
+
+ public String toString() { return "valueAction" ; }
+ }
+
+ private static Operation valueActionImpl = new ValueAction() ;
+
+ private static class IdentityAction extends OperationBase
+ {
+ public Object operate( Object value )
+ {
+ return value ;
+ }
+
+ public String toString() { return "identityAction" ; }
+ }
+
+ private static Operation identityActionImpl = new IdentityAction() ;
+
+ private static class BooleanAction extends OperationBase
+ {
+ public Object operate( Object value )
+ {
+ return new Boolean( getString( value ) ) ;
+ }
+
+ public String toString() { return "booleanAction" ; }
+ }
+
+ private static Operation booleanActionImpl = new BooleanAction() ;
+
+ private static class IntegerAction extends OperationBase
+ {
+ public Object operate( Object value )
+ {
+ return new Integer( getString( value ) ) ;
+ }
+
+ public String toString() { return "integerAction" ; }
+ }
+
+ private static Operation integerActionImpl = new IntegerAction() ;
+
+ private static class StringAction extends OperationBase
+ {
+ public Object operate( Object value )
+ {
+ return value ;
+ }
+
+ public String toString() { return "stringAction" ; }
+ }
+
+ private static Operation stringActionImpl = new StringAction() ;
+
+ private static class ClassAction extends OperationBase
+ {
+ public Object operate( Object value )
+ {
+ String className = getString( value ) ;
+
+ try {
+ Class<?> result =
+ SharedSecrets.getJavaCorbaAccess().loadClass( className ) ;
+ return result ;
+ } catch (Exception exc) {
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.ORB_LIFECYCLE ) ;
+ throw wrapper.couldNotLoadClass( exc, className ) ;
+ }
+ }
+
+ public String toString() { return "classAction" ; }
+ }
+
+ private static Operation classActionImpl = new ClassAction() ;
+
+ private static class SetFlagAction extends OperationBase
+ {
+ public Object operate( Object value )
+ {
+ return Boolean.TRUE ;
+ }
+
+ public String toString() { return "setFlagAction" ; }
+ }
+
+ private static Operation setFlagActionImpl = new SetFlagAction() ;
+
+ private static class URLAction extends OperationBase
+ {
+ public Object operate( Object value )
+ {
+ String val = (String)value ;
+ try {
+ return new URL( val ) ;
+ } catch (MalformedURLException exc) {
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.ORB_LIFECYCLE ) ;
+ throw wrapper.badUrl( exc, val ) ;
+ }
+ }
+
+ public String toString() { return "URLAction" ; }
+ }
+
+ private static Operation URLActionImpl = new URLAction() ;
+
+ public static Operation identityAction()
+ {
+ return identityActionImpl ;
+ }
+
+ public static Operation suffixAction()
+ {
+ return suffixActionImpl ;
+ }
+
+ public static Operation valueAction()
+ {
+ return valueActionImpl ;
+ }
+
+ public static Operation booleanAction()
+ {
+ return booleanActionImpl ;
+ }
+
+ public static Operation integerAction()
+ {
+ return integerActionImpl ;
+ }
+
+ public static Operation stringAction()
+ {
+ return stringActionImpl ;
+ }
+
+ public static Operation classAction()
+ {
+ return classActionImpl ;
+ }
+
+ public static Operation setFlagAction()
+ {
+ return setFlagActionImpl ;
+ }
+
+ public static Operation URLAction()
+ {
+ return URLActionImpl ;
+ }
+
+ private static class IntegerRangeAction extends OperationBase
+ {
+ private int min ;
+ private int max ;
+
+ IntegerRangeAction( int min, int max )
+ {
+ this.min = min ;
+ this.max = max ;
+ }
+
+ public Object operate( Object value )
+ {
+ int result = Integer.parseInt( getString( value ) ) ;
+ if ((result >= min) && (result <= max))
+ return new Integer( result ) ;
+ else
+ throw new IllegalArgumentException(
+ "Property value " + result + " is not in the range " +
+ min + " to " + max ) ;
+ }
+
+ public String toString() {
+ return "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 ;
+
+ 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
+ // 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 ;
+ while (st.hasMoreTokens()) {
+ String next = st.nextToken() ;
+ Object val = act.operate( next ) ;
+ if (result == null)
+ result = Array.newInstance( val.getClass(), length ) ;
+ Array.set( result, ctr++, val ) ;
+ }
+
+ return result ;
+ }
+
+ public String toString() {
+ return "listAction(separator=\"" + sep +
+ "\",action=" + 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 ;
+
+ SequenceAction( String sep, Operation[] actions )
+ {
+ this.sep = sep ;
+ this.actions = actions ;
+ }
+
+ public Object operate( Object value )
+ {
+ StringTokenizer st = new StringTokenizer( getString( value ),
+ sep ) ;
+
+ int numTokens = st.countTokens() ;
+ if (numTokens != actions.length)
+ throw new Error(
+ "Number of tokens and number of actions do not match" ) ;
+
+ int ctr = 0 ;
+ Object[] result = new Object[ numTokens ] ;
+ while (st.hasMoreTokens()) {
+ Operation act = actions[ctr] ;
+ String next = st.nextToken() ;
+ result[ctr++] = act.operate( next ) ;
+ }
+
+ return result ;
+ }
+
+ public String toString() {
+ return "sequenceAction(separator=\"" + sep +
+ "\",actions=" +
+ Arrays.toString(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 ;
+
+ ComposeAction( Operation op1, Operation op2 )
+ {
+ this.op1 = op1 ;
+ this.op2 = op2 ;
+ }
+
+ public Object operate( Object value )
+ {
+ return op2.operate( op1.operate( value ) ) ;
+ }
+
+ public String toString() {
+ return "composition(" + op1 + "," + op2 + ")" ;
+ }
+ }
+
+ public static Operation compose( Operation op1, Operation op2 )
+ {
+ return new ComposeAction( op1, op2 ) ;
+ }
+
+ private static class MapAction extends OperationBase
+ {
+ Operation 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<values.length; ctr++ )
+ result[ctr] = op.operate( values[ctr] ) ;
+ return result ;
+ }
+
+ public String toString() {
+ return "mapAction(" + op + ")" ;
+ }
+ }
+
+ public static Operation mapAction( Operation op )
+ {
+ return new MapAction( op ) ;
+ }
+
+ private static class MapSequenceAction extends OperationBase
+ {
+ private Operation[] op ;
+
+ public MapSequenceAction( Operation[] op )
+ {
+ this.op = op ;
+ }
+
+ // XXX Does this correctly handle array types? It seems
+ // that hetereogeneous arrays work this way, while
+ // homogeneous arrays need to use Array.newInstance tricks.
+ public Object operate( Object value )
+ {
+ Object[] values = (Object[])value ;
+ Object[] result = new Object[ values.length ] ;
+ for (int ctr=0; ctr<values.length; ctr++ )
+ result[ctr] = op[ctr].operate( values[ctr] ) ;
+ return result ;
+ }
+
+ public String toString() {
+ return "mapSequenceAction(" +
+ Arrays.toString(op) + ")" ;
+ }
+ }
+
+ public static Operation mapSequenceAction( Operation[] op )
+ {
+ return new MapSequenceAction( op ) ;
+ }
+
+ private static class ConvertIntegerToShort extends OperationBase
+ {
+ public Object operate( Object value )
+ {
+ Integer val = (Integer)value ;
+ return new Short( val.shortValue() ) ;
+ }
+
+ public String toString() {
+ return "ConvertIntegerToShort" ;
+ }
+ }
+
+ private static Operation convertIntegerToShortImpl = new ConvertIntegerToShort() ;
+
+ public static Operation convertIntegerToShort()
+ {
+ return convertIntegerToShortImpl ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserData.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserData.java
new file mode 100644
index 0000000..76027f3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserData.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.orb ;
+
+import java.util.Properties ;
+
+public interface ParserData {
+ public String getPropertyName() ;
+
+ public Operation getOperation() ;
+
+ public String getFieldName() ;
+
+ public Object getDefaultValue() ;
+
+ public Object getTestValue() ;
+
+ public void addToParser( PropertyParser parser ) ;
+
+ public void addToProperties( Properties props ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserDataFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserDataFactory.java
new file mode 100644
index 0000000..6551535
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserDataFactory.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.orb ;
+
+import com.sun.corba.se.impl.orb.NormalParserData ;
+import com.sun.corba.se.impl.orb.PrefixParserData ;
+
+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, StringPair[] testData, Class componentType )
+ {
+ return new PrefixParserData( propertyName, operation, fieldName,
+ defaultValue, testValue, testData, componentType ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserImplBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserImplBase.java
new file mode 100644
index 0000000..50e5760
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserImplBase.java
@@ -0,0 +1,136 @@
+/*
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.orb ;
+
+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.lang.reflect.Field ;
+
+import org.omg.CORBA.INTERNAL ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+import com.sun.corba.se.impl.orbutil.ObjectUtility ;
+
+// XXX This could probably be further extended by using more reflection and
+// a dynamic proxy that satisfies the interfaces that are inherited by the
+// more derived class. Do we want to go that far?
+public abstract class ParserImplBase {
+ private ORBUtilSystemException wrapper ;
+
+ protected abstract PropertyParser makeParser() ;
+
+ /** Override this method if there is some needed initialization
+ * that takes place after argument parsing. It is always called
+ * at the end of setFields.
+ */
+ protected void complete()
+ {
+ }
+
+ public ParserImplBase()
+ {
+ // Do nothing in this case: no parsing takes place
+ wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.ORB_LIFECYCLE ) ;
+ }
+
+ public void init( DataCollector coll )
+ {
+ PropertyParser parser = makeParser() ;
+ coll.setParser( parser ) ;
+ Properties props = coll.getProperties() ;
+ Map map = parser.parse( props ) ;
+ setFields( map ) ;
+ }
+
+ private Field getAnyField( String name )
+ {
+ Field result = null ;
+
+ try {
+ Class cls = this.getClass() ;
+ result = cls.getDeclaredField( name ) ;
+ while (result == null) {
+ cls = cls.getSuperclass() ;
+ if (cls == null)
+ break ;
+
+ result = cls.getDeclaredField( name ) ;
+ }
+ } catch (Exception exc) {
+ throw wrapper.fieldNotFound( exc, name ) ;
+ }
+
+ if (result == null)
+ throw wrapper.fieldNotFound( name ) ;
+
+ return result ;
+ }
+
+ 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() ;
+
+ 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 ;
+ }
+ }
+ ) ;
+ } catch (PrivilegedActionException exc) {
+ // Since exc wraps the actual exception, use exc.getCause()
+ // instead of exc.
+ throw wrapper.errorSettingField( exc.getCause(), name,
+ value.toString() ) ;
+ }
+ }
+
+ // Make sure that any extra initialization takes place after all the
+ // fields are set from the map.
+ complete() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserImplTableBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserImplTableBase.java
new file mode 100644
index 0000000..fafed51
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/ParserImplTableBase.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.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.lang.reflect.Field ;
+
+import org.omg.CORBA.INTERNAL ;
+
+// XXX This could probably be further extended by using more reflection and
+// a dynamic proxy that satisfies the interfaces that are inherited by the
+// more derived class. Do we want to go that far?
+public abstract class ParserImplTableBase extends ParserImplBase {
+ private final ParserData[] entries ;
+
+ public ParserImplTableBase( ParserData[] entries )
+ {
+ this.entries = entries ;
+ setDefaultValues() ;
+ }
+
+ protected PropertyParser makeParser()
+ {
+ PropertyParser result = new PropertyParser() ;
+ for (int ctr=0; ctr<entries.length; ctr++ ) {
+ ParserData entry = entries[ctr] ;
+ entry.addToParser( result ) ;
+ }
+
+ return result ;
+ }
+
+ private static final class MapEntry implements Map.Entry {
+ private Object key ;
+ private Object value ;
+
+ public MapEntry( Object key )
+ {
+ this.key = key ;
+ }
+
+ public Object getKey()
+ {
+ return key ;
+ }
+
+ public Object getValue()
+ {
+ return value ;
+ }
+
+ public Object setValue( Object value )
+ {
+ Object result = this.value ;
+ this.value = value ;
+ return result ;
+ }
+
+ public boolean equals( Object obj )
+ {
+ if (!(obj instanceof MapEntry))
+ return false ;
+
+ MapEntry other = (MapEntry)obj ;
+
+ return (key.equals( other.key )) &&
+ (value.equals( other.value )) ;
+ }
+
+ public int hashCode()
+ {
+ return key.hashCode() ^ value.hashCode() ;
+ }
+ }
+
+ // Construct a map that maps field names to test or default values,
+ // then use setFields from the parent class. A map is constructed
+ // by implementing AbstractMap, which requires implementing the
+ // entrySet() method, which requires implementing a set of
+ // map entries, which requires implementing an iterator,
+ // which iterates over the ParserData, extracting the
+ // correct (key, value) pairs (nested typed lambda expression).
+ private static class FieldMap extends AbstractMap {
+ private final ParserData[] entries ;
+ private final boolean useDefault ;
+
+ public FieldMap( ParserData[] entries, boolean useDefault )
+ {
+ this.entries = entries ;
+ this.useDefault = useDefault ;
+ }
+
+ public Set entrySet()
+ {
+ return new AbstractSet()
+ {
+ public Iterator iterator()
+ {
+ return new Iterator() {
+ // index of next element to return
+ int ctr = 0 ;
+
+ public boolean hasNext()
+ {
+ return ctr < entries.length ;
+ }
+
+ public Object next()
+ {
+ ParserData pd = entries[ctr++] ;
+ Map.Entry result = new MapEntry( pd.getFieldName() ) ;
+ if (useDefault)
+ result.setValue( pd.getDefaultValue() ) ;
+ else
+ result.setValue( pd.getTestValue() ) ;
+ return result ;
+ }
+
+ public void remove()
+ {
+ throw new UnsupportedOperationException() ;
+ }
+ } ;
+ }
+
+ public int size()
+ {
+ return entries.length ;
+ }
+ } ;
+ }
+ } ;
+
+ protected void setDefaultValues()
+ {
+ Map map = new FieldMap( entries, true ) ;
+ setFields( map ) ;
+ }
+
+ public void setTestValues()
+ {
+ Map map = new FieldMap( entries, false ) ;
+ setFields( map ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/PropertyParser.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/PropertyParser.java
new file mode 100644
index 0000000..0550800
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/PropertyParser.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.orb ;
+
+import java.util.List ;
+import java.util.LinkedList ;
+import java.util.Map ;
+import java.util.HashMap ;
+import java.util.Iterator ;
+import java.util.Properties ;
+
+import com.sun.corba.se.impl.orb.ParserAction ;
+import com.sun.corba.se.impl.orb.ParserActionFactory ;
+
+public class PropertyParser {
+ private List actions ;
+
+ 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 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.
+ */
+ public Map parse( Properties props )
+ {
+ Map map = new HashMap() ;
+ Iterator iter = actions.iterator() ;
+ while (iter.hasNext()) {
+ ParserAction act = (ParserAction)(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)
+ map.put( act.getFieldName(), result ) ;
+ }
+
+ return map ;
+ }
+
+ public Iterator iterator()
+ {
+ return actions.iterator() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orb/StringPair.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/StringPair.java
new file mode 100644
index 0000000..194fe15
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orb/StringPair.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.corba.se.spi.orb ;
+
+public class StringPair {
+ private String first ;
+ private String second ;
+
+ public boolean equals( Object obj )
+ {
+ if (this == obj)
+ return true ;
+
+ if (!(obj instanceof StringPair))
+ return false ;
+
+ StringPair other = (StringPair)obj ;
+
+ return (first.equals( other.first ) &&
+ second.equals( other.second )) ;
+ }
+
+ public int hashCode()
+ {
+ return first.hashCode() ^ second.hashCode() ;
+ }
+
+ public StringPair( String first, String second )
+ {
+ this.first = first ;
+ this.second = second ;
+ }
+
+ public String getFirst()
+ {
+ return first ;
+ }
+
+ public String getSecond()
+ {
+ return second ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/closure/Closure.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/closure/Closure.java
new file mode 100644
index 0000000..b01263c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/closure/Closure.java
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.closure ;
+
+public interface Closure {
+ public Object evaluate() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/closure/ClosureFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/closure/ClosureFactory.java
new file mode 100644
index 0000000..00301f5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/closure/ClosureFactory.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.closure ;
+
+import com.sun.corba.se.impl.orbutil.closure.Constant ;
+import com.sun.corba.se.impl.orbutil.closure.Future ;
+
+public abstract class ClosureFactory {
+ private ClosureFactory() {}
+
+ public static Closure makeConstant( Object value )
+ {
+ return new Constant( value ) ;
+ }
+
+ public static Closure makeFuture( Closure value )
+ {
+ return new Future( value ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Action.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Action.java
new file mode 100644
index 0000000..296602e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Action.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm;
+
+/**
+ * Description goes here
+ *
+ * @author Ken Cavanaugh
+ */
+public interface Action
+{
+ /** Called by the state engine to perform an action
+ * before a state transition takes place. The FSM is
+ * passed so that the Action may set the next state in
+ * cases when that is required. FSM and Input together
+ * allow actions to be written that depend on the state and
+ * input, but this should generally be avoided, as the
+ * reason for a state machine in the first place is to cleanly
+ * separate the actions and control flow. Note that an
+ * action should complete in a timely manner. If the state machine
+ * is used for concurrency control with multiple threads, the
+ * action must not allow multiple threads to run simultaneously
+ * in the state machine, as the state could be corrupted.
+ * Any exception thrown by the Action for the transition
+ * will be propagated to doIt.
+ * @param fsm the state machine causing this action.
+ * @param in the input that caused the transition.
+ */
+ public void doIt( FSM fsm, Input in ) ;
+}
+
+// end of Action.java
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/ActionBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/ActionBase.java
new file mode 100644
index 0000000..5b590eb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/ActionBase.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm ;
+
+import com.sun.corba.se.impl.orbutil.fsm.NameBase ;
+
+public abstract class ActionBase extends NameBase implements Action {
+ public ActionBase( String name ) { super( name ) ; }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSM.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSM.java
new file mode 100644
index 0000000..4ca832f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSM.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm ;
+
+/**
+ * An FSM is used to represent an instance of a finite state machine
+ * which has a transition function represented by an instance of
+ * StateEngine. An instance of an FSM may be created either by calling
+ * StateEngine.makeFSM( startState ) on a state engine, or by extending FSMImpl and
+ * using a constructor. Using FSMImpl as a base class is convenient if
+ * additional state is associated with the FSM beyond that encoded
+ * by the current state. This is especially convenient if an action
+ * needs some additional information. For example, counters are best
+ * handled by special actions rather than encoding a bounded counter
+ * in a state machine. It is also possible to create a class that
+ * implements the FSM interface by delegating to an FSM instance
+ * created by StateEngine.makeFSM.
+ *
+ * @author Ken Cavanaugh
+ */
+public interface FSM
+{
+ /** Get the current state of this FSM.
+ */
+ public State getState() ;
+
+ /** Perform the action and transition to the next state based
+ * on the current state of the FSM and the input.
+ */
+ public void doIt( Input in ) ;
+}
+
+// end of FSM.java
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSMImpl.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSMImpl.java
new file mode 100644
index 0000000..1674eba
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSMImpl.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm ;
+
+import java.util.Set ;
+import java.util.HashSet ;
+
+import com.sun.corba.se.spi.orbutil.fsm.Input ;
+import com.sun.corba.se.spi.orbutil.fsm.StateEngine ;
+import com.sun.corba.se.impl.orbutil.fsm.StateEngineImpl ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+import com.sun.corba.se.spi.orbutil.fsm.FSM ;
+
+/**
+ * This is the main class that represents an instance of a state machine
+ * using a state engine. It may be used as a base class, in which case
+ * the guards and actions have access to the derived class.
+ *
+ * @author Ken Cavanaugh
+ */
+public class FSMImpl implements FSM
+{
+ private boolean debug ;
+ private State state ;
+ private StateEngineImpl stateEngine ;
+
+ /** Create an instance of an FSM using the StateEngine
+ * in a particular start state.
+ */
+ public FSMImpl( StateEngine se, State startState )
+ {
+ this( se, startState, false ) ;
+ }
+
+ public FSMImpl( StateEngine se, State startState, boolean debug )
+ {
+ state = startState ;
+ stateEngine = (StateEngineImpl)se ;
+ this.debug = debug ;
+ }
+
+ /** Return the current state.
+ */
+ public State getState()
+ {
+ return state ;
+ }
+
+ /** Perform the transition for the given input in the current state. This proceeds as follows:
+ * <p>Let S be the current state of the FSM.
+ * If there are guarded actions for S with input in, evaluate their guards successively until
+ * all have been evaluted, or one returns a non-DISABLED Result.
+ * <ol>
+ * <li>If a DEFERED result is returned, retry the input
+ * <li>If a ENABLED result is returned, the action for the guarded action
+ * is the current action
+ * <li>Otherwise there is no enabled action. If S has a default action and next state, use them; otherwise
+ * use the state engine default action (the next state is always the current state).
+ * </ol>
+ * After the action is available, the transition proceeds as follows:
+ * <ol>
+ * <li>If the next state is not the current state, execute the current state postAction method.
+ * <li>Execute the action.
+ * <li>If the next state is not the current state, execute the next state preAction method.
+ * <li>Set the current state to the next state.
+ * </ol>
+ */
+ public void doIt( Input in )
+ {
+ stateEngine.doIt( this, in, debug ) ;
+ }
+
+ // Methods for use only by StateEngineImpl
+
+ public void internalSetState( State nextState )
+ {
+ if (debug) {
+ ORBUtility.dprint( this, "Calling internalSetState with nextState = " +
+ nextState ) ;
+ }
+
+ state = nextState ;
+
+ if (debug) {
+ ORBUtility.dprint( this, "Exiting internalSetState with state = " +
+ state ) ;
+ }
+ }
+}
+
+// end of FSMImpl.java
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSMTest.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSMTest.java
new file mode 100644
index 0000000..1f3f36d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/FSMTest.java
@@ -0,0 +1,227 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm ;
+
+import com.sun.corba.se.spi.orbutil.fsm.Input ;
+import com.sun.corba.se.spi.orbutil.fsm.Action ;
+import com.sun.corba.se.spi.orbutil.fsm.Guard ;
+import com.sun.corba.se.spi.orbutil.fsm.StateEngine ;
+import com.sun.corba.se.spi.orbutil.fsm.StateImpl ;
+import com.sun.corba.se.spi.orbutil.fsm.StateEngineFactory ;
+import com.sun.corba.se.spi.orbutil.fsm.FSM ;
+
+class TestInput {
+ TestInput( Input value, String msg )
+ {
+ this.value = value ;
+ this.msg = msg ;
+ }
+
+ public String toString()
+ {
+ return "Input " + value + " : " + msg ;
+ }
+
+ public Input getInput()
+ {
+ return value ;
+ }
+
+ Input value ;
+ String msg ;
+}
+
+class TestAction1 implements Action
+{
+ public void doIt( FSM fsm, Input in )
+ {
+ System.out.println( "TestAction1:" ) ;
+ System.out.println( "\tlabel = " + label ) ;
+ System.out.println( "\toldState = " + oldState ) ;
+ System.out.println( "\tnewState = " + newState ) ;
+ if (label != in)
+ throw new Error( "Unexcepted Input " + in ) ;
+ if (oldState != fsm.getState())
+ throw new Error( "Unexpected old State " + fsm.getState() ) ;
+ }
+
+ public TestAction1( State oldState, Input label, State newState )
+ {
+ this.oldState = oldState ;
+ this.newState = newState ;
+ this.label = label ;
+ }
+
+ private State oldState ;
+ private Input label ;
+ private State newState ;
+}
+
+class TestAction2 implements Action
+{
+ private State oldState ;
+ private State newState ;
+
+ public void doIt( FSM fsm, Input in )
+ {
+ System.out.println( "TestAction2:" ) ;
+ System.out.println( "\toldState = " + oldState ) ;
+ System.out.println( "\tnewState = " + newState ) ;
+ System.out.println( "\tinput = " + in ) ;
+ if (oldState != fsm.getState())
+ throw new Error( "Unexpected old State " + fsm.getState() ) ;
+ }
+
+ public TestAction2( State oldState, State newState )
+ {
+ this.oldState = oldState ;
+ this.newState = newState ;
+ }
+}
+
+class TestAction3 implements Action {
+ private State oldState ;
+ private Input label ;
+
+ public void doIt( FSM fsm, Input in )
+ {
+ System.out.println( "TestAction1:" ) ;
+ System.out.println( "\tlabel = " + label ) ;
+ System.out.println( "\toldState = " + oldState ) ;
+ if (label != in)
+ throw new Error( "Unexcepted Input " + in ) ;
+ }
+
+ public TestAction3( State oldState, Input label )
+ {
+ this.oldState = oldState ;
+ this.label = label ;
+ }
+}
+
+class NegateGuard implements Guard {
+ Guard guard ;
+
+ public NegateGuard( Guard guard )
+ {
+ this.guard = guard ;
+ }
+
+ public Guard.Result evaluate( FSM fsm, Input in )
+ {
+ return guard.evaluate( fsm, in ).complement() ;
+ }
+}
+
+class MyFSM extends FSMImpl {
+ public MyFSM( StateEngine se )
+ {
+ super( se, FSMTest.STATE1 ) ;
+ }
+
+ public int counter = 0 ;
+}
+
+public class FSMTest {
+ public static final State STATE1 = new StateImpl( "1" ) ;
+ public static final State STATE2 = new StateImpl( "2" ) ;
+ public static final State STATE3 = new StateImpl( "3" ) ;
+ public static final State STATE4 = new StateImpl( "4" ) ;
+
+ public static final Input INPUT1 = new InputImpl( "1" ) ;
+ public static final Input INPUT2 = new InputImpl( "2" ) ;
+ public static final Input INPUT3 = new InputImpl( "3" ) ;
+ public static final Input INPUT4 = new InputImpl( "4" ) ;
+
+ private Guard counterGuard = new Guard() {
+ public Guard.Result evaluate( FSM fsm, Input in )
+ {
+ MyFSM mfsm = (MyFSM) fsm ;
+ return Guard.Result.convert( mfsm.counter < 3 ) ;
+ }
+ } ;
+
+ private static void add1( StateEngine se, State oldState, Input in, State newState )
+ {
+ se.add( oldState, in, new TestAction1( oldState, in, newState ), newState ) ;
+ }
+
+ private static void add2( StateEngine se, State oldState, State newState )
+ {
+ se.setDefault( oldState, new TestAction2( oldState, newState ), newState ) ;
+ }
+
+ public static void main( String[] args )
+ {
+ TestAction3 ta3 = new TestAction3( STATE3, INPUT1 ) ;
+
+ StateEngine se = StateEngineFactory.create() ;
+ add1( se, STATE1, INPUT1, STATE1 ) ;
+ add2( se, STATE1, STATE2 ) ;
+
+ add1( se, STATE2, INPUT1, STATE2 ) ;
+ add1( se, STATE2, INPUT2, STATE2 ) ;
+ add1( se, STATE2, INPUT3, STATE1 ) ;
+ add1( se, STATE2, INPUT4, STATE3 ) ;
+
+ se.add( STATE3, INPUT1, ta3, STATE3 ) ;
+ se.add( STATE3, INPUT1, ta3, STATE4 ) ;
+ add1( se, STATE3, INPUT2, STATE1 ) ;
+ add1( se, STATE3, INPUT3, STATE2 ) ;
+ add1( se, STATE3, INPUT4, STATE2 ) ;
+
+ MyFSM fsm = new MyFSM( se ) ;
+ TestInput in11 = new TestInput( INPUT1, "1.1" ) ;
+ TestInput in12 = new TestInput( INPUT1, "1.2" ) ;
+ TestInput in21 = new TestInput( INPUT2, "2.1" ) ;
+ TestInput in22 = new TestInput( INPUT2, "2.2" ) ;
+ TestInput in31 = new TestInput( INPUT3, "3.1" ) ;
+ TestInput in32 = new TestInput( INPUT3, "3.2" ) ;
+ TestInput in33 = new TestInput( INPUT3, "3.3" ) ;
+ TestInput in41 = new TestInput( INPUT4, "4.1" ) ;
+
+ fsm.doIt( in11.getInput() ) ;
+ fsm.doIt( in12.getInput() ) ;
+ fsm.doIt( in41.getInput() ) ;
+ fsm.doIt( in11.getInput() ) ;
+ fsm.doIt( in22.getInput() ) ;
+ fsm.doIt( in31.getInput() ) ;
+ fsm.doIt( in33.getInput() ) ;
+ fsm.doIt( in41.getInput() ) ;
+ fsm.doIt( in41.getInput() ) ;
+ fsm.doIt( in41.getInput() ) ;
+ fsm.doIt( in22.getInput() ) ;
+ fsm.doIt( in32.getInput() ) ;
+ fsm.doIt( in41.getInput() ) ;
+ fsm.doIt( in11.getInput() ) ;
+ fsm.doIt( in12.getInput() ) ;
+ fsm.doIt( in11.getInput() ) ;
+ fsm.doIt( in11.getInput() ) ;
+ fsm.doIt( in11.getInput() ) ;
+ fsm.doIt( in11.getInput() ) ;
+ fsm.doIt( in11.getInput() ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Guard.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Guard.java
new file mode 100644
index 0000000..2fd467c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Guard.java
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm;
+
+/**
+ *
+ * @author Ken Cavanaugh
+ */
+public interface Guard
+{
+ public static final class Complement extends GuardBase {
+ private Guard guard ;
+
+ public Complement( GuardBase guard )
+ {
+ super( "not(" + guard.getName() + ")" ) ;
+ this.guard = guard ;
+ }
+
+ public Result evaluate( FSM fsm, Input in )
+ {
+ return guard.evaluate( fsm, in ).complement() ;
+ }
+ }
+
+ public static final class Result {
+ private String name ;
+
+ private Result( String name )
+ {
+ this.name = name ;
+ }
+
+ public static Result convert( boolean res )
+ {
+ return res ? ENABLED : DISABLED ;
+ }
+
+ public Result complement()
+ {
+ if (this == ENABLED)
+ return DISABLED ;
+ else if (this == DISABLED)
+ return ENABLED ;
+ else
+ return DEFERED ;
+ }
+
+ public String toString()
+ {
+ return "Guard.Result[" + name + "]" ;
+ }
+
+ public static final Result ENABLED = new Result( "ENABLED" ) ;
+ public static final Result DISABLED = new Result( "DISABLED" ) ;
+ public static final Result DEFERED = new Result( "DEFERED" ) ;
+ }
+
+ /** Called by the state engine to determine whether a
+ * transition is enabled, defered, or disabled.
+ * The result is interpreted as follows:
+ * <ul>
+ * <li>ENABLED if the transition is ready to proceed
+ * <li>DISABLED if the transition is not ready to proceed
+ * <li>DEFERED if the action associated with the transition
+ * is to be deferred. This means that the input will not be
+ * acted upon, but rather it will be saved for later execution.
+ * Typically this is implemented using a CondVar wait, and the
+ * blocked thread represents the defered input. The defered
+ * input is retried when the thread runs again.
+ * </ul>
+ *
+ * @param fsm is the state machine causing this action.
+ * @param in is the input that caused the transition.
+ */
+ public Result evaluate( FSM fsm, Input in ) ;
+}
+
+// end of Action.java
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/GuardBase.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/GuardBase.java
new file mode 100644
index 0000000..b84abb9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/GuardBase.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm ;
+
+import com.sun.corba.se.impl.orbutil.fsm.NameBase ;
+
+public abstract class GuardBase extends NameBase implements Guard {
+ public GuardBase( String name ) { super( name ) ; }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Input.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Input.java
new file mode 100644
index 0000000..9f39958
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/Input.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm;
+
+/**
+ * This interface must be implemented by any class that is used as
+ * an input to a FSM. The FSM only needs the identity of this
+ * object, so all that is really needs is the default equals implementation.
+ * The toString() method should also be overridden to give a concise
+ * description or name of the input.
+ *
+ * @author Ken Cavanaugh
+ */
+public interface Input
+{
+}
+
+// end of Input.java
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/InputImpl.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/InputImpl.java
new file mode 100644
index 0000000..28bbe86
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/InputImpl.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm ;
+
+import com.sun.corba.se.impl.orbutil.fsm.NameBase ;
+
+public class InputImpl extends NameBase implements Input {
+ public InputImpl( String name ) { super( name ) ; }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/State.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/State.java
new file mode 100644
index 0000000..53ea514
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/State.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm ;
+
+/**
+ * This interface must be implemented by any class that is used as
+ * a state in a FSM. The FSM only needs the identity of this
+ * object, so all that is really needs is the default equals implementation.
+ * The toString() method should also be overridden to give a concise
+ * description or name of the state. The StateImpl class handles this.
+ * <P>
+ * Pre- and post- actions are taken only on completed transitions between
+ * different states. Assume that the FSM is in state A, and the FSM will
+ * transition to state B under input I with action X. If A != B and X completes
+ * successfully, then after X completes execution, A.postAction is executed,
+ * followed by B.preAction.
+ *
+ * @author Ken Cavanaugh
+ */
+public interface State
+{
+ /** Method that defines action that occurs whenever this state is entered.
+ * Any exceptions thrown by this method are ignored.
+ */
+ void preAction( FSM fsm ) ;
+
+ /** Method that defines action that occurs whenever this state is exited.
+ * Any exceptions thrown by this method are ignored.
+ */
+ void postAction( FSM fsm ) ;
+}
+
+// end of State.java
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateEngine.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateEngine.java
new file mode 100644
index 0000000..e9d8624
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateEngine.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm;
+
+/**
+ * A StateEngine defines the state transition function for a
+ * finite state machine (FSM). A FSM always has a current state.
+ * In response to an Input, the FSM performs an Action and
+ * makes a transition to a new state. Note that any object can
+ * be used as an input if it supports the Input interface.
+ * For example, a protocol message may be an input. The FSM
+ * uses only the result of calling getLabel on the Input to
+ * drive the transition.
+ * <p>
+ * The function can be non-deterministic
+ * in that the same input may cause transitions to different new
+ * states from the current state. In this case, the action that
+ * is executed for the transition must set the correct new state.
+ *
+ * @author Ken Cavanaugh
+ */
+public interface StateEngine
+{
+ /** Add a new transition (old,in,guard,act,new) to the state engine.
+ * Multiple calls to add with the same old and in are permitted,
+ * in which case only a transition in which the guard evaluates to
+ * true will be taken. If no such transition is enabled, a default
+ * will be taken. If more than one transition is enabled, one will
+ * be chosen arbitrarily.
+ * This method can only be called before done(). An attempt to
+ * call it after done() results in an IllegalStateException.
+ */
+ public StateEngine add( State oldState, Input input, Guard guard,
+ Action action, State newState ) throws IllegalStateException ;
+
+ /** Add a transition with a guard that always evaluates to true.
+ */
+ public StateEngine add( State oldState, Input input,
+ Action action, State newState ) throws IllegalStateException ;
+
+ /** Set the default transition and action for a state.
+ * This transition will be used if no more specific transition was
+ * defined for the actual input. Repeated calls to this method
+ * simply change the default.
+ * This method can only be called before done(). An attempt to
+ * call it after done() results in an IllegalStateException.
+ */
+ public StateEngine setDefault( State oldState, Action action, State newState )
+ throws IllegalStateException ;
+
+ /** Equivalent to setDefault( oldState, act, newState ) where act is an
+ * action that does nothing.
+ */
+ public StateEngine setDefault( State oldState, State newState )
+ throws IllegalStateException ;
+
+ /** Euaivalent to setDefault( oldState, oldState )
+ */
+ public StateEngine setDefault( State oldState )
+ throws IllegalStateException ;
+
+ /** Set the default action used in this state engine. This is the
+ * action that is called whenever there is no applicable transition.
+ * Normally this would simply flag an error. This method can only
+ * be called before done(). An attempt to
+ * call it after done() results in an IllegalStateException.
+ */
+ public void setDefaultAction( Action act ) throws IllegalStateException ;
+
+ /** Called after all transitions have been added to the state engine.
+ * This provides an opportunity for the implementation to optimize
+ * its representation before the state engine is used. This method
+ * may only be called once. An attempt to call it more than once
+ * results in an IllegalStateException.
+ */
+ public void done() throws IllegalStateException ;
+
+ /** Create an instance of a FSM that uses this state engine.
+ * The initial state of the FSM will be the stateState specified
+ * here. This method can only be called after done(). An attempt
+ * to call it before done results in an IllegalStateException.
+ */
+ public FSM makeFSM( State startState ) throws IllegalStateException ;
+}
+
+// end of StateEngine.java
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateEngineFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateEngineFactory.java
new file mode 100644
index 0000000..d2e8f2b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateEngineFactory.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm;
+
+import com.sun.corba.se.impl.orbutil.fsm.StateEngineImpl ;
+
+/**
+ * Factory for creating the standard state machine implementation.
+ *
+ * @author Ken Cavanaugh
+ */
+public class StateEngineFactory {
+ private StateEngineFactory() {}
+
+ public static StateEngine create()
+ {
+ return new StateEngineImpl() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateImpl.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateImpl.java
new file mode 100644
index 0000000..49df29a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/fsm/StateImpl.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.fsm ;
+
+import com.sun.corba.se.impl.orbutil.fsm.NameBase ;
+
+import java.util.Map ;
+import java.util.HashMap ;
+import java.util.Set ;
+import java.util.HashSet ;
+
+import com.sun.corba.se.impl.orbutil.fsm.GuardedAction ;
+import com.sun.corba.se.impl.orbutil.fsm.NameBase ;
+
+/** Base class for all states in a StateEngine. This must be used
+* as the base class for all states in transitions added to a StateEngine.
+*/
+public class StateImpl extends NameBase implements State {
+ private Action defaultAction ;
+ private State defaultNextState ;
+ private Map inputToGuardedActions ;
+
+ public StateImpl( String name )
+ {
+ super( name ) ;
+ defaultAction = null ;
+ inputToGuardedActions = new HashMap() ;
+ }
+
+ public void preAction( FSM fsm )
+ {
+ }
+
+ public void postAction( FSM fsm )
+ {
+ }
+
+ // Methods for use only by StateEngineImpl.
+
+ public State getDefaultNextState()
+ {
+ return defaultNextState ;
+ }
+
+ public void setDefaultNextState( State defaultNextState )
+ {
+ this.defaultNextState = defaultNextState ;
+ }
+
+ public Action getDefaultAction()
+ {
+ return defaultAction ;
+ }
+
+ public void setDefaultAction( Action defaultAction )
+ {
+ this.defaultAction = defaultAction ;
+ }
+
+ public void addGuardedAction( Input in, GuardedAction ga )
+ {
+ Set gas = (Set)inputToGuardedActions.get( in ) ;
+ if (gas == null) {
+ gas = new HashSet() ;
+ inputToGuardedActions.put( in, gas ) ;
+ }
+
+ gas.add( ga ) ;
+ }
+
+ public Set getGuardedActions( Input in )
+ {
+ return (Set)inputToGuardedActions.get( in ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandler.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandler.java
new file mode 100644
index 0000000..54b7aad
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandler.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.proxy ;
+
+import java.io.Serializable ;
+import java.lang.reflect.InvocationHandler ;
+
+public interface CompositeInvocationHandler extends InvocationHandler,
+ Serializable
+{
+ /** Add an invocation handler for all methods on interface interf.
+ */
+ void addInvocationHandler( Class interf, InvocationHandler handler ) ;
+
+ /** Set the default invocation handler to use if none of the
+ * invocation handlers added by calls to addInvocationHandler apply.
+ */
+ void setDefaultHandler( InvocationHandler handler ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java
new file mode 100644
index 0000000..577f07e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/CompositeInvocationHandlerImpl.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.proxy ;
+
+import java.io.Serializable ;
+
+import java.util.Map ;
+import java.util.LinkedHashMap ;
+
+import java.lang.reflect.Proxy ;
+import java.lang.reflect.Method ;
+import java.lang.reflect.InvocationHandler ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+import com.sun.corba.se.impl.presentation.rmi.DynamicAccessPermission;
+
+public class CompositeInvocationHandlerImpl implements
+ CompositeInvocationHandler
+{
+ private Map classToInvocationHandler = new LinkedHashMap() ;
+ private InvocationHandler defaultHandler = null ;
+
+ public void addInvocationHandler( Class interf,
+ InvocationHandler handler )
+ {
+ checkAccess();
+ classToInvocationHandler.put( interf, handler ) ;
+ }
+
+ public void setDefaultHandler( InvocationHandler handler )
+ {
+ checkAccess();
+ defaultHandler = handler ;
+ }
+
+ public Object invoke( Object proxy, Method method, Object[] args )
+ throws Throwable
+ {
+ // Note that the declaring class in method is the interface
+ // in which the method was defined, not the proxy class.
+ Class cls = method.getDeclaringClass() ;
+ InvocationHandler handler =
+ (InvocationHandler)classToInvocationHandler.get( cls ) ;
+
+ if (handler == null) {
+ if (defaultHandler != null)
+ handler = defaultHandler ;
+ else {
+ ORBUtilSystemException wrapper = ORBUtilSystemException.get(
+ CORBALogDomains.UTIL ) ;
+ throw wrapper.noInvocationHandler( "\"" + method.toString() +
+ "\"" ) ;
+ }
+ }
+
+ // handler should never be null here.
+
+ return handler.invoke( proxy, method, args ) ;
+ }
+
+ private static final DynamicAccessPermission perm = new DynamicAccessPermission("access");
+ private void checkAccess() {
+ final SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ sm.checkPermission(perm);
+}
+ }
+
+ private static final long serialVersionUID = 4571178305984833743L;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/DelegateInvocationHandlerImpl.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/DelegateInvocationHandlerImpl.java
new file mode 100644
index 0000000..981cf66
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/DelegateInvocationHandlerImpl.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2004, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.proxy ;
+
+import java.io.Serializable ;
+
+import java.util.Map ;
+import java.util.LinkedHashMap ;
+
+import java.lang.reflect.Proxy ;
+import java.lang.reflect.Method ;
+import java.lang.reflect.InvocationHandler ;
+import java.lang.reflect.InvocationTargetException ;
+import com.sun.corba.se.impl.presentation.rmi.DynamicAccessPermission ;
+
+public abstract class DelegateInvocationHandlerImpl
+{
+ private DelegateInvocationHandlerImpl() {}
+
+ public static InvocationHandler create( final Object delegate )
+ {
+ SecurityManager s = System.getSecurityManager();
+ if (s != null) {
+ s.checkPermission(new DynamicAccessPermission("access"));
+ }
+ return new InvocationHandler() {
+ public Object invoke( Object proxy, Method method, Object[] args )
+ throws Throwable
+ {
+ // This throws an IllegalArgument exception if the delegate
+ // is not assignable from method.getDeclaring class.
+ try {
+ return method.invoke( delegate, args ) ;
+ } catch (InvocationTargetException ite) {
+ // Propagate the underlying exception as the
+ // result of the invocation
+ throw ite.getCause() ;
+ }
+ }
+ } ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/InvocationHandlerFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/InvocationHandlerFactory.java
new file mode 100644
index 0000000..2016fd8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/InvocationHandlerFactory.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.proxy ;
+
+import java.lang.reflect.InvocationHandler ;
+
+public interface InvocationHandlerFactory
+{
+ /** Get an InvocationHandler.
+ */
+ InvocationHandler getInvocationHandler() ;
+
+ /** Get the interfaces that InvocationHandler instances
+ * produced by this InvocationHandlerFactory support.
+ */
+ Class[] getProxyInterfaces() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/LinkedInvocationHandler.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/LinkedInvocationHandler.java
new file mode 100644
index 0000000..a0e611a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/proxy/LinkedInvocationHandler.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.proxy ;
+
+import java.lang.reflect.InvocationHandler ;
+import java.lang.reflect.Proxy ;
+
+/** This interface is used for InvocationHandler types that are
+ * linked to their Proxy. This is useful when the InvocationHandler
+ * needs access to data keyed by identity on the Proxy.
+ */
+public interface LinkedInvocationHandler extends InvocationHandler
+{
+ void setProxy( Proxy proxy ) ;
+
+ Proxy getProxy() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/NoSuchThreadPoolException.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/NoSuchThreadPoolException.java
new file mode 100644
index 0000000..dd8609b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/NoSuchThreadPoolException.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.threadpool;
+
+public class NoSuchThreadPoolException extends Exception
+{
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/NoSuchWorkQueueException.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/NoSuchWorkQueueException.java
new file mode 100644
index 0000000..90f40e7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/NoSuchWorkQueueException.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.threadpool;
+
+public class NoSuchWorkQueueException extends Exception
+{
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPool.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPool.java
new file mode 100644
index 0000000..dd61ff2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPool.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.threadpool;
+
+import java.io.Closeable;
+
+/** This interface defines a thread pool execution service. The ORB uses this
+ * interface, which preceeds the JDK 5 ExecutorService. Note that the close
+ * method must be called in order to reclaim thread resources.
+ */
+public interface ThreadPool extends Closeable
+{
+
+ /**
+ * This method will return any instance of the WorkQueue. If the ThreadPool
+ * instance only services one WorkQueue then that WorkQueue instance will
+ * be returned. If there are more than one WorkQueues serviced by this
+ * ThreadPool, then this method would return a WorkQueue based on the
+ * implementation of the class that implements this interface. For PE 8.0 we
+ * would return a WorkQueue in a roundrobin fashion everytime this method
+ * is called. In the future we could allow pluggability of Policy objects for this.
+ */
+ public WorkQueue getAnyWorkQueue();
+
+ /**
+ * This method will return an instance of the of the WorkQueue given a queueId.
+ * This will be useful in situations where there are more than one WorkQueues
+ * managed by the ThreadPool and the user of the ThreadPool wants to always use
+ * the same WorkQueue for doing the Work.
+ * If the number of WorkQueues in the ThreadPool are 10, then queueIds will go
+ * from 0-9
+ *
+ * @throws NoSuchWorkQueueException thrown when queueId passed is invalid
+ */
+ public WorkQueue getWorkQueue(int queueId) throws NoSuchWorkQueueException;
+
+ /**
+ * This method will return the number of WorkQueues serviced by the threadpool.
+ */
+ public int numberOfWorkQueues();
+
+ /**
+ * This method will return the minimum number of threads maintained by the threadpool.
+ */
+ public int minimumNumberOfThreads();
+
+ /**
+ * This method will return the maximum number of threads in the threadpool at any
+ * point in time, for the life of the threadpool
+ */
+ public int maximumNumberOfThreads();
+
+ /**
+ * This method will return the time in milliseconds when idle threads in the threadpool are
+ * removed.
+ */
+ public long idleTimeoutForThreads();
+
+ /**
+ * This method will return the current number of threads in the threadpool. This method
+ * returns a value which is not synchronized.
+ */
+ public int currentNumberOfThreads();
+
+ /**
+ * This method will return the number of available threads in the threadpool which are
+ * waiting for work. This method returns a value which is not synchronized.
+ */
+ public int numberOfAvailableThreads();
+
+ /**
+ * This method will return the number of busy threads in the threadpool
+ * This method returns a value which is not synchronized.
+ */
+ public int numberOfBusyThreads();
+
+ /**
+ * This method returns the number of Work items processed by the threadpool
+ */
+ public long currentProcessedCount();
+
+ /**
+ * This method returns the average elapsed time taken to complete a Work
+ * item.
+ */
+ public long averageWorkCompletionTime();
+
+ /**
+ * This method will return the name of the threadpool.
+ */
+ public String getName();
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolChooser.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolChooser.java
new file mode 100644
index 0000000..ffd58e6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolChooser.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.threadpool;
+
+
+public interface ThreadPoolChooser
+{
+ /**
+ * This method is used to return an instance of ThreadPool based on the
+ * strategy/policy implemented in the ThreadPoolChooser from the set of
+ * ThreadPools allowed to be used by the ORB. Typically, the set of
+ * ThreadPools would be specified by passing the threadpool-ids
+ * configured in the ORB element of the domain.xml of the appserver.
+ */
+ public ThreadPool getThreadPool();
+
+ /**
+ * This method is used to return an instance of ThreadPool that is obtained
+ * by using the id argument passed to it. This method will be used in
+ * situations where the threadpool id is known to the caller e.g. by the
+ * connection object or looking at the high order bits of the request id
+ */
+ public ThreadPool getThreadPool(int id);
+
+ /**
+ * This method is a convenience method to see what threadpool-ids are being
+ * used by the ThreadPoolChooser
+ */
+ public String[] getThreadPoolIds();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolManager.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolManager.java
new file mode 100644
index 0000000..14875f6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/ThreadPoolManager.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2003, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.threadpool;
+
+import java.io.Closeable;
+
+public interface ThreadPoolManager extends Closeable
+{
+ /**
+ * This method will return an instance of the threadpool given a threadpoolId,
+ * that can be used by any component in the app. server.
+ *
+ * @throws NoSuchThreadPoolException thrown when invalid threadpoolId is passed
+ * as a parameter
+ */
+ public ThreadPool getThreadPool(String threadpoolId) throws NoSuchThreadPoolException;
+
+ /**
+ * This method will return an instance of the threadpool given a numeric threadpoolId.
+ * This method will be used by the ORB to support the functionality of
+ * dedicated threadpool for EJB beans
+ *
+ * @throws NoSuchThreadPoolException thrown when invalidnumericIdForThreadpool is passed
+ * as a parameter
+ */
+ public ThreadPool getThreadPool(int numericIdForThreadpool) throws NoSuchThreadPoolException;
+
+ /**
+ * This method is used to return the numeric id of the threadpool, given a String
+ * threadpoolId. This is used by the POA interceptors to add the numeric threadpool
+ * Id, as a tagged component in the IOR. This is used to provide the functionality of
+ * dedicated threadpool for EJB beans
+ */
+ public int getThreadPoolNumericId(String threadpoolId);
+
+ /**
+ * Return a String Id for a numericId of a threadpool managed by the threadpool
+ * manager
+ */
+ public String getThreadPoolStringId(int numericIdForThreadpool);
+
+ /**
+ * Returns the first instance of ThreadPool in the ThreadPoolManager
+ */
+ public ThreadPool getDefaultThreadPool();
+
+ /**
+ * Return an instance of ThreadPoolChooser based on the componentId that was
+ * passed as argument
+ */
+ public ThreadPoolChooser getThreadPoolChooser(String componentId);
+
+ /**
+ * Return an instance of ThreadPoolChooser based on the componentIndex that was
+ * passed as argument. This is added for improved performance so that the caller
+ * does not have to pay the cost of computing hashcode for the componentId
+ */
+ public ThreadPoolChooser getThreadPoolChooser(int componentIndex);
+
+ /**
+ * Sets a ThreadPoolChooser for a particular componentId in the ThreadPoolManager. This
+ * would enable any component to add a ThreadPoolChooser for their specific use
+ */
+ public void setThreadPoolChooser(String componentId, ThreadPoolChooser aThreadPoolChooser);
+
+ /**
+ * Gets the numeric index associated with the componentId specified for a
+ * ThreadPoolChooser. This method would help the component call the more
+ * efficient implementation i.e. getThreadPoolChooser(int componentIndex)
+ */
+ public int getThreadPoolChooserNumericId(String componentId);
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/Work.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/Work.java
new file mode 100644
index 0000000..75f76e3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/Work.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.threadpool;
+
+public interface Work
+{
+
+ /**
+ * This method denotes the actual work that is done by the work item.
+ */
+ public void doWork();
+
+ /**
+ * This methods sets the time in millis in the work item, when this
+ * work item was enqueued in the work queue.
+ */
+ public void setEnqueueTime(long timeInMillis);
+
+ /**
+ * This methods gets the time in millis in the work item, when this
+ * work item was enqueued in the work queue.
+ */
+ public long getEnqueueTime();
+
+ /**
+ * This method will return the name of the work item.
+ */
+ public String getName();
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/WorkQueue.java b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/WorkQueue.java
new file mode 100644
index 0000000..d6057cc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/orbutil/threadpool/WorkQueue.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.orbutil.threadpool;
+
+public interface WorkQueue
+{
+
+ /**
+ * This method is used to add work to the WorkQueue
+ */
+ public void addWork(Work aWorkItem);
+
+ /**
+ * This method will return the name of the WorkQueue.
+ */
+ public String getName();
+
+ /**
+ * Returns the total number of Work items added to the Queue.
+ */
+ public long totalWorkItemsAdded();
+
+ /**
+ * Returns the total number of Work items in the Queue to be processed.
+ */
+ public int workItemsInQueue();
+
+ /**
+ * Returns the average time a work item is waiting in the queue before
+ * getting processed.
+ */
+ public long averageTimeInQueue();
+
+ /**
+ * Set the ThreadPool instance servicing this WorkQueue
+ */
+ public void setThreadPool(ThreadPool aThreadPool);
+
+ /**
+ * Get the ThreadPool instance servicing this WorkQueue
+ */
+ public ThreadPool getThreadPool();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/DynamicMethodMarshaller.java b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/DynamicMethodMarshaller.java
new file mode 100644
index 0000000..9055ab7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/DynamicMethodMarshaller.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.presentation.rmi ;
+
+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.rmi.RemoteException ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+/** Used to read and write arguments and results for a particular method.
+*
+*/
+public interface DynamicMethodMarshaller
+{
+ /** Returns the method used to create this DynamicMethodMarshaller.
+ */
+ Method getMethod() ;
+
+ /** Copy the arguments as needed for this particular method.
+ * Can be optimized so that as little copying as possible is
+ * performed.
+ */
+ Object[] copyArguments( Object[] args, ORB orb ) throws RemoteException ;
+
+ /** Read the arguments for this method from the InputStream.
+ * Returns null if there are no arguments.
+ */
+ Object[] readArguments( InputStream is ) ;
+
+ /** Write arguments for this method to the OutputStream.
+ * Does nothing if there are no arguments.
+ */
+ 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
+ * performed.
+ */
+ Object copyResult( Object result, ORB orb ) throws RemoteException ;
+
+ /** Read the result from the InputStream. Returns null
+ * if the result type is null.
+ */
+ Object readResult( InputStream is ) ;
+
+ /** Write the result to the OutputStream. Does nothing if
+ * the result type is null.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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
+ * this method.
+ */
+ Exception readException( ApplicationException ae ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/DynamicStub.java b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/DynamicStub.java
new file mode 100644
index 0000000..54c1bb8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/DynamicStub.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.presentation.rmi ;
+
+import java.rmi.RemoteException ;
+
+import org.omg.CORBA.portable.Delegate ;
+import org.omg.CORBA.portable.OutputStream ;
+
+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.
+ */
+public interface DynamicStub extends org.omg.CORBA.Object
+{
+ /** Similar to ObjectImpl._set_delegate
+ */
+ void setDelegate( Delegate delegate ) ;
+
+ /** Similar to ObjectImpl._get_delegate
+ */
+ Delegate getDelegate() ;
+
+ /** Similar to ObjectImpl._orb()
+ */
+ ORB getORB() ;
+
+ /** Similar to ObjectImpl._ids
+ */
+ 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
+ * org.omg.CORBA.portable.InputStream.
+ */
+ void connect( ORB orb ) throws RemoteException ;
+
+ boolean isLocal() ;
+
+ OutputStream request( String operation, boolean responseExpected ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/IDLNameTranslator.java b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/IDLNameTranslator.java
new file mode 100644
index 0000000..6ac876d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/IDLNameTranslator.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.presentation.rmi ;
+
+import java.lang.reflect.Method ;
+
+/** 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ String getIDLName( Method method ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/PresentationDefaults.java b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/PresentationDefaults.java
new file mode 100644
index 0000000..81ff426
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/PresentationDefaults.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.presentation.rmi;
+
+import com.sun.corba.se.spi.orb.ORB;
+
+import com.sun.corba.se.spi.presentation.rmi.PresentationManager;
+
+import com.sun.corba.se.impl.presentation.rmi.StubFactoryFactoryProxyImpl;
+import com.sun.corba.se.impl.presentation.rmi.StubFactoryFactoryStaticImpl;
+import com.sun.corba.se.impl.presentation.rmi.StubFactoryStaticImpl;
+
+public abstract class PresentationDefaults
+{
+ private static StubFactoryFactoryStaticImpl staticImpl = null ;
+
+ private PresentationDefaults() {}
+
+ public synchronized static PresentationManager.StubFactoryFactory
+ getStaticStubFactoryFactory()
+ {
+ if (staticImpl == null)
+ staticImpl = new StubFactoryFactoryStaticImpl( );
+
+ return staticImpl ;
+ }
+
+ public static PresentationManager.StubFactoryFactory
+ getProxyStubFactoryFactory()
+ {
+ return new StubFactoryFactoryProxyImpl();
+ }
+
+ public static PresentationManager.StubFactory makeStaticStubFactory(
+ Class stubClass )
+ {
+ return new StubFactoryStaticImpl( stubClass ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/PresentationManager.java b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/PresentationManager.java
new file mode 100644
index 0000000..adc670b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/PresentationManager.java
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.presentation.rmi ;
+
+import java.util.Map ;
+
+import java.lang.reflect.Method ;
+import java.lang.reflect.InvocationHandler ;
+
+import javax.rmi.CORBA.Tie ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orbutil.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
+ * com.sun.corba.se.spi.orb.ORB.getPresentationManager.
+ * <p>
+ * Note that
+ * the getClassData and getDynamicMethodMarshaller methods
+ * maintain caches to avoid redundant computation.
+ */
+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.
+ */
+ 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.
+ * @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 expectedClass The expected stub type (may be null or unused).
+ * @param classLoader The classLoader to use (may be null).
+ */
+ PresentationManager.StubFactory createStubFactory( String className,
+ boolean isIDLStub, String remoteCodeBase, Class expectedClass,
+ ClassLoader classLoader);
+
+ /** Return a Tie for the given class.
+ */
+ 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.
+ */
+ boolean createsDynamicStubs() ;
+ }
+
+ /** 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.
+ */
+ org.omg.CORBA.Object makeStub() ;
+
+ /** Return the repository ID information for all Stubs
+ * created by this stub factory.
+ */
+ String[] getTypeIds() ;
+ }
+
+ public interface ClassData
+ {
+ /** Get the class used to create this ClassData instance
+ */
+ Class getMyClass() ;
+
+ /** Get the IDLNameTranslator for the class used to create
+ * this ClassData instance.
+ */
+ IDLNameTranslator getIDLNameTranslator() ;
+
+ /** Return the array of repository IDs for all of the remote
+ * interfaces implemented by this class.
+ */
+ String[] getTypeIds() ;
+
+ /** Get the InvocationHandlerFactory that is used to create
+ * an InvocationHandler for dynamic stubs of the type of the
+ * ClassData.
+ */
+ 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.
+ */
+ 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.
+ */
+ ClassData getClassData( Class cls ) ;
+
+ /** Given a particular method, return a DynamicMethodMarshaller
+ * for that method. This is used for dynamic stubs and ties.
+ */
+ DynamicMethodMarshaller getDynamicMethodMarshaller( Method method ) ;
+
+ /** Return the registered StubFactoryFactory.
+ */
+ StubFactoryFactory getStubFactoryFactory( boolean isDynamic ) ;
+
+ /** Register the StubFactoryFactory. Note that
+ * a static StubFactoryFactory is always required for IDL. The
+ * dynamic stubFactoryFactory is optional.
+ */
+ void setStubFactoryFactory( boolean isDynamic, StubFactoryFactory sff ) ;
+
+ /** 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.
+ */
+ Tie getTie() ;
+
+ /** Returns the value of the com.sun.CORBA.ORBUseDynamicStub
+ * property.
+ */
+ boolean useDynamicStubs() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/StubAdapter.java b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/StubAdapter.java
new file mode 100644
index 0000000..879803f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/StubAdapter.java
@@ -0,0 +1,209 @@
+/*
+ * Copyright (c) 2003, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.presentation.rmi ;
+
+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.PortableServer.POA ;
+import org.omg.PortableServer.POAManager ;
+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.CORBA.ORB ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+// XXX Getting rid of this requires introducing an ObjectAdapterManager abstraction
+// as an interface into the OA framework.
+import com.sun.corba.se.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() {}
+
+ private static ORBUtilSystemException wrapper =
+ ORBUtilSystemException.get( CORBALogDomains.RPC_PRESENTATION ) ;
+
+ 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 void setDelegate( Object stub, Delegate delegate )
+ {
+ if (stub instanceof DynamicStub)
+ ((DynamicStub)stub).setDelegate( delegate ) ;
+ else if (stub instanceof ObjectImpl)
+ ((ObjectImpl)stub)._set_delegate( delegate ) ;
+ else
+ throw wrapper.setDelegateRequiresStub() ;
+ }
+
+ /** Use implicit activation to get an object reference for the servant.
+ */
+ 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 ) ;
+ } catch (ServantNotActive sna) {
+ throw wrapper.getDelegateServantNotActive( sna ) ;
+ } catch (WrongPolicy 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() ;
+ if (mgr instanceof POAManagerImpl) {
+ POAManagerImpl mgrImpl = (POAManagerImpl)mgr ;
+ mgrImpl.implicitActivation() ;
+ }
+
+ return ref ;
+ }
+
+ /** Given any Tie, return the corresponding object refernce, activating
+ * the Servant if necessary.
+ */
+ 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() ;
+ } else if (tie instanceof Servant) {
+ Servant servant = (Servant)tie ;
+ return activateServant( servant ) ;
+ } else {
+ throw wrapper.badActivateTieCall() ;
+ }
+ }
+
+
+ /** This also gets the delegate from a Servant by
+ * using Servant._this_object()
+ */
+ 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 ) ;
+ } else
+ throw wrapper.getDelegateRequiresStub() ;
+ }
+
+ public static ORB getORB( Object stub )
+ {
+ if (stub instanceof DynamicStub)
+ return ((DynamicStub)stub).getORB() ;
+ else if (stub instanceof ObjectImpl)
+ return (ORB)((ObjectImpl)stub)._orb() ;
+ else
+ throw wrapper.getOrbRequiresStub() ;
+ }
+
+ public static String[] getTypeIds( Object stub )
+ {
+ if (stub instanceof DynamicStub)
+ return ((DynamicStub)stub).getTypeIds() ;
+ else if (stub instanceof ObjectImpl)
+ return ((ObjectImpl)stub)._ids() ;
+ else
+ throw wrapper.getTypeIdsRequiresStub() ;
+ }
+
+ public static void connect( Object stub,
+ ORB orb ) throws java.rmi.RemoteException
+ {
+ if (stub instanceof DynamicStub)
+ ((DynamicStub)stub).connect(
+ (com.sun.corba.se.spi.orb.ORB)orb ) ;
+ else if (stub instanceof javax.rmi.CORBA.Stub)
+ ((javax.rmi.CORBA.Stub)stub).connect( orb ) ;
+ else if (stub instanceof ObjectImpl)
+ orb.connect( (org.omg.CORBA.Object)stub ) ;
+ else
+ throw wrapper.connectRequiresStub() ;
+ }
+
+ public static boolean isLocal( Object stub )
+ {
+ if (stub instanceof DynamicStub)
+ return ((DynamicStub)stub).isLocal() ;
+ else if (stub instanceof ObjectImpl)
+ return ((ObjectImpl)stub)._is_local() ;
+ else
+ throw wrapper.isLocalRequiresStub() ;
+ }
+
+ public static OutputStream request( Object stub,
+ String operation, boolean responseExpected )
+ {
+ if (stub instanceof DynamicStub)
+ return ((DynamicStub)stub).request( operation,
+ responseExpected ) ;
+ else if (stub instanceof ObjectImpl)
+ return ((ObjectImpl)stub)._request( operation,
+ responseExpected ) ;
+ else
+ throw wrapper.requestRequiresStub() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/StubWrapper.java b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/StubWrapper.java
new file mode 100644
index 0000000..1a683e7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/presentation/rmi/StubWrapper.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.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 StubWrapper( org.omg.CORBA.Object object )
+ {
+ if (!(StubAdapter.isStub(object)))
+ throw new IllegalStateException() ;
+
+ this.object = object ;
+ }
+
+ public void setDelegate( Delegate delegate )
+ {
+ StubAdapter.setDelegate( object, delegate ) ;
+ }
+
+ public Delegate getDelegate()
+ {
+ return StubAdapter.getDelegate( object ) ;
+ }
+
+ public ORB getORB()
+ {
+ return StubAdapter.getORB( object ) ;
+ }
+
+ public String[] getTypeIds()
+ {
+ return StubAdapter.getTypeIds( object ) ;
+ }
+
+ public void connect( ORB orb ) throws RemoteException
+ {
+ StubAdapter.connect( object, (com.sun.corba.se.spi.orb.ORB)orb ) ;
+ }
+
+ public boolean isLocal()
+ {
+ return StubAdapter.isLocal( object ) ;
+ }
+
+ 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_equivalent(org.omg.CORBA.Object other)
+ {
+ return object._is_equivalent( other ) ;
+ }
+
+ public boolean _non_existent()
+ {
+ return object._non_existent() ;
+ }
+
+ public int _hash(int maximum)
+ {
+ return object._hash( maximum ) ;
+ }
+
+ public org.omg.CORBA.Object _duplicate()
+ {
+ return object._duplicate() ;
+ }
+
+ public void _release()
+ {
+ object._release() ;
+ }
+
+ public org.omg.CORBA.Object _get_interface_def()
+ {
+ return object._get_interface_def() ;
+ }
+
+ 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, 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 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 ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/ClientDelegateFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/ClientDelegateFactory.java
new file mode 100644
index 0000000..97ae509
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/ClientDelegateFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol ;
+
+import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
+
+import com.sun.corba.se.spi.protocol.CorbaClientDelegate ;
+
+/** Interface used to create a ClientDelegate from a ContactInfoList.
+ */
+public interface ClientDelegateFactory {
+ CorbaClientDelegate create( CorbaContactInfoList list ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaClientDelegate.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaClientDelegate.java
new file mode 100644
index 0000000..5737844
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaClientDelegate.java
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol;
+
+public abstract class CorbaClientDelegate
+ extends org.omg.CORBA_2_3.portable.Delegate
+ implements com.sun.corba.se.pept.protocol.ClientDelegate
+{
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaMessageMediator.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaMessageMediator.java
new file mode 100644
index 0000000..b34de3b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaMessageMediator.java
@@ -0,0 +1,146 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol;
+
+import java.nio.ByteBuffer;
+
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.UnknownException;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+
+import com.sun.corba.se.pept.broker.Broker;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.ProtocolHandler;
+import com.sun.corba.se.pept.transport.Connection;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.ior.ObjectKey;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.protocol.CorbaProtocolHandler;
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateReplyOrReplyMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageBase;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.MessageHandler;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage_1_0;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage_1_0;
+
+/**
+ * @author Harold Carr
+ */
+public interface CorbaMessageMediator
+ extends
+ MessageMediator,
+ ResponseHandler
+{
+ 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 Integer getRequestIdInteger();
+ public boolean isOneWay();
+ public short getAddrDisposition();
+ public String getOperationName();
+ public ServiceContexts getRequestServiceContexts();
+ public ServiceContexts getReplyServiceContexts();
+ public Message getDispatchHeader();
+ public void setDispatchHeader(Message msg);
+ public ByteBuffer getDispatchBuffer();
+ public void setDispatchBuffer(ByteBuffer byteBuffer);
+ public int getThreadPoolToUse();
+ public byte getStreamFormatVersion(); // REVIST name ForRequest?
+ public byte getStreamFormatVersionForReply();
+
+ // REVISIT - not sure if the final fragment and DII stuff should
+ // go here.
+
+ public void sendCancelRequestIfFinalFragmentNotSent();
+
+ public void setDIIInfo(org.omg.CORBA.Request request);
+ public boolean isDIIRequest();
+ 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();
+
+ ////////////////////////////////////////////////////
+ //
+ // Server side
+ //
+
+ public ObjectKey getObjectKey();
+ public void setProtocolHandler(CorbaProtocolHandler protocolHandler);
+ public CorbaProtocolHandler getProtocolHandler();
+
+ ////////////////////////////////////////////////////
+ //
+ // ResponseHandler
+ //
+
+ public org.omg.CORBA.portable.OutputStream createReply();
+ public org.omg.CORBA.portable.OutputStream createExceptionReply();
+
+ ////////////////////////////////////////////////////
+ //
+ // from core.ServerRequest
+ //
+
+ public boolean executeReturnServantInResponseConstructor();
+
+ public void setExecuteReturnServantInResponseConstructor(boolean b);
+
+ public boolean executeRemoveThreadInfoInResponseConstructor();
+
+ public void setExecuteRemoveThreadInfoInResponseConstructor(boolean b);
+
+ public boolean executePIInResponseConstructor();
+
+ public void setExecutePIInResponseConstructor( boolean b );
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaProtocolHandler.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaProtocolHandler.java
new file mode 100644
index 0000000..bdb5b2e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaProtocolHandler.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol;
+
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.portable.UnknownException;
+
+import com.sun.corba.se.pept.protocol.ProtocolHandler;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import com.sun.corba.se.spi.servicecontext.ServiceContexts;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.LocateRequestMessage;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.RequestMessage;
+
+/**
+ * @author Harold Carr
+ */
+public interface CorbaProtocolHandler
+ extends ProtocolHandler
+{
+ public void handleRequest(RequestMessage header,
+ CorbaMessageMediator messageMediator);
+
+ public void handleRequest(LocateRequestMessage header,
+ CorbaMessageMediator messageMediator);
+
+ public CorbaMessageMediator createResponse(
+ CorbaMessageMediator messageMediator,
+ ServiceContexts svc);
+ public CorbaMessageMediator createUserExceptionResponse(
+ CorbaMessageMediator messageMediator,
+ ServiceContexts svc);
+ public CorbaMessageMediator createUnknownExceptionResponse(
+ CorbaMessageMediator messageMediator,
+ UnknownException ex);
+ public CorbaMessageMediator createSystemExceptionResponse(
+ CorbaMessageMediator messageMediator,
+ SystemException ex,
+ ServiceContexts svc);
+ public CorbaMessageMediator createLocationForward(
+ CorbaMessageMediator messageMediator,
+ IOR ior,
+ ServiceContexts svc);
+
+ public void handleThrowableDuringServerDispatch(
+ CorbaMessageMediator request,
+ Throwable exception,
+ CompletionStatus completionStatus);
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaServerRequestDispatcher.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaServerRequestDispatcher.java
new file mode 100644
index 0000000..7b6f1e7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/CorbaServerRequestDispatcher.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol;
+
+import com.sun.corba.se.pept.protocol.ServerRequestDispatcher;
+
+import com.sun.corba.se.spi.ior.ObjectKey;
+
+// XXX These must all be replaced by Sun private APIs.
+import com.sun.corba.se.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.
+ * Instances of this class are registered in the subcontract Registry.
+ */
+public interface CorbaServerRequestDispatcher
+ extends ServerRequestDispatcher
+{
+ /**
+ * Handle a locate request.
+ */
+ public IOR locate(ObjectKey key);
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/ForwardException.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/ForwardException.java
new file mode 100644
index 0000000..dccf119
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/ForwardException.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1996, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol;
+
+import org.omg.CORBA.BAD_PARAM ;
+
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+import com.sun.corba.se.spi.ior.IOR ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+/**
+ * Thrown to signal an OBJECT_FORWARD or LOCATION_FORWARD
+ */
+public class ForwardException extends RuntimeException {
+ private ORB orb ;
+ private org.omg.CORBA.Object obj;
+ private IOR ior ;
+
+ public ForwardException( ORB orb, IOR ior ) {
+ super();
+
+ this.orb = orb ;
+ this.obj = null ;
+ this.ior = ior ;
+ }
+
+ 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
+ // forwarding to locals in some restricted cases.
+ if (obj instanceof org.omg.CORBA.LocalObject)
+ throw new BAD_PARAM() ;
+
+ this.orb = orb ;
+ this.obj = obj ;
+ this.ior = null ;
+ }
+
+ public synchronized org.omg.CORBA.Object getObject()
+ {
+ if (obj == null) {
+ obj = ORBUtility.makeObjectReference( ior ) ;
+ }
+
+ return obj ;
+ }
+
+ public synchronized IOR getIOR()
+ {
+ if (ior == null) {
+ ior = ORBUtility.getIOR( obj ) ;
+ }
+
+ return ior ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/InitialServerRequestDispatcher.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/InitialServerRequestDispatcher.java
new file mode 100644
index 0000000..fb93eee
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/InitialServerRequestDispatcher.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol;
+
+import com.sun.corba.se.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.
+ */
+public interface InitialServerRequestDispatcher
+ extends CorbaServerRequestDispatcher
+{
+ /** Plug in the resolver that this InitialServerRequestDispatcher should
+ * use in order to lookup or list initial name to object reference
+ * bindings.
+ */
+ void init( Resolver resolver ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcher.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcher.java
new file mode 100644
index 0000000..653b014
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcher.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol;
+
+import org.omg.CORBA.portable.ServantObject;
+
+/**
+ * @author Harold Carr
+ */
+
+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.
+ *
+ * @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 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.
+ */
+ public ServantObject servant_preinvoke(org.omg.CORBA.Object self,
+ String operation,
+ Class expectedType);
+
+ public void servant_postinvoke(org.omg.CORBA.Object self,
+ ServantObject servant);
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcherFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcherFactory.java
new file mode 100644
index 0000000..e05c731
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/LocalClientRequestDispatcherFactory.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol;
+
+import com.sun.corba.se.spi.ior.IOR ;
+
+public interface LocalClientRequestDispatcherFactory {
+ public LocalClientRequestDispatcher create( int id, IOR ior ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/PIHandler.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/PIHandler.java
new file mode 100644
index 0000000..ac25b79
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/PIHandler.java
@@ -0,0 +1,306 @@
+/*
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol;
+
+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.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.se.spi.oa.ObjectAdapter ;
+
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator ;
+
+import com.sun.corba.se.spi.ior.ObjectKeyTemplate ;
+
+// XXX These need to go away.
+import com.sun.corba.se.impl.corba.RequestImpl ;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.ReplyMessage ;
+
+/** 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() ;
+
+ /*
+ ****************************
+ * IOR interceptor PI hooks
+ ****************************/
+
+ /**
+ * Called when a new object adapter is created.
+ *
+ * @param oa The adapter associated with the interceptors to be
+ * invoked.
+ */
+ 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.
+ */
+ 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 ) ;
+
+ /*
+ *****************
+ * Client PI hooks
+ *****************/
+
+ /**
+ * 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() ;
+
+ /**
+ * 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() ;
+
+ /**
+ * Called when the send_request or send_poll portable interception point
+ * is to be invoked for all appropriate client-side request interceptors.
+ *
+ * @exception RemarhsalException - Thrown when this request needs to
+ * be retried.
+ */
+ void invokeClientPIStartingPoint()
+ throws RemarshalException ;
+
+ /**
+ * 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.
+ */
+ 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).
+ *
+ * @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 ) ;
+
+ /**
+ * 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ void setClientPIInfo( RequestImpl requestImpl ) ;
+
+ /**
+ * Notify PI of the MessageMediator for the request.
+ */
+ void setClientPIInfo(CorbaMessageMediator messageMediator) ;
+
+ /*
+ *****************
+ * Server PI hooks
+ *****************/
+
+ /**
+ * 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.
+ */
+ void invokeServerPIStartingPoint() ;
+
+ /**
+ * 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.
+ */
+ void invokeServerPIIntermediatePoint() ;
+
+ /**
+ * 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.
+ */
+ 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.
+ */
+ void initializeServerPIInfo( CorbaMessageMediator 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.
+ */
+ void setServerPIInfo( java.lang.Object servant,
+ String targetMostDerivedInterface ) ;
+
+ /**
+ * Notifies PI of additional information required for ServerRequestInfo.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ 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.
+ */
+ void cleanupServerPIRequest() ;
+
+ Policy create_policy( int type, Any val ) throws PolicyError ;
+
+ void register_interceptor( Interceptor interceptor, int type )
+ throws DuplicateName ;
+
+ Current getPICurrent() ;
+
+ void registerPolicyFactory( int type, PolicyFactory factory ) ;
+
+ int allocateServerRequestId() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherDefault.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherDefault.java
new file mode 100644
index 0000000..748dc61
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherDefault.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol ;
+
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+// Used only in the implementation: no client of this class ever needs these
+import com.sun.corba.se.spi.ior.IOR ;
+
+import com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl ;
+import com.sun.corba.se.impl.protocol.CorbaServerRequestDispatcherImpl ;
+import com.sun.corba.se.impl.protocol.MinimalServantCacheLocalCRDImpl ;
+import com.sun.corba.se.impl.protocol.InfoOnlyServantCacheLocalCRDImpl ;
+import com.sun.corba.se.impl.protocol.FullServantCacheLocalCRDImpl ;
+import com.sun.corba.se.impl.protocol.JIDLLocalCRDImpl ;
+import com.sun.corba.se.impl.protocol.POALocalCRDImpl ;
+import com.sun.corba.se.impl.protocol.INSServerRequestDispatcher ;
+import com.sun.corba.se.impl.protocol.BootstrapServerRequestDispatcher ;
+
+public final class RequestDispatcherDefault {
+ private RequestDispatcherDefault() {}
+
+ public static ClientRequestDispatcher makeClientRequestDispatcher()
+ {
+ return new CorbaClientRequestDispatcherImpl() ;
+ }
+
+ public static CorbaServerRequestDispatcher makeServerRequestDispatcher( ORB orb )
+ {
+ return new CorbaServerRequestDispatcherImpl( (com.sun.corba.se.spi.orb.ORB)orb ) ;
+ }
+
+ public static CorbaServerRequestDispatcher makeBootstrapServerRequestDispatcher( ORB orb )
+ {
+ return new BootstrapServerRequestDispatcher( orb ) ;
+ }
+
+ public static CorbaServerRequestDispatcher makeINSServerRequestDispatcher( ORB orb )
+ {
+ return new INSServerRequestDispatcher( 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 static LocalClientRequestDispatcherFactory makeInfoOnlyServantCacheLocalClientRequestDispatcherFactory( final ORB orb )
+ {
+ return new LocalClientRequestDispatcherFactory() {
+ public LocalClientRequestDispatcher create( int id, IOR ior ) {
+ return new InfoOnlyServantCacheLocalCRDImpl( orb, id, ior ) ;
+ }
+ } ;
+ }
+
+ public static LocalClientRequestDispatcherFactory makeFullServantCacheLocalClientRequestDispatcherFactory( final ORB orb )
+ {
+ return new LocalClientRequestDispatcherFactory() {
+ public LocalClientRequestDispatcher create( int id, IOR ior ) {
+ return new FullServantCacheLocalCRDImpl( orb, id, ior ) ;
+ }
+ } ;
+ }
+
+ public static LocalClientRequestDispatcherFactory makeJIDLLocalClientRequestDispatcherFactory( final ORB orb )
+ {
+ return new LocalClientRequestDispatcherFactory() {
+ public LocalClientRequestDispatcher create( int id, IOR ior ) {
+ return new JIDLLocalCRDImpl( orb, id, ior ) ;
+ }
+ } ;
+ }
+
+ public static LocalClientRequestDispatcherFactory makePOALocalClientRequestDispatcherFactory( final ORB orb )
+ {
+ return new LocalClientRequestDispatcherFactory() {
+ public LocalClientRequestDispatcher create( int id, IOR ior ) {
+ return new POALocalCRDImpl( orb, id, ior ) ;
+ }
+ } ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherRegistry.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherRegistry.java
new file mode 100644
index 0000000..f5aae43
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RequestDispatcherRegistry.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol;
+
+import java.util.Set;
+
+import com.sun.corba.se.pept.protocol.ClientRequestDispatcher ;
+import com.sun.corba.se.spi.protocol.CorbaServerRequestDispatcher ;
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcherFactory ;
+
+import com.sun.corba.se.spi.oa.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.
+ */
+ void registerClientRequestDispatcher( ClientRequestDispatcher csc, int scid) ;
+
+ /** Get the ClientRequestDispatcher for subcontract ID 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.
+ */
+ void registerLocalClientRequestDispatcherFactory( LocalClientRequestDispatcherFactory csc, int scid) ;
+
+ /** Get the LocalClientRequestDispatcher for subcontract ID 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.
+ */
+ void registerServerRequestDispatcher( CorbaServerRequestDispatcher ssc, int scid) ;
+
+ /** Get the CorbaServerRequestDispatcher for subcontract ID scid.
+ */
+ CorbaServerRequestDispatcher 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.
+ */
+ void registerServerRequestDispatcher( CorbaServerRequestDispatcher ssc, String name ) ;
+
+ /** Get the CorbaServerRequestDispatcher for a particular object key.
+ */
+ CorbaServerRequestDispatcher getServerRequestDispatcher( String name ) ;
+
+ /** Register an ObjectAdapterFactory for a particular subcontract ID.
+ * This controls how Object references are created and managed.
+ */
+ void registerObjectAdapterFactory( ObjectAdapterFactory oaf, int scid) ;
+
+ /** Get the ObjectAdapterFactory for a particular subcontract ID scid.
+ */
+ ObjectAdapterFactory getObjectAdapterFactory( int scid ) ;
+
+ /** Return the set of all ObjectAdapterFactory instances that are registered.
+ */
+ Set<ObjectAdapterFactory> getObjectAdapterFactories();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RetryType.java b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RetryType.java
new file mode 100644
index 0000000..6035011
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/protocol/RetryType.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.protocol ;
+
+// Introduce more information about WHY we are re-trying a request
+// so we can properly handle the two cases:
+// - BEFORE_RESPONSE means that the retry is caused by
+// something that happened BEFORE the message was sent: either
+// an exception from the SocketFactory, or one from the
+// Client side send_request interceptor point.
+// - 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 ) ;
+
+ private final boolean isRetry ;
+
+ RetryType( boolean isRetry ) {
+ this.isRetry = isRetry ;
+ }
+
+ public boolean isRetry() {
+ return this.isRetry ;
+ }
+} ;
+
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/LocalResolver.java b/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/LocalResolver.java
new file mode 100644
index 0000000..bd0d63f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/LocalResolver.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.resolver ;
+
+import com.sun.corba.se.spi.orbutil.closure.Closure ;
+
+/** 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.
+ * The Closure must evaluate to an org.omg.CORBA.Object.
+ */
+ void register( String name, Closure closure ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/Resolver.java b/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/Resolver.java
new file mode 100644
index 0000000..0391648
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/Resolver.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.resolver ;
+
+/** 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. Returns null if no object
+ * is bound to the 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.
+ */
+ java.util.Set list() ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/ResolverDefault.java b/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/ResolverDefault.java
new file mode 100644
index 0000000..5342f37
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/resolver/ResolverDefault.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.resolver ;
+
+import java.io.File ;
+
+import com.sun.corba.se.impl.resolver.LocalResolverImpl ;
+import com.sun.corba.se.impl.resolver.ORBInitRefResolverImpl ;
+import com.sun.corba.se.impl.resolver.ORBDefaultInitRefResolverImpl ;
+import com.sun.corba.se.impl.resolver.BootstrapResolverImpl ;
+import com.sun.corba.se.impl.resolver.CompositeResolverImpl ;
+import com.sun.corba.se.impl.resolver.INSURLOperationImpl ;
+import com.sun.corba.se.impl.resolver.SplitLocalResolverImpl ;
+import com.sun.corba.se.impl.resolver.FileResolverImpl ;
+
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.orb.Operation ;
+import com.sun.corba.se.spi.orb.StringPair ;
+
+/** 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.
+ */
+ public static LocalResolver makeLocalResolver( )
+ {
+ return new LocalResolverImpl() ;
+ }
+
+ /** Return a resolver that relies on configured values of ORBInitRef for data.
+ */
+ public static Resolver makeORBInitRefResolver( Operation urlOperation,
+ StringPair[] initRefs )
+ {
+ return new ORBInitRefResolverImpl( urlOperation, initRefs ) ;
+ }
+
+ 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.
+ */
+ 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 ).
+ */
+ public static Resolver makeCompositeResolver( Resolver first, Resolver second )
+ {
+ return new CompositeResolverImpl( first, second ) ;
+ }
+
+ public static Operation makeINSURLOperation( ORB orb, Resolver bootstrapResolver )
+ {
+ return new INSURLOperationImpl(
+ (com.sun.corba.se.spi.orb.ORB)orb, bootstrapResolver ) ;
+ }
+
+ 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 ) ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/CodeSetServiceContext.java b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/CodeSetServiceContext.java
new file mode 100644
index 0000000..587b597
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/CodeSetServiceContext.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.servicecontext;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.encoding.MarshalInputStream ;
+import com.sun.corba.se.impl.encoding.MarshalOutputStream ;
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo ;
+
+public class CodeSetServiceContext extends ServiceContext {
+ public CodeSetServiceContext( CodeSetComponentInfo.CodeSetContext csc )
+ {
+ this.csc = csc ;
+ }
+
+ public CodeSetServiceContext(InputStream is, GIOPVersion gv)
+ {
+ super(is, gv) ;
+ csc = new CodeSetComponentInfo.CodeSetContext() ;
+ csc.read( (MarshalInputStream)in ) ;
+ }
+
+ // Required SERVICE_CONTEXT_ID and getId definitions
+ public static final int SERVICE_CONTEXT_ID = 1 ;
+ public int getId() { return SERVICE_CONTEXT_ID ; }
+
+ public void writeData( OutputStream os ) throws SystemException
+ {
+ csc.write( (MarshalOutputStream)os ) ;
+ }
+
+ public CodeSetComponentInfo.CodeSetContext getCodeSetContext()
+ {
+ return csc ;
+ }
+
+ private CodeSetComponentInfo.CodeSetContext csc ;
+
+ public String toString()
+ {
+ return "CodeSetServiceContext[ csc=" + csc + " ]" ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/MaxStreamFormatVersionServiceContext.java b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/MaxStreamFormatVersionServiceContext.java
new file mode 100644
index 0000000..ec0267b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/MaxStreamFormatVersionServiceContext.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ */
+package com.sun.corba.se.spi.servicecontext;
+
+import org.omg.IOP.RMICustomMaxStreamFormat;
+import javax.rmi.CORBA.*;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.impl.encoding.MarshalInputStream;
+import com.sun.corba.se.impl.encoding.MarshalOutputStream;
+import com.sun.corba.se.impl.orbutil.ORBUtility;
+
+public class MaxStreamFormatVersionServiceContext extends ServiceContext {
+
+ private byte maxStreamFormatVersion;
+
+ // The singleton uses the maximum version indicated by our
+ // ValueHandler.
+ public static final MaxStreamFormatVersionServiceContext singleton
+ = new MaxStreamFormatVersionServiceContext();
+
+ public MaxStreamFormatVersionServiceContext() {
+ maxStreamFormatVersion = ORBUtility.getMaxStreamFormatVersion();
+ }
+
+ public MaxStreamFormatVersionServiceContext(byte maxStreamFormatVersion) {
+ this.maxStreamFormatVersion = maxStreamFormatVersion;
+ }
+
+ public MaxStreamFormatVersionServiceContext(InputStream is,
+ GIOPVersion gv) {
+ super(is, gv) ;
+
+ maxStreamFormatVersion = is.read_octet();
+ }
+
+ public static final int SERVICE_CONTEXT_ID = RMICustomMaxStreamFormat.value;
+ public int getId() { return SERVICE_CONTEXT_ID; }
+
+ public void writeData(OutputStream os) throws SystemException
+ {
+ os.write_octet(maxStreamFormatVersion);
+ }
+
+ public byte getMaximumStreamFormatVersion()
+ {
+ return maxStreamFormatVersion;
+ }
+
+ public String toString()
+ {
+ return "MaxStreamFormatVersionServiceContext["
+ + maxStreamFormatVersion + "]";
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ORBVersionServiceContext.java b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ORBVersionServiceContext.java
new file mode 100644
index 0000000..b610a52
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ORBVersionServiceContext.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2000, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.servicecontext;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+
+import com.sun.corba.se.spi.orb.ORBVersion ;
+import com.sun.corba.se.spi.orb.ORBVersionFactory ;
+
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.servicecontext.ServiceContext ;
+import com.sun.corba.se.impl.orbutil.ORBConstants ;
+
+public class ORBVersionServiceContext extends ServiceContext {
+
+ public ORBVersionServiceContext( )
+ {
+ version = ORBVersionFactory.getORBVersion() ;
+ }
+
+ public ORBVersionServiceContext( ORBVersion ver )
+ {
+ this.version = ver ;
+ }
+
+ public ORBVersionServiceContext(InputStream is, GIOPVersion gv)
+ {
+ super(is, gv) ;
+ // 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 ) ;
+ }
+
+ // Required SERVICE_CONTEXT_ID and getId definitions
+ public static final int SERVICE_CONTEXT_ID = ORBConstants.TAG_ORB_VERSION ;
+ public int getId() { return SERVICE_CONTEXT_ID ; }
+
+ public void writeData( OutputStream os ) throws SystemException
+ {
+ version.write( os ) ;
+ }
+
+ public ORBVersion getVersion()
+ {
+ return version ;
+ }
+
+ // current ORB Version
+ private ORBVersion version = ORBVersionFactory.getORBVersion() ;
+
+ public String toString()
+ {
+ return "ORBVersionServiceContext[ version=" + version + " ]" ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/SendingContextServiceContext.java b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/SendingContextServiceContext.java
new file mode 100644
index 0000000..a26231c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/SendingContextServiceContext.java
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.servicecontext;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.servicecontext.ServiceContext ;
+import com.sun.corba.se.impl.encoding.MarshalOutputStream ;
+import com.sun.corba.se.impl.ior.IORImpl ;
+
+public class SendingContextServiceContext extends ServiceContext {
+ public SendingContextServiceContext( IOR ior )
+ {
+ this.ior = ior ;
+ }
+
+ public SendingContextServiceContext(InputStream is, GIOPVersion gv)
+ {
+ super(is, gv) ;
+ ior = new IORImpl( in ) ;
+ }
+
+ // Required SERVICE_CONTEXT_ID and getId definitions
+ public static final int SERVICE_CONTEXT_ID = 6 ;
+ public int getId() { return SERVICE_CONTEXT_ID ; }
+
+ public void writeData( OutputStream os ) throws SystemException
+ {
+ ior.write( os ) ;
+ }
+
+ public IOR getIOR()
+ {
+ return ior ;
+ }
+
+ private IOR ior = null ;
+
+ public String toString()
+ {
+ return "SendingContexServiceContext[ ior=" + ior + " ]" ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java
new file mode 100644
index 0000000..c2b07a2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContext.java
@@ -0,0 +1,120 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.servicecontext;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA_2_3.portable.InputStream ;
+import org.omg.CORBA_2_3.portable.OutputStream ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.impl.encoding.CDRInputStream ;
+import com.sun.corba.se.impl.encoding.EncapsInputStream ;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+/** 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:
+* <ul>
+* <li>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.</li>
+* <li>a public constructor that takes an InputStream as its argument.</li>
+* <li>Appropriate definitions of getId() and writeData(). getId() must
+* return SERVICE_CONTEXT_ID.</li>
+* </ul>
+* <p>
+* 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 ServiceContext {
+ /** Simple default constructor used when subclass is constructed
+ * from its representation.
+ */
+ protected ServiceContext() { }
+
+ private void dprint( String msg )
+ {
+ ORBUtility.dprint( this, msg ) ;
+ }
+
+ /** 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.
+ */
+ protected ServiceContext(InputStream s, GIOPVersion gv) throws SystemException
+ {
+ in = s;
+ }
+
+ /** Returns Service context id. Must be overloaded in subclass.
+ */
+ 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.
+ */
+ public void write(OutputStream s, GIOPVersion gv) throws SystemException
+ {
+ EncapsOutputStream os =
+ sun.corba.OutputStreamFactory.newEncapsOutputStream((ORB)(s.orb()), gv);
+ os.putEndian() ;
+ writeData( os ) ;
+ byte[] data = os.toByteArray() ;
+
+ s.write_long(getId());
+ s.write_long(data.length);
+ 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.
+ */
+ 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.
+ */
+ protected InputStream in = null ;
+
+ public String toString()
+ {
+ return "ServiceContext[ id=" + getId() + " ]" ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContextData.java b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContextData.java
new file mode 100644
index 0000000..2ee34f3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContextData.java
@@ -0,0 +1,161 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.servicecontext;
+
+import org.omg.CORBA.BAD_PARAM ;
+import org.omg.CORBA_2_3.portable.InputStream ;
+import com.sun.corba.se.spi.servicecontext.ServiceContext ;
+import java.lang.reflect.InvocationTargetException ;
+import java.lang.reflect.Modifier ;
+import java.lang.reflect.Field ;
+import java.lang.reflect.Constructor ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+/** Internal class used to hold data about a service context class.
+*/
+public class ServiceContextData {
+ private void dprint( String msg )
+ {
+ ORBUtility.dprint( this, msg ) ;
+ }
+
+ private void throwBadParam( String msg, Throwable exc )
+ {
+ BAD_PARAM error = new BAD_PARAM( msg ) ;
+ if (exc != null)
+ error.initCause( exc ) ;
+ throw error ;
+ }
+
+ public ServiceContextData( Class cls )
+ {
+ if (ORB.ORBInitDebug)
+ dprint( "ServiceContextData constructor called for class " + cls ) ;
+
+ scClass = cls ;
+
+ try {
+ if (ORB.ORBInitDebug)
+ dprint( "Finding constructor for " + cls ) ;
+
+ // Find the appropriate constructor in cls
+ Class[] args = new Class[2] ;
+ args[0] = InputStream.class ;
+ args[1] = GIOPVersion.class;
+ try {
+ scConstructor = cls.getConstructor( args ) ;
+ } catch (NoSuchMethodException nsme) {
+ throwBadParam( "Class does not have an InputStream constructor", nsme ) ;
+ }
+
+ if (ORB.ORBInitDebug)
+ dprint( "Finding SERVICE_CONTEXT_ID field in " + cls ) ;
+
+ // get the ID from the public static final int SERVICE_CONTEXT_ID
+ Field fld = null ;
+ try {
+ fld = cls.getField( "SERVICE_CONTEXT_ID" ) ;
+ } catch (NoSuchFieldException nsfe) {
+ throwBadParam( "Class does not have a SERVICE_CONTEXT_ID member", nsfe ) ;
+ } catch (SecurityException se) {
+ throwBadParam( "Could not access SERVICE_CONTEXT_ID member", se ) ;
+ }
+
+ if (ORB.ORBInitDebug)
+ dprint( "Checking modifiers of SERVICE_CONTEXT_ID field in " + cls ) ;
+
+ int mod = fld.getModifiers() ;
+ if (!Modifier.isPublic(mod) || !Modifier.isStatic(mod) ||
+ !Modifier.isFinal(mod) )
+ throwBadParam( "SERVICE_CONTEXT_ID field is not public static final", null ) ;
+
+ if (ORB.ORBInitDebug)
+ dprint( "Getting value of SERVICE_CONTEXT_ID in " + cls ) ;
+
+ try {
+ scId = fld.getInt( null ) ;
+ } catch (IllegalArgumentException iae) {
+ throwBadParam( "SERVICE_CONTEXT_ID not convertible to int", iae ) ;
+ } catch (IllegalAccessException iae2) {
+ throwBadParam( "Could not access value of SERVICE_CONTEXT_ID", iae2 ) ;
+ }
+ } catch (BAD_PARAM nssc) {
+ if (ORB.ORBInitDebug)
+ dprint( "Exception in ServiceContextData constructor: " + nssc ) ;
+ throw nssc ;
+ } catch (Throwable thr) {
+ if (ORB.ORBInitDebug)
+ dprint( "Unexpected Exception in ServiceContextData constructor: " +
+ thr ) ;
+ }
+
+ if (ORB.ORBInitDebug)
+ dprint( "ServiceContextData constructor completed" ) ;
+ }
+
+ /** Factory method used to create a ServiceContext object by
+ * unmarshalling it from the InputStream.
+ */
+ public ServiceContext makeServiceContext(InputStream is, GIOPVersion gv)
+ {
+ Object[] args = new Object[2];
+ args[0] = is ;
+ args[1] = gv;
+ ServiceContext sc = null ;
+
+ try {
+ sc = (ServiceContext)(scConstructor.newInstance( args )) ;
+ } catch (IllegalArgumentException iae) {
+ throwBadParam( "InputStream constructor argument error", iae ) ;
+ } catch (IllegalAccessException iae2) {
+ throwBadParam( "InputStream constructor argument error", iae2 ) ;
+ } catch (InstantiationException ie) {
+ throwBadParam( "InputStream constructor called for abstract class", ie ) ;
+ } catch (InvocationTargetException ite) {
+ throwBadParam( "InputStream constructor threw exception " +
+ ite.getTargetException(), ite ) ;
+ }
+
+ return sc ;
+ }
+
+ int getId()
+ {
+ return scId ;
+ }
+
+ public String toString()
+ {
+ return "ServiceContextData[ scClass=" + scClass + " scConstructor=" +
+ scConstructor + " scId=" + scId + " ]" ;
+ }
+
+ private Class scClass ;
+ private Constructor scConstructor ;
+ private int scId ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContextRegistry.java b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContextRegistry.java
new file mode 100644
index 0000000..41bbd23
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContextRegistry.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.servicecontext;
+
+import org.omg.CORBA.BAD_PARAM;
+import java.util.Vector ;
+import java.util.Enumeration ;
+import com.sun.corba.se.spi.servicecontext.ServiceContext ;
+import com.sun.corba.se.spi.servicecontext.ServiceContextData ;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+
+public class ServiceContextRegistry {
+ private ORB orb ;
+ private Vector scCollection ;
+
+ private void dprint( String msg )
+ {
+ ORBUtility.dprint( this, msg ) ;
+ }
+
+ public ServiceContextRegistry( ORB orb )
+ {
+ scCollection = new Vector() ;
+ this.orb = orb ;
+ }
+
+ /** Register the ServiceContext class so that it will be recognized
+ * by the read method.
+ * Class cls must have the following properties:
+ * <ul>
+ * <li>It must derive from com.sun.corba.se.spi.servicecontext.ServiceContext.</li>
+ * <li>It must have a public static final int SERVICE_CONTEXT_ID
+ * member.</li>
+ * <li>It must implement a constructor that takes a
+ * org.omg.CORBA_2_3.portable.InputStream argument.</li>
+ * </ul>
+ */
+ public void register( Class cls )
+ {
+ if (ORB.ORBInitDebug)
+ dprint( "Registering service context class " + cls ) ;
+
+ ServiceContextData scd = new ServiceContextData( cls ) ;
+
+ if (findServiceContextData(scd.getId()) == null)
+ scCollection.addElement( scd ) ;
+ else
+ throw new BAD_PARAM( "Tried to register duplicate service context" ) ;
+ }
+
+ public ServiceContextData findServiceContextData( int scId )
+ {
+ if (ORB.ORBInitDebug)
+ dprint( "Searching registry for service context id " + scId ) ;
+
+ Enumeration enumeration = scCollection.elements() ;
+ while (enumeration.hasMoreElements()) {
+ ServiceContextData scd =
+ (ServiceContextData)(enumeration.nextElement()) ;
+ if (scd.getId() == scId) {
+ if (ORB.ORBInitDebug)
+ dprint( "Service context data found: " + scd ) ;
+
+ return scd ;
+ }
+ }
+
+ if (ORB.ORBInitDebug)
+ dprint( "Service context data not found" ) ;
+
+ return null ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java
new file mode 100644
index 0000000..ea4569b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/ServiceContexts.java
@@ -0,0 +1,415 @@
+/*
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.servicecontext;
+
+import java.lang.reflect.InvocationTargetException ;
+import java.lang.reflect.Modifier ;
+import java.lang.reflect.Field ;
+import java.lang.reflect.Constructor ;
+import java.util.*;
+
+import org.omg.CORBA.OctetSeqHelper;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.INTERNAL;
+import org.omg.CORBA.CompletionStatus;
+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.se.spi.ior.iiop.GIOPVersion;
+
+import com.sun.corba.se.spi.orb.ORB ;
+
+import com.sun.corba.se.spi.logging.CORBALogDomains;
+
+
+import com.sun.corba.se.spi.servicecontext.ServiceContext ;
+import com.sun.corba.se.spi.servicecontext.ServiceContextRegistry ;
+import com.sun.corba.se.spi.servicecontext.ServiceContextData ;
+import com.sun.corba.se.spi.servicecontext.UnknownServiceContext ;
+
+import com.sun.corba.se.impl.encoding.CDRInputStream;
+import com.sun.corba.se.impl.encoding.EncapsInputStream ;
+import com.sun.corba.se.impl.orbutil.ORBUtility ;
+import com.sun.corba.se.impl.util.Utility ;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException ;
+
+import sun.corba.EncapsInputStreamFactory;
+
+
+public class ServiceContexts {
+ private static boolean isDebugging( OutputStream os )
+ {
+ ORB orb = (ORB)(os.orb()) ;
+ if (orb==null)
+ return false ;
+ return orb.serviceContextDebugFlag ;
+ }
+
+ private static boolean isDebugging( InputStream is )
+ {
+ ORB orb = (ORB)(is.orb()) ;
+ if (orb==null)
+ return false ;
+ return orb.serviceContextDebugFlag ;
+ }
+
+ private void dprint( String msg )
+ {
+ ORBUtility.dprint( this, msg ) ;
+ }
+
+ public static void writeNullServiceContext( OutputStream os )
+ {
+ if (isDebugging(os))
+ ORBUtility.dprint( "ServiceContexts", "Writing null service context" ) ;
+ os.write_long( 0 ) ;
+ }
+
+ /**
+ * 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).
+ */
+ private void createMapFromInputStream(InputStream is)
+ {
+ orb = (ORB)(is.orb()) ;
+ if (orb.serviceContextDebugFlag)
+ dprint( "Constructing ServiceContexts from input stream" ) ;
+
+ int numValid = is.read_long() ;
+
+ if (orb.serviceContextDebugFlag)
+ dprint("Number of service contexts = " + numValid);
+
+ for (int ctr = 0; ctr < numValid; ctr++) {
+ int scId = is.read_long();
+
+ if (orb.serviceContextDebugFlag)
+ dprint("Reading service context id " + scId);
+
+ byte[] data = OctetSeqHelper.read(is);
+
+ if (orb.serviceContextDebugFlag)
+ dprint("Service context" + scId + " length: " + data.length);
+
+ scMap.put(new Integer(scId), data);
+ }
+ }
+
+ public ServiceContexts( ORB orb )
+ {
+ this.orb = orb ;
+ wrapper = ORBUtilSystemException.get( orb,
+ CORBALogDomains.RPC_PROTOCOL ) ;
+
+ addAlignmentOnWrite = false ;
+
+ scMap = new HashMap();
+
+ // Use the GIOP version of the ORB. Should
+ // be specified in ServiceContext.
+ // See REVISIT below concerning giopVersion.
+ giopVersion = orb.getORBData().getGIOPVersion();
+ codeBase = null ;
+ }
+
+ /**
+ * Read the Service contexts from the input stream.
+ */
+ public ServiceContexts(InputStream s)
+ {
+ 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 = ((CDRInputStream)s).getCodeBase();
+
+ createMapFromInputStream(s);
+
+ // Fix for bug 4904723
+ giopVersion = ((CDRInputStream)s).getGIOPVersion();
+ }
+
+ /**
+ * Find the ServiceContextData for a given scId and unmarshal
+ * the bytes.
+ */
+ private ServiceContext unmarshal(Integer scId, byte[] data) {
+
+ ServiceContextRegistry scr = orb.getServiceContextRegistry();
+
+ ServiceContextData scd = scr.findServiceContextData(scId.intValue());
+ ServiceContext sc = null;
+
+ if (scd == null) {
+ if (orb.serviceContextDebugFlag) {
+ dprint("Could not find ServiceContextData for "
+ + scId
+ + " using UnknownServiceContext");
+ }
+
+ sc = new UnknownServiceContext(scId.intValue(), data);
+
+ } else {
+
+ if (orb.serviceContextDebugFlag) {
+ dprint("Found " + scd);
+ }
+
+ // 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.
+ //
+ // Since we don't have that, yet, I'm using the GIOP
+ // version of the input stream, presuming that someone
+ // 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
+ // ship wchar data or are defined as using anything but GIOP 1.0 CDR.
+ EncapsInputStream eis
+ = EncapsInputStreamFactory.newEncapsInputStream(orb,
+ data,
+ data.length,
+ giopVersion,
+ codeBase);
+ eis.consumeEndian();
+
+ // Now the input stream passed to a ServiceContext
+ // constructor is already the encapsulation input
+ // stream with the endianness read off, so the
+ // service context should just unmarshal its own
+ // data.
+ sc = scd.makeServiceContext(eis, giopVersion);
+ if (sc == null)
+ throw wrapper.svcctxUnmarshalError(
+ CompletionStatus.COMPLETED_MAYBE);
+ }
+
+ return sc;
+ }
+
+ public void addAlignmentPadding()
+ {
+ // Make service context 12 bytes longer by adding
+ // JAVAIDL_ALIGN_SERVICE_ID service context at end.
+ // The exact length
+ // must be >8 (minimum service context size) and
+ // =4 mod 8, so 12 is the minimum.
+ addAlignmentOnWrite = true ;
+ }
+
+ /**
+ * Hopefully unused scid: This should be changed to a proper
+ * VMCID aligned value. REVISIT!
+ */
+ private static final int JAVAIDL_ALIGN_SERVICE_ID = 0xbe1345cd ;
+
+ /**
+ * Write the service contexts to the output stream.
+ *
+ * If they haven't been unmarshaled, we don't have to
+ * unmarshal them.
+ */
+ public void write(OutputStream os, GIOPVersion gv)
+ {
+ if (isDebugging(os)) {
+ dprint( "Writing service contexts to output stream" ) ;
+ Utility.printStackTrace() ;
+ }
+
+ int numsc = scMap.size();
+
+ if (addAlignmentOnWrite) {
+ if (isDebugging(os))
+ dprint( "Adding alignment padding" ) ;
+
+ numsc++ ;
+ }
+
+ if (isDebugging(os))
+ dprint( "Service context has " + numsc + " components" ) ;
+
+ os.write_long( numsc ) ;
+
+ writeServiceContextsInOrder(os, gv);
+
+ if (addAlignmentOnWrite) {
+ if (isDebugging(os))
+ dprint( "Writing alignment padding" ) ;
+
+ os.write_long( JAVAIDL_ALIGN_SERVICE_ID ) ;
+ os.write_long( 4 ) ;
+ os.write_octet( (byte)0 ) ;
+ os.write_octet( (byte)0 ) ;
+ os.write_octet( (byte)0 ) ;
+ os.write_octet( (byte)0 ) ;
+ }
+
+ if (isDebugging(os))
+ dprint( "Service context writing complete" ) ;
+ }
+
+ /**
+ * 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.
+ */
+ private void writeServiceContextsInOrder(OutputStream os, GIOPVersion gv) {
+
+ // Temporarily remove this rather than check it per iteration
+ Integer ueInfoId
+ = new Integer(UEInfoServiceContext.SERVICE_CONTEXT_ID);
+
+ Object unknownExceptionInfo = scMap.remove(ueInfoId);
+
+ Iterator iter = scMap.keySet().iterator();
+
+ while (iter.hasNext()) {
+ Integer id = (Integer)iter.next();
+
+ writeMapEntry(os, id, scMap.get(id), gv);
+ }
+
+ // Write the UnknownExceptionInfo service context last
+ // (so it will be after the CodeBase) and restore it in
+ // the map.
+ if (unknownExceptionInfo != null) {
+ writeMapEntry(os, ueInfoId, unknownExceptionInfo, gv);
+
+ scMap.put(ueInfoId, unknownExceptionInfo);
+ }
+ }
+
+ /**
+ * 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.
+ */
+ private void writeMapEntry(OutputStream os, Integer id, Object scObj, GIOPVersion gv) {
+
+ // If it's still in byte[] form, we don't need to
+ // unmarshal it here, just copy the bytes into
+ // the new stream.
+
+ if (scObj instanceof byte[]) {
+ if (isDebugging(os))
+ dprint( "Writing service context bytes for id " + id);
+
+ OctetSeqHelper.write(os, (byte[])scObj);
+
+ } else {
+
+ // We actually unmarshaled it into a ServiceContext
+ // at some point.
+ ServiceContext sc = (ServiceContext)scObj;
+
+ if (isDebugging(os))
+ dprint( "Writing service context " + sc ) ;
+
+ sc.write(os, gv);
+ }
+ }
+
+ /** Add a service context to the stream, if there is not already
+ * a service context in this object with the same id as sc.
+ */
+ public void put( ServiceContext sc )
+ {
+ Integer id = new Integer(sc.getId());
+ scMap.put(id, sc);
+ }
+
+ public void delete( int scId ) {
+ this.delete(new Integer(scId));
+ }
+
+ public void delete(Integer id)
+ {
+ scMap.remove(id) ;
+ }
+
+ public ServiceContext get(int scId) {
+ return this.get(new Integer(scId));
+ }
+
+ public ServiceContext get(Integer id)
+ {
+ Object result = scMap.get(id);
+ if (result == null)
+ return null ;
+
+ // Lazy unmarshaling on first use.
+ if (result instanceof byte[]) {
+
+ ServiceContext sc = unmarshal(id, (byte[])result);
+
+ scMap.put(id, sc);
+
+ return sc;
+ } else {
+ return (ServiceContext)result;
+ }
+ }
+
+ private 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).
+ *
+ * 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 Map scMap;
+
+ /**
+ * If true, write out a special alignment service context to force the
+ * correct alignment on re-marshalling.
+ */
+ private boolean addAlignmentOnWrite ;
+
+ private CodeBase codeBase;
+ private GIOPVersion giopVersion;
+ private ORBUtilSystemException wrapper ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/UEInfoServiceContext.java b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/UEInfoServiceContext.java
new file mode 100644
index 0000000..847dfb1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/UEInfoServiceContext.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.servicecontext;
+
+import java.io.Serializable ;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.CompletionStatus;
+import org.omg.CORBA.UNKNOWN;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.servicecontext.ServiceContext ;
+
+public class UEInfoServiceContext extends ServiceContext {
+ public UEInfoServiceContext( Throwable ex )
+ {
+ unknown = ex ;
+ }
+
+ public UEInfoServiceContext(InputStream is, GIOPVersion gv)
+ {
+ super(is, gv) ;
+
+ try {
+ unknown = (Throwable) in.read_value() ;
+ } catch (ThreadDeath d) {
+ throw d ;
+ } catch (Throwable e) {
+ unknown = new UNKNOWN( 0, CompletionStatus.COMPLETED_MAYBE ) ;
+ }
+ }
+
+ // Required SERVICE_CONTEXT_ID and getId definitions
+ public static final int SERVICE_CONTEXT_ID = 9 ;
+ public int getId() { return SERVICE_CONTEXT_ID ; }
+
+ public void writeData( OutputStream os ) throws SystemException
+ {
+ os.write_value( (Serializable)unknown ) ;
+ }
+
+ public Throwable getUE() { return unknown ; }
+
+ private Throwable unknown = null ;
+
+ public String toString()
+ {
+ return "UEInfoServiceContext[ unknown=" + unknown.toString() + " ]" ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/UnknownServiceContext.java b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/UnknownServiceContext.java
new file mode 100644
index 0000000..e814cfa
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/servicecontext/UnknownServiceContext.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.servicecontext;
+
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA_2_3.portable.InputStream;
+import org.omg.CORBA_2_3.portable.OutputStream;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.servicecontext.ServiceContext ;
+
+public class UnknownServiceContext extends ServiceContext {
+ public UnknownServiceContext( int id, byte[] data )
+ {
+ this.id = id ;
+ this.data = data ;
+ }
+
+ public UnknownServiceContext( int id, InputStream is )
+ {
+ this.id = id ;
+
+ int len = is.read_long();
+ data = new byte[len];
+ is.read_octet_array(data,0,len);
+ }
+
+ public int getId() { return id ; }
+
+ public void writeData( OutputStream os ) throws SystemException
+ {
+ }
+
+ public void write( OutputStream os , GIOPVersion gv)
+ throws SystemException
+ {
+ os.write_long( id ) ;
+ os.write_long( data.length ) ;
+ os.write_octet_array( data, 0, data.length ) ;
+ }
+
+ public byte[] getData()
+ {
+ return data ;
+ }
+
+ private int id = -1 ;
+ private byte[] data = null ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaAcceptor.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaAcceptor.java
new file mode 100644
index 0000000..ba6a46f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaAcceptor.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+
+import com.sun.corba.se.spi.ior.IORTemplate;
+
+// REVISIT - impl/poa specific:
+import com.sun.corba.se.impl.oa.poa.Policies;
+
+/**
+ * @author Harold Carr
+ */
+public interface CorbaAcceptor
+ extends
+ Acceptor
+{
+ public String getObjectAdapterId();
+ public String getObjectAdapterManagerId();
+ public void addToIORTemplate(IORTemplate iorTemplate, Policies policies,
+ String codebase);
+ public String getMonitoringName();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaConnection.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaConnection.java
new file mode 100644
index 0000000..59bbd51
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaConnection.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 2002, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+import java.io.IOException;
+import java.nio.ByteBuffer;
+import java.nio.channels.SocketChannel;
+
+import org.omg.CORBA.SystemException;
+
+import com.sun.org.omg.SendingContext.CodeBase;
+
+import com.sun.corba.se.pept.encoding.InputObject;
+import com.sun.corba.se.pept.encoding.OutputObject;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.Connection;
+import com.sun.corba.se.pept.transport.ResponseWaitingRoom;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import com.sun.corba.se.impl.encoding.CodeSetComponentInfo;
+import com.sun.corba.se.impl.logging.ORBUtilSystemException;
+
+/**
+ * @author Harold Carr
+ */
+public interface CorbaConnection
+ extends
+ Connection,
+ com.sun.corba.se.spi.legacy.connection.Connection
+{
+ public boolean shouldUseDirectByteBuffers();
+
+ public boolean shouldReadGiopHeaderOnly();
+
+ public ByteBuffer read(int size, int offset, int length, long max_wait_time)
+ throws IOException;
+
+ public ByteBuffer read(ByteBuffer byteBuffer, int offset,
+ int length, long max_wait_time) throws IOException;
+
+ public void write(ByteBuffer byteBuffer)
+ throws IOException;
+
+ public void dprint(String msg);
+
+ //
+ // From iiop.Connection.java
+ //
+
+ public int getNextRequestId();
+ public ORB getBroker();
+ public CodeSetComponentInfo.CodeSetContext getCodeSetContext();
+ public void setCodeSetContext(CodeSetComponentInfo.CodeSetContext csc);
+
+ //
+ // from iiop.IIOPConnection.java
+ //
+
+ // 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();
+
+ // Can never be unset...
+ public void setPostInitialContexts();
+
+ public void purgeCalls(SystemException systemException,
+ boolean die, boolean lockHeld);
+
+ //
+ // Connection status
+ //
+ public static final int OPENING = 1;
+ public static final int ESTABLISHED = 2;
+ public static final int CLOSE_SENT = 3;
+ public static final int CLOSE_RECVD = 4;
+ public static final int ABORT = 5;
+
+ // 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
+ // 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
+ // getting the IOR out of the SendingContext service context.
+ // Our ORBs always send this, but it's optional in CORBA.
+
+ void setCodeBaseIOR(IOR ior);
+
+ IOR getCodeBaseIOR();
+
+ // 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 sendMessageError(GIOPVersion giopVersion)
+ throws IOException;
+
+ public void sendCancelRequest(GIOPVersion giopVersion, int requestId)
+ throws
+ IOException;
+
+ public void sendCancelRequestWithLock(GIOPVersion giopVersion,
+ int requestId)
+ throws
+ IOException;
+
+ public ResponseWaitingRoom getResponseWaitingRoom();
+
+ public void serverRequestMapPut(int requestId,
+ CorbaMessageMediator messageMediator);
+ public CorbaMessageMediator serverRequestMapGet(int requestId);
+ public void serverRequestMapRemove(int requestId);
+
+ // REVISIT: WRONG: should not expose sockets here.
+ public SocketChannel getSocketChannel();
+
+ // REVISIT - MessageMediator parameter?
+ public void serverRequestProcessingBegins();
+ public void serverRequestProcessingEnds();
+
+ /** Clean up all connection resources. Used when shutting down an ORB.
+ */
+ public void closeConnectionResources();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaConnectionCache.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaConnectionCache.java
new file mode 100644
index 0000000..9e9915f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaConnectionCache.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+/**
+ * @author Harold Carr
+ */
+public interface CorbaConnectionCache
+{
+ public String getMonitoringName();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfo.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfo.java
new file mode 100644
index 0000000..a5fed87
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfo.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.ior.iiop.IIOPProfile;
+
+import com.sun.corba.se.pept.transport.ContactInfo ;
+
+/**
+ * @author Harold Carr
+ */
+public interface CorbaContactInfo
+ extends
+ ContactInfo
+{
+ public IOR getTargetIOR();
+ public IOR getEffectiveTargetIOR();
+ public IIOPProfile getEffectiveProfile(); // REVISIT - type
+ public void setAddressingDisposition(short addressingDisposition);
+ public short getAddressingDisposition();
+ public String getMonitoringName();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoList.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoList.java
new file mode 100644
index 0000000..653e366
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoList.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+import com.sun.corba.se.spi.ior.IOR ;
+
+import com.sun.corba.se.spi.protocol.LocalClientRequestDispatcher ;
+
+import com.sun.corba.se.pept.transport.ContactInfoList ;
+
+/**
+ * @author Harold Carr
+ */
+public interface CorbaContactInfoList
+ extends
+ ContactInfoList
+{
+ public void setTargetIOR(IOR ior);
+ public IOR getTargetIOR();
+
+ public void setEffectiveTargetIOR(IOR locatedIor);
+ public IOR getEffectiveTargetIOR();
+
+ public LocalClientRequestDispatcher getLocalClientRequestDispatcher();
+
+ public int hashCode();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoListFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoListFactory.java
new file mode 100644
index 0000000..14d3494
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoListFactory.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport ;
+
+import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.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.
+ */
+public interface CorbaContactInfoListFactory {
+ /**
+ * This will be called after the no-arg constructor before
+ * create is called.
+ */
+ public void setORB(ORB orb);
+
+ public CorbaContactInfoList create( IOR ior ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoListIterator.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoListIterator.java
new file mode 100644
index 0000000..ce93e69
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaContactInfoListIterator.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport ;
+
+import com.sun.corba.se.pept.transport.ContactInfoListIterator ;
+
+import com.sun.corba.se.spi.ior.IOR;
+import com.sun.corba.se.spi.transport.CorbaContactInfo;
+
+public interface CorbaContactInfoListIterator extends ContactInfoListIterator
+{
+ // REVISIT: this is GIOP specific.
+ public void reportAddrDispositionRetry(CorbaContactInfo contactInfo,
+ short disposition);
+
+ public void reportRedirect(CorbaContactInfo contactInfo,
+ IOR forwardedIOR);
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaResponseWaitingRoom.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaResponseWaitingRoom.java
new file mode 100644
index 0000000..58992c3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaResponseWaitingRoom.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.pept.transport.ResponseWaitingRoom;
+import org.omg.CORBA.SystemException;
+
+/**
+ * @author Harold Carr
+ */
+public interface CorbaResponseWaitingRoom
+ extends
+ ResponseWaitingRoom
+{
+ public void signalExceptionToAllWaiters(SystemException systemException);
+
+ public MessageMediator getMessageMediator(int requestId);
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaTransportManager.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaTransportManager.java
new file mode 100644
index 0000000..6605c36
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/CorbaTransportManager.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+import java.util.Collection;
+
+import com.sun.corba.se.pept.transport.TransportManager;
+import com.sun.corba.se.spi.ior.IORTemplate;
+import com.sun.corba.se.spi.ior.ObjectAdapterId;
+
+// REVISIT - impl/poa specific:
+import com.sun.corba.se.impl.oa.poa.Policies;
+
+/**
+ * @author Harold Carr
+ */
+public interface CorbaTransportManager
+ extends
+ TransportManager
+{
+ public static final String SOCKET_OR_CHANNEL_CONNECTION_CACHE =
+ "SocketOrChannelConnectionCache";
+
+ public Collection getAcceptors(String objectAdapterManagerId,
+ ObjectAdapterId objectAdapterId);
+
+ // REVISIT - POA specific policies
+ public void addToIORTemplate(IORTemplate iorTemplate,
+ Policies policies,
+ String codebase,
+ String objectAdapterManagerId,
+ ObjectAdapterId objectAdapterId);
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IIOPPrimaryToContactInfo.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IIOPPrimaryToContactInfo.java
new file mode 100644
index 0000000..763fa40
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IIOPPrimaryToContactInfo.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+import java.util.List;
+
+import com.sun.corba.se.pept.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.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 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.
+ *
+ * @author Harold Carr
+ */
+public interface IIOPPrimaryToContactInfo
+{
+ /**
+ * @param primary - clear any state relating to primary.
+ */
+ public void reset(ContactInfo primary);
+
+ /**
+ * @param primary - the key.
+ * @param previous - if null return true. Otherwise, find previous in
+ * <code>contactInfos</code> and if another <code>ContactInfo</code>
+ * follows it in the list then return true. Otherwise false.
+ * @param contactInfos - the list of replicas associated with the
+ * primary.
+ */
+ 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 primary and return primary. 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 <code>ContactInfo</code> following
+ * previous to primary and return that <code>ContactInfo</code>.
+ */
+ public ContactInfo next(ContactInfo primary,
+ ContactInfo previous,
+ List contactInfos);
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IORToSocketInfo.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IORToSocketInfo.java
new file mode 100644
index 0000000..5af3a98
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IORToSocketInfo.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+import java.util.List;
+
+import com.sun.corba.se.spi.ior.IOR;
+
+public interface IORToSocketInfo
+{
+ /**
+ * Used to extract socket address information from an IOR.
+ *
+ * @param ior.
+ *
+ * @return List - a list of SocketInfo.
+ *
+ */
+ public List getSocketInfo(IOR ior);
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IORTransformer.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IORTransformer.java
new file mode 100644
index 0000000..13b3dce
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/IORTransformer.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2002, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport ;
+
+import com.sun.corba.se.spi.ior.IOR ;
+import com.sun.corba.se.spi.encoding.CorbaInputObject ;
+import com.sun.corba.se.spi.encoding.CorbaOutputObject ;
+
+/** 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( CorbaInputObject io ) ;
+
+ void marshal( CorbaOutputObject oo, IOR ior ) ;
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ORBSocketFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ORBSocketFactory.java
new file mode 100644
index 0000000..7b0bdb4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ORBSocketFactory.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.SocketException;
+import java.net.ServerSocket;
+
+import com.sun.corba.se.pept.transport.Acceptor;
+import com.sun.corba.se.spi.orb.ORB;
+
+/**
+ * @author Harold Carr
+ */
+public interface ORBSocketFactory
+{
+ public void setORB(ORB orb);
+
+ public ServerSocket createServerSocket(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;
+
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ReadTimeouts.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ReadTimeouts.java
new file mode 100644
index 0000000..a295462
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ReadTimeouts.java
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+public interface ReadTimeouts {
+ public int get_initial_time_to_wait();
+ public int get_max_time_to_wait();
+ public double get_backoff_factor();
+ public int get_max_giop_header_time_to_wait();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ReadTimeoutsFactory.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ReadTimeoutsFactory.java
new file mode 100644
index 0000000..ea203d8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/ReadTimeoutsFactory.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport ;
+
+import com.sun.corba.se.spi.transport.ReadTimeouts;
+
+public interface ReadTimeoutsFactory {
+ // create transport read timeouts
+ public ReadTimeouts create(int initial_wait_time,
+ int max_wait_time,
+ int max_giop_hdr_wait_time,
+ int backoff_percent_factor);
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/SocketInfo.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/SocketInfo.java
new file mode 100644
index 0000000..e406f78
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/SocketInfo.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+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
+ // to avoid a compilation dependency.
+
+ public static final String IIOP_CLEAR_TEXT = "IIOP_CLEAR_TEXT";
+
+
+ public String getType();
+
+ public String getHost();
+
+ public int getPort();
+}
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/SocketOrChannelAcceptor.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/SocketOrChannelAcceptor.java
new file mode 100644
index 0000000..ce3b256
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/SocketOrChannelAcceptor.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport;
+
+import java.net.ServerSocket;
+
+/**
+ * @author Harold Carr
+ */
+public interface SocketOrChannelAcceptor
+{
+ public ServerSocket getServerSocket();
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/corba/se/spi/transport/TransportDefault.java b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/TransportDefault.java
new file mode 100644
index 0000000..19d9bcf
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/corba/se/spi/transport/TransportDefault.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2002, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.corba.se.spi.transport ;
+
+import com.sun.corba.se.spi.protocol.CorbaClientDelegate ;
+import com.sun.corba.se.spi.protocol.ClientDelegateFactory ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoList ;
+import com.sun.corba.se.spi.transport.CorbaContactInfoListFactory ;
+import com.sun.corba.se.spi.transport.ReadTimeouts;
+import com.sun.corba.se.spi.transport.ReadTimeoutsFactory;
+import com.sun.corba.se.spi.orb.ORB ;
+import com.sun.corba.se.spi.ior.IOR ;
+
+// Internal imports, not used in the interface to this package
+import com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl ;
+import com.sun.corba.se.impl.transport.CorbaContactInfoListImpl;
+import com.sun.corba.se.impl.transport.ReadTCPTimeoutsImpl;
+
+/** This class provices standard building blocks for the ORB, as do all Default classes
+ * in the various packages.
+ */
+public abstract class TransportDefault {
+ private TransportDefault() {}
+
+ public static CorbaContactInfoListFactory makeCorbaContactInfoListFactory(
+ final ORB broker )
+ {
+ return new CorbaContactInfoListFactory() {
+ public void setORB(ORB orb) { }
+ public CorbaContactInfoList create( IOR ior ) {
+ return new CorbaContactInfoListImpl(
+ (com.sun.corba.se.spi.orb.ORB)broker, ior ) ;
+ }
+ };
+ }
+
+ public static ClientDelegateFactory makeClientDelegateFactory(
+ final ORB broker )
+ {
+ return new ClientDelegateFactory() {
+ public CorbaClientDelegate create( CorbaContactInfoList info ) {
+ return new CorbaClientDelegateImpl(
+ (com.sun.corba.se.spi.orb.ORB)broker, info ) ;
+ }
+ };
+ }
+
+ public static IORTransformer makeIORTransformer(
+ final ORB broker )
+ {
+ return null ;
+ }
+
+ public static ReadTimeoutsFactory makeReadTimeoutsFactory()
+ {
+ return new ReadTimeoutsFactory() {
+ public ReadTimeouts create(int initial_wait_time,
+ int max_wait_time,
+ int max_giop_hdr_wait_time,
+ int backoff_percent_factor)
+ {
+ return new ReadTCPTimeoutsImpl(
+ initial_wait_time,
+ max_wait_time,
+ max_giop_hdr_wait_time,
+ backoff_percent_factor);
+ };
+ };
+ }
+}
+
+// End of file.
diff --git a/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java b/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java
new file mode 100644
index 0000000..7c6d58d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNBindingEnumeration.java
@@ -0,0 +1,240 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.cosnaming;
+
+import javax.naming.*;
+import javax.naming.spi.NamingManager;
+
+import java.util.NoSuchElementException;
+import java.util.Hashtable;
+
+import org.omg.CosNaming.*;
+
+import com.sun.jndi.toolkit.corba.CorbaUtils;
+
+/**
+ * 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<javax.naming.Binding> {
+
+ 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 ?
+
+ /**
+ * Creates a CNBindingEnumeration object.
+ * @param ctx Context to enumerate
+ */
+ CNBindingEnumeration(CNCtx ctx, boolean isLookedUpCtx, Hashtable<?,?> env) {
+ // Get batch size to use
+ String batch = (env != null ?
+ (String)env.get(javax.naming.Context.BATCHSIZE) : null);
+ if (batch != null) {
+ try {
+ batchsize = Integer.parseInt(batch);
+ } catch (NumberFormatException e) {
+ throw new IllegalArgumentException("Batch size not numeric: " + batch);
+ }
+ }
+ _ctx = ctx;
+ _ctx.incEnumCount();
+ this.isLookedUpCtx = isLookedUpCtx;
+ _env = env;
+ _bindingList = new BindingListHolder();
+ BindingIteratorHolder _bindingIterH = new BindingIteratorHolder();
+
+ // Perform listing and request that bindings be returned in _bindingIter
+ // Upon return,_bindingList returns a zero length list
+ _ctx._nc.list(0, _bindingList, _bindingIterH);
+
+ _bindingIter = _bindingIterH.value;
+
+ // Get first batch using _bindingIter
+ if (_bindingIter != null) {
+ more = _bindingIter.next_n(batchsize, _bindingList);
+ } else {
+ more = false;
+ }
+ counter = 0;
+ }
+
+ /**
+ * Returns the next binding in the list.
+ * @exception NamingException any naming exception.
+ */
+
+ public javax.naming.Binding next() throws NamingException {
+ if (more && counter >= _bindingList.value.length) {
+ getMore();
+ }
+ if (more && counter < _bindingList.value.length) {
+ org.omg.CosNaming.Binding bndg = _bindingList.value[counter];
+ counter++;
+ return mapBinding(bndg);
+ } else {
+ throw new NoSuchElementException();
+ }
+ }
+
+
+ /**
+ * 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,
+ // and if so, try to get more.
+ // If no more, just say so.
+ return more ? (counter < _bindingList.value.length || getMore()) : false;
+ }
+
+ /**
+ * Returns true or false depending on whether there are more bindings.
+ * Need to define this to satisfy the Enumeration api requirement.
+ * @return boolean value
+ */
+
+ public boolean hasMoreElements() {
+ try {
+ return hasMore();
+ } catch (NamingException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Returns the next binding in the list.
+ * @exception NoSuchElementException Thrown when the end of the
+ * list is reached.
+ */
+
+ public javax.naming.Binding nextElement() {
+ try {
+ return next();
+ } catch (NamingException ne) {
+ throw new NoSuchElementException();
+ }
+ }
+
+ public void close() throws NamingException {
+ more = false;
+ if (_bindingIter != null) {
+ _bindingIter.destroy();
+ _bindingIter = null;
+ }
+ if (_ctx != null) {
+ _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
+ */
+ if (isLookedUpCtx) {
+ _ctx.close();
+ }
+ _ctx = null;
+ }
+ }
+
+ protected void finalize() {
+ try {
+ close();
+ } catch (NamingException e) {
+ // ignore failures
+ }
+ }
+
+ /**
+ * Get the next batch using _bindingIter. Update the 'more' field.
+ */
+ private boolean getMore() throws NamingException {
+ try {
+ more = _bindingIter.next_n(batchsize, _bindingList);
+ counter = 0; // reset
+ } catch (Exception e) {
+ more = false;
+ NamingException ne = new NamingException(
+ "Problem getting binding list");
+ ne.setRootCause(e);
+ throw ne;
+ }
+ return more;
+ }
+
+ /**
+ * 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);
+
+ try {
+ // Check whether object factory codebase is trusted
+ if (CorbaUtils.isObjectFactoryTrusted(obj)) {
+ obj = NamingManager.getObjectInstance(obj, cname, _ctx, _env);
+ }
+ } catch (NamingException e) {
+ throw e;
+ } catch (Exception e) {
+ NamingException ne = new NamingException(
+ "problem generating object using object factory");
+ ne.setRootCause(e);
+ throw ne;
+ }
+
+ // Use cname.toString() instead of bindingName because the name
+ // in the binding should be a composite name
+ String cnameStr = cname.toString();
+ javax.naming.Binding jbndg = new javax.naming.Binding(cnameStr, obj);
+
+ NameComponent[] comps = _ctx.makeFullName(bndg.binding_name);
+ String fullName = CNNameParser.cosNameToInsString(comps);
+ jbndg.setNameInNamespace(fullName);
+ return jbndg;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java b/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java
new file mode 100644
index 0000000..82078e3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtx.java
@@ -0,0 +1,1178 @@
+/*
+ * Copyright (c) 1999, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.cosnaming;
+
+import javax.naming.*;
+import javax.naming.spi.NamingManager;
+import javax.naming.spi.ResolveResult;
+
+import java.util.Hashtable;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import org.omg.CosNaming.*;
+import org.omg.CosNaming.NamingContextPackage.*;
+import org.omg.CORBA.*;
+
+import com.sun.jndi.toolkit.corba.CorbaUtils;
+
+// Needed for creating default ORB
+import java.applet.Applet;
+
+/**
+ * Provides a bridge to the CosNaming server provided by
+ * JavaIDL. This class provides the InitialContext from CosNaming.
+ *
+ * @author Raj Krishnamurthy
+ * @author Rosanna Lee
+ */
+
+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.
+ */
+ private static ORB _defaultOrb;
+ 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<String, java.lang.Object>());
+ }
+ return _defaultOrb;
+ }
+
+ private NameComponent[] _name = null;
+
+ Hashtable<String, java.lang.Object> _env; // used by ExceptionMapper
+ static final CNNameParser parser = new CNNameParser();
+
+ private static final String FED_PROP = "com.sun.jndi.cosnaming.federation";
+ boolean federation = false;
+
+ /**
+ * Determines whether classes may be loaded from an arbitrary URL code base.
+ */
+ public static final boolean trustURLCodebase;
+ static {
+ // System property to control whether classes may be loaded from an
+ // arbitrary URL code base
+ PrivilegedAction<String> act = () -> System.getProperty(
+ "com.sun.jndi.cosnaming.object.trustURLCodebase", "false");
+ String trust = AccessController.doPrivileged(act);
+ trustURLCodebase = "true".equalsIgnoreCase(trust);
+ }
+
+ // Reference counter for tracking _orb references
+ OrbReuseTracker orbTracker = null;
+ int enumCount;
+ 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.
+ */
+ @SuppressWarnings("unchecked")
+ CNCtx(Hashtable<?,?> env) throws NamingException {
+ if (env != null) {
+ env = (Hashtable<?,?>)env.clone();
+ }
+ _env = (Hashtable<String, java.lang.Object>)env;
+ federation = "true".equals(env != null ? env.get(FED_PROP) : null);
+ initOrbAndRootContext(env);
+ }
+
+ 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 {
+ CNCtx ctx = new CNCtx();
+ if (env != null) {
+ env = (Hashtable<?,?>) env.clone();
+ }
+ ctx._env = (Hashtable<String, java.lang.Object>)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
+ // from parsing the string as a composite name
+ // The caller should be aware that a toString() of the name,
+ // which came from the environment will yield its INS syntax,
+ // rather than a composite syntax
+ return new ResolveResult(ctx, parser.parse(rest));
+ }
+
+ /**
+ * 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<String, java.lang.Object> 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];
+
+ // parent
+ System.arraycopy(_name, 0, answer, 0, _name.length);
+
+ // child
+ System.arraycopy(child, 0, answer, _name.length, child.length);
+ return answer;
+ }
+
+
+ public String getNameInNamespace() throws NamingException {
+ if (_name == null || _name.length == 0) {
+ return "";
+ }
+ return CNNameParser.cosNameToInsString(_name);
+ }
+
+ /**
+ * 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:")
+ ;
+ }
+
+ /**
+ * 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.
+ *<p>
+ * _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.
+ *<p>
+ * _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");
+ *<p>
+ * _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;
+
+ if (inOrb == null && env != null) {
+ inOrb = (org.omg.CORBA.ORB) env.get("java.naming.corba.orb");
+ }
+
+ if (inOrb == null)
+ inOrb = getDefaultOrb(); // will create a default ORB if none exists
+
+ // Extract PROVIDER_URL from environment
+ String provUrl = null;
+ if (env != null) {
+ provUrl = (String)env.get(javax.naming.Context.PROVIDER_URL);
+ }
+
+ if (provUrl != null && !isCorbaUrl(provUrl)) {
+ // Initialize the root naming context by using the IOR supplied
+ // in the PROVIDER_URL
+ ncIor = getStringifiedIor(provUrl);
+ setOrbAndRootContext(inOrb, ncIor);
+ } else if (provUrl != null) {
+ // Initialize the root naming context by using the URL supplied
+ // in the PROVIDER_URL
+ String insName = initUsingUrl(inOrb, provUrl, env);
+
+ // If name supplied in URL, resolve it to a NamingContext
+ if (insName.length() > 0) {
+ _name = CNNameParser.nameToCosName(parser.parse(insName));
+ try {
+ org.omg.CORBA.Object obj = _nc.resolve(_name);
+ _nc = NamingContextHelper.narrow(obj);
+ if (_nc == null) {
+ 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");
+ } catch (Exception e) {
+ throw ExceptionMapper.mapException(e, this, _name);
+ }
+ }
+ } else {
+ // No PROVIDER_URL supplied; initialize using defaults
+ if (debug) {
+ System.err.println("Getting default ORB: " + inOrb + env);
+ }
+ setOrbAndRootContext(inOrb, (String)null);
+ }
+ }
+
+
+ private String initUsingUrl(ORB orb, String url, Hashtable<?,?> env)
+ throws NamingException {
+ if (url.startsWith("iiop://") || url.startsWith("iiopname://")) {
+ return initUsingIiopUrl(orb, url, env);
+ } else {
+ return initUsingCorbanameUrl(orb, url, env);
+ }
+ }
+
+ /**
+ * Handles "iiop" and "iiopname" URLs (INS 98-10-11)
+ */
+ private String initUsingIiopUrl(ORB defOrb, String url, Hashtable<?,?> env)
+ throws NamingException {
+
+ if (defOrb == null)
+ defOrb = getDefaultOrb();
+
+ try {
+ IiopUrl parsedUrl = new IiopUrl(url);
+
+ NamingException savedException = null;
+
+ for (IiopUrl.Address addr : parsedUrl.getAddresses()) {
+
+ try {
+ try {
+ 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);
+ setOrbAndRootContext(defOrb, rootCtx);
+ return parsedUrl.getStringName();
+ } catch (Exception e) {} // keep going
+
+ // Get ORB
+ if (debug) {
+ System.err.println("Getting ORB for " + addr.host
+ + " and port " + addr.port);
+ }
+
+ // Assign to fields
+ setOrbAndRootContext(defOrb, (String)null);
+ return parsedUrl.getStringName();
+
+ } catch (NamingException ne) {
+ savedException = ne;
+ }
+ }
+ if (savedException != null) {
+ throw savedException;
+ } else {
+ throw new ConfigurationException("Problem with URL: " + url);
+ }
+ } catch (MalformedURLException e) {
+ throw new ConfigurationException(e.getMessage());
+ }
+ }
+
+ /**
+ * Initializes using "corbaname" URL (INS 99-12-03)
+ */
+ private String initUsingCorbanameUrl(ORB orb, String url, Hashtable<?,?> env)
+ throws NamingException {
+
+ if (orb == null)
+ orb = getDefaultOrb();
+
+ try {
+ CorbanameUrl parsedUrl = new CorbanameUrl(url);
+
+ String corbaloc = parsedUrl.getLocation();
+ String cosName = parsedUrl.getStringName();
+
+ setOrbAndRootContext(orb, corbaloc);
+
+ return parsedUrl.getStringName();
+ } catch (MalformedURLException e) {
+ throw new ConfigurationException(e.getMessage());
+ }
+ }
+
+ private void setOrbAndRootContext(ORB orb, String ncIor)
+ throws NamingException {
+ _orb = orb;
+ try {
+ org.omg.CORBA.Object ncRef;
+ if (ncIor != null) {
+ if (debug) {
+ System.err.println("Passing to string_to_object: " + ncIor);
+ }
+ ncRef = _orb.string_to_object(ncIor);
+ } else {
+ ncRef = _orb.resolve_initial_references("NameService");
+ }
+ if (debug) {
+ System.err.println("Naming Context Ref: " + ncRef);
+ }
+ _nc = NamingContextHelper.narrow(ncRef);
+ if (_nc == null) {
+ if (ncIor != null) {
+ throw new ConfigurationException(
+ "Cannot convert IOR to a NamingContext: " + ncIor);
+ } else {
+ 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'");
+ ne.setRootCause(in);
+ throw ne;
+ } catch (org.omg.CORBA.COMM_FAILURE e) {
+ 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);
+ ne.setRootCause(e);
+ throw ne;
+ } catch (org.omg.CORBA.INV_OBJREF e) {
+ 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 {
+ _orb = orb;
+ try {
+ _nc = NamingContextHelper.narrow(ncRef);
+ if (_nc == null) {
+ 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");
+ ne.setRootCause(e);
+ throw ne;
+ }
+ }
+
+ private String getStringifiedIor(String url) throws NamingException {
+ if (url.startsWith("IOR:") || url.startsWith("corbaloc:")) {
+ return url;
+ } else {
+ InputStream in = null;
+ try {
+ URL u = new URL(url);
+ in = u.openStream();
+ if (in != null) {
+ BufferedReader bufin =
+ new BufferedReader(new InputStreamReader(in, "8859_1"));
+ String str;
+ while ((str = bufin.readLine()) != null) {
+ if (str.startsWith("IOR:")) {
+ return str;
+ }
+ }
+ }
+ } catch (IOException e) {
+ NamingException ne =
+ new ConfigurationException("Invalid URL: " + url);
+ ne.setRootCause(e);
+ throw ne;
+ } finally {
+ try {
+ if (in != null) {
+ in.close();
+ }
+ } catch (IOException e) {
+ NamingException ne =
+ new ConfigurationException("Invalid URL: " + url);
+ ne.setRootCause(e);
+ throw ne;
+ }
+ }
+ throw new ConfigurationException(url + " does not contain an IOR");
+ }
+ }
+
+
+ /**
+ * 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 {
+ 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) {
+ 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
+ */
+ public java.lang.Object lookup(String name) throws NamingException {
+ if (debug) {
+ System.out.println("Looking up: " + name);
+ }
+ return lookup(new CompositeName(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);
+ java.lang.Object answer = null;
+
+ try {
+ answer = callResolve(path);
+ try {
+ // Check whether object factory codebase is trusted
+ if (CorbaUtils.isObjectFactoryTrusted(answer)) {
+ answer = 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());
+ }
+ return answer;
+ }
+
+ /**
+ * 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 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);
+ }
+ 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");
+ }
+
+ 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);
+ }
+ }
+
+ 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;
+ RefAddr addr = ref.get("nns");
+ if (addr.getContent() instanceof javax.naming.Context) {
+ NamingException ne = new NameNotFoundException(
+ "No object reference bound for specified name");
+ ne.setRootCause(cpe.getRootCause());
+ ne.setRemainingName(cpe.getRemainingName());
+ throw ne;
+ }
+ }
+ throw e;
+ }
+ }
+
+ /**
+ * 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 "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.
+ */
+ 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 (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) {
+
+ // This test is not foolproof because some name servers
+ // always just return one component in rest_of_name
+ // so you might not be able to tell whether that is
+ // 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)));
+ }
+
+ /**
+ * 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());
+ }
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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<NameClassPair> 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.
+ */
+ @SuppressWarnings("unchecked")
+ public NamingEnumeration<NameClassPair> 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<javax.naming.Binding> 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<javax.naming.Binding> 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);
+ }
+
+ /**
+ * 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 {
+ 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;
+ }
+ }
+ 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);
+ }
+ }
+
+ /**
+ * 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());
+ }
+ }
+
+ /**
+ * 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);
+ }
+
+ /**
+ * 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 {
+ return parser;
+ }
+
+ /**
+ * Returns the current environment.
+ * @return Environment.
+ */
+ @SuppressWarnings("unchecked")
+ public Hashtable<String, java.lang.Object> getEnvironment() throws NamingException {
+ if (_env == null) {
+ return new Hashtable<>(5, 0.75f);
+ } else {
+ return (Hashtable<String, java.lang.Object>)_env.clone();
+ }
+ }
+
+ public String composeName(String name, String prefix) throws NamingException {
+ return composeName(new CompositeName(name),
+ new CompositeName(prefix)).toString();
+ }
+
+ public Name composeName(Name name, Name prefix) throws NamingException {
+ 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.
+ */
+ @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<String, java.lang.Object>)_env.clone();
+ }
+
+ 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<String, java.lang.Object>)_env.clone();
+ return _env.remove(propName);
+ }
+ return null;
+ }
+
+ synchronized public void incEnumCount() {
+ enumCount++;
+ if (debug) {
+ System.out.println("incEnumCount, new count:" + enumCount);
+ }
+ }
+
+ synchronized public void decEnumCount()
+ throws NamingException {
+ enumCount--;
+ if (debug) {
+ System.out.println("decEnumCount, new count:" + enumCount +
+ " isCloseCalled:" + isCloseCalled);
+ }
+ if ((enumCount == 0) && isCloseCalled) {
+ close();
+ }
+ }
+
+ synchronized public void close() throws NamingException {
+
+ if (enumCount > 0) {
+ isCloseCalled = true;
+ return;
+ }
+
+ // Never destroy an orb in CNCtx.
+ // The orb we have is either the shared/default orb, or one passed in to a constructor
+ // from elsewhere, so that orb is somebody else's responsibility.
+ }
+
+ protected void finalize() {
+ try {
+ close();
+ } catch (NamingException e) {
+ // ignore failures
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtxFactory.java b/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtxFactory.java
new file mode 100644
index 0000000..04bcf4d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNCtxFactory.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.cosnaming;
+
+import javax.naming.spi.InitialContextFactory;
+import javax.naming.*;
+
+import java.util.Hashtable;
+
+/**
+ * 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
+ */
+
+ public Context getInitialContext(Hashtable<?,?> env) throws NamingException {
+ return new CNCtx(env);
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java b/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java
new file mode 100644
index 0000000..2b41694
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/cosnaming/CNNameParser.java
@@ -0,0 +1,500 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.cosnaming;
+
+import javax.naming.*;
+import java.util.Properties;
+import java.util.Vector;
+import java.util.Enumeration;
+
+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.
+ *
+ * @author Rosanna Lee
+ */
+
+final public class CNNameParser implements NameParser {
+
+ private static final Properties mySyntax = new Properties();
+ private static final char kindSeparator = '.';
+ private static final char compSeparator = '/';
+ 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);
+ };
+
+ /**
+ * 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
+ */
+ public Name parse(String name) throws NamingException {
+ Vector<String> 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.
+ */
+ 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;
+ }
+
+ /**
+ * 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();
+ }
+
+ /**
+ * 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++) {
+ try {
+ nm.add(stringifyComponent(cname[i]));
+ } catch (InvalidNameException e) {
+ // ignore
+ }
+ }
+ return nm;
+ }
+
+ /**
+ * 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<String> insStringToStringifiedComps(String str)
+ throws InvalidNameException {
+
+ int len = str.length();
+ Vector<String> components = new Vector<>(10);
+ char[] id = new char[len];
+ char[] kind = new char[len];
+ int idCount, kindCount;
+ boolean idMode;
+ for (int i = 0; i < len; ) {
+ idCount = kindCount = 0; // reset for new component
+ 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))) {
+ ++i; // skip escape and let meta through
+ if (idMode) {
+ id[idCount++] = str.charAt(i++);
+ } else {
+ kind[kindCount++] = str.charAt(i++);
+ }
+ } else {
+ throw new InvalidNameException(str +
+ ": invalid character being escaped");
+ }
+
+ } else if (idMode && str.charAt(i) == kindSeparator) {
+ // just look for the first kindSeparator
+ ++i; // skip kind separator
+ idMode = false;
+
+ } else {
+ if (idMode) {
+ id[idCount++] = str.charAt(i++);
+ } else {
+ kind[kindCount++] = str.charAt(i++);
+ }
+ }
+ }
+ components.addElement(stringifyComponent(
+ new NameComponent(new String(id, 0, idCount),
+ new String(kind, 0, kindCount))));
+
+ if (i < len) {
+ ++i; // skip separator
+ }
+ }
+
+ return components;
+ }
+
+ /**
+ * Return a NameComponent given its stringified form.
+ */
+ private static NameComponent parseComponent(String compStr)
+ throws InvalidNameException {
+ NameComponent comp = new NameComponent();
+ int kindSep = -1;
+ int len = compStr.length();
+
+ int j = 0;
+ char[] newStr = new char[len];
+ boolean escaped = false;
+
+ // Find the kind separator
+ for (int i = 0; i < len && kindSep < 0; 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))) {
+ escaped = true;
+ } else {
+ throw new InvalidNameException(compStr +
+ ": invalid character being escaped");
+ }
+ } else if (compStr.charAt(i) == kindSeparator) {
+ kindSep = i;
+ } else {
+ newStr[j++] = compStr.charAt(i);
+ }
+ }
+
+ // Set id
+ comp.id = new String(newStr, 0, j);
+
+ // Set kind
+ if (kindSep < 0) {
+ comp.kind = ""; // no kind separator
+ } else {
+ // unescape kind
+ j = 0;
+ escaped = false;
+ 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))) {
+ escaped = true;
+ } else {
+ throw new InvalidNameException(compStr +
+ ": invalid character being escaped");
+ }
+ } else {
+ newStr[j++] = compStr.charAt(i);
+ }
+ }
+ comp.kind = new String(newStr, 0, j);
+ }
+ return comp;
+ }
+
+ private static String stringifyComponent(NameComponent comp) {
+ StringBuilder one = new StringBuilder(escape(comp.id));
+ if (comp.kind != null && !comp.kind.equals("")) {
+ one.append(kindSeparator).append(escape(comp.kind));
+ }
+ if (one.length() == 0) {
+ 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.
+ */
+ 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
+ } else {
+ int len = str.length();
+ int j = 0;
+ 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++] = str.charAt(i);
+ }
+ return new String(newStr, 0, j);
+ }
+ }
+
+ /**
+ * In INS, there are three meta characters: '.', '/' and '\'.
+ */
+ private static boolean isMeta(char ch) {
+ switch (ch) {
+ case kindSeparator:
+ case compSeparator:
+ case escapeChar:
+ return true;
+ }
+ return false;
+ }
+
+ /**
+ * An implementation of CompoundName that bypasses the parsing
+ * and stringifying code of the default CompoundName.
+ */
+ static final class CNCompoundName extends CompoundName {
+ CNCompoundName(Enumeration<String> enum_) {
+ super(enum_, CNNameParser.mySyntax);
+ }
+
+ public Object clone() {
+ return new CNCompoundName(getAll());
+ }
+
+ public Name getPrefix(int posn) {
+ Enumeration<String> comps = super.getPrefix(posn).getAll();
+ return new CNCompoundName(comps);
+ }
+
+ public Name getSuffix(int posn) {
+ Enumeration<String> comps = super.getSuffix(posn).getAll();
+ return new CNCompoundName(comps);
+ }
+
+ public String toString() {
+ try {
+ // Convert Name to NameComponent[] then stringify
+ return cosNameToInsString(nameToCosName(this));
+ } catch (InvalidNameException e) {
+ return super.toString();
+ }
+ }
+
+ private static final long serialVersionUID = -6599252802678482317L;
+ }
+
+// 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));
+ }
+*/
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/cosnaming/CorbanameUrl.java b/src/java.corba/share/classes/com/sun/jndi/cosnaming/CorbanameUrl.java
new file mode 100644
index 0000000..a24044a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/cosnaming/CorbanameUrl.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.cosnaming;
+
+import javax.naming.Name;
+import javax.naming.NamingException;
+
+import java.net.MalformedURLException;
+import com.sun.jndi.toolkit.corba.CorbaUtils;
+
+/**
+ * Extract components of a "corbaname" URL.
+ *
+ * The format of an corbaname URL is defined in INS 99-12-03 as follows.
+ * <pre>{@code
+ * corbaname url = "corbaname:" <corbaloc_obj> ["#" <string_name>]
+ * corbaloc_obj = <obj_addr_list> ["/" <key_string>]
+ * obj_addr_list = as defined in a corbaloc URL
+ * key_string = as defined in a corbaloc URL
+ * string_name = stringified COS name | empty_string
+ * }</pre>
+ * Characters in {@code <string_name>} are escaped as follows.
+ * US-ASCII alphanumeric characters are not escaped. Any characters outside
+ * of this range are escaped except for the following:
+ * <pre>{@code
+ * ; / : ? @ & = + $ , - _ . ! ~ * ; ( )
+ * }</pre>
+ * Escaped characters is escaped by using a % followed by its 2 hexadecimal
+ * numbers representing the octet.
+ * <p>
+ * 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 <corbaloc_obj>}.
+ * The COS name is {@code <string_name>} with the escaped characters resolved.
+ * <p>
+ * A corbaname URL is resolved by:
+ * <ol>
+ * <li>Construct a corbaloc URL by concatenating {@code "corbaloc:"} and {@code <corbaloc_obj>}.
+ * <li>Resolve the corbaloc URL to a NamingContext by using
+ * <pre>{@code
+ * nctx = ORB.string_to_object(corbalocUrl);
+ * }</pre>
+ * <li>Resolve {@code <string_name>} in the NamingContext.
+ * </ol>
+ *
+ * @author Rosanna Lee
+ */
+
+public final class CorbanameUrl {
+ private String stringName;
+ private String location;
+
+ /**
+ * Returns a possibly empty but non-null string that is the "string_name"
+ * portion of the URL.
+ */
+ public String getStringName() {
+ return stringName;
+ }
+
+ public Name getCosName() throws NamingException {
+ return CNCtx.parser.parse(stringName);
+ }
+
+ public String getLocation() {
+ return "corbaloc:" + location;
+ }
+
+ public CorbanameUrl(String url) throws MalformedURLException {
+
+ if (!url.startsWith("corbaname:")) {
+ throw new MalformedURLException("Invalid corbaname URL: " + url);
+ }
+
+ int addrStart = 10; // "corbaname:"
+
+ int addrEnd = url.indexOf('#', addrStart);
+ if (addrEnd < 0) {
+ addrEnd = url.length();
+ stringName = "";
+ } else {
+ 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)) {
+ 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();
+ }
+ }
+*/
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java b/src/java.corba/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java
new file mode 100644
index 0000000..1f626d5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/cosnaming/ExceptionMapper.java
@@ -0,0 +1,247 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.cosnaming;
+
+import javax.naming.*;
+import javax.naming.directory.*;
+import javax.naming.spi.*;
+
+import org.omg.CosNaming.*;
+import org.omg.CosNaming.NamingContextPackage.*;
+import org.omg.CORBA.*;
+
+import com.sun.jndi.toolkit.corba.CorbaUtils;
+
+/**
+ * A convenience class to map the COS Naming exceptions to the JNDI exceptions.
+ * @author Raj Krishnamurthy
+ */
+
+public final class ExceptionMapper {
+ private ExceptionMapper() {} // ensure no instance
+ private static final boolean debug = false;
+
+ public static final NamingException mapException(Exception e,
+ CNCtx ctx, NameComponent[] inputName) throws NamingException {
+ if (e instanceof NamingException) {
+ return (NamingException)e;
+ }
+
+ if (e instanceof RuntimeException) {
+ throw (RuntimeException)e;
+ }
+
+ NamingException ne;
+ if (e instanceof NotFound) {
+ if (ctx.federation) {
+ return tryFed((NotFound)e, ctx, inputName);
+
+ } else {
+ ne = new NameNotFoundException();
+ }
+
+ } else if (e instanceof CannotProceed) {
+
+ ne = new CannotProceedException();
+ NamingContext nc = ((CannotProceed) e).cxt;
+ NameComponent[] rest = ((CannotProceed) e).rest_of_name;
+
+ // %%% We assume that rest returns *all* unprocessed components.
+ // 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];
+ 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)));
+ } else {
+ ne.setResolvedObj(ctx);
+ }
+
+ ne.setRemainingName(CNNameParser.cosNameToName(rest));
+
+ } else if (e instanceof InvalidName) {
+ ne = new InvalidNameException();
+ } else if (e instanceof AlreadyBound) {
+ ne = new NameAlreadyBoundException();
+ } else if (e instanceof NotEmpty) {
+ ne = new ContextNotEmptyException();
+ } else {
+ ne = new NamingException("Unknown reasons");
+ }
+
+ ne.setRootCause(e);
+ return ne;
+ }
+
+ private static final NamingException tryFed(NotFound e, CNCtx ctx,
+ NameComponent[] inputName) throws NamingException {
+ NameComponent[] rest = e.rest_of_name;
+
+ if (debug) {
+ System.out.println(e.why.value());
+ System.out.println(rest.length);
+ }
+
+ // %%% Using 1.2 & 1.3 Sun's tnameserv, 'rest' contains only the first
+ // component that failed, not *rest* as advertized. This is useless
+ // because what if you have something like aa/aa/aa/aa/aa.
+ // 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)) {
+ // Might be legit
+ ;
+ } else {
+ // Due to 1.2/1.3 bug that always returns single-item 'rest'
+ NamingException ne = new NameNotFoundException();
+ ne.setRemainingName(CNNameParser.cosNameToName(rest));
+ ne.setRootCause(e);
+ throw ne;
+ }
+ }
+ // Fixed in 1.4; perform calculations based on correct (1.4) behavior
+
+ // Calculate the components of the name that has been resolved
+ NameComponent[] resolvedName = null;
+ int len = 0;
+ if (inputName != null && (inputName.length >= rest.length)) {
+
+ if (e.why == NotFoundReason.not_context) {
+ // First component of rest is found but not a context; keep it
+ // as part of resolved name
+ len = inputName.length - (rest.length - 1);
+
+ // Remove resolved component from rest
+ if (rest.length == 1) {
+ // No more remaining
+ rest = null;
+ } else {
+ NameComponent[] tmp = new NameComponent[rest.length-1];
+ System.arraycopy(rest, 1, tmp, 0, tmp.length);
+ rest = tmp;
+ }
+ } else {
+ len = inputName.length - rest.length;
+ }
+
+ if (len > 0) {
+ resolvedName = new NameComponent[len];
+ System.arraycopy(inputName, 0, resolvedName, 0, len);
+ }
+ }
+
+ // Create CPE and set common fields
+ CannotProceedException cpe = new CannotProceedException();
+ cpe.setRootCause(e);
+ if (rest != null && rest.length > 0) {
+ cpe.setRemainingName(CNNameParser.cosNameToName(rest));
+ }
+ cpe.setEnvironment(ctx._env);
+
+ if (debug) {
+ System.out.println("rest of name: " + cpe.getRemainingName());
+ }
+
+ // Lookup resolved name to get resolved object
+ 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
+ // try getting its nns dynamically by constructing
+ // a Reference containing obj.
+ RefAddr addr = new RefAddr("nns") {
+ public java.lang.Object getContent() {
+ return resolvedObj;
+ }
+ private static final long serialVersionUID =
+ 669984699392133792L;
+ };
+ Reference ref = new Reference("java.lang.Object", addr);
+
+ // Resolved name has trailing slash to indicate nns
+ CompositeName cname = new CompositeName();
+ cname.add(""); // add trailing slash
+
+ cpe.setResolvedObj(ref);
+ cpe.setAltName(cname);
+ cpe.setAltNameCtx((javax.naming.Context)resolvedObj);
+
+ return cpe;
+ } else {
+ // Not a context, use object factory to transform object.
+
+ Name cname = CNNameParser.cosNameToName(resolvedName);
+ java.lang.Object resolvedObj2 = null;
+ try {
+ // Check whether object factory codebase is trusted
+ if (CorbaUtils.isObjectFactoryTrusted(resolvedObj)) {
+ 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");
+ ne.setRootCause(ge);
+ throw ne;
+ }
+
+ // If a context, continue operation with context
+ if (resolvedObj2 instanceof javax.naming.Context) {
+ cpe.setResolvedObj(resolvedObj2);
+ } else {
+ // Add trailing slash
+ cname.add("");
+ cpe.setAltName(cname);
+
+ // Create nns reference
+ final java.lang.Object rf2 = resolvedObj2;
+ RefAddr addr = new RefAddr("nns") {
+ public java.lang.Object getContent() {
+ return rf2;
+ }
+ private static final long serialVersionUID =
+ -785132553978269772L;
+ };
+ Reference ref = new Reference("java.lang.Object", addr);
+ cpe.setResolvedObj(ref);
+ cpe.setAltNameCtx(ctx);
+ }
+ return cpe;
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/cosnaming/IiopUrl.java b/src/java.corba/share/classes/com/sun/jndi/cosnaming/IiopUrl.java
new file mode 100644
index 0000000..d328f52
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/cosnaming/IiopUrl.java
@@ -0,0 +1,228 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.cosnaming;
+
+import javax.naming.Name;
+import javax.naming.NamingException;
+
+import java.net.MalformedURLException;
+import java.util.Vector;
+import java.util.StringTokenizer;
+import com.sun.jndi.toolkit.corba.CorbaUtils;
+
+/**
+ * Extract components of an "iiop" or "iiopname" URL.
+ *
+ * The format of an iiopname URL is defined in INS 98-10-11 as follows:
+ *
+ * <pre>
+ * iiopname url = "iiopname://" [addr_list]["/" string_name]
+ * addr_list = [address ","]* address
+ * address = [version host [":" port]]
+ * host = DNS style host name | IP address
+ * version = major "." minor "@" | empty_string
+ * port = number
+ * major = number
+ * minor = number
+ * string_name = stringified name | empty_string
+ * </pre>
+ *
+ * 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:
+ * <pre>{@code
+ * ; / : ? : @ & = + $ , - _ . ! ~ * ' ( )
+ * }</pre>
+ * 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:
+ * <pre>{@code
+ * iiop url = "iiop://" [host [":" port]] ["/" string_name]
+ * }</pre>
+ * The default port is 900.
+ *
+ * @author Rosanna Lee
+ */
+
+public final class IiopUrl {
+ static final private int DEFAULT_IIOPNAME_PORT = 9999;
+ static final private int DEFAULT_IIOP_PORT = 900;
+ static final private String DEFAULT_HOST = "localhost";
+ private Vector<Address> addresses;
+ private String stringName;
+
+ public static class Address {
+ public int port = -1;
+ public int major, minor;
+ public String host;
+
+ public Address(String hostPortVers, boolean oldFormat)
+ throws MalformedURLException {
+ // [version host [":" port]]
+ int start;
+
+ // Parse version
+ int at;
+ if (oldFormat || (at = hostPortVers.indexOf('@')) < 0) {
+ major = 1;
+ minor = 0;
+ start = 0; // start at the beginning
+ } else {
+ int dot = hostPortVers.indexOf('.');
+ if (dot < 0) {
+ throw new MalformedURLException(
+ "invalid version: " + hostPortVers);
+ }
+ try {
+ major = Integer.parseInt(hostPortVers.substring(0, dot));
+ minor = Integer.parseInt(hostPortVers.substring(dot+1, at));
+ } catch (NumberFormatException e) {
+ throw new MalformedURLException(
+ "Nonnumeric version: " + hostPortVers);
+ }
+ start = at + 1; // skip '@' sign
+ }
+
+ // Parse host and port
+ int slash = hostPortVers.indexOf('/', start);
+ if (slash < 0) {
+ slash = hostPortVers.length();
+ }
+ 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);
+ }
+
+ // include brackets
+ host = hostPortVers.substring(start, brac + 1);
+ start = brac + 1;
+ } else { // at hostname or IPv4
+ int colon = hostPortVers.indexOf(':', start);
+ int hostEnd = (colon < 0 || colon > slash)
+ ? slash
+ : colon;
+ if (start < hostEnd) {
+ host = hostPortVers.substring(start, hostEnd);
+ }
+ 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));
+ } else {
+ throw new IllegalArgumentException(
+ "IiopURL: name is an Invalid URL: " + hostPortVers);
+ }
+ }
+ start = slash;
+ if ("".equals(host) || host == null) {
+ host = DEFAULT_HOST ;
+ }
+ if (port == -1) {
+ port = (oldFormat ? DEFAULT_IIOP_PORT :
+ DEFAULT_IIOPNAME_PORT);
+ }
+ }
+ }
+
+ public Vector<Address> getAddresses() {
+ return addresses;
+ }
+
+ /**
+ * Returns a possibly empty but non-null string that is the "string_name"
+ * portion of the URL.
+ */
+ public String getStringName() {
+ return stringName;
+ }
+
+ public Name getCosName() throws NamingException {
+ return CNCtx.parser.parse(stringName);
+ }
+
+ public IiopUrl(String url) throws MalformedURLException {
+ int addrStart;
+ boolean oldFormat;
+
+ if (url.startsWith("iiopname://")) {
+ oldFormat = false;
+ addrStart = 11;
+ } else if (url.startsWith("iiop://")) {
+ oldFormat = true;
+ addrStart = 7;
+ } else {
+ throw new MalformedURLException("Invalid iiop/iiopname URL: " + url);
+ }
+ int addrEnd = url.indexOf('/', addrStart);
+ if (addrEnd < 0) {
+ addrEnd = url.length();
+ stringName = "";
+ } else {
+ 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));
+ } else {
+ StringTokenizer tokens =
+ new StringTokenizer(url.substring(addrStart, addrEnd), ",");
+ while (tokens.hasMoreTokens()) {
+ addresses.addElement(new Address(tokens.nextToken(), oldFormat));
+ }
+ if (addresses.size() == 0) {
+ addresses.addElement(new Address("", oldFormat));
+ }
+ }
+ }
+
+ // 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();
+ }
+ } */
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/cosnaming/OrbReuseTracker.java b/src/java.corba/share/classes/com/sun/jndi/cosnaming/OrbReuseTracker.java
new file mode 100644
index 0000000..25063e7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/cosnaming/OrbReuseTracker.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.cosnaming;
+
+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.
+ */
+class OrbReuseTracker {
+
+ int referenceCnt;
+ ORB orb;
+
+ private static final boolean debug = false;
+
+ OrbReuseTracker(ORB orb) {
+ this.orb = orb;
+ referenceCnt++;
+ if (debug) {
+ System.out.println("New OrbReuseTracker created");
+ }
+ }
+
+ synchronized void incRefCount() {
+ referenceCnt++;
+ if (debug) {
+ System.out.println("Increment orb ref count to:" + referenceCnt);
+ }
+ }
+
+ synchronized void decRefCount() {
+ referenceCnt--;
+ if (debug) {
+ System.out.println("Decrement orb ref count to:" + referenceCnt);
+ }
+ if ((referenceCnt == 0)) {
+ if (debug) {
+ System.out.println("Destroying the ORB");
+ }
+ orb.destroy();
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/cosnaming/RemoteToCorba.java b/src/java.corba/share/classes/com/sun/jndi/cosnaming/RemoteToCorba.java
new file mode 100644
index 0000000..9f8414a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/cosnaming/RemoteToCorba.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.cosnaming;
+
+import javax.naming.*;
+import javax.naming.spi.StateFactory;
+import java.util.Hashtable;
+
+import org.omg.CORBA.ORB;
+
+import java.rmi.Remote;
+import java.rmi.server.ExportException;
+
+import com.sun.jndi.toolkit.corba.CorbaUtils; // for RMI-IIOP
+
+/**
+ * StateFactory that turns java.rmi.Remote objects to org.omg.CORBA.Object.
+ *
+ * @author Rosanna Lee
+ */
+
+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.
+ *
+ * @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.
+ */
+ public Object getStateToBind(Object orig, Name name, Context ctx,
+ Hashtable<?,?> env) throws NamingException {
+ 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);
+ }
+ return null; // pass and let next state factory try
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties b/src/java.corba/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties
new file mode 100644
index 0000000..23ace2d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/cosnaming/jndiprovider.properties
@@ -0,0 +1,4 @@
+# Provider resource file for the COS Naming service provider.
+
+# State factory to turn java.rmi.Remote into org.omg.CORBA.Object.
+java.naming.factory.state=com.sun.jndi.cosnaming.RemoteToCorba
diff --git a/src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java b/src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java
new file mode 100644
index 0000000..856ce9d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/toolkit/corba/CorbaUtils.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.toolkit.corba;
+
+// Needed for RMI/IIOP
+import java.rmi.Remote;
+
+import java.rmi.RemoteException;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.Enumeration;
+import java.applet.Applet;
+
+import org.omg.CORBA.ORB;
+
+import javax.naming.*;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.PortableRemoteObject;
+
+import com.sun.jndi.cosnaming.CNCtx;
+
+import java.io.UnsupportedEncodingException;
+import java.net.MalformedURLException;
+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
+ */
+
+public class CorbaUtils {
+ /**
+ * Returns the CORBA object reference associated with a Remote
+ * object by using the javax.rmi.CORBA package.
+ *<p>
+ * This method effective does the following:
+ * <blockquote><pre>
+ * 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;
+ * </pre></blockquote>
+ *
+ * @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);
+
+ 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;
+ }
+
+// Next, make sure that the stub is javax.rmi.CORBA.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;
+ }
+// Finally, return 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
+ * @return A non-null ORB.
+ */
+ public static ORB getOrb(String server, int port, Hashtable<?,?> env) {
+ // See if we can get info from environment
+ Properties orbProp;
+
+ // Extract any org.omg.CORBA properties from environment
+ if (env != null) {
+ if (env instanceof Properties) {
+ // Already a Properties, just clone
+ orbProp = (Properties) env.clone();
+ } else {
+ // Get all String properties
+ Enumeration<?> envProp;
+ orbProp = new Properties();
+ for (envProp = env.keys(); envProp.hasMoreElements();) {
+ String key = (String)envProp.nextElement();
+ Object val = env.get(key);
+ if (val instanceof String) {
+ orbProp.put(key, val);
+ }
+ }
+ }
+ } else {
+ orbProp = new Properties();
+ }
+
+ if (server != null) {
+ orbProp.put("org.omg.CORBA.ORBInitialHost", server);
+ }
+ if (port >= 0) {
+ orbProp.put("org.omg.CORBA.ORBInitialPort", ""+port);
+ }
+
+ // Get Applet from environment
+ if (env != null) {
+ @SuppressWarnings("deprecation")
+ Applet applet = (Applet) env.get(Context.APPLET);
+ if (applet != null) {
+ // Create ORBs using applet and orbProp
+ return ORB.init(applet, orbProp);
+ }
+ }
+
+ return ORB.init(new String[0], orbProp);
+ }
+
+ /**
+ * Check whether object factory code base is trusted.
+ * Classes may only be loaded from an arbitrary URL code base when
+ * the system property com.sun.jndi.rmi.object.trustURLCodebase
+ * has been set to "true".
+ */
+ public static boolean isObjectFactoryTrusted(Object obj)
+ throws NamingException {
+
+ // Extract Reference, if possible
+ Reference ref = null;
+ if (obj instanceof Reference) {
+ ref = (Reference) obj;
+ } else if (obj instanceof Referenceable) {
+ ref = ((Referenceable)(obj)).getReference();
+ }
+
+ if (ref != null && ref.getFactoryClassLocation() != null &&
+ !CNCtx.trustURLCodebase) {
+ throw new ConfigurationException(
+ "The object factory is untrusted. Set the system property" +
+ " 'com.sun.jndi.cosnaming.object.trustURLCodebase' to 'true'.");
+ }
+ return true;
+ }
+
+ /**
+ * Decode a URI string (according to RFC 2396).
+ */
+ public static final String decode(String s) throws MalformedURLException {
+ try {
+ return decode(s, "8859_1");
+ } catch (UnsupportedEncodingException e) {
+ // ISO-Latin-1 should always be available?
+ throw new MalformedURLException("ISO-Latin-1 decoder unavailable");
+ }
+ }
+
+ /**
+ * 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.
+ *
+ * The string is subsequently converted using the specified encoding
+ */
+ public static final String decode(String s, String enc)
+ throws MalformedURLException, UnsupportedEncodingException {
+ try {
+ return URLDecoder.decode(s, enc);
+ } catch (IllegalArgumentException iae) {
+ MalformedURLException mue = new MalformedURLException("Invalid URI encoding: " + s);
+ mue.initCause(iae);
+ throw mue;
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/url/corbaname/corbanameURLContextFactory.java b/src/java.corba/share/classes/com/sun/jndi/url/corbaname/corbanameURLContextFactory.java
new file mode 100644
index 0000000..f5df93a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/url/corbaname/corbanameURLContextFactory.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.url.corbaname;
+
+import com.sun.jndi.url.iiop.iiopURLContextFactory;
+
+/**
+ * A corbaname URL context factory.
+ * It just uses the iiop URL context factory but is needed here
+ * so that NamingManager.getURLContext() will find it.
+ *
+ * @author Rosanna Lee
+ */
+final public class corbanameURLContextFactory extends iiopURLContextFactory {
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/url/iiop/GenericURLContext.java b/src/java.corba/share/classes/com/sun/jndi/url/iiop/GenericURLContext.java
new file mode 100644
index 0000000..1c78b92
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/url/iiop/GenericURLContext.java
@@ -0,0 +1,537 @@
+/*
+ * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.url.iiop;
+
+import com.sun.jndi.toolkit.corba.CorbaUtils;
+
+import javax.naming.*;
+import javax.naming.spi.ResolveResult;
+import javax.naming.spi.NamingManager;
+
+import java.util.Hashtable;
+import java.net.MalformedURLException;
+
+/**
+ * This abstract class is a generic URL context that accepts as the
+ * name argument either a string URL or a Name whose first component
+ * is a URL. It resolves the URL to a target context and then continues
+ * the operation using the remaining name in the target context as if
+ * the first component names a junction.
+ *
+ * A subclass must define getRootURLContext()
+ * to process the URL into head/tail pieces. If it wants to control how
+ * URL strings are parsed and compared for the rename() operation, then
+ * it should override getNonRootURLSuffixes() and urlEquals().
+ *
+ * @author Scott Seligman
+ * @author Rosanna Lee
+ */
+abstract public class GenericURLContext implements Context {
+ protected Hashtable<String, Object> myEnv = null;
+
+ @SuppressWarnings("unchecked") // Expect Hashtable<String, Object>
+ public GenericURLContext(Hashtable<?,?> env) {
+ // context that is not tied to any specific URL
+ myEnv =
+ (Hashtable<String, Object>)(env == null ? null : env.clone());
+ }
+
+ public void close() throws NamingException {
+ myEnv = null;
+ }
+
+ public String getNameInNamespace() throws NamingException {
+ return ""; // %%% check this out: A URL context's name is ""
+ }
+
+ /**
+ * Resolves 'name' into a target context with remaining name.
+ * For example, with a JNDI URL "jndi://dnsname/rest_name",
+ * this method resolves "jndi://dnsname/" to a target context,
+ * and returns the target context with "rest_name".
+ * The definition of "root URL" and how much of the URL to
+ * consume is implementation specific.
+ * If rename() is supported for a particular URL scheme,
+ * getRootURLContext(), getURLPrefix(), and getURLSuffix()
+ * must be in sync wrt how URLs are parsed and returned.
+ */
+ abstract protected ResolveResult getRootURLContext(String url,
+ Hashtable<?,?> env) throws NamingException;
+
+ /**
+ * Returns the suffix of the url. The result should be identical to
+ * that of calling getRootURLContext().getRemainingName(), but
+ * without the overhead of doing anything with the prefix like
+ * creating a context.
+ *<p>
+ * This method returns a Name instead of a String because to give
+ * the provider an opportunity to return a Name (for example,
+ * for weakly separated naming systems like COS naming).
+ *<p>
+ * The default implementation uses skips 'prefix', calls
+ * CorbaUtils.decode() on it, and returns the result as a single component
+ * CompositeName.
+ * Subclass should override if this is not appropriate.
+ * This method is used only by rename().
+ * If rename() is supported for a particular URL scheme,
+ * getRootURLContext(), getURLPrefix(), and getURLSuffix()
+ * must be in sync wrt how URLs are parsed and returned.
+ *<p>
+ * For many URL schemes, this method is very similar to URL.getFile(),
+ * except getFile() will return a leading slash in the
+ * 2nd, 3rd, and 4th cases. For schemes like "ldap" and "iiop",
+ * the leading slash must be skipped before the name is an acceptable
+ * format for operation by the Context methods. For schemes that treat the
+ * leading slash as significant (such as "file"),
+ * the subclass must override getURLSuffix() to get the correct behavior.
+ * Remember, the behavior must match getRootURLContext().
+ *
+ * <pre>{@code
+ * URL Suffix
+ * foo://host:port <empty string>
+ * foo://host:port/rest/of/name rest/of/name
+ * foo:///rest/of/name rest/of/name
+ * foo:/rest/of/name rest/of/name
+ * foo:rest/of/name rest/of/name
+ * }</pre>
+ */
+ protected Name getURLSuffix(String prefix, String url) throws NamingException {
+ String suffix = url.substring(prefix.length());
+ if (suffix.length() == 0) {
+ return new CompositeName();
+ }
+
+ if (suffix.charAt(0) == '/') {
+ suffix = suffix.substring(1); // skip leading slash
+ }
+
+ try {
+ return new CompositeName().add(CorbaUtils.decode(suffix));
+ } catch (MalformedURLException e) {
+ throw new InvalidNameException(e.getMessage());
+ }
+ }
+
+ /**
+ * Finds the prefix of a URL.
+ * Default implementation looks for slashes and then extracts
+ * prefixes using String.substring().
+ * Subclass should override if this is not appropriate.
+ * This method is used only by rename().
+ * If rename() is supported for a particular URL scheme,
+ * getRootURLContext(), getURLPrefix(), and getURLSuffix()
+ * must be in sync wrt how URLs are parsed and returned.
+ *<p>
+ * URL Prefix
+ * foo://host:port foo://host:port
+ * foo://host:port/rest/of/name foo://host:port
+ * foo:///rest/of/name foo://
+ * foo:/rest/of/name foo:
+ * foo:rest/of/name foo:
+ */
+ protected String getURLPrefix(String url) throws NamingException {
+ int start = url.indexOf(':');
+
+ if (start < 0) {
+ throw new OperationNotSupportedException("Invalid URL: " + url);
+ }
+ ++start; // skip ':'
+
+ if (url.startsWith("//", start)) {
+ start += 2; // skip double slash
+
+ // find last slash
+ int posn = url.indexOf('/', start);
+ if (posn >= 0) {
+ start = posn;
+ } else {
+ start = url.length(); // rest of URL
+ }
+ }
+
+ // else 0 or 1 initial slashes; start is unchanged
+ return url.substring(0, start);
+ }
+
+ /**
+ * Determines whether two URLs are the same.
+ * Default implementation uses String.equals().
+ * Subclass should override if this is not appropriate.
+ * This method is used by rename().
+ */
+ protected boolean urlEquals(String url1, String url2) {
+ return url1.equals(url2);
+ }
+
+ /**
+ * Gets the context in which to continue the operation. This method
+ * is called when this context is asked to process a multicomponent
+ * Name in which the first component is a URL.
+ * Treat the first component like a junction: resolve it and then use
+ * NamingManager.getContinuationContext() to get the target context in
+ * which to operate on the remainder of the name (n.getSuffix(1)).
+ */
+ protected Context getContinuationContext(Name n) throws NamingException {
+ Object obj = lookup(n.get(0));
+ CannotProceedException cpe = new CannotProceedException();
+ cpe.setResolvedObj(obj);
+ cpe.setEnvironment(myEnv);
+ return NamingManager.getContinuationContext(cpe);
+ }
+
+ public Object lookup(String name) throws NamingException {
+ ResolveResult res = getRootURLContext(name, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ return ctx.lookup(res.getRemainingName());
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public Object lookup(Name name) throws NamingException {
+ if (name.size() == 1) {
+ return lookup(name.get(0));
+ } else {
+ Context ctx = getContinuationContext(name);
+ try {
+ return ctx.lookup(name.getSuffix(1));
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public void bind(String name, Object obj) throws NamingException {
+ ResolveResult res = getRootURLContext(name, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ ctx.bind(res.getRemainingName(), obj);
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public void bind(Name name, Object obj) throws NamingException {
+ if (name.size() == 1) {
+ bind(name.get(0), obj);
+ } else {
+ Context ctx = getContinuationContext(name);
+ try {
+ ctx.bind(name.getSuffix(1), obj);
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public void rebind(String name, Object obj) throws NamingException {
+ ResolveResult res = getRootURLContext(name, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ ctx.rebind(res.getRemainingName(), obj);
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public void rebind(Name name, Object obj) throws NamingException {
+ if (name.size() == 1) {
+ rebind(name.get(0), obj);
+ } else {
+ Context ctx = getContinuationContext(name);
+ try {
+ ctx.rebind(name.getSuffix(1), obj);
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public void unbind(String name) throws NamingException {
+ ResolveResult res = getRootURLContext(name, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ ctx.unbind(res.getRemainingName());
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public void unbind(Name name) throws NamingException {
+ if (name.size() == 1) {
+ unbind(name.get(0));
+ } else {
+ Context ctx = getContinuationContext(name);
+ try {
+ ctx.unbind(name.getSuffix(1));
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public void rename(String oldName, String newName) throws NamingException {
+ String oldPrefix = getURLPrefix(oldName);
+ String newPrefix = getURLPrefix(newName);
+ if (!urlEquals(oldPrefix, newPrefix)) {
+ throw new OperationNotSupportedException(
+ "Renaming using different URL prefixes not supported : " +
+ oldName + " " + newName);
+ }
+
+ ResolveResult res = getRootURLContext(oldName, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ ctx.rename(res.getRemainingName(), getURLSuffix(newPrefix, newName));
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public void rename(Name name, Name newName) throws NamingException {
+ if (name.size() == 1) {
+ if (newName.size() != 1) {
+ throw new OperationNotSupportedException(
+ "Renaming to a Name with more components not supported: " + newName);
+ }
+ rename(name.get(0), newName.get(0));
+ } else {
+ // > 1 component with 1st one being URL
+ // URLs must be identical; cannot deal with diff URLs
+ if (!urlEquals(name.get(0), newName.get(0))) {
+ throw new OperationNotSupportedException(
+ "Renaming using different URLs as first components not supported: " +
+ name + " " + newName);
+ }
+
+ Context ctx = getContinuationContext(name);
+ try {
+ ctx.rename(name.getSuffix(1), newName.getSuffix(1));
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public NamingEnumeration<NameClassPair> list(String name) throws NamingException {
+ ResolveResult res = getRootURLContext(name, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ return ctx.list(res.getRemainingName());
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public NamingEnumeration<NameClassPair> list(Name name) throws NamingException {
+ if (name.size() == 1) {
+ return list(name.get(0));
+ } else {
+ Context ctx = getContinuationContext(name);
+ try {
+ return ctx.list(name.getSuffix(1));
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public NamingEnumeration<Binding> listBindings(String name)
+ throws NamingException {
+ ResolveResult res = getRootURLContext(name, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ return ctx.listBindings(res.getRemainingName());
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public NamingEnumeration<Binding> listBindings(Name name) throws NamingException {
+ if (name.size() == 1) {
+ return listBindings(name.get(0));
+ } else {
+ Context ctx = getContinuationContext(name);
+ try {
+ return ctx.listBindings(name.getSuffix(1));
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public void destroySubcontext(String name) throws NamingException {
+ ResolveResult res = getRootURLContext(name, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ ctx.destroySubcontext(res.getRemainingName());
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public void destroySubcontext(Name name) throws NamingException {
+ if (name.size() == 1) {
+ destroySubcontext(name.get(0));
+ } else {
+ Context ctx = getContinuationContext(name);
+ try {
+ ctx.destroySubcontext(name.getSuffix(1));
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public Context createSubcontext(String name) throws NamingException {
+ ResolveResult res = getRootURLContext(name, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ return ctx.createSubcontext(res.getRemainingName());
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public Context createSubcontext(Name name) throws NamingException {
+ if (name.size() == 1) {
+ return createSubcontext(name.get(0));
+ } else {
+ Context ctx = getContinuationContext(name);
+ try {
+ return ctx.createSubcontext(name.getSuffix(1));
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public Object lookupLink(String name) throws NamingException {
+ ResolveResult res = getRootURLContext(name, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ return ctx.lookupLink(res.getRemainingName());
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public Object lookupLink(Name name) throws NamingException {
+ if (name.size() == 1) {
+ return lookupLink(name.get(0));
+ } else {
+ Context ctx = getContinuationContext(name);
+ try {
+ return ctx.lookupLink(name.getSuffix(1));
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public NameParser getNameParser(String name) throws NamingException {
+ ResolveResult res = getRootURLContext(name, myEnv);
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ return ctx.getNameParser(res.getRemainingName());
+ } finally {
+ ctx.close();
+ }
+ }
+
+ public NameParser getNameParser(Name name) throws NamingException {
+ if (name.size() == 1) {
+ return getNameParser(name.get(0));
+ } else {
+ Context ctx = getContinuationContext(name);
+ try {
+ return ctx.getNameParser(name.getSuffix(1));
+ } finally {
+ ctx.close();
+ }
+ }
+ }
+
+ public String composeName(String name, String prefix)
+ throws NamingException {
+ if (prefix.equals("")) {
+ return name;
+ } else if (name.equals("")) {
+ return prefix;
+ } else {
+ return (prefix + "/" + name);
+ }
+ }
+
+ public Name composeName(Name name, Name prefix) throws NamingException {
+ Name result = (Name)prefix.clone();
+ result.addAll(name);
+ return result;
+ }
+
+ public Object removeFromEnvironment(String propName)
+ throws NamingException {
+ if (myEnv == null) {
+ return null;
+ }
+ return myEnv.remove(propName);
+ }
+
+ public Object addToEnvironment(String propName, Object propVal)
+ throws NamingException {
+ if (myEnv == null) {
+ myEnv = new Hashtable<String, Object>(11, 0.75f);
+ }
+ return myEnv.put(propName, propVal);
+ }
+
+ @SuppressWarnings("unchecked") // clone()
+ public Hashtable<String, Object> getEnvironment() throws NamingException {
+ if (myEnv == null) {
+ return new Hashtable<>(5, 0.75f);
+ } else {
+ return (Hashtable<String, Object>)myEnv.clone();
+ }
+ }
+
+/*
+// To test, declare getURLPrefix and getURLSuffix static.
+
+ public static void main(String[] args) throws Exception {
+ String[] tests = {"file://host:port",
+ "file:///rest/of/name",
+ "file://host:port/rest/of/name",
+ "file:/rest/of/name",
+ "file:rest/of/name"};
+ for (int i = 0; i < tests.length; i++) {
+ String pre = getURLPrefix(tests[i]);
+ System.out.println(pre);
+ System.out.println(getURLSuffix(pre, tests[i]));
+ }
+ }
+*/
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/url/iiop/iiopURLContext.java b/src/java.corba/share/classes/com/sun/jndi/url/iiop/iiopURLContext.java
new file mode 100644
index 0000000..2f83f4a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/url/iiop/iiopURLContext.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.url.iiop;
+
+import javax.naming.spi.ResolveResult;
+import javax.naming.*;
+import java.util.Hashtable;
+import java.net.MalformedURLException;
+
+import com.sun.jndi.cosnaming.IiopUrl;
+import com.sun.jndi.cosnaming.CorbanameUrl;
+
+/**
+ * An IIOP URL context.
+ *
+ * @author Rosanna Lee
+ */
+
+public class iiopURLContext
+ extends GenericURLContext {
+
+ iiopURLContext(Hashtable<?,?> env) {
+ super(env);
+ }
+
+ /**
+ * Resolves 'name' into a target context with remaining name.
+ * It only resolves the hostname/port number. The remaining name
+ * contains the rest of the name found in the URL.
+ *
+ * For example, with a iiop URL "iiop://localhost:900/rest/of/name",
+ * this method resolves "iiop://localhost:900/" to the "NameService"
+ * context on for the ORB at 'localhost' on port 900,
+ * and returns as the remaining name "rest/of/name".
+ */
+ protected ResolveResult getRootURLContext(String name, Hashtable<?,?> env)
+ throws NamingException {
+ return iiopURLContextFactory.getUsingURLIgnoreRest(name, env);
+ }
+
+ /**
+ * Return the suffix of an "iiop", "iiopname", or "corbaname" url.
+ * prefix parameter is ignored.
+ */
+ protected Name getURLSuffix(String prefix, String url)
+ throws NamingException {
+ try {
+ if (url.startsWith("iiop://") || url.startsWith("iiopname://")) {
+ IiopUrl parsedUrl = new IiopUrl(url);
+ return parsedUrl.getCosName();
+ } else if (url.startsWith("corbaname:")) {
+ CorbanameUrl parsedUrl = new CorbanameUrl(url);
+ return parsedUrl.getCosName();
+ } else {
+ throw new MalformedURLException("Not a valid URL: " + url);
+ }
+ } catch (MalformedURLException e) {
+ throw new InvalidNameException(e.getMessage());
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/url/iiop/iiopURLContextFactory.java b/src/java.corba/share/classes/com/sun/jndi/url/iiop/iiopURLContextFactory.java
new file mode 100644
index 0000000..1371581
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/url/iiop/iiopURLContextFactory.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.url.iiop;
+
+import javax.naming.*;
+import javax.naming.spi.*;
+
+import java.util.Hashtable;
+
+import com.sun.jndi.cosnaming.CNCtx;
+
+/**
+ * An IIOP URL context factory.
+ *
+ * @author Rosanna Lee
+ */
+
+public class iiopURLContextFactory implements ObjectFactory {
+
+ public Object getObjectInstance(Object urlInfo, Name name, Context nameCtx,
+ Hashtable<?,?> env) throws Exception {
+
+//System.out.println("iiopURLContextFactory " + urlInfo);
+ if (urlInfo == null) {
+ return new iiopURLContext(env);
+ }
+ if (urlInfo instanceof String) {
+ return getUsingURL((String)urlInfo, env);
+ } else if (urlInfo instanceof String[]) {
+ return getUsingURLs((String[])urlInfo, env);
+ } else {
+ throw (new IllegalArgumentException(
+ "iiopURLContextFactory.getObjectInstance: " +
+ "argument must be a URL String or array of URLs"));
+ }
+ }
+
+ /**
+ * Resolves 'name' into a target context with remaining name.
+ * It only resolves the hostname/port number. The remaining name
+ * contains the rest of the name found in the URL.
+ *
+ * For example, with a iiop URL "iiop://localhost:900/rest/of/name",
+ * this method resolves "iiop://localhost:900/" to the "NameService"
+ * context on for the ORB at 'localhost' on port 900,
+ * and returns as the remaining name "rest/of/name".
+ */
+ static ResolveResult getUsingURLIgnoreRest(String url, Hashtable<?,?> env)
+ throws NamingException {
+ return CNCtx.createUsingURL(url, env);
+ }
+
+ private static Object getUsingURL(String url, Hashtable<?,?> env)
+ throws NamingException {
+ ResolveResult res = getUsingURLIgnoreRest(url, env);
+
+ Context ctx = (Context)res.getResolvedObj();
+ try {
+ return ctx.lookup(res.getRemainingName());
+ } finally {
+ ctx.close();
+ }
+ }
+
+ private static Object getUsingURLs(String[] urls, Hashtable<?,?> env) {
+ for (int i = 0; i < urls.length; i++) {
+ String url = urls[i];
+ try {
+ Object obj = getUsingURL(url, env);
+ if (obj != null) {
+ return obj;
+ }
+ } catch (NamingException e) {
+ }
+ }
+ return null; // %%% exception??
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/jndi/url/iiopname/iiopnameURLContextFactory.java b/src/java.corba/share/classes/com/sun/jndi/url/iiopname/iiopnameURLContextFactory.java
new file mode 100644
index 0000000..76e32cf
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/jndi/url/iiopname/iiopnameURLContextFactory.java
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.jndi.url.iiopname;
+
+import com.sun.jndi.url.iiop.iiopURLContextFactory;
+
+/**
+ * An iiopname URL context factory.
+ * It just uses the iiop URL context factory but is needed here
+ * so that NamingManager.getURLContext() will find it.
+ *
+ * @author Rosanna Lee
+ */
+final public class iiopnameURLContextFactory extends iiopURLContextFactory {
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java
new file mode 100644
index 0000000..2367e1a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttrDescriptionSeqHelper.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class AttrDescriptionSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/AttrDescriptionSeq:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ 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[] = null;
+ 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);
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeDescription.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeDescription.java
new file mode 100644
index 0000000..3d0bf5a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeDescription.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class AttributeDescription 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 com.sun.org.omg.CORBA.AttributeMode mode = null;
+
+ 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)
+ {
+ name = _name;
+ id = _id;
+ defined_in = _defined_in;
+ version = _version;
+ type = _type;
+ mode = _mode;
+ } // ctor
+
+} // class AttributeDescription
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeDescriptionHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeDescriptionHelper.java
new file mode 100644
index 0000000..66ad04b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeDescriptionHelper.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class AttributeDescriptionHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/AttributeDescription:1.0";
+
+ 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 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;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ 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);
+ 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);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeMode.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeMode.java
new file mode 100644
index 0000000..ca5314c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeMode.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+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];
+
+ 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 ()
+ {
+ return __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 ();
+ }
+
+ protected AttributeMode (int value)
+ {
+ __value = value;
+ __array[__value] = this;
+ }
+} // class AttributeMode
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeModeHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeModeHelper.java
new file mode 100644
index 0000000..7d27d66
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/AttributeModeHelper.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class AttributeModeHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/AttributeMode:1.0";
+
+ 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 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"} );
+ }
+ return __typeCode;
+ }
+
+ 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 void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.AttributeMode value)
+ {
+ ostream.write_long (value.value ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ContextIdSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ContextIdSeqHelper.java
new file mode 100644
index 0000000..77129c2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ContextIdSeqHelper.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class ContextIdSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ContextIdSeq:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String[] read (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)
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ContextIdentifierHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ContextIdentifierHelper.java
new file mode 100644
index 0000000..9c07fa0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ContextIdentifierHelper.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class ContextIdentifierHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ContextIdentifier:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value = null;
+ value = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ ostream.write_string (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/DefinitionKindHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/DefinitionKindHelper.java
new file mode 100644
index 0000000..29b6288
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/DefinitionKindHelper.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// This file has been manually _CHANGED_
+
+public final class DefinitionKindHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/DefinitionKind:1.0";
+
+ 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 ());
+ }
+
+ // _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 ());
+ }
+
+ 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"} );
+ }
+ return __typeCode;
+ }
+
+ 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)
+ {
+ // _CHANGED_
+ //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 ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java
new file mode 100644
index 0000000..e58eef7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExcDescriptionSeqHelper.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class ExcDescriptionSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ExcDescriptionSeq:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ 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[] = null;
+ 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);
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExceptionDescription.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExceptionDescription.java
new file mode 100644
index 0000000..09897e4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExceptionDescription.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+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 ()
+ {
+ } // ctor
+
+ public ExceptionDescription (String _name, String _id, String _defined_in, String _version, org.omg.CORBA.TypeCode _type)
+ {
+ name = _name;
+ id = _id;
+ defined_in = _defined_in;
+ version = _version;
+ type = _type;
+ } // ctor
+
+} // class ExceptionDescription
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java
new file mode 100644
index 0000000..5196b35
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ExceptionDescriptionHelper.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class ExceptionDescriptionHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ExceptionDescription:1.0";
+
+ 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 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;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ 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 ();
+ 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);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/IDLTypeHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/IDLTypeHelper.java
new file mode 100644
index 0000000..ac15603
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/IDLTypeHelper.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// This file has been _CHANGED_
+
+public final class IDLTypeHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/IDLType:1.0";
+
+ 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 ());
+ }
+
+ // _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 ());
+ }
+
+ 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");
+ }
+ return __typeCode;
+ }
+
+ 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 (_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);
+ }
+
+ // _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)
+ {
+ if (obj == null)
+ return null;
+ // _CHANGED_
+ //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 com.sun.org.omg.CORBA._IDLTypeStub (delegate);
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/IdentifierHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/IdentifierHelper.java
new file mode 100644
index 0000000..4104903
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/IdentifierHelper.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class IdentifierHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/Identifier:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value = null;
+ value = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ ostream.write_string (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/Initializer.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/Initializer.java
new file mode 100644
index 0000000..abf80ec
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/Initializer.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// This file has been _CHANGED_
+
+public final class Initializer implements org.omg.CORBA.portable.IDLEntity
+{
+ // _CHANGED_
+ //public com.sun.org.omg.CORBA.StructMember members[] = null;
+ public org.omg.CORBA.StructMember members[] = null;
+ public String name = null;
+
+ public Initializer ()
+ {
+ } // ctor
+
+ // _CHANGED_
+ //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
+
+} // class Initializer
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/InitializerHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/InitializerHelper.java
new file mode 100644
index 0000000..ea0605f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/InitializerHelper.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class InitializerHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/Initializer:1.0";
+
+ 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 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;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ 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 ();
+ 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);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/InitializerSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/InitializerSeqHelper.java
new file mode 100644
index 0000000..2119a71
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/InitializerSeqHelper.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class InitializerSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/InitializerSeq:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ 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[] = null;
+ 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);
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java
new file mode 100644
index 0000000..6b531db
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/OpDescriptionSeqHelper.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class OpDescriptionSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/OpDescriptionSeq:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ 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[] = null;
+ 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);
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationDescription.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationDescription.java
new file mode 100644
index 0000000..6ab6521
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationDescription.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class OperationDescription 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 result = null;
+ public com.sun.org.omg.CORBA.OperationMode mode = null;
+ public String contexts[] = null;
+ public com.sun.org.omg.CORBA.ParameterDescription parameters[] = null;
+ public com.sun.org.omg.CORBA.ExceptionDescription exceptions[] = null;
+
+ 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)
+ {
+ name = _name;
+ id = _id;
+ defined_in = _defined_in;
+ version = _version;
+ result = _result;
+ mode = _mode;
+ contexts = _contexts;
+ parameters = _parameters;
+ exceptions = _exceptions;
+ } // ctor
+
+} // class OperationDescription
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationDescriptionHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationDescriptionHelper.java
new file mode 100644
index 0000000..49f052c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationDescriptionHelper.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class OperationDescriptionHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/OperationDescription:1.0";
+
+ 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 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;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ 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);
+ 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);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationMode.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationMode.java
new file mode 100644
index 0000000..6cef553
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationMode.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+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];
+
+ 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 ()
+ {
+ return __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 ();
+ }
+
+ protected OperationMode (int value)
+ {
+ __value = value;
+ __array[__value] = this;
+ }
+} // class OperationMode
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationModeHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationModeHelper.java
new file mode 100644
index 0000000..a819f94
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/OperationModeHelper.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class OperationModeHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/OperationMode:1.0";
+
+ 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 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"} );
+ }
+ return __typeCode;
+ }
+
+ 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 void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.OperationMode value)
+ {
+ ostream.write_long (value.value ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java
new file mode 100644
index 0000000..947d68f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParDescriptionSeqHelper.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class ParDescriptionSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ParDescriptionSeq:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ 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[] = null;
+ 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);
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterDescription.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterDescription.java
new file mode 100644
index 0000000..34f1e57
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterDescription.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// This file has been _CHANGED_
+
+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 org.omg.CORBA.IDLType type_def = null;
+ public com.sun.org.omg.CORBA.ParameterMode mode = null;
+
+ 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)
+ {
+ name = _name;
+ type = _type;
+ type_def = _type_def;
+ mode = _mode;
+ } // ctor
+
+} // class ParameterDescription
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterDescriptionHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterDescriptionHelper.java
new file mode 100644
index 0000000..b5d37f0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterDescriptionHelper.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class ParameterDescriptionHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ParameterDescription:1.0";
+
+ 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 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;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ 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);
+ 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);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterMode.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterMode.java
new file mode 100644
index 0000000..57645af
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterMode.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+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];
+
+ 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);
+ public static final int _PARAM_OUT = 1;
+ public static final com.sun.org.omg.CORBA.ParameterMode PARAM_OUT = new com.sun.org.omg.CORBA.ParameterMode(_PARAM_OUT);
+ 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 ()
+ {
+ return __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 ();
+ }
+
+ protected ParameterMode (int value)
+ {
+ __value = value;
+ __array[__value] = this;
+ }
+} // class ParameterMode
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterModeHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterModeHelper.java
new file mode 100644
index 0000000..639b7ba
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ParameterModeHelper.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class ParameterModeHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ParameterMode:1.0";
+
+ 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 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"} );
+ }
+ return __typeCode;
+ }
+
+ 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 void write (org.omg.CORBA.portable.OutputStream ostream, com.sun.org.omg.CORBA.ParameterMode value)
+ {
+ ostream.write_long (value.value ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/Repository.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/Repository.java
new file mode 100644
index 0000000..278200a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/Repository.java
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.org.omg.CORBA;
+
+public interface Repository extends org.omg.CORBA.IRObject, org.omg.CORBA.portable.IDLEntity
+{
+} // interface Repository
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryHelper.java
new file mode 100644
index 0000000..5541b07
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryHelper.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.org.omg.CORBA;
+
+public final class RepositoryHelper
+{
+ private static String _id = "IDL:com.sun.omg.org/CORBA/Repository:3.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static Repository read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value = null;
+ value = istream.read_string ();
+ return null;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, Repository value)
+ {
+ ostream.write_string (null);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryIdHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryIdHelper.java
new file mode 100644
index 0000000..1e760b9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryIdHelper.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class RepositoryIdHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/RepositoryId:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value = null;
+ value = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ ostream.write_string (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java
new file mode 100644
index 0000000..bee221c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/RepositoryIdSeqHelper.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class RepositoryIdSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/RepositoryIdSeq:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String[] read (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)
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/StructMemberHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/StructMemberHelper.java
new file mode 100644
index 0000000..68329e6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/StructMemberHelper.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// This file has been manually _CHANGED_
+
+public final class StructMemberHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/StructMember:1.0";
+
+ 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 ());
+ }
+
+ // _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 ());
+ }
+
+ 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;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ 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)
+ {
+ // _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);
+ 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);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/StructMemberSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/StructMemberSeqHelper.java
new file mode 100644
index 0000000..6139d51
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/StructMemberSeqHelper.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// This file has been _CHANGED_
+
+public final class StructMemberSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/StructMemberSeq:1.0";
+
+ 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 ());
+ }
+
+ // _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 ());
+ }
+
+ 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);
+ }
+ return __typeCode;
+ }
+
+ 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)
+ {
+ // _CHANGED_
+ //com.sun.org.omg.CORBA.StructMember value[] = null;
+ org.omg.CORBA.StructMember value[] = null;
+ int _len0 = istream.read_long ();
+ // _CHANGED_
+ //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);
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java
new file mode 100644
index 0000000..2be44fe
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescription.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// This file has been manually _CHANGED_
+
+public final class FullValueDescription implements org.omg.CORBA.portable.IDLEntity
+{
+ public String name = null;
+ public String id = null;
+ public boolean is_abstract = false;
+ public boolean is_custom = false;
+ public String defined_in = null;
+ public String version = null;
+ public com.sun.org.omg.CORBA.OperationDescription operations[] = null;
+ public com.sun.org.omg.CORBA.AttributeDescription attributes[] = null;
+
+ // _CHANGED_
+ //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;
+ public boolean is_truncatable = false;
+ public String base_value = null;
+ public org.omg.CORBA.TypeCode type = null;
+
+ 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)
+ {
+ name = _name;
+ id = _id;
+ is_abstract = _is_abstract;
+ is_custom = _is_custom;
+ defined_in = _defined_in;
+ version = _version;
+ operations = _operations;
+ attributes = _attributes;
+ members = _members;
+ initializers = _initializers;
+ supported_interfaces = _supported_interfaces;
+ abstract_base_values = _abstract_base_values;
+ is_truncatable = _is_truncatable;
+ base_value = _base_value;
+ type = _type;
+ } // ctor
+
+} // class FullValueDescription
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java
new file mode 100644
index 0000000..9d11d04
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueDefPackage/FullValueDescriptionHelper.java
@@ -0,0 +1,220 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class FullValueDescriptionHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ValueDef/FullValueDescription:1.0";
+
+ 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 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;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ 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 ();
+ 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);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueMemberHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueMemberHelper.java
new file mode 100644
index 0000000..dd03508
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueMemberHelper.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// This file has been _CHANGED_
+
+public final class ValueMemberHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ValueMember:1.0";
+
+ 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 ());
+ }
+
+ // _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 ());
+ }
+
+ 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;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ 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)
+ {
+ // _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 ();
+ 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);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueMemberSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueMemberSeqHelper.java
new file mode 100644
index 0000000..cf759d3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/ValueMemberSeqHelper.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// This file has been _CHANGED_
+
+public final class ValueMemberSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ValueMemberSeq:1.0";
+
+ 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 ());
+ }
+
+ // _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 ());
+ }
+
+ 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);
+ }
+ return __typeCode;
+ }
+
+ 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)
+ {
+ // _CHANGED_
+ //com.sun.org.omg.CORBA.ValueMember value[] = null;
+ org.omg.CORBA.ValueMember value[] = null;
+ int _len0 = istream.read_long ();
+ // _CHANGED_
+ //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);
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/VersionSpecHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/VersionSpecHelper.java
new file mode 100644
index 0000000..ea3112e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/VersionSpecHelper.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class VersionSpecHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/VersionSpec:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value = null;
+ value = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ ostream.write_string (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/VisibilityHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/VisibilityHelper.java
new file mode 100644
index 0000000..24f526f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/VisibilityHelper.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+
+// orbos 98-01-18: Objects By Value -- begin
+public final class VisibilityHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/Visibility:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ 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 void write (org.omg.CORBA.portable.OutputStream ostream, short value)
+ {
+ ostream.write_short (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/CORBA/_IDLTypeStub.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/_IDLTypeStub.java
new file mode 100644
index 0000000..e1a5b86
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/_IDLTypeStub.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package com.sun.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
+*/
+
+// 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
+{
+ // Constructors
+ // 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 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 ();
+ return __result;
+ } catch (org.omg.CORBA.portable.ApplicationException _ex) {
+ _in = _ex.getInputStream ();
+ String _id = _ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return type ();
+ } finally {
+ _releaseReply (_in);
+ }
+ } // type
+
+
+ // read interface
+ // _CHANGED_
+ //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);
+ // _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);
+ return __result;
+ } catch (org.omg.CORBA.portable.ApplicationException _ex) {
+ _in = _ex.getInputStream ();
+ String _id = _ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return def_kind ();
+ } finally {
+ _releaseReply (_in);
+ }
+ } // def_kind
+
+
+ // write interface
+ public void destroy ()
+ {
+ org.omg.CORBA.portable.InputStream _in = null;
+ try {
+ 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);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ destroy ();
+ } finally {
+ _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"};
+
+ 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 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/src/java.corba/share/classes/com/sun/org/omg/CORBA/portable/ValueHelper.java b/src/java.corba/share/classes/com/sun/org/omg/CORBA/portable/ValueHelper.java
new file mode 100644
index 0000000..b34a058
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/CORBA/portable/ValueHelper.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.org.omg.CORBA.portable;
+
+import org.omg.CORBA.TypeCode;
+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.
+ *
+ * @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/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBase.java b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBase.java
new file mode 100644
index 0000000..faa2ea0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBase.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// Edited to leave RunTime in org.omg.CORBA
+
+public interface CodeBase extends CodeBaseOperations, org.omg.SendingContext.RunTime, org.omg.CORBA.portable.IDLEntity
+{
+} // interface CodeBase
diff --git a/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBaseHelper.java b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBaseHelper.java
new file mode 100644
index 0000000..666d7e3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBaseHelper.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class CodeBaseHelper
+{
+ private static String _id = "IDL:omg.org/SendingContext/CodeBase:1.0";
+
+ 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 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");
+ }
+ return __typeCode;
+ }
+
+ 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 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)
+ {
+ 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);
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBaseOperations.java b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBaseOperations.java
new file mode 100644
index 0000000..71a656a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBaseOperations.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+// Edited to leave RunTime in org.omg.CORBA
+
+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 ();
+
+ // Operations to obtain a URL to the implementation code
+ 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);
+
+ // information
+ String[] bases (String x);
+} // interface CodeBaseOperations
diff --git a/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java
new file mode 100644
index 0000000..320ca0c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/URLHelper.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class URLHelper
+{
+ private static String _id = "IDL:omg.org/SendingContext/CodeBase/URL:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value = null;
+ value = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ ostream.write_string (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java
new file mode 100644
index 0000000..5b2494a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/URLSeqHelper.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class URLSeqHelper
+{
+ private static String _id = "IDL:omg.org/SendingContext/CodeBase/URLSeq:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String[] read (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)
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java
new file mode 100644
index 0000000..2f832aa
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/CodeBasePackage/ValueDescSeqHelper.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public final class ValueDescSeqHelper
+{
+ private static String _id = "IDL:omg.org/SendingContext/CodeBase/ValueDescSeq:1.0";
+
+ 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 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);
+ }
+ return __typeCode;
+ }
+
+ 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[] = null;
+ 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);
+ 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]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java
new file mode 100644
index 0000000..508f827
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/_CodeBaseImplBase.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1999, 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+public abstract class _CodeBaseImplBase extends org.omg.CORBA.portable.ObjectImpl
+ implements com.sun.org.omg.SendingContext.CodeBase, org.omg.CORBA.portable.InvokeHandler
+{
+
+ // Constructors
+ public _CodeBaseImplBase ()
+ {
+ }
+
+ private static java.util.Hashtable _methods = new java.util.Hashtable ();
+ static
+ {
+ _methods.put ("get_ir", new java.lang.Integer (0));
+ _methods.put ("implementation", new java.lang.Integer (1));
+ _methods.put ("implementations", new java.lang.Integer (2));
+ _methods.put ("meta", new java.lang.Integer (3));
+ _methods.put ("metas", new java.lang.Integer (4));
+ _methods.put ("bases", new java.lang.Integer (5));
+ }
+
+ 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 = (java.lang.Integer)_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);
+ }
+
+ return out;
+ } // _invoke
+
+ // Type-specific CORBA::Object operations
+ 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();
+ }
+
+
+} // class _CodeBaseImplBase
diff --git a/src/java.corba/share/classes/com/sun/org/omg/SendingContext/_CodeBaseStub.java b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/_CodeBaseStub.java
new file mode 100644
index 0000000..23527eb
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/org/omg/SendingContext/_CodeBaseStub.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+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
+*/
+
+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 ();
+ }
+
+ 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 ()
+ {
+ 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);
+ return __result;
+ } catch (org.omg.CORBA.portable.ApplicationException _ex) {
+ _in = _ex.getInputStream ();
+ String _id = _ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return get_ir ();
+ } finally {
+ _releaseReply (_in);
+ }
+ } // get_ir
+
+
+ // Operations to obtain a URL to the implementation code
+ 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);
+ return __result;
+ } catch (org.omg.CORBA.portable.ApplicationException _ex) {
+ _in = _ex.getInputStream ();
+ String _id = _ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return implementation (x);
+ } finally {
+ _releaseReply (_in);
+ }
+ } // implementation
+
+ 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);
+ return __result;
+ } catch (org.omg.CORBA.portable.ApplicationException _ex) {
+ _in = _ex.getInputStream ();
+ String _id = _ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return implementations (x);
+ } finally {
+ _releaseReply (_in);
+ }
+ } // implementations
+
+
+ // the same information
+ 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);
+ return __result;
+ } catch (org.omg.CORBA.portable.ApplicationException _ex) {
+ _in = _ex.getInputStream ();
+ String _id = _ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return meta (x);
+ } finally {
+ _releaseReply (_in);
+ }
+ } // meta
+
+ 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);
+ return __result;
+ } catch (org.omg.CORBA.portable.ApplicationException _ex) {
+ _in = _ex.getInputStream ();
+ String _id = _ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return metas (x);
+ } finally {
+ _releaseReply (_in);
+ }
+ } // metas
+
+
+ // information
+ 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);
+ return __result;
+ } catch (org.omg.CORBA.portable.ApplicationException _ex) {
+ _in = _ex.getInputStream ();
+ String _id = _ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return bases (x);
+ } finally {
+ _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"};
+
+ 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 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/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Arguments.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Arguments.java
new file mode 100644
index 0000000..35a0344
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Arguments.java
@@ -0,0 +1,325 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -F46082.51<daz> Remove -stateful option. "Stateful interfaces" obsolete.
+// -D58319<daz> Add -version option. Note that this may occur as the last
+// argument on the command-line.
+// -F60858.1<daz> Add -corba [level] option. Accept IDL upto this level, and
+// behave in a "proprietary manner" otherwise.
+// -D62023<daz> Add -noWarn option to supress warnings.
+
+import java.io.DataInputStream;
+import java.io.IOException;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.Vector;
+import java.util.StringTokenizer;
+import java.lang.reflect.Modifier;
+import java.lang.reflect.Field;
+
+import com.sun.tools.corba.se.idl.som.cff.FileLocator;
+
+/**
+ * This class is responsible for parsing the command line arguments to the
+ * compiler. To add new arguments to the compiler, this class must be extended
+ * and the parseOtherArgs method overridden.
+ **/
+public class Arguments
+{
+ /**
+ * Method parseOtherArgs() is called when the framework detects arguments
+ * which are unknown to it. The default implementation of this method simply
+ * throws an InvalidArgument exception. Any overriding implementation
+ * must check the arguments passed to it for validity and process the
+ * arguments appropriately. If it detects an invalid argument, it should
+ * throw an InvalidArgument exception. Arguments MUST be of the form
+ * {@code '/<arg> [<qualifiers>]'} or {@code '-<arg> [<qualifiers>]'} where {@code <qualifiers>}
+ * is optional (for example, -iC:\includes, 'C:\includes' is the qualifier
+ * for the argument 'i').
+ * @param args The arguments which are unknown by the framework.
+ * @param properties Environment-style properties collected from the
+ * file idl.config.
+ * @exception idl.InvalidArgument if the argument is unknown.
+ **/
+ protected void parseOtherArgs (String[] args, Properties properties) throws InvalidArgument
+ {
+ if (args.length > 0)
+ throw new InvalidArgument (args[0]);
+ } // parseOtherArgs
+
+
+ protected void setDebugFlags( String args )
+ {
+ StringTokenizer st = new StringTokenizer( args, "," ) ;
+ while (st.hasMoreTokens()) {
+ String token = st.nextToken() ;
+
+ // If there is a public boolean data member in this class
+ // named token + "DebugFlag", set it to true.
+ try {
+ Field fld = this.getClass().getField( token + "DebugFlag" ) ;
+ int mod = fld.getModifiers() ;
+ if (Modifier.isPublic( mod ) && !Modifier.isStatic( mod ))
+ if (fld.getType() == boolean.class)
+ fld.setBoolean( this, true ) ;
+ } catch (Exception exc) {
+ // ignore it
+ }
+ }
+ }
+
+ /**
+ * Collect the command-line parameters.
+ **/
+ void parseArgs (String[] args) throws InvalidArgument {
+ Vector unknownArgs = new Vector ();
+ int i = 0;
+
+ try {
+ // Process command line parameters
+ for (i = 0; i < args.length - 1; ++i) {
+ String lcArg = args[i].toLowerCase ();
+ if (lcArg.charAt (0) != '-' && lcArg.charAt (0) != '/')
+ throw new InvalidArgument (args[i]);
+ if (lcArg.charAt (0) == '-' ) {
+ lcArg = lcArg.substring (1);
+ }
+
+ // Include path
+ if (lcArg.equals ("i")) {
+ includePaths.addElement (args[++i]);
+ } else if (lcArg.startsWith ("i")) {
+ includePaths.addElement (args[i].substring (2));
+ } else if (lcArg.equals ("v") || lcArg.equals ("verbose")) {
+ // Verbose mode
+ verbose = true;
+ } else if (lcArg.equals ("d")) {
+ // Define symbol
+ definedSymbols.put (args[++i], "");
+ } else if (lcArg.equals( "debug" )) {
+ // Turn on debug flags
+ setDebugFlags( args[++i] ) ;
+ } else if (lcArg.startsWith ("d")) {
+ definedSymbols.put (args[i].substring (2), "");
+ } else if (lcArg.equals ("emitall")) {
+ // Emit bindings for included sources
+ emitAll = true;
+ } else if (lcArg.equals ("keep")) {
+ // Keep old files
+ keepOldFiles = true;
+ } else if (lcArg.equals ("nowarn")) {
+ // <d62023> Suppress warnings
+ noWarn = true;
+ } else if (lcArg.equals ("trace")) {
+ // Allow tracing.
+ Runtime.getRuntime ().traceMethodCalls (true);
+ }
+ // <f46082.51> Remove -stateful feature.
+ //else if (lcArg.equals ("stateful"))
+ //{
+ // Emit stateful bindings.
+ // parseStateful = true;
+ //}
+ // CPPModule
+ else if ( lcArg.equals ("cppmodule")) {
+ cppModule = true;
+ } else if (lcArg.equals ("version")) {
+ // Version
+ versionRequest = true;
+ } else if (lcArg.equals ("corba")) {
+ // CORBA level
+ if (i + 1 >= args.length)
+ throw new InvalidArgument (args[i]);
+ String level = args[++i];
+ if (level.charAt (0) == '-')
+ throw new InvalidArgument (args[i - 1]);
+ try {
+ corbaLevel = new Float (level).floatValue ();
+ } catch (NumberFormatException e) {
+ throw new InvalidArgument (args[i]);
+ }
+ } else {
+ unknownArgs.addElement (args[i]);
+ ++i;
+ while (i < (args.length - 1) &&
+ args[i].charAt (0) != '-' &&
+ args[i].charAt (0) != '/') {
+ unknownArgs.addElement (args[i++]);
+ }
+ --i;
+ }
+ }
+ } catch (ArrayIndexOutOfBoundsException e) {
+ // If there is any array indexing problem, it is probably
+ // because the qualifier on the last argument is missing.
+ // Report that this last argument is invalid.
+ throw new InvalidArgument (args[args.length - 1]);
+ }
+
+ // <d57319>
+ // The last argument is the file argument or "-version", which may
+ // be specified without a file argument.
+ if (i == args.length - 1) {
+ if (args[i].toLowerCase ().equals ("-version"))
+ versionRequest = true;
+ else
+ file = args[i];
+ } else
+ throw new InvalidArgument ();
+
+ // Get and process the idl.config file.
+ Properties props = new Properties ();
+ try {
+ DataInputStream stream = FileLocator.locateFileInClassPath ("idl.config");
+ props.load (stream);
+ addIncludePaths (props);
+ } catch (IOException e) {
+ }
+
+ // Call parseOtherArgs. By default, if there are unknown args,
+ // InvalidArgument is called. A call to parseOtherArgs is useful
+ // only when this framework has been extended.
+ String[] otherArgs;
+ if (unknownArgs.size () > 0) {
+ otherArgs = new String[unknownArgs.size ()];
+ unknownArgs.copyInto (otherArgs);
+ } else
+ otherArgs = new String[0];
+
+ parseOtherArgs (otherArgs, props);
+ } // parseArgs
+
+ /**
+ *
+ **/
+ private void addIncludePaths (Properties props)
+ {
+ String paths = props.getProperty ("includes");
+ if (paths != null)
+ {
+ String separator = System.getProperty ("path.separator");
+ int end = -separator.length (); // so the first pass paths == original paths
+ do
+ {
+ paths = paths.substring (end + separator.length ());
+ end = paths.indexOf (separator);
+ if (end < 0)
+ end = paths.length ();
+ includePaths.addElement (paths.substring (0, end));
+ }
+ while (end != paths.length ());
+ }
+ } // addIncludePaths
+
+ /**
+ * The name of the IDL file.
+ **/
+ public String file = null;
+
+ /**
+ * True if the user wishes to see processing remarks.
+ **/
+ public boolean verbose = false;
+
+ /**
+ * If this is true, then existing files should not be overwritten
+ * by the compiler.
+ **/
+ public boolean keepOldFiles = false;
+
+ /**
+ * If this is true, then the types in all included files are also emitted.
+ **/
+ public boolean emitAll = false;
+
+ // <f46082.51> Remove -stateful feature.
+ ///**
+ // * If this is true, then stateful interfaces (for the Objects-by-Value
+ // * proposal) are allowed. This is not yet a standard, so it must
+ // * explicitly be called for by setting the -stateful argument to the
+ // * compiler. If -stateful does not appear on the command line, then
+ // * the IDL will be parsed according to the standards.
+ // **/
+ //public boolean parseStateful = false;
+ /**
+ * A list of strings, each of which is a path from which included files
+ * are found.
+ **/
+ public Vector includePaths = new Vector ();
+
+ /**
+ * A table of defined symbols. The key is the symbol name; the value
+ * (if any) is the replacement value for the symbol.
+ **/
+ public Hashtable definedSymbols = new Hashtable ();
+
+ /**
+ * (f46082.46.01) True if new module entries are created for each
+ * re-opened module.
+ **/
+ public boolean cppModule = false;
+
+ /**
+ * -version option.
+ **/
+ public boolean versionRequest = false; // <D58319>
+
+ // <f60858.1> Specify the maximal level of the CORBA spec. the parser
+ // will support.
+ //
+ // NOTE: For BOSS 3.0, specify at 2.2. Raise to greater value in future
+ // releases.
+ /**
+ * -corba [level] option, where [level] is a floating-point number indicating
+ * the maximal level of CORBA IDL the parser framework can accept.
+ **/
+ public float corbaLevel = 2.2f;
+ // <d62023>
+ /**
+ * -noWarn option. Suppress warnings when true.
+ **/
+ public boolean noWarn = false; // Issue warnings by default.
+
+ // 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.
+ public boolean scannerDebugFlag = false ;
+ public boolean tokenDebugFlag = false ;
+
+} // class Arguments
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/AttributeEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/AttributeEntry.java
new file mode 100644
index 0000000..0ce15c3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/AttributeEntry.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+/**
+ * This is the symbol table entry for attributes. An attribute is simply
+ * two methods with no exceptions or contexts: a get method and, if not
+ * readOnly, a set method.
+ **/
+public class AttributeEntry extends MethodEntry
+{
+ protected AttributeEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected AttributeEntry (AttributeEntry that)
+ {
+ super (that);
+ _readOnly = that._readOnly;
+ } // ctor
+
+ protected AttributeEntry (InterfaceEntry that, IDLID clone)
+ {
+ super (that, clone);
+ } // ctor
+
+ public Object clone ()
+ {
+ return new AttributeEntry (this);
+ } // clone
+
+ /** Invoke the attribute generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ attributeGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the attribute generator.
+ @return an object which implements the AttributeGen interface.
+ @see AttributeGen */
+ public Generator generator ()
+ {
+ return attributeGen;
+ } // generator
+
+ /** if true, only a get method will be generated. */
+ public boolean readOnly ()
+ {
+ return _readOnly;
+ } // readOnly
+
+ /** if true, only a get method will be generated. */
+ public void readOnly (boolean readOnly)
+ {
+ _readOnly = readOnly;
+ } // readOnly
+
+ static AttributeGen attributeGen;
+
+ public boolean _readOnly = false;
+} // class AttributeEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/AttributeGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/AttributeGen.java
new file mode 100644
index 0000000..a041779
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/AttributeGen.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+public interface AttributeGen extends Generator
+{
+ void generate (Hashtable symbolTable, AttributeEntry entry, PrintWriter stream);
+} // interface AttributeGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Comment.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Comment.java
new file mode 100644
index 0000000..698d292
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Comment.java
@@ -0,0 +1,208 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.io.IOException;
+import java.util.StringTokenizer;
+
+public class Comment
+{
+ // Styles
+ static final int UNKNOWN = -1;
+ static final int JAVA_DOC = 0;
+ static final int C_BLOCK = 1;
+ static final int CPP_LINE = 2;
+
+ // System-dependent line separator
+ private static String _eol = System.getProperty ("line.separator");
+
+ private String _text = new String ("");
+ private int _style = UNKNOWN;
+
+ Comment () {_text = new String (""); _style = UNKNOWN;} // ctor
+
+ Comment (String text) {_text = text; _style = style (_text);} // ctor
+
+ /** Sets comment text */
+ public void text (String string) {_text = string; _style = style (_text);}
+
+ /** Returns comment text */
+ public String text () {return _text;}
+
+ /** Returns the comment style of a string. */
+ private int style (String text)
+ {
+ if (text == null)
+ return UNKNOWN;
+ else if (text.startsWith ("/**") && text.endsWith ("*/"))
+ return JAVA_DOC;
+ else if (text.startsWith ("/*") && text.endsWith ("*/"))
+ return C_BLOCK;
+ else if (text.startsWith ("//"))
+ return CPP_LINE;
+ else
+ return UNKNOWN;
+ } // style
+
+ /** Writes comment text to standard output (debug). */
+ public void write () {System.out.println (_text);}
+
+ /** Writes comment text to the specified print stream in the appropriate format. */
+ public void generate (String indent, PrintWriter printStream)
+ {
+ if (_text == null || printStream == null)
+ return;
+ if (indent == null)
+ indent = new String ("");
+ switch (_style)
+ {
+ case JAVA_DOC:
+ //printJavaDoc (indent, printStream);
+ print (indent, printStream);
+ break;
+ case C_BLOCK:
+ //printCBlock (indent, printStream);
+ print (indent, printStream);
+ break;
+ case CPP_LINE:
+ //printCppLine (indent, printStream);
+ print (indent, printStream);
+ break;
+ default:
+ break;
+ }
+ } // generate
+
+ /** Writes comment to the specified print stream without altering its format.
+ This routine does not alter vertical or horizontal spacing of comment text,
+ thus, it only works well for comments with a non-indented first line. */
+ private void print (String indent, PrintWriter stream)
+ {
+ String text = _text.trim () + _eol;
+ String line = null;
+
+ int iLineStart = 0;
+ int iLineEnd = text.indexOf (_eol);
+ int iTextEnd = text.length () - 1;
+
+ stream.println ();
+ while (iLineStart < iTextEnd)
+ {
+ line = text.substring (iLineStart, iLineEnd);
+ stream.println (indent + line);
+ iLineStart = iLineEnd + _eol.length ();
+ iLineEnd = iLineStart + text.substring (iLineStart).indexOf (_eol);
+ }
+ } // print
+
+ /*
+ * The following routines print formatted comments of differing styles.
+ * Each routine will alter the horizontal spacing of the comment text,
+ * but not the vertical spacing.
+ */
+
+ /** Writes comment in JavaDoc-style to the specified print stream. */
+ private void printJavaDoc (String indent, PrintWriter stream)
+ {
+ // Strip surrounding "/**", "*/", and whitespace; append sentinel
+ String text = _text.substring (3, (_text.length () - 2)).trim () + _eol;
+ String line = null;
+
+ int iLineStart = 0;
+ int iLineEnd = text.indexOf (_eol);
+ int iTextEnd = text.length () - 1; // index of last text character
+
+ stream.println (_eol + indent + "/**");
+ while (iLineStart < iTextEnd)
+ {
+ line = text.substring (iLineStart, iLineEnd).trim ();
+ if (line.startsWith ("*"))
+ // Strip existing "*<ws>" prefix
+ stream.println (indent + " * " + line.substring (1, line.length ()).trim ());
+ else
+ stream.println (indent + " * " + line);
+ iLineStart = iLineEnd + _eol.length ();
+ iLineEnd = iLineStart + text.substring (iLineStart).indexOf (_eol);
+ }
+ stream.println (indent + " */");
+ } // printJavaDoc
+
+ /** Writes comment in c-block-style to the specified print stream. */
+ private void printCBlock (String indent, PrintWriter stream)
+ {
+ // Strip surrounding "/*", "*/", and whitespace; append sentinel
+ String text = _text.substring (2, (_text.length () - 2)).trim () + _eol;
+ String line = null;
+
+ int iLineStart = 0;
+ int iLineEnd = text.indexOf (_eol);
+ int iTextEnd = text.length () - 1; // index of last text character
+
+ stream.println (indent + "/*");
+ while (iLineStart < iTextEnd)
+ {
+ line = text.substring (iLineStart, iLineEnd).trim ();
+ if (line.startsWith ("*"))
+ // Strip existing "*[ws]" prefix
+ stream.println (indent + " * " + line.substring (1, line.length ()).trim ());
+ else
+ stream.println (indent + " * " + line);
+ iLineStart = iLineEnd + _eol.length ();
+ iLineEnd = iLineStart + text.substring (iLineStart).indexOf (_eol);
+ }
+ stream.println (indent + " */");
+ } // printCBlock
+
+ /** Writes a line comment to the specified print stream. */
+ private void printCppLine (String indent, PrintWriter stream)
+ {
+ stream.println (indent + "//");
+ // Strip "//[ws]" prefix
+ stream.println (indent + "// " + _text.substring (2).trim ());
+ stream.println (indent + "//");
+ } // printCppLine
+} // class Comment
+
+
+/*==================================================================================
+ DATE<AUTHOR> ACTION
+ ----------------------------------------------------------------------------------
+ 11aug1997<daz> Initial version completed.
+ 18aug1997<daz> Modified generate to write comment unformatted.
+ ==================================================================================*/
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Compile.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Compile.java
new file mode 100644
index 0000000..a3e0473
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Compile.java
@@ -0,0 +1,520 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -D56351<daz> Update computation of RepositoryIDs to CORBA 2.3 (see spec.).
+// -D58319<daz> Display version info. for -version option.
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.constExpr.ExprFactory;
+import com.sun.tools.corba.se.idl.constExpr.DefaultExprFactory;
+
+/**
+ * Compiler usage:
+ * <br><br>
+ *
+ * {@code java com.sun.tools.corba.se.idl.toJava.compile [options] <idl file>}
+ * <br><br>
+ *
+ * where &lt;idl file&gt; is the name of a file containing IDL definitions,
+ * and [options] is any combination of the options listed below. The options
+ * and the idl file name can appear in any order.
+ * <br><br>
+ *
+ * Options:
+ * <dl>
+ * <dt>{@code -i <include path>}
+ * <dd>By default, the current directory is scanned for included files.
+ * This option adds another directory. See also Note 1 below.
+ *
+ * <dt>{@code -d <symbol>}
+ * <dd>This is equivalent to the following line in an IDL file: {@code #define <symbol>}
+ *
+ * <dt>{@code -emitAll}
+ * <dd>Emit all types, including those found in #included files.
+ *
+ * <dt>{@code -v}
+ * <dd>Verbose mode.
+ * </dl>
+ *
+ * Note 1: If you have an include path or paths that you will always be using,
+ * it can get tedious putting these on the command with the -i option all the
+ * time. Instead, these can be placed into a config file called idl.config.
+ * This file must be in the CLASSPATH. The format of the includes line is:
+ *
+ * <pre>{@code
+ * includes=<path1>;<path2>;...;<pathN>
+ * }</pre>
+ *
+ * Note that the path separator character, here shown as a semicolon, is
+ * machine dependent. For instance, on Windows 95 this character is a
+ * semicolon, on UNIX it is a colon.
+ *
+ * <p>
+ * Note 2: If you are directly invoking the main method on this class (not
+ * a subclass), then it will only check that the IDL file is syntactically
+ * correct. It does not generate any files. Only extensions to this
+ * framework generate files, therefore an extension must be invoked if you
+ * want files to be generated.
+ * <br><br>
+ *
+ * To Extend the compiler:
+ * <br><br>
+ *
+ * You only need to extend the compiler if you want it to generate something
+ * other than what it currently generates.
+ * <br><br>
+ *
+ * Step 1 - Implement the generator interfaces:
+ * <br><br>
+ *
+ * Each generator interface defines one method: generate (Hashtable, XXXEntry, PrintWriter);
+ * <br>
+ * - The Hashtable is the symbol table; each element is a SymtabEntry (or a
+ * subclass of SymtabEntry) and is keyed by its fully qualified name;
+ * <br>
+ * - XXXEntry is the appropriate entry for the type to be generated. For
+ * example: AttributeGen defines generate (Hashtable, AttributeEntry, PrintWriter);
+ * ConstGen defines generate (Hashtable, ConstEntry, PrintWriter); etc.
+ * <br>
+ * - The PrintWriter is a stream to the file being generated. For the
+ * generators called by the compiler framework, this will be null. The
+ * generator is responsible for creating and opening files. But for
+ * generators that are called by other generators - for instance,
+ * MethodGen.generate will most likely be called by InterfaceGen.generate -
+ * this parameter is provided so that the proper file can be written to.
+ * <br><br>
+ *
+ * Step 2 - Implement the GenFactory interface:
+ * <br><br>
+ *
+ * All of the generators implemented in Step 1 must be created somehow. There
+ * is an interface for a factory, GenFactory, which must be implemented. The
+ * name of this factory must be set in the extension to the Compile class (see
+ * Step 3, below).
+ * <br><br>
+ *
+ * Step 3 - Extend com.sun.tools.corba.se.idl.Factories:
+ * <br><br>
+ *
+ * Extend com.sun.tools.corba.se.idl.Factories and override the method genFactory. This
+ * method must return an instance of the factory which you implemented in
+ * step 2. Your extension of this class may also do more, this is only the
+ * minimum. See com.sun.tools.corba.se.idl.Factories for more information.
+ * <br><br>
+ *
+ * Step 4 - Extend com.sun.tools.corba.se.idl.Compile:
+ * <br><br>
+ *
+ * Your extension of com.sun.tools.corba.se.idl.Compile should contain a minimum of
+ * two methods:
+ * <dl>
+ * <dt>protected com.sun.tools.corba.se.idl.Factories ()
+ * <dd>This method overrides com.sun.tools.corba.se.idl.Compile.factories and returns your
+ * extension from Step 3.
+ *
+ * <dt>public static void main (String[] args)
+ * <dd>This main method must instantiate this class and call its start method.
+ * </dl>
+ *
+ * Given that the extension of Factories is MyFactories, the extension of
+ * Compile could be:
+ *
+ * <pre>
+ * public class MyCompile extends com.sun.tools.corba.se.idl.Compile
+ * {
+ * protected com.sun.tools.corba.se.idl.Factories factories ()
+ * {
+ * return new MyFactories ();
+ * }
+ * public static void main (String[] args)
+ * {
+ * MyCompile compile = new MyCompile ();
+ * compile.start (args);
+ * }
+ * }
+ * </pre>
+ *
+ * If you would like a bit more control over the processing of the framework,
+ * you can replace compile.start with what it calls. But then you also have
+ * to handle the exceptions which start handles for you:
+ * <pre>
+ * public class MyCompile extends com.sun.tools.corba.se.idl.Compile
+ * {
+ * ...
+ *
+ * public static void main (String[] args)
+ * {
+ * MyCompile compile = new MyCompile ();
+ * try
+ * {
+ * compile.init (args);
+ * java.util.Enumeration emitList = compile.parse ();
+ * compile.generate ();
+ * }
+ * catch (com.sun.tools.corba.se.idl.InvalidArgument e)
+ * {
+ * System.err.println (e);
+ * }
+ * catch (java.io.IOException e)
+ * {
+ * System.err.println (e);
+ * }
+ * }
+ * }
+ * </pre>
+ *
+ * Note that compile.parse returns an enumeration. This enumerates the
+ * SymtabEntry's which should be generated. If the parse method detects
+ * errors, it returns null. Note that you do not have to check that
+ * `emitList' is valid before calling generate (that's done internally), but
+ * if you do any processing between parse and generate, emitList should be
+ * checked before executing that code.
+ * <br><br>
+ **/
+public class Compile
+{
+ public Compile ()
+ {
+ noPragma.init (preprocessor);
+ preprocessor.registerPragma (noPragma);
+
+ // <d41197> Reset static variables to allow parsing multiple sources.
+ // DO NOT reset SymtabEntry.maxKey because it crashes IDLC.
+ ParseException.detected = false;
+ SymtabEntry.includeStack = new java.util.Stack ();
+ SymtabEntry.setEmit = true;
+ //SymtabEntry.maxKey = -1;
+ Parser.repIDStack = new java.util.Stack (); // <d56351>
+ } // ctor
+
+ public static void main (String[] args)
+ {
+ (new Compile ()).start (args);
+ } // main
+
+ protected Factories factories ()
+ {
+ return new Factories ();
+ } // genFactoryName
+
+ protected void registerPragma (PragmaHandler handler)
+ {
+ handler.init (preprocessor);
+ preprocessor.registerPragma (handler);
+ } // registerPragma
+
+ /**
+ * Initialize the framework.
+ **/
+ protected void init (String[] args) throws InvalidArgument
+ {
+ initFactories ();
+ arguments.parseArgs (args);
+ initGenerators ();
+ parser = new Parser (preprocessor, arguments, overrideNames, symbolTable, symtabFactory, exprFactory, keywords);
+ preprocessor.init (parser);
+ parser.includes = includes;
+ parser.includeEntries = includeEntries;
+ } // init
+
+ /**
+ * Parse the IDL file and return an enumeration of the symbols to be
+ * generated. All elements of the Enumeration will be extensions of
+ * SymtabEntry. If any errors were encountered during parsing, null
+ * will be returned.
+ **/
+ protected Enumeration parse () throws IOException
+ {
+ if (arguments.verbose)
+ System.out.println (Util.getMessage ("Compile.parsing", arguments.file));
+ parser.parse (arguments.file);
+ if ( !ParseException.detected )
+ {
+ parser.forwardEntryCheck();
+
+ // <46082.03> Revert to "IDL:"-style (i.e., regular) repository ID.
+ //parser.updateRepositoryIds();
+ }
+ if (arguments.verbose)
+ System.out.println (Util.getMessage ("Compile.parseDone", arguments.file));
+ if (ParseException.detected)
+ {
+ symbolTable = null;
+ emitList = null;
+ }
+ else
+ {
+ symbolTable = parser.symbolTable;
+ emitList = parser.emitList.elements ();
+ }
+ return emitList;
+ } // parse
+
+ /**
+ * Invoke the generators.
+ **/
+ protected void generate () throws IOException
+ {
+ /*
+ // print the symbol table
+ Enumeration v = parser.symbolTable.elements ();
+ Enumeration k = parser.symbolTable.keys ();
+ while (k.hasMoreElements ())
+ System.out.println (k.nextElement () + ": " + v.nextElement ());
+ */
+ if (ParseException.detected)
+ emitList = null;
+ else
+ emitList = parser.emitList.elements ();
+ if (emitList != null)
+ {
+ // Emit the output files for all of the types in the IDL file
+ if (arguments.verbose)
+ System.out.println ();
+ while (emitList.hasMoreElements ())
+ {
+ SymtabEntry entry = (SymtabEntry)emitList.nextElement ();
+ if (arguments.verbose)
+ if (entry.generator () instanceof Noop)
+ ; // Nothing will be generated, so don't say so.
+ else if (entry.module () . equals (""))
+ System.out.println (Util.getMessage ("Compile.generating", entry.name ()));
+ else
+ System.out.println (Util.getMessage ("Compile.generating", entry.module () + '/' + entry.name ()));
+ entry.generate (symbolTable, null);
+ if (arguments.verbose)
+ if (entry.generator () instanceof Noop)
+ ; // Nothing will be generated, so don't say so.
+ else if (entry.module () . equals (""))
+ System.out.println (Util.getMessage ("Compile.genDone", entry.name ()));
+ else
+ System.out.println (Util.getMessage ("Compile.genDone", entry.module () + '/' + entry.name ()));
+ }
+ }
+ } // generate
+
+ /**
+ * Start the parse/code generation process. This method calls init,
+ * parse, generate. If more control is desired, rather than call start,
+ * those three methods could be called explicitly.
+ **/
+ public void start (String[] args)
+ {
+ try
+ {
+ init (args);
+ if (arguments.versionRequest) // <d59319>
+ displayVersion ();
+ else
+ {
+ parse ();
+ generate ();
+ }
+ }
+ catch (InvalidArgument e)
+ {
+ System.err.println (e);
+ }
+ catch (IOException e)
+ {
+ System.err.println (e);
+ }
+ } // start
+
+ private void initFactories ()
+ {
+ // Get the factories.
+ Factories factories = factories ();
+ if (factories == null) factories = new Factories ();
+
+ // Get the argument processor from the factories.
+ Arguments tmpArgs = factories.arguments ();
+ if (tmpArgs == null)
+ arguments = new Arguments ();
+ else
+ arguments = tmpArgs;
+
+ // Get the symbol table entry factory from the factories.
+ SymtabFactory tmpSTF = factories.symtabFactory ();
+ if (tmpSTF == null)
+ symtabFactory = new DefaultSymtabFactory ();
+ else
+ symtabFactory = tmpSTF;
+
+ // Get the expression factory from the factories.
+ ExprFactory tmpExpF = factories.exprFactory ();
+ if (tmpExpF == null)
+ exprFactory = new DefaultExprFactory ();
+ else
+ exprFactory = tmpExpF;
+
+ // Get the generator factory from the factories.
+ GenFactory tmpGenF = factories.genFactory ();
+ if (tmpGenF == null)
+ genFactory = noop;
+ else
+ genFactory = tmpGenF;
+
+ // Get the language keywords.
+ keywords = factories.languageKeywords ();
+ if (keywords == null)
+ keywords = new String[0];
+ } // initFactories
+
+ private void initGenerators ()
+ {
+ AttributeGen agen = genFactory.createAttributeGen ();
+ AttributeEntry.attributeGen = agen == null ? noop : agen;
+
+ ConstGen cgen = genFactory.createConstGen ();
+ ConstEntry.constGen = cgen == null ? noop : cgen;
+
+ EnumGen egen = genFactory.createEnumGen ();
+ EnumEntry.enumGen = egen == null ? noop : egen;
+
+ ExceptionGen exgen = genFactory.createExceptionGen ();
+ ExceptionEntry.exceptionGen = exgen == null ? noop : exgen;
+
+ ForwardGen fgen = genFactory.createForwardGen ();
+ ForwardEntry.forwardGen = fgen == null ? noop : fgen;
+
+ ForwardValueGen fvgen = genFactory.createForwardValueGen ();
+ ForwardValueEntry.forwardValueGen = fvgen == null ? noop : fvgen;
+
+ IncludeGen ingen = genFactory.createIncludeGen ();
+ IncludeEntry.includeGen = ingen == null ? noop : ingen;
+
+ InterfaceGen igen = genFactory.createInterfaceGen ();
+ InterfaceEntry.interfaceGen = igen == null ? noop : igen;
+
+ ValueGen vgen = genFactory.createValueGen ();
+ ValueEntry.valueGen = vgen == null ? noop : vgen;
+
+ ValueBoxGen vbgen = genFactory.createValueBoxGen ();
+ ValueBoxEntry.valueBoxGen = vbgen == null ? noop : vbgen;
+
+ MethodGen mgen = genFactory.createMethodGen ();
+ MethodEntry.methodGen = mgen == null ? noop : mgen;
+
+ ModuleGen modgen = genFactory.createModuleGen ();
+ ModuleEntry.moduleGen = modgen == null ? noop : modgen;
+
+ NativeGen ngen = genFactory.createNativeGen ();
+ NativeEntry.nativeGen = ngen == null ? noop : ngen;
+
+ ParameterGen pgen = genFactory.createParameterGen ();
+ ParameterEntry.parameterGen = pgen == null ? noop : pgen;
+
+ PragmaGen prgen = genFactory.createPragmaGen ();
+ PragmaEntry.pragmaGen = prgen == null ? noop : prgen;
+
+ PrimitiveGen primgen = genFactory.createPrimitiveGen ();
+ PrimitiveEntry.primitiveGen = primgen == null ? noop : primgen;
+
+ SequenceGen seqgen = genFactory.createSequenceGen ();
+ SequenceEntry.sequenceGen = seqgen == null ? noop : seqgen;
+
+ StringGen strgen = genFactory.createStringGen ();
+ StringEntry.stringGen = strgen == null ? noop : strgen;
+
+ StructGen sgen = genFactory.createStructGen ();
+ StructEntry.structGen = sgen == null ? noop : sgen;
+
+ TypedefGen tgen = genFactory.createTypedefGen ();
+ TypedefEntry.typedefGen = tgen == null ? noop : tgen;
+
+ UnionGen ugen = genFactory.createUnionGen ();
+ UnionEntry.unionGen = ugen == null ? noop : ugen;
+ } // initGenerators
+
+ /**
+ * Write the version number of this compiler to standard out.
+ **/
+ protected void displayVersion ()
+ {
+ String message = Util.getMessage ("Version.product", Util.getMessage ("Version.number"));
+ System.out.println (message);
+ }
+
+ /**
+ * This is the repository of emitter arguments.
+ **/
+ public Arguments arguments = null;
+ /**
+ * This hashtable contains {@code <real name, alias>} pairs. It is filled in by
+ * extenders in cases where they wish to override an IDL type name with
+ * some other name. For instance, when mapping to Java, there could be
+ * an overrideNames entry of {@code <"TRUE", "true">}. NOTE: Do NOT change this
+ * variable to a new Hash table. Just add elements to it.
+ **/
+ protected Hashtable overrideNames = new Hashtable ();
+ /**
+ * This is the symbol table. It will be empty until the parse method
+ * executes. If errors are encountered, the state of the symbol table
+ * is undefined.
+ **/
+ protected Hashtable symbolTable = new Hashtable ();
+ /**
+ * This is a vector of strings of the form {@code "IDLfile"} or {@code <IDLfile>}.
+ * It is a list of the files included in the given IDL file. It will be empty
+ * until the parse method executes. If errors are encountered, the state
+ * of this vector is undefined.
+ **/
+ protected Vector includes = new Vector ();
+ /**
+ * This is a vector of IncludeEntry's. It is a list of the files included
+ * in the given IDL file. It mirrors the includes vector. It will be empty
+ * until the parse method executes. If errors are encountered, the state of
+ * this vector is undefined.
+ **/
+ protected Vector includeEntries = new Vector ();
+ static Noop noop = new Noop ();
+ private GenFactory genFactory = null;
+ private SymtabFactory symtabFactory = null;
+ private ExprFactory exprFactory = null;
+ private Parser parser = null;
+ Preprocessor preprocessor = new Preprocessor ();
+ private NoPragma noPragma = new NoPragma ();
+ private Enumeration emitList = null;
+ private String[] keywords = null;
+} // class Compile
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ConstEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ConstEntry.java
new file mode 100644
index 0000000..5f395be
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ConstEntry.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.constExpr.Expression;
+
+/**
+ * This is the symbol table entry for constants.
+ **/
+public class ConstEntry extends SymtabEntry
+{
+ protected ConstEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected ConstEntry (ConstEntry that)
+ {
+ super (that);
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ _value = that._value;
+ } // ctor
+
+ /** This is a shallow copy constructor. */
+ protected ConstEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ /** This is a shallow copy clone. */
+ public Object clone ()
+ {
+ return new ConstEntry (this);
+ } // clone
+
+ /** Invoke the constant generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ constGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the constant generator.
+ @return an object which implements the ConstGen interface.
+ @see ConstGen */
+ public Generator generator ()
+ {
+ return constGen;
+ } // generator
+
+ public Expression value ()
+ {
+ return _value;
+ } // value
+
+ public void value (Expression newValue)
+ {
+ _value = newValue;
+ } // value
+
+ static ConstGen constGen;
+ private Expression _value = null;
+} // class ConstEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ConstGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ConstGen.java
new file mode 100644
index 0000000..8dde99e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ConstGen.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+public interface ConstGen extends Generator
+{
+ void generate (Hashtable symbolTable, ConstEntry entry, PrintWriter stream);
+} // interface ConstGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/DefaultSymtabFactory.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/DefaultSymtabFactory.java
new file mode 100644
index 0000000..f10d86f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/DefaultSymtabFactory.java
@@ -0,0 +1,257 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+/**
+ * This factory constructs the default symbol table entries, namely,
+ * those declared within the package com.sun.tools.corba.se.idl.
+ **/
+public class DefaultSymtabFactory implements SymtabFactory
+{
+ public AttributeEntry attributeEntry ()
+ {
+ return new AttributeEntry ();
+ } // attributeEntry
+
+ public AttributeEntry attributeEntry (InterfaceEntry container, IDLID id)
+ {
+ return new AttributeEntry (container, id);
+ } // attributeEntry
+
+ public ConstEntry constEntry ()
+ {
+ return new ConstEntry ();
+ } // constEntry
+
+ public ConstEntry constEntry (SymtabEntry container, IDLID id)
+ {
+ return new ConstEntry (container, id);
+ } // constEntry
+
+ public NativeEntry nativeEntry ()
+ {
+ return new NativeEntry ();
+ } // interfaceEntry
+
+ public NativeEntry nativeEntry (SymtabEntry container, IDLID id)
+ {
+ return new NativeEntry (container, id);
+ } // interfaceEntry
+
+ public EnumEntry enumEntry ()
+ {
+ return new EnumEntry ();
+ } // enumEntry
+
+ public EnumEntry enumEntry (SymtabEntry container, IDLID id)
+ {
+ return new EnumEntry (container, id);
+ } // enumEntry
+
+ public ExceptionEntry exceptionEntry ()
+ {
+ return new ExceptionEntry ();
+ } // exceptionEntry
+
+ public ExceptionEntry exceptionEntry (SymtabEntry container, IDLID id)
+ {
+ return new ExceptionEntry (container, id);
+ } // exceptionEntry
+
+ public ForwardEntry forwardEntry ()
+ {
+ return new ForwardEntry ();
+ } // forwardEntry
+
+ public ForwardEntry forwardEntry (ModuleEntry container, IDLID id)
+ {
+ return new ForwardEntry (container, id);
+ } // forwardEntry
+
+ public ForwardValueEntry forwardValueEntry ()
+ {
+ return new ForwardValueEntry ();
+ } // forwardValueEntry
+
+ public ForwardValueEntry forwardValueEntry (ModuleEntry container, IDLID id)
+ {
+ return new ForwardValueEntry (container, id);
+ } // forwardValueEntry
+
+ public IncludeEntry includeEntry ()
+ {
+ return new IncludeEntry ();
+ } // includeEntry
+
+ public IncludeEntry includeEntry (SymtabEntry container)
+ {
+ return new IncludeEntry (container);
+ } // includeEntry
+
+ public InterfaceEntry interfaceEntry ()
+ {
+ return new InterfaceEntry ();
+ } // interfaceEntry
+
+ public InterfaceEntry interfaceEntry (ModuleEntry container, IDLID id)
+ {
+ return new InterfaceEntry (container, id);
+ } // interfaceEntry
+
+ public ValueEntry valueEntry ()
+ {
+ return new ValueEntry ();
+ } // valueEntry
+
+ public ValueEntry valueEntry (ModuleEntry container, IDLID id)
+ {
+ return new ValueEntry (container, id);
+ } // valueEntry
+
+ public ValueBoxEntry valueBoxEntry ()
+ {
+ return new ValueBoxEntry ();
+ } // valueBoxEntry
+
+ public ValueBoxEntry valueBoxEntry (ModuleEntry container, IDLID id)
+ {
+ return new ValueBoxEntry (container, id);
+ } // valueBoxEntry
+
+ public MethodEntry methodEntry ()
+ {
+ return new MethodEntry ();
+ } // methodEntry
+
+ public MethodEntry methodEntry (InterfaceEntry container, IDLID id)
+ {
+ return new MethodEntry (container, id);
+ } // methodEntry
+
+ public ModuleEntry moduleEntry ()
+ {
+ return new ModuleEntry ();
+ } // moduleEntry
+
+ public ModuleEntry moduleEntry (ModuleEntry container, IDLID id)
+ {
+ return new ModuleEntry (container, id);
+ } // moduleEntry
+
+ public ParameterEntry parameterEntry ()
+ {
+ return new ParameterEntry ();
+ } // parameterEntry
+
+ public ParameterEntry parameterEntry (MethodEntry container, IDLID id)
+ {
+ return new ParameterEntry (container, id);
+ } // parameterEntry
+
+ public PragmaEntry pragmaEntry ()
+ {
+ return new PragmaEntry ();
+ } // pragmaEntry
+
+ public PragmaEntry pragmaEntry (SymtabEntry container)
+ {
+ return new PragmaEntry (container);
+ } // pragmaEntry
+
+ public PrimitiveEntry primitiveEntry ()
+ {
+ return new PrimitiveEntry ();
+ } // primitiveEntry
+
+ /** "name" can be, but is not limited to, the primitive idl type names:
+ 'char', 'octet', 'short', 'long', etc. The reason it is not limited
+ to these is that, as an extender, you may wish to override these names.
+ For instance, when generating Java code, octet translates to byte, so
+ there is an entry in Compile.overrideNames: {@code <"octet", "byte">} and a
+ PrimitiveEntry in the symbol table for "byte". */
+ public PrimitiveEntry primitiveEntry (String name)
+ {
+ return new PrimitiveEntry (name);
+ } // primitiveEntry
+
+ public SequenceEntry sequenceEntry ()
+ {
+ return new SequenceEntry ();
+ } // sequenceEntry
+
+ public SequenceEntry sequenceEntry (SymtabEntry container, IDLID id)
+ {
+ return new SequenceEntry (container, id);
+ } // sequenceEntry
+
+ public StringEntry stringEntry ()
+ {
+ return new StringEntry ();
+ } // stringEntry
+
+ public StructEntry structEntry ()
+ {
+ return new StructEntry ();
+ } // structEntry
+
+ public StructEntry structEntry (SymtabEntry container, IDLID id)
+ {
+ return new StructEntry (container, id);
+ } // structEntry
+
+ public TypedefEntry typedefEntry ()
+ {
+ return new TypedefEntry ();
+ } // typedefEntry
+
+ public TypedefEntry typedefEntry (SymtabEntry container, IDLID id)
+ {
+ return new TypedefEntry (container, id);
+ } // typedefEntry
+
+ public UnionEntry unionEntry ()
+ {
+ return new UnionEntry ();
+ } // unionEntry
+
+ public UnionEntry unionEntry (SymtabEntry container, IDLID id)
+ {
+ return new UnionEntry (container, id);
+ } // unionEntry
+
+} // interface DefaultSymtabFactory
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/EnumEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/EnumEntry.java
new file mode 100644
index 0000000..ef7c048
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/EnumEntry.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This is the symbol table entry for enumerated types.
+ **/
+public class EnumEntry extends SymtabEntry
+{
+ protected EnumEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected EnumEntry (EnumEntry that)
+ {
+ super (that);
+ _elements = (Vector)that._elements.clone ();
+ } // ctor
+
+ protected EnumEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ public Object clone ()
+ {
+ return new EnumEntry (this);
+ } // clone
+
+ /** Invoke the enumerator generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ enumGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the enumerator generator.
+ @return an object which implements the EnumGen interface.
+ @see EnumGen */
+ public Generator generator ()
+ {
+ return enumGen;
+ } // generator
+
+ /** Add an element to the list of elements. */
+ public void addElement (String element)
+ {
+ _elements.addElement (element);
+ } // addElement
+
+ /** Each element of the vector is a String. */
+ public Vector elements ()
+ {
+ return _elements;
+ } // elements
+
+ static EnumGen enumGen;
+ private Vector _elements = new Vector ();
+} // class EnumEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/EnumGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/EnumGen.java
new file mode 100644
index 0000000..7a05ea4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/EnumGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface EnumGen extends Generator
+{
+ void generate (Hashtable symbolTable, EnumEntry entry, PrintWriter stream);
+} // interface EnumGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ExceptionEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ExceptionEntry.java
new file mode 100644
index 0000000..a669b5d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ExceptionEntry.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This is the symbol table entry for exceptions. An exception is simply
+ * a struct by a different name.
+ **/
+public class ExceptionEntry extends StructEntry
+{
+ protected ExceptionEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected ExceptionEntry (ExceptionEntry that)
+ {
+ super (that);
+ } // ctor
+
+ protected ExceptionEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ } // ctor
+
+ public Object clone ()
+ {
+ return new ExceptionEntry (this);
+ } // clone
+
+ /** Invoke the exception generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ exceptionGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the exception generator.
+ @return an object which implements the ExceptionGen interface.
+ @see ExceptionGen */
+ public Generator generator ()
+ {
+ return exceptionGen;
+ } // generator
+
+ static ExceptionGen exceptionGen;
+} // class ExceptionEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ExceptionGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ExceptionGen.java
new file mode 100644
index 0000000..52cbea8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ExceptionGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface ExceptionGen extends Generator
+{
+ void generate (Hashtable symbolTable, ExceptionEntry entry, PrintWriter stream);
+} // interface ExceptionGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Factories.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Factories.java
new file mode 100644
index 0000000..de17dfa
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Factories.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+/**
+ * If the framework is being extended, this class must be extended.
+ * At very least, the genFactory method must be overridden to return
+ * the code generator extensions. The remaining methods may be overridden
+ * if necessary:
+ * <dl>
+ * <dt>symtabFactory
+ * <dd>If you wish to extend the symbol table entries, this method must return the factory which constructs those extensions. If you only want to extend a few of the symbol table entries, it may be useful to extend com.sun.tools.corba.se.idl.DefaultSymtabFactory and only override the pertinent methods.
+ * <dt>exprFactory
+ * <dd>If you wish to extend the expression classes, this method must return the factory which constructs those extensions. If you only want to extend a few of the expression classes, it may be useful to extend com.sun.tools.corba.se.idl.constExpr.DefaultSymtabFactory and only override the pertinent methods.
+ * <dt>arguments
+ * <dd>If you wish to add additional arguments to the base set of arguments, extend com.sun.tools.corba.se.idl.Arguments and override this method to return that class.
+ * <dt>languageKeywords
+ * <dd>If the language you are generating code in has keywords other than IDL keywords, these keywords should be returned by this method. The framework will prepend any IDL identifiers it encounters which are in this list with an underscore (`_') to avoid compilation errors. For instance, `catch' is a Java keyword. If the generators are emitting Java code for the following IDL, emitting `catch' as is will cause compile errors, so it is changed to `_catch':
+ * <br>
+ * IDL:
+ * <br>
+ * const long catch = 22;
+ * <br>
+ * Possible generated code:
+ * <br>
+ * public static final int _catch = 22;
+ * </dl>
+ **/
+public class Factories
+{
+ /** Return the implementation of the GenFactory interface. If this
+ returns null, then the compiler cannot generate anything. */
+ public GenFactory genFactory ()
+ {
+ return null;
+ } // genFactory
+
+ /** Return the implementation of the SymtabFactory interface. If this
+ returns null, the default symbol table entries will be used. */
+ public SymtabFactory symtabFactory ()
+ {
+ return new DefaultSymtabFactory ();
+ } // symtabFactory
+
+ /** Return the implementation of the ExprFactory interface. If this
+ returns null, the default expressions will be used. */
+ public com.sun.tools.corba.se.idl.constExpr.ExprFactory exprFactory ()
+ {
+ return new com.sun.tools.corba.se.idl.constExpr.DefaultExprFactory ();
+ } // exprFactory
+
+ /** Return a subclass of the Arguments class. If this returns null,
+ the default will be used. */
+ public Arguments arguments ()
+ {
+ return new Arguments ();
+ } // arguments
+
+ /** Return the list of keywords in the generated language.
+ Note that these keywords may contain the following wildcards:
+ <dl>
+ <dt>`*'
+ <dd>matches zero or more characters
+ <dt>`+'
+ <dd>matches one or more characters
+ <dt>`.'
+ <dd>matches any single character
+ </dl> */
+ public String[] languageKeywords ()
+ {
+ return null;
+ } // languageKeywords
+} // interface Factories
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardEntry.java
new file mode 100644
index 0000000..a8da768
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardEntry.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This is the symbol table entry for forward declarations of interfaces.
+ **/
+public class ForwardEntry extends SymtabEntry implements InterfaceType
+{
+ protected ForwardEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected ForwardEntry (ForwardEntry that)
+ {
+ super (that);
+ } // ctor
+
+ protected ForwardEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ public Object clone ()
+ {
+ return new ForwardEntry (this);
+ } // clone
+
+ /** Invoke the forward declaration generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ forwardGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the interface generator.
+ @return an object which implements the InterfaceGen interface.
+ @see InterfaceGen */
+ public Generator generator ()
+ {
+ return forwardGen;
+ } // generator
+
+ static boolean replaceForwardDecl (InterfaceEntry interfaceEntry)
+ {
+ boolean result = true;
+ try
+ {
+ ForwardEntry forwardEntry =
+ (ForwardEntry)Parser.symbolTable.get (interfaceEntry.fullName ());
+ if ( forwardEntry != null )
+ {
+ result = (interfaceEntry.getInterfaceType () ==
+ forwardEntry.getInterfaceType ());
+ forwardEntry.type (interfaceEntry);
+
+ // If this interface has been forward declared, there are probably
+ // other interfaces which derive from a ForwardEntry. Replace
+ // those ForwardEntry's with this InterfaceEntry:
+ interfaceEntry.forwardedDerivers = forwardEntry.derivers;
+ for ( Enumeration derivers = forwardEntry.derivers.elements();
+ derivers.hasMoreElements(); )
+ ((InterfaceEntry)derivers.nextElement ()).replaceForwardDecl (forwardEntry, interfaceEntry);
+
+ // Replace the entry's whose types are forward declarations:
+ for ( Enumeration types = forwardEntry.types.elements ();
+ types.hasMoreElements (); )
+ ((SymtabEntry)types.nextElement ()).type (interfaceEntry);
+ }
+ }
+ catch (Exception exception)
+ {}
+ return result;
+ } // replaceForwardDecl
+
+ ///////////////
+ // Implement interface InterfaceType
+
+ public int getInterfaceType ()
+ {
+ return _type;
+ }
+
+ public void setInterfaceType (int type)
+ {
+ _type = type;
+ }
+
+ static ForwardGen forwardGen;
+ Vector derivers = new Vector (); // Vector of InterfaceEntry's.
+ Vector types = new Vector (); // Vector of the entry's whose type is a forward declaration.
+ private int _type = InterfaceType.NORMAL; // interface type
+} // class ForwardEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardGen.java
new file mode 100644
index 0000000..c136a26
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface ForwardGen extends Generator
+{
+ void generate (Hashtable symbolTable, ForwardEntry entry, PrintWriter stream);
+} // interface ForwardGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardValueEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardValueEntry.java
new file mode 100644
index 0000000..45c1a9d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardValueEntry.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This is the symbol table entry for forward declarations of values.
+ **/
+public class ForwardValueEntry extends ForwardEntry
+{
+ protected ForwardValueEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected ForwardValueEntry (ForwardValueEntry that)
+ {
+ super (that);
+ } // ctor
+
+ protected ForwardValueEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ } // ctor
+
+ public Object clone ()
+ {
+ return new ForwardValueEntry (this);
+ } // clone
+
+ /** Invoke the forward value declaration generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ forwardValueGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the interface generator.
+ @return an object which implements the ForwardValueGen interface.
+ @see ValueGen */
+ public Generator generator ()
+ {
+ return forwardValueGen;
+ } // generator
+
+ static ForwardValueGen forwardValueGen;
+} // class ForwardValueEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardValueGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardValueGen.java
new file mode 100644
index 0000000..d4f85a6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ForwardValueGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface ForwardValueGen extends Generator
+{
+ void generate (Hashtable symbolTable, ForwardValueEntry entry, PrintWriter stream);
+} // interface ForwardValueGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/GenFactory.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/GenFactory.java
new file mode 100644
index 0000000..315b1fe
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/GenFactory.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+/**
+ * To extend this compiler framework to generate something other than
+ * the default, this factory interface must be implemented and the name
+ * of it must be set in the main method (see idl.Compile).
+ * <p>
+ * The implementation of each method should be quite simple. Take
+ * createAttributeGen, for instance. If the interface AttributeGen is
+ * implemented by a class called MyAttributeGen, then createAttributeGen
+ * will be the following:
+ * <pre>
+ * public AttributeGen createAttributeGen ()
+ * {
+ * return new MyAttributeGen ();
+ * }
+ * </pre>
+ * <p>
+ * If it is desired that a generator do nothing, it is not necessary to
+ * implement one which does nothing; you may simply write that particular
+ * create method so that it returns null.
+ * <p>
+ * Note that this class MUST have a public default constructor (one which
+ * takes no parameters).
+ **/
+public interface GenFactory
+{
+ public AttributeGen createAttributeGen ();
+ public ConstGen createConstGen ();
+ public EnumGen createEnumGen ();
+ public ExceptionGen createExceptionGen ();
+ public ForwardGen createForwardGen ();
+ public ForwardValueGen createForwardValueGen ();
+ public IncludeGen createIncludeGen ();
+ public InterfaceGen createInterfaceGen ();
+ public ValueGen createValueGen ();
+ public ValueBoxGen createValueBoxGen ();
+ public MethodGen createMethodGen ();
+ public ModuleGen createModuleGen ();
+ public NativeGen createNativeGen ();
+ public ParameterGen createParameterGen ();
+ public PragmaGen createPragmaGen ();
+ public PrimitiveGen createPrimitiveGen ();
+ public SequenceGen createSequenceGen ();
+ public StringGen createStringGen ();
+ public StructGen createStructGen ();
+ public TypedefGen createTypedefGen ();
+ public UnionGen createUnionGen ();
+} // interface GenFactory
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/GenFileStream.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/GenFileStream.java
new file mode 100644
index 0000000..d4347c0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/GenFileStream.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.CharArrayWriter;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.PrintWriter;
+
+public class GenFileStream extends PrintWriter
+{
+ public GenFileStream (String filename)
+ {
+ // What I really want to do here is:
+ // super (byteStream = new ByteArrayOutputStream ());
+ // but that isn't legal. The super constructor MUST
+ // be called before any instance variables are used.
+ // This implementation gets around that problem.
+ // <f49747.1>
+ //super (tmpByteStream = new ByteArrayOutputStream ());
+ //byteStream = tmpByteStream;
+ super (tmpCharArrayWriter = new CharArrayWriter());
+ charArrayWriter = tmpCharArrayWriter;
+ name = filename;
+ } // ctor
+
+ public void close ()
+ {
+ File file = new File (name);
+ try
+ {
+ if (checkError ())
+ throw new IOException ();
+ // <f49747.1>
+ //FileOutputStream fileStream = new FileOutputStream (file);
+ //fileStream.write (byteStream.toByteArray ());
+ //fileStream.close ();
+ FileWriter fileWriter = new FileWriter (file);
+ fileWriter.write (charArrayWriter.toCharArray ());
+ fileWriter.close ();
+ }
+ catch (IOException e)
+ {
+ String[] parameters = {name, e.toString ()};
+ System.err.println (Util.getMessage ("GenFileStream.1", parameters));
+ }
+ super.close ();
+ } // close
+
+ public String name ()
+ {
+ return name;
+ } // name
+
+ // <f49747.1>
+ //private ByteArrayOutputStream byteStream;
+ //private static ByteArrayOutputStream tmpByteStream;
+ private CharArrayWriter charArrayWriter;
+ private static CharArrayWriter tmpCharArrayWriter;
+ private String name;
+} // GenFileStream
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Generator.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Generator.java
new file mode 100644
index 0000000..6eff7f7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Generator.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+public interface Generator
+{
+} // interface Generator
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IDLID.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IDLID.java
new file mode 100644
index 0000000..6feb97d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IDLID.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+public class IDLID extends RepositoryID
+{
+ public IDLID ()
+ {
+ _prefix = "";
+ _name = "";
+ _version = "1.0";
+ } // ctor
+
+ public IDLID (String prefix, String name, String version)
+ {
+ _prefix = prefix;
+ _name = name;
+ _version = version;
+ } // ctor
+
+ public String ID ()
+ {
+ if (_prefix.equals (""))
+ return "IDL:" + _name + ':' + _version;
+ else
+ return "IDL:" + _prefix + '/' + _name + ':' + _version;
+ } // ID
+
+ public String prefix ()
+ {
+ return _prefix;
+ } // prefix
+
+ void prefix (String prefix)
+ {
+ if (prefix == null)
+ _prefix = "";
+ else
+ _prefix = prefix;
+ } // prefix
+
+ public String name ()
+ {
+ return _name;
+ } // name
+
+ void name (String name)
+ {
+ if (name == null)
+ _name = "";
+ else
+ _name = name;
+ } // name
+
+ public String version ()
+ {
+ return _version;
+ } // version
+
+ void version (String version)
+ {
+ if (version == null)
+ _version = "";
+ else
+ _version = version;
+ } // version
+
+ void appendToName (String name)
+ {
+ if (name != null)
+ if (_name.equals (""))
+ _name = name;
+ else
+ _name = _name + '/' + name;
+ } // appendToName
+
+ void replaceName (String name)
+ {
+ if (name == null)
+ _name = "";
+ else
+ {
+ int index = _name.lastIndexOf ('/');
+ if (index < 0)
+ _name = name;
+ else
+ _name = _name.substring (0, index + 1) + name;
+ }
+ } // replaceName
+
+ public Object clone ()
+ {
+ return new IDLID (_prefix, _name, _version);
+ } // clone
+
+ private String _prefix;
+ private String _name;
+ private String _version;
+} // class IDLID
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IncludeEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IncludeEntry.java
new file mode 100644
index 0000000..cfb3529
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IncludeEntry.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This is the symbol table entry for the #include statement.
+ **/
+public class IncludeEntry extends SymtabEntry
+{
+ protected IncludeEntry ()
+ {
+ super ();
+ repositoryID (Util.emptyID);
+ } // ctor
+
+ protected IncludeEntry (SymtabEntry that)
+ {
+ super (that, new IDLID ());
+ module (that.name ());
+ name ("");
+ } // ctor
+
+ protected IncludeEntry (IncludeEntry that)
+ {
+ super (that);
+ } // ctor
+
+ public Object clone ()
+ {
+ return new IncludeEntry (this);
+ } // clone
+
+ /** Invoke the Include type generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ includeGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the Include type generator.
+ @return an object which implements the IncludeGen interface.
+ @see IncludeGen */
+ public Generator generator ()
+ {
+ return includeGen;
+ } // generator
+
+ //d44810
+ /** Set the fully-qualified file specification of this include file. */
+ public void absFilename (String afn)
+ {
+ _absFilename = afn;
+ }
+
+ //d44810
+ /** Access the fully-qualified file specification of this include.
+ @return a string containing the path of the include file. */
+ public String absFilename ()
+ {
+ return _absFilename;
+ }
+
+ /** Add an IncludeEntry to the list of files which this included
+ file includes. */
+ public void addInclude (IncludeEntry entry)
+ {
+ includeList.addElement (entry);
+ } // addInclude
+
+ /** Get the list of files which this file includes. */
+ public Vector includes ()
+ {
+ return includeList;
+ } // includes
+
+ static IncludeGen includeGen;
+ /** List of files this file includes */
+ private Vector includeList = new Vector ();
+ //d44810
+ /** Absolute file name for .u file generation. */
+ private String _absFilename = null;
+} // class IncludeEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IncludeGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IncludeGen.java
new file mode 100644
index 0000000..d97f602
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/IncludeGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface IncludeGen extends Generator
+{
+ void generate (Hashtable symbolTable, IncludeEntry entry, PrintWriter stream);
+} // interface IncludeGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceEntry.java
new file mode 100644
index 0000000..a5b303c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceEntry.java
@@ -0,0 +1,355 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This is the symbol table entry for interfaces.
+ **/
+public class InterfaceEntry extends SymtabEntry implements InterfaceType
+{
+
+ protected InterfaceEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected InterfaceEntry (InterfaceEntry that)
+ {
+ super (that);
+ _derivedFromNames = (Vector)that._derivedFromNames.clone ();
+ _derivedFrom = (Vector)that._derivedFrom.clone ();
+ _methods = (Vector)that._methods.clone ();
+ _allMethods = (Vector)that._allMethods.clone ();
+ forwardedDerivers = (Vector)that.forwardedDerivers.clone ();
+ _contained = (Vector)that._contained.clone ();
+ _interfaceType = that._interfaceType;
+ } // ctor
+
+ protected InterfaceEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ public boolean isAbstract()
+ {
+ return _interfaceType == ABSTRACT ;
+ }
+
+ public boolean isLocal()
+ {
+ return _interfaceType == LOCAL ;
+ }
+
+ public boolean isLocalServant()
+ {
+ return _interfaceType == LOCALSERVANT ;
+ }
+
+ public boolean isLocalSignature()
+ {
+ return _interfaceType == LOCAL_SIGNATURE_ONLY ;
+ }
+
+ public Object clone ()
+ {
+ return new InterfaceEntry (this);
+ } // clone
+
+ /** Invoke the interface generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ interfaceGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the interface generator.
+ @return an object which implements the InterfaceGen interface.
+ @see InterfaceGen */
+ public Generator generator ()
+ {
+ return interfaceGen;
+ } // generator
+
+ /** Add an InterfaceEntry to the list of interfaces which this interface
+ is derivedFrom. During parsing, the parameter to this method COULD
+ be a ForwardEntry, but when parsing is complete, calling derivedFrom
+ will return a vector which only contains InterfaceEntry's. */
+ public void addDerivedFrom (SymtabEntry derivedFrom)
+ {
+ _derivedFrom.addElement (derivedFrom);
+ } // addDerivedFrom
+
+ /** This method returns a vector of InterfaceEntry's. */
+ public Vector derivedFrom ()
+ {
+ return _derivedFrom;
+ } // derivedFrom
+
+ /** Add to the list of derivedFrom names. */
+ public void addDerivedFromName (String name)
+ {
+ _derivedFromNames.addElement (name);
+ } // addDerivedFromName
+
+ /** This method returns a vector of Strings, each of which is a fully
+ qualified name of an interface. This vector corresponds to the
+ derivedFrom vector. The first element of this vector is the name
+ of the first element of the derivedFrom vector, etc. */
+ public Vector derivedFromNames ()
+ {
+ return _derivedFromNames;
+ } // derivedFromNames
+
+ /** Add a method/attribute to the list of methods. */
+ public void addMethod (MethodEntry method)
+ {
+ _methods.addElement (method);
+ } // addMethod
+
+ /** This is a vector of MethodEntry's. These are the methods and
+ attributes contained within this Interface. */
+ public Vector methods ()
+ {
+ return _methods;
+ } // methods
+
+ /** Add a symbol table entry to this interface's contained vector. */
+ public void addContained (SymtabEntry entry)
+ {
+ _contained.addElement (entry);
+ } // addContained
+
+ /** This is a vector of SymtabEntry's. Valid entries in this vector are:
+ AttributeEntry, ConstEntry, EnumEntry, ExceptionEntry, MethodEntry,
+ StructEntry, NativeEntry, TypedefEntry, UnionEntry.
+ Note that the methods vector is a subset of this vector. */
+ public Vector contained ()
+ {
+ return _contained;
+ } // contained
+
+ void methodsAddElement (MethodEntry method, Scanner scanner)
+ {
+ if (verifyMethod (method, scanner, false))
+ {
+ addMethod (method);
+ _allMethods.addElement (method);
+
+ // Add this method to the 'allMethods' list of any interfaces
+ // which may have inherited this one when it was a forward
+ // reference.
+ addToForwardedAllMethods (method, scanner);
+ }
+ } // methodsAddElement
+
+ void addToForwardedAllMethods (MethodEntry method, Scanner scanner)
+ {
+ Enumeration e = forwardedDerivers.elements ();
+ while (e.hasMoreElements ())
+ {
+ InterfaceEntry derived = (InterfaceEntry)e.nextElement ();
+ if (derived.verifyMethod (method, scanner, true))
+ derived._allMethods.addElement (method);
+ }
+ } // addToForwardedAllMethods
+
+ // Make sure a method by this name doesn't exist in this class or
+ // in this class's parents
+ private boolean verifyMethod (MethodEntry method, Scanner scanner, boolean clash)
+ {
+ boolean unique = true;
+ String lcName = method.name ().toLowerCase ();
+ Enumeration e = _allMethods.elements ();
+ while (e.hasMoreElements ())
+ {
+ MethodEntry emethod = (MethodEntry)e.nextElement ();
+
+ // Make sure the method doesn't exist either in its
+ // original name or in all lower case. In IDL, identifiers
+ // which differ only in case are collisions.
+ String lceName = emethod.name ().toLowerCase ();
+ if (method != emethod && lcName.equals (lceName))
+ {
+ if (clash)
+ ParseException.methodClash (scanner, fullName (), method.name ());
+ else
+ ParseException.alreadyDeclared (scanner, method.name ());
+ unique = false;
+ break;
+ }
+ }
+ return unique;
+ } // verifyMethod
+
+ void derivedFromAddElement (SymtabEntry e, Scanner scanner)
+ {
+ addDerivedFrom (e);
+ addDerivedFromName (e.fullName ());
+ addParentType( e, scanner );
+ } // derivedFromAddElement
+
+ void addParentType (SymtabEntry e, Scanner scanner)
+ {
+ if (e instanceof ForwardEntry)
+ addToDerivers ((ForwardEntry)e);
+ else
+ { // e instanceof InterfaceEntry
+ InterfaceEntry derivedFrom = (InterfaceEntry)e;
+
+ // Compare all of the parent's methods to the methods on this
+ // interface, looking for name clashes:
+ for ( Enumeration enumeration = derivedFrom._allMethods.elements ();
+ enumeration.hasMoreElements (); )
+ {
+ MethodEntry method = (MethodEntry)enumeration.nextElement ();
+ if ( verifyMethod (method, scanner, true))
+ _allMethods.addElement (method);
+
+ // Add this method to the 'allMethods' list of any interfaces
+ // which may have inherited this one when it was a forward
+ // reference:
+ addToForwardedAllMethods (method, scanner);
+ }
+
+ // If any of the parent's parents are forward entries, make
+ // sure this interface gets added to their derivers list so
+ // that when the forward entry is defined, the 'allMethods'
+ // list of this interface can be updated.
+ lookForForwardEntrys (scanner, derivedFrom);
+ }
+ } // addParentType
+
+ private void lookForForwardEntrys (Scanner scanner, InterfaceEntry entry)
+ {
+ Enumeration parents = entry.derivedFrom ().elements ();
+ while (parents.hasMoreElements ())
+ {
+ SymtabEntry parent = (SymtabEntry)parents.nextElement ();
+ if (parent instanceof ForwardEntry)
+ addToDerivers ((ForwardEntry)parent);
+ else if (parent == entry)
+ ParseException.selfInherit (scanner, entry.fullName ());
+ else // it must be an InterfaceEntry
+ lookForForwardEntrys (scanner, (InterfaceEntry)parent);
+ }
+ } // lookForForwardEntrys
+
+ public boolean replaceForwardDecl (ForwardEntry oldEntry, InterfaceEntry newEntry)
+ {
+ int index = _derivedFrom.indexOf( oldEntry );
+ if ( index >= 0 )
+ _derivedFrom.setElementAt( newEntry, index );
+ return (index >= 0);
+ } // replaceForwardDecl
+
+ private void addToDerivers (ForwardEntry forward)
+ {
+ // Add this interface to the derivers list on the forward entry
+ // so that when the forward entry is defined, the 'allMethods'
+ // list of this interface can be updated.
+ forward.derivers.addElement (this);
+ Enumeration e = forwardedDerivers.elements ();
+ while (e.hasMoreElements ())
+ forward.derivers.addElement ((InterfaceEntry)e.nextElement ());
+ } // addToDerivers
+
+ /** This method returns a vector of the elements in the state block.
+ If it is null, this is not a stateful interface. If it is non-null,
+ but of zero length, then it is still stateful; it has no state
+ entries itself, but it has an ancestor which does. */
+ public Vector state ()
+ {
+ return _state;
+ } // state
+
+ public void initState ()
+ {
+ _state = new Vector ();
+ } // initState
+
+ public void addStateElement (InterfaceState state, Scanner scanner)
+ {
+ if (_state == null)
+ _state = new Vector ();
+ String name = state.entry.name ();
+ for (Enumeration e = _state.elements (); e.hasMoreElements ();)
+ if (name.equals (((InterfaceState) e.nextElement ()).entry.name ()))
+ ParseException.duplicateState (scanner, name);
+ _state.addElement (state);
+ } // state
+
+ public int getInterfaceType ()
+ {
+ return _interfaceType;
+ }
+
+ public void setInterfaceType (int type)
+ {
+ _interfaceType = type;
+ }
+
+ /** Get the allMethods vector. */
+ public Vector allMethods ()
+ {
+ return _allMethods;
+ }
+
+ private Vector _derivedFromNames = new Vector();
+ private Vector _derivedFrom = new Vector();
+ private Vector _methods = new Vector();
+ Vector _allMethods = new Vector();
+ Vector forwardedDerivers = new Vector();
+ private Vector _contained = new Vector();
+ private Vector _state = null;
+ private int _interfaceType = NORMAL;
+
+ static InterfaceGen interfaceGen;
+} // class InterfaceEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceGen.java
new file mode 100644
index 0000000..aee4d67
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface InterfaceGen extends Generator
+{
+ void generate (Hashtable symbolTable, InterfaceEntry entry, PrintWriter stream);
+} // interface InterfaceGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceState.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceState.java
new file mode 100644
index 0000000..2827456
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceState.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+/**
+ * This class is only used within an InterfaceEntry. If the interface
+ * is stateful, then its state vector will contain one or more of these
+ * InterfaceStates.
+ **/
+public class InterfaceState
+{
+ public static final int Private = 0,
+ Protected = 1,
+ Public = 2;
+
+ public InterfaceState (int m, TypedefEntry e)
+ {
+ modifier = m;
+ entry = e;
+ if (modifier < Private || modifier > Public)
+ modifier = Public;
+ } // ctor
+
+ public int modifier = Public;
+ public TypedefEntry entry = null;
+} // class InterfaceState
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceType.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceType.java
new file mode 100644
index 0000000..4fb3418
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InterfaceType.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface InterfaceType
+{
+ public static final int NORMAL = 0 ;
+ public static final int ABSTRACT = 1 ;
+
+ // LOCAL generates code according to the Local interfaces
+ // Here helper and holder classes are the only ones generated
+ public static final int LOCAL = 2 ;
+
+ // intermediate solution to enable people to extend ServantLocatorPOA
+ // and ServantActivatorPOA for interoperability. This is until the
+ // POA is declared Local officially by OMG
+ public static final int LOCALSERVANT = 3 ;
+
+ // generate only signature interfaces, no helper/holders are generated
+ public static final int LOCAL_SIGNATURE_ONLY = 4 ;
+
+ public int getInterfaceType ();
+
+ public void setInterfaceType( int type ) ;
+} // interface InterfaceType
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InvalidArgument.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InvalidArgument.java
new file mode 100644
index 0000000..fa3e1bd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InvalidArgument.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+/**
+ * An invalid argument for the compiler has been encountered.
+ **/
+public class InvalidArgument extends Exception
+{
+ /** @param arg the invalid argument. */
+ public InvalidArgument (String arg)
+ {
+ message = Util.getMessage ("InvalidArgument.1", arg) + "\n\n" + Util.getMessage ("usage");
+ } // ctor
+
+ public InvalidArgument ()
+ {
+ message = Util.getMessage ("InvalidArgument.2") + "\n\n" + Util.getMessage ("usage");
+ } // ctor
+
+ public String getMessage ()
+ {
+ return message;
+ } // getMessage
+
+ private String message = null;
+} // class InvalidArgument
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InvalidCharacter.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InvalidCharacter.java
new file mode 100644
index 0000000..19932b2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/InvalidCharacter.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -D62023<daz> Cast char to byte for JDK 1.2 compatability.
+
+import java.io.IOException;
+
+public class InvalidCharacter extends IOException
+{
+ public InvalidCharacter (String filename, String line, int lineNumber, int pos, char ch)
+ {
+ String pointer = "^";
+ if (pos > 1)
+ {
+ byte[] bytes = new byte [pos - 1];
+ for (int i = 0; i < pos - 1; ++i)
+ bytes[i] = (byte)' '; // <d62023>
+ pointer = new String (bytes) + pointer;
+ }
+ String[] parameters = {filename, Integer.toString (lineNumber), "" + ch, Integer.toString ((int)ch), line, pointer};
+ message = Util.getMessage ("InvalidCharacter.1", parameters);
+ }
+
+ public String getMessage ()
+ {
+ return message;
+ } // getMessage
+
+ private String message = null;
+} // class InvalidCharacter
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/MethodEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/MethodEntry.java
new file mode 100644
index 0000000..f7acfa1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/MethodEntry.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// - What does oneway mean?
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This is the symbol table entry for methods.
+ **/
+public class MethodEntry extends SymtabEntry
+{
+ protected MethodEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected MethodEntry (MethodEntry that)
+ {
+ super (that);
+ _exceptionNames = (Vector)that._exceptionNames.clone ();
+ _exceptions = (Vector)that._exceptions.clone ();
+ _contexts = (Vector)that._contexts.clone ();
+ _parameters = (Vector)that._parameters.clone ();
+ _oneway = that._oneway;
+ } // ctor
+
+ protected MethodEntry (InterfaceEntry that, IDLID clone)
+ {
+ super (that, clone);
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ public Object clone ()
+ {
+ return new MethodEntry (this);
+ } // clone
+
+ /** Invoke the method generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ methodGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the method generator.
+ @return an object which implements the MethodGen interface.
+ @see MethodGen */
+ public Generator generator ()
+ {
+ return methodGen;
+ } // generator
+
+ public void type (SymtabEntry newType)
+ {
+ super.type (newType);
+ if (newType == null)
+ typeName ("void");
+ } // type
+
+ /** Add an exception to the exception list. */
+ public void addException (ExceptionEntry exception)
+ {
+ _exceptions.addElement (exception);
+ } // addException
+
+ /** This a a vector of the exceptions which this method raises. */
+ public Vector exceptions ()
+ {
+ return _exceptions;
+ } // exceptions
+
+ /** Add an exception name to the list of exception names. */
+ public void addExceptionName (String name)
+ {
+ _exceptionNames.addElement (name);
+ } // addExceptionName
+
+ /** This is a vector of strings, each of which is the full name of an
+ exception which this method throws. This vector corresponds to the
+ exceptions vector. The first element of this vector is the name
+ of the first element of the exceptions vector, etc. */
+ public Vector exceptionNames ()
+ {
+ return _exceptionNames;
+ } // exceptionNames
+
+ /* Add a context to the context list. */
+ public void addContext (String context)
+ {
+ _contexts.addElement (context);
+ } // addContext
+
+ /** This is a vector of strings, each of which is the name of a context. */
+ public Vector contexts ()
+ {
+ return _contexts;
+ } // contexts
+
+ /** Add a parameter to the parameter list. */
+ public void addParameter (ParameterEntry parameter)
+ {
+ _parameters.addElement (parameter);
+ } // addParameter
+
+ /** This is a vector of ParameterEntry's. They are the parameters on
+ this method and their order in the vector is the order they appear
+ on the method. */
+ public Vector parameters ()
+ {
+ return _parameters;
+ } // parameters
+
+ /** Is this a oneway method? */
+ public void oneway (boolean yes)
+ {
+ _oneway = yes;
+ } // oneway
+
+ /** Is this a oneway method? */
+ public boolean oneway ()
+ {
+ return _oneway;
+ } // oneway
+
+ /** Is this a value method? */
+ public void valueMethod (boolean yes)
+ {
+ _valueMethod = yes;
+ } // valueMethod
+
+ /** Is this a value method? */
+ public boolean valueMethod ()
+ {
+ return _valueMethod;
+ } // valueMethod
+
+ void exceptionsAddElement (ExceptionEntry e)
+ {
+ addException (e);
+ addExceptionName (e.fullName ());
+ } // exceptionsAddElement
+
+ private Vector _exceptionNames = new Vector ();
+ private Vector _exceptions = new Vector ();
+ private Vector _contexts = new Vector ();
+ private Vector _parameters = new Vector ();
+ private boolean _oneway = false;
+ private boolean _valueMethod = false;
+
+ static MethodGen methodGen;
+} // class MethodEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/MethodGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/MethodGen.java
new file mode 100644
index 0000000..fab8044
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/MethodGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface MethodGen extends Generator
+{
+ void generate (Hashtable symbolTable, MethodEntry entry, PrintWriter stream);
+} // interface MethodGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ModuleEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ModuleEntry.java
new file mode 100644
index 0000000..1dee7aa
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ModuleEntry.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This is the symbol table entry for modules.
+ **/
+public class ModuleEntry extends SymtabEntry
+{
+ protected ModuleEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected ModuleEntry (ModuleEntry that)
+ {
+ super (that);
+ _contained = (Vector)that._contained.clone ();
+ } // ctor
+
+ protected ModuleEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ public Object clone ()
+ {
+ return new ModuleEntry (this);
+ } // clone
+
+ /** Invoke the module generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ moduleGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the module generator.
+ @return an object which implements the ModuleGen interface.
+ @see ModuleGen */
+ public Generator generator ()
+ {
+ return moduleGen;
+ } // generator
+
+ /** alid entries in this vector are: TypedefEntry, ExceptionEntry,
+ StructEntry, UnionEntry, EnumEntry, ConstEntry, InterfaceEntry,
+ ModuleEntry. */
+ public void addContained (SymtabEntry entry)
+ {
+ _contained.addElement (entry);
+ } // addContained
+
+ /** This is a vector of SymtabEntry's. Valid entries in this vector are:
+ TypedefEntry, ExceptionEntry, StructEntry, UnionEntry, EnumEntry,
+ ConstEntry, InterfaceEntry, ModuleEntry. */
+ public Vector contained ()
+ {
+ return _contained;
+ } // contained
+
+ private Vector _contained = new Vector ();
+
+ static ModuleGen moduleGen;
+} // class ModuleEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ModuleGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ModuleGen.java
new file mode 100644
index 0000000..90902d0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ModuleGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface ModuleGen extends Generator
+{
+ void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream);
+} // interface ModuleGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NativeEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NativeEntry.java
new file mode 100644
index 0000000..7be0fa3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NativeEntry.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+/**
+ * This is the symbol table entry for constants.
+ **/
+public class NativeEntry extends SymtabEntry
+{
+ protected NativeEntry ()
+ {
+ super ();
+ repositoryID (Util.emptyID);
+ } // ctor
+
+ protected NativeEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ protected NativeEntry (NativeEntry that)
+ {
+ super (that);
+ } // ctor
+
+ /** This is a shallow copy clone. */
+ public Object clone ()
+ {
+ return new NativeEntry (this);
+ } // clone
+
+ /** Invoke the constant generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ nativeGen.generate(symbolTable, this, stream);
+ } // generate
+
+ /** Access the constant generator.
+ @return an object which implements the ConstGen interface.
+ @see ConstGen */
+ public Generator generator ()
+ {
+ return nativeGen;
+ } // generator
+
+ static NativeGen nativeGen;
+} // class NativeEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NativeGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NativeGen.java
new file mode 100644
index 0000000..91fb12c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NativeGen.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+public interface NativeGen extends Generator
+{
+ void generate (Hashtable symbolTable, NativeEntry entry, PrintWriter stream);
+} // interface NativeGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NoPragma.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NoPragma.java
new file mode 100644
index 0000000..c8e6a70
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/NoPragma.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.IOException;
+
+class NoPragma extends PragmaHandler
+{
+ public boolean process (String pragma, String currentToken) throws IOException
+ {
+ parseException (Util.getMessage ("Preprocessor.unknownPragma", pragma));
+ skipToEOL ();
+ return true;
+ } // process
+} // class NoPragma
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Noop.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Noop.java
new file mode 100644
index 0000000..87ae2ce
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Noop.java
@@ -0,0 +1,241 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.constExpr.ExprFactory;
+
+public class Noop implements
+ AttributeGen, ConstGen, EnumGen, ExceptionGen, ForwardGen,
+ ForwardValueGen, IncludeGen, InterfaceGen, ValueGen, ValueBoxGen,
+ MethodGen, ModuleGen, NativeGen, ParameterGen, PragmaGen,
+ PrimitiveGen, SequenceGen, StringGen, StructGen, TypedefGen,
+ UnionGen, GenFactory
+{
+ public void generate (Hashtable symbolTable, AttributeEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, ConstEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, EnumEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, ExceptionEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, ForwardEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, ForwardValueEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, IncludeEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, InterfaceEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, ValueEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, ValueBoxEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, MethodEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, ParameterEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, PragmaEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, PrimitiveEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, SequenceEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, StringEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, StructEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, TypedefEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, UnionEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ public void generate (Hashtable symbolTable, NativeEntry entry, PrintWriter stream)
+ {
+ } // generate
+
+ // For GenFactory
+ public AttributeGen createAttributeGen ()
+ {
+ return null;
+ } // createAttributeGen
+
+ public ConstGen createConstGen ()
+ {
+ return null;
+ } // createConstGen
+
+ public EnumGen createEnumGen ()
+ {
+ return null;
+ } // createEnumGen
+
+ public ExceptionGen createExceptionGen ()
+ {
+ return null;
+ } // createExceptionGen
+
+ public ForwardGen createForwardGen ()
+ {
+ return null;
+ } // createForwardGen
+
+ public ForwardValueGen createForwardValueGen ()
+ {
+ return null;
+ } // createForwardValueGen
+
+ public IncludeGen createIncludeGen ()
+ {
+ return null;
+ } // createIncludeGen
+
+ public InterfaceGen createInterfaceGen ()
+ {
+ return null;
+ } // createInterfaceGen
+
+ public ValueGen createValueGen ()
+ {
+ return null;
+ } // createValueGen
+
+ public ValueBoxGen createValueBoxGen ()
+ {
+ return null;
+ } // createValueBoxGen
+
+ public MethodGen createMethodGen ()
+ {
+ return null;
+ } // createMethodGen
+
+ public ModuleGen createModuleGen ()
+ {
+ return null;
+ } // createModuleGen
+
+ public NativeGen createNativeGen ()
+ {
+ return null;
+ } // createNativeGen
+
+ public ParameterGen createParameterGen ()
+ {
+ return null;
+ } // createParameterGen
+
+ public PragmaGen createPragmaGen ()
+ {
+ return null;
+ } // createPragmaGen
+
+ public PrimitiveGen createPrimitiveGen ()
+ {
+ return null;
+ } // createPrimitiveGen
+
+ public SequenceGen createSequenceGen ()
+ {
+ return null;
+ } // createSequenceGen
+
+ public StringGen createStringGen ()
+ {
+ return null;
+ } // createStringGen
+
+ public StructGen createStructGen ()
+ {
+ return null;
+ } // createStructGen
+
+ public TypedefGen createTypedefGen ()
+ {
+ return null;
+ } // createTypedefGen
+
+ public UnionGen createUnionGen ()
+ {
+ return null;
+ } // createUnionGen
+} // class Noop
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParameterEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParameterEntry.java
new file mode 100644
index 0000000..0818c11
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParameterEntry.java
@@ -0,0 +1,114 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+/**
+ * This is the symbol table entry for parameters.
+ **/
+public class ParameterEntry extends SymtabEntry
+{
+ /** This is a set of class constants. A parameter can be passed
+ as one of In, Out, or Inout. */
+ public static final int In = 0,
+ Inout = 1,
+ Out = 2;
+
+ protected ParameterEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected ParameterEntry (ParameterEntry that)
+ {
+ super (that);
+ _passType = that._passType;
+ } // ctor
+
+ protected ParameterEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ public Object clone ()
+ {
+ return new ParameterEntry (this);
+ } // clone
+
+ /** Invoke the paramter generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ parameterGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the parameter generator.
+ @return an object which implements the ParameterGen interface.
+ @see ParameterGen */
+ public Generator generator ()
+ {
+ return parameterGen;
+ } // generator
+
+ /** This indicates the pass type of this parameter. */
+ public void passType (int passType)
+ {
+ if (passType >= In && passType <= Out)
+ _passType = passType;
+ } // passType
+
+ /** This indicates the pass type of this parameter. */
+ public int passType ()
+ {
+ return _passType;
+ } // passType
+
+ private int _passType = In;
+
+ static ParameterGen parameterGen;
+} // class ParameterEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParameterGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParameterGen.java
new file mode 100644
index 0000000..d61923f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParameterGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface ParameterGen extends Generator
+{
+ void generate (Hashtable symbolTable, ParameterEntry entry, PrintWriter stream);
+} // interface ParameterGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParseException.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParseException.java
new file mode 100644
index 0000000..d689f5b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ParseException.java
@@ -0,0 +1,456 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -D56351<daz> Update Prefix pragma directive to CORBA 2.3 (see spec.).
+// -D57110<daz> Update ID pragma directive to CORBA 2.3 (see spec.).
+// -D46094<daz> Prohibit exceptions from appearing wihtin structs, unions, exceptions.
+// -D46094<daz> Prohibit attributes from appearing as operation parameter types,
+// operation return types, attribute types.
+// -D59166<daz> Prohibit identifiers form colliding with IDL keywords.
+// -F60858.1<daz> Add keyword collision warning.
+// -F60942<daz> Prohibit operations from appearing as operation parameter types.
+// -D62023<daz> Add deprecated keyword warning; cast char to byte for JDK 1.2 compatability.
+
+import java.io.IOException;
+
+/**
+ *
+ **/
+class ParseException extends Exception
+{
+ /**
+ * Constructor: print the supplied message to Standard.err
+ * and create a new ParseException
+ * @return a new ParseException.
+ **/
+ ParseException (String message)
+ {
+ super (message);
+ System.err.println (message);
+ detected = true;
+ } // ctor
+
+ /**
+ * Constructor: print the supplied message to Standard.err, if it
+ * is not a warning, and create a new ParseException.
+ * @return a new ParseException.
+ **/
+ ParseException (String message, boolean onlyAWarning)
+ {
+ super (message);
+ System.err.println (message);
+ if (!onlyAWarning)
+ detected = true;
+ }
+
+ static ParseException abstractValueBox (Scanner scanner)
+ {
+ return arg0 ("abstractValueBox", scanner);
+ }
+
+ static ParseException alreadyDeclared (Scanner scanner, String type)
+ {
+ return arg1 ("alreadyDeclared", scanner, type);
+ }
+
+ static ParseException declNotInSameFile( Scanner scanner, String type,
+ String firstFile )
+ {
+ return arg2 ("declNotInSameFile", scanner, type, firstFile) ;
+ }
+
+ static ParseException alreadyDefaulted (Scanner scanner)
+ {
+ return arg0 ("alreadydefaulted", scanner);
+ }
+
+ static ParseException alreadyDerived (Scanner scanner, String derived, String iface)
+ {
+ return arg2 ("alreadyDerived", scanner, derived, iface);
+ }
+
+ static ParseException alreadyRaised (Scanner scanner, String exception)
+ {
+ return arg1 ("alreadyRaised", scanner, exception);
+ }
+
+ // <d60942>
+ static ParseException attributeNotType (Scanner scanner, String attr)
+ {
+ return arg1 ("attributeNotType", scanner, attr);
+ }
+
+ static ParseException badAbstract (Scanner scanner, String name)
+ {
+ return arg1 ("badAbstract", scanner, name);
+ }
+
+ static ParseException badCustom (Scanner scanner)
+ {
+ return arg0 ("badCustom", scanner);
+ }
+
+ // <d57110>
+ static ParseException badRepIDAlreadyAssigned (Scanner scanner, String entry)
+ {
+ return arg1 ("badRepIDAlreadyAssigned", scanner, entry);
+ }
+
+ // <d57110>
+ static ParseException badRepIDForm (Scanner scanner, String entry)
+ {
+ return arg1 ("badRepIDForm", scanner, entry);
+ }
+
+ // <d56351>
+ static ParseException badRepIDPrefix (Scanner scanner, String entry, String expected, String got)
+ {
+ return arg3 ("badRepIDPrefix", scanner, entry, expected, got);
+ }
+
+ static ParseException badState (Scanner scanner, String entry)
+ {
+ return arg1 ("badState", scanner, entry);
+ }
+
+ static ParseException branchLabel (Scanner scanner, String label)
+ {
+ return arg1 ("branchLabel", scanner, label);
+ }
+
+ static ParseException branchName (Scanner scanner, String name)
+ {
+ return arg1 ("branchName", scanner, name);
+ }
+
+ static ParseException duplicateInit (Scanner scanner)
+ {
+ return arg0 ("duplicateInit", scanner);
+ }
+
+ static ParseException duplicateState (Scanner scanner, String name)
+ {
+ return arg1 ("duplicateState", scanner, name);
+ }
+
+ static ParseException elseNoIf (Scanner scanner)
+ {
+ return arg0 ("elseNoIf", scanner);
+ }
+
+ static ParseException endNoIf (Scanner scanner)
+ {
+ return arg0 ("endNoIf", scanner);
+ }
+
+ static ParseException evaluationError (Scanner scanner, String problem)
+ {
+ return arg1 ("evaluation", scanner, problem);
+ }
+
+ static ParseException forwardEntry (Scanner scanner, String name)
+ {
+ return arg1 ("forwardEntry", scanner, name);
+ }
+
+ // <f46082.40> Cannot forward value boxes.
+ static ParseException forwardedValueBox (Scanner scanner, String name)
+ {
+ return arg1 ("forwardedValueBox", scanner, name);
+ }
+
+ static ParseException generic (Scanner scanner, String message)
+ {
+ return arg1 ("generic", scanner, message);
+ }
+
+ static ParseException illegalArray (Scanner scanner, String name)
+ {
+ return arg1 ("illegalArray", scanner, name);
+ }
+
+ static ParseException illegalException (Scanner scanner, String name)
+ {
+ return arg1 ("illegalException", scanner, name);
+ }
+
+ static ParseException invalidConst (Scanner scanner, String mustBe, String is)
+ {
+ return arg2 ("invalidConst1", scanner, mustBe, is);
+ }
+
+ static ParseException invalidConst (Scanner scanner, String type)
+ {
+ return arg1 ("invalidConst2", scanner, type);
+ }
+
+ // <d59166> Non-escaped identifiers that collide with keywords are illegal.
+ static ParseException keywordCollision (Scanner scanner, String id)
+ {
+ return arg1 ("keywordCollision", scanner, id);
+ }
+
+ // <d62023> Warning for keywords that will be removed in a future version of IDL.
+ static ParseException deprecatedKeywordWarning (Scanner scanner, String id)
+ {
+ return arg1Warning ("deprecatedKeywordWarning", scanner, id);
+ }
+
+ // <f60858.1> Warning for above error.
+ static ParseException keywordCollisionWarning (Scanner scanner, String id)
+ {
+ return arg1Warning ("keywordCollisionWarning", scanner, id);
+ }
+
+ static ParseException methodClash (Scanner scanner, String interf, String method)
+ {
+ return arg2 ("methodClash", scanner, interf, method);
+ }
+
+ static ParseException moduleNotType (Scanner scanner, String module)
+ {
+ return arg1 ("moduleNotType", scanner, module);
+ }
+
+ // <d59067>
+ static ParseException nestedValueBox (Scanner scanner)
+ {
+ return arg0 ("nestedValueBox", scanner);
+ }
+
+ static ParseException noDefault (Scanner scanner)
+ {
+ return arg0 ("noDefault", scanner);
+ }
+
+ static ParseException nonAbstractParent (Scanner scanner, String baseClass, String parentClass)
+ {
+ return arg2 ("nonAbstractParent", scanner, baseClass, parentClass);
+ }
+
+ static ParseException nonAbstractParent2 (Scanner scanner, String baseClass, String parentClass)
+ {
+ return arg2 ("nonAbstractParent2", scanner, baseClass, parentClass);
+ }
+
+ static ParseException nonAbstractParent3 (Scanner scanner, String baseClass, String parentClass)
+ {
+ return arg2 ("nonAbstractParent3", scanner, baseClass, parentClass);
+ }
+
+ static ParseException notANumber (Scanner scanner, String notNumber)
+ {
+ return arg1 ("notANumber", scanner, notNumber);
+ }
+
+ static ParseException nothing (String filename)
+ {
+ return new ParseException (Util.getMessage ("ParseException.nothing", filename));
+ }
+
+ static ParseException notPositiveInt (Scanner scanner, String notPosInt)
+ {
+ return arg1 ("notPosInt", scanner, notPosInt);
+ }
+
+ static ParseException oneway (Scanner scanner, String method)
+ {
+ return arg1 ("oneway", scanner, method);
+ }
+
+ // <d60942>
+ static ParseException operationNotType (Scanner scanner, String op)
+ {
+ return arg1 ("operationNotType", scanner, op);
+ }
+
+ static ParseException outOfRange (Scanner scanner, String value, String type)
+ {
+ return arg2 ("outOfRange", scanner, value, type);
+ }
+
+ static ParseException recursive (Scanner scanner, String type, String name)
+ {
+ return arg2 ("recursive", scanner, type, name);
+ }
+
+ static ParseException selfInherit (Scanner scanner, String name)
+ {
+ return arg1 ("selfInherit", scanner, name);
+ }
+
+ static ParseException stringTooLong (Scanner scanner, String str, String max)
+ {
+ return arg2 ("stringTooLong", scanner, str, max);
+ }
+
+ static ParseException syntaxError (Scanner scanner, int expected, int got)
+ {
+ return arg2 ("syntax1", scanner, Token.toString (expected), Token.toString (got));
+ }
+
+ static ParseException syntaxError (Scanner scanner, String expected, String got)
+ {
+ return arg2 ("syntax1", scanner, expected, got);
+ }
+
+ static ParseException syntaxError (Scanner scanner, int[] expected, int got)
+ {
+ return syntaxError (scanner, expected, Token.toString (got));
+ }
+
+ static ParseException syntaxError (Scanner scanner, int[] expected, String got)
+ {
+ String tokenList = "";
+ for (int i = 0; i < expected.length; ++i)
+ tokenList += " `" + Token.toString (expected[i]) + "'";
+ return arg2 ("syntax2", scanner, tokenList, got);
+ }
+
+ static ParseException unclosedComment (String filename)
+ {
+ return new ParseException (Util.getMessage ("ParseException.unclosed", filename));
+ }
+
+ static ParseException undeclaredType (Scanner scanner, String undeclaredType)
+ {
+ return arg1 ("undeclaredType", scanner, undeclaredType);
+ }
+
+ static ParseException warning (Scanner scanner, String message)
+ {
+ scannerInfo (scanner);
+ String[] parameters = { filename, Integer.toString (lineNumber), message, line, pointer };
+ return new ParseException (Util.getMessage ("ParseException.warning", parameters), true);
+ }
+
+ static ParseException wrongType (Scanner scanner, String name, String mustBe, String is)
+ {
+ scannerInfo (scanner);
+ String[] parameters = {filename, Integer.toString (lineNumber), name, is, mustBe, line, pointer};
+ return new ParseException (Util.getMessage ("ParseException.wrongType", parameters));
+ }
+
+ static ParseException wrongExprType (Scanner scanner, String mustBe, String is)
+ {
+ scannerInfo (scanner);
+ String[] parameters = {filename, Integer.toString (lineNumber),
+ is, mustBe, line, pointer};
+ return new ParseException (Util.getMessage ("ParseException.constExprType",
+ parameters));
+ }
+
+ static ParseException illegalForwardInheritance( Scanner scanner, String declName,
+ String baseName )
+ {
+ scannerInfo( scanner ) ;
+ String[] parameters = { filename, Integer.toString(lineNumber),
+ declName, baseName, line, pointer } ;
+ return new ParseException (Util.getMessage(
+ "ParseException.forwardInheritance", parameters ) ) ;
+ }
+
+ static ParseException illegalIncompleteTypeReference( Scanner scanner,
+ String declName )
+ {
+ scannerInfo( scanner ) ;
+ String[] parameters = { filename, Integer.toString(lineNumber),
+ declName, line, pointer } ;
+ return new ParseException (Util.getMessage(
+ "ParseException.illegalIncompleteTypeReference", parameters ) ) ;
+ }
+
+ private static void scannerInfo (Scanner scanner)
+ {
+ filename = scanner.filename ();
+ line = scanner.lastTokenLine ();
+ lineNumber = scanner.lastTokenLineNumber ();
+ int pos = scanner.lastTokenLinePosition ();
+ pointer = "^";
+ if (pos > 1)
+ {
+ byte[] bytes = new byte[ pos - 1 ];
+ for (int i = 0; i < pos - 1; ++i)
+ bytes[i] = (byte)' '; // <d62023>
+ pointer = new String (bytes) + pointer;
+ }
+ }
+
+ private static ParseException arg0 (String msgId, Scanner scanner)
+ {
+ scannerInfo (scanner);
+ String[] parameters = {filename, Integer.toString (lineNumber), line, pointer};
+ return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
+ }
+
+ private static ParseException arg1 (String msgId, Scanner scanner, String arg1)
+ {
+ scannerInfo (scanner);
+ String[] parameters = {filename, Integer.toString (lineNumber), arg1, line, pointer};
+ return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
+ }
+
+ // <f60858.1>
+ private static ParseException arg1Warning (String msgId, Scanner scanner, String arg1)
+ {
+ scannerInfo (scanner);
+ String[] parameters = {filename, Integer.toString (lineNumber), arg1, line, pointer};
+ return new ParseException (Util.getMessage ("ParseException." + msgId, parameters), true);
+ }
+
+ private static ParseException arg2 (String msgId, Scanner scanner, String arg1, String arg2)
+ {
+ scannerInfo (scanner);
+ String[] parameters = {filename, Integer.toString (lineNumber), arg1, arg2, line, pointer};
+ return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
+ }
+
+ private static ParseException arg3 (String msgId, Scanner scanner, String arg1, String arg2, String arg3)
+ {
+ scannerInfo (scanner);
+ String[] parameters = {filename, Integer.toString (lineNumber), arg1, arg2, arg3, line, pointer};
+ return new ParseException (Util.getMessage ("ParseException." + msgId, parameters));
+ }
+
+ private static String filename = "";
+ private static String line = "";
+ private static int lineNumber = 0;
+ private static String pointer = "^";
+
+ static boolean detected = false;
+} // class ParseException
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Parser.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Parser.java
new file mode 100644
index 0000000..ff42421
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Parser.java
@@ -0,0 +1,3905 @@
+/*
+ * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -F46082.51<daz> Remove -stateful feature.
+// -D52042<daz> Allow floating-point constants to be initialized with
+// integral as well as floating-point literals. No other variations allowed.
+// -D58058<daz> Set index array type to long rather than array element type.
+// -D56351<daz> Update computation of RepositoryIDs to CORBA 2.3 (see spec.).
+// -D57110<daz> Provide method() to set/clear ability for scoped names to
+// resolve to modules. Allows rep. ids to be assigned to modules.
+// -D46094<daz> Prohibit exceptions from appearing wihtin structs, unions, exceptions.
+// -D46094<daz> Prohibit attributes from appearing as operation parameter types,
+// operation return types, attribute types.
+// -D59067<daz> Prohibit nested value boxes.
+// -D59166<daz> Prohibit collisions between keywords and non-escaped identifiers.
+// -D59809<daz> At Pigeonhole(), add map short name of CORBA types to long name
+// (e.g., CORBA/StringValue --> org/omg/CORBA/StringValue), which allows fully-
+// qualified CORBA type names to resolve successfully.
+// -F60858.1<daz> Support "-corba" option, level <= 2.2: issue warning for
+// keyowrd collisions;
+// -D60942<daz> Prohibit operations from appearing within parameter types.
+// -D61643<daz> Repair pigeonhole() to correctly filter bad RepIDs.
+// -D62023<daz> Support -noWarn option; Issue warnings when tokens are
+// deprecated keywords or keywords in greater release version.
+// -D61919<daz> Emit entries for modules originally opened in #include files
+// appearing at global scope and then reopened in the main IDL file. Only
+// types appearing in the main IDL source will be emitted.
+
+import java.io.EOFException;
+import java.io.IOException;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Stack;
+import java.util.Vector;
+import java.util.List ;
+import java.util.ArrayList ;
+import java.util.Iterator ;
+
+import java.math.BigInteger;
+
+import com.sun.tools.corba.se.idl.constExpr.*;
+
+/**
+ *
+ **/
+class Parser
+{
+ /**
+ *
+ **/
+ Parser (Preprocessor preprocessor, Arguments arguments, Hashtable overrides,
+ Hashtable symtab, SymtabFactory stFac, ExprFactory exprFac, String [] genKeywords)
+ {
+ this.arguments = arguments;
+ noWarn = arguments.noWarn; // <d62023>
+ corbaLevel = arguments.corbaLevel; // <f60858.1>
+ paths = arguments.includePaths;
+ symbols = arguments.definedSymbols;
+ verbose = arguments.verbose;
+ emitAll = arguments.emitAll;
+ // <f46082.46.01>
+ cppModule = arguments.cppModule;
+ // <f46082.51> Remove -stateful feature.
+ //parseStateful = arguments.parseStateful;
+ overrideNames = (overrides == null) ? new Hashtable () : overrides;
+ symbolTable = (symtab == null) ? new Hashtable () : symtab;
+ keywords = (genKeywords == null) ? new String [0] : genKeywords;
+ stFactory = stFac;
+ exprFactory = exprFac;
+ currentModule = topLevelModule = new ModuleEntry ();
+ prep = preprocessor;
+ repIDStack.push (new IDLID ());
+ addPrimEntries ();
+ } // ctor
+
+ /**
+ *
+ **/
+ void parse (String file) throws IOException
+ {
+ IncludeEntry fileEntry = stFactory.includeEntry ();
+ fileEntry.name ('"' + file + '"');
+ try
+ {
+ // Set absolute file path
+ fileEntry.absFilename (Util.getAbsolutePath (file, paths));
+ }
+ catch (IOException ioe)
+ {}
+
+ // <f46082.51> Remove -stateful feature.
+ //scanner = new Scanner (fileEntry, keywords, verbose, parseStateful, emitAll);
+ // <f60585.1> Support "-corba [level]" option.
+ //scanner = new Scanner (fileEntry, keywords, verbose, emitAll);
+ scanner = new Scanner (fileEntry, keywords, verbose, emitAll, corbaLevel,
+ arguments.scannerDebugFlag );
+ topLevelModule.sourceFile (fileEntry);
+
+ // Prime the pump...
+ // Match handles preprocessor directives, so use match to
+ // call scanner.getToken just in case the first token is
+ // such a directive. But match depends on the token
+ // already having a value, so fudge something.
+ token = new Token (0);
+ tokenHistory.insert (token); // Initialize look back buffer <26jul1997daz>.
+ try
+ {
+ match (0);
+ if (token.equals (Token.EOF))
+ ParseException.nothing (file);
+ else
+ specification (topLevelModule);
+ }
+ catch (ParseException exception) // Match MIGHT throw this
+ {
+ // It has already been reported, just end.
+ }
+ catch (EOFException exception) // skipToSemicolon MIGHT throw this
+ {
+ // It has already been reported, just end.
+ }
+ } // parse
+
+ /**
+ *
+ **/
+ private void addPrimEntries ()
+ {
+ symbolTable.put ("short", stFactory.primitiveEntry ("short"));
+ symbolTable.put ("long", stFactory.primitiveEntry ("long"));
+ symbolTable.put ("long long", stFactory.primitiveEntry ("long long"));
+ symbolTable.put ("unsigned short", stFactory.primitiveEntry ("unsigned short"));
+ symbolTable.put ("unsigned long", stFactory.primitiveEntry ("unsigned long"));
+ symbolTable.put ("unsigned long long", stFactory.primitiveEntry ("unsigned long long"));
+ symbolTable.put ("char", stFactory.primitiveEntry ("char"));
+ symbolTable.put ("wchar", stFactory.primitiveEntry ("wchar"));
+ symbolTable.put ("float", stFactory.primitiveEntry ("float"));
+ //Support fixed type: symbolTable.put ("fixed", stFactory.primitiveEntry ("fixed"));
+ symbolTable.put ("double", stFactory.primitiveEntry ("double"));
+ symbolTable.put ("boolean", stFactory.primitiveEntry ("boolean"));
+ symbolTable.put ("octet", stFactory.primitiveEntry ("octet"));
+ symbolTable.put ("any", stFactory.primitiveEntry ("any"));
+
+ InterfaceEntry object = stFactory.interfaceEntry();
+ object.name ("Object");
+ symbolTable.put ("Object", object);
+
+ ValueEntry valueBase = stFactory.valueEntry();
+ valueBase.name ("ValueBase");
+ symbolTable.put ("ValueBase", valueBase);
+
+ // put these same entries in the lowercase symbol table
+ lcSymbolTable.put ("short", stFactory.primitiveEntry ("short"));
+ lcSymbolTable.put ("long", stFactory.primitiveEntry ("long"));
+ lcSymbolTable.put ("long long", stFactory.primitiveEntry ("long long"));
+ lcSymbolTable.put ("unsigned short", stFactory.primitiveEntry ("unsigned short"));
+ lcSymbolTable.put ("unsigned long", stFactory.primitiveEntry ("unsigned long"));
+ lcSymbolTable.put ("unsigned long long", stFactory.primitiveEntry ("unsigned long long"));
+ lcSymbolTable.put ("char", stFactory.primitiveEntry ("char"));
+ lcSymbolTable.put ("wchar", stFactory.primitiveEntry ("wchar"));
+ lcSymbolTable.put ("float", stFactory.primitiveEntry ("float"));
+ // Support fixed type: lcSymbolTable.put ("fixed", stFactory.primitiveEntry ("fixed"));
+ lcSymbolTable.put ("double", stFactory.primitiveEntry ("double"));
+ lcSymbolTable.put ("boolean", stFactory.primitiveEntry ("boolean"));
+ lcSymbolTable.put ("octet", stFactory.primitiveEntry ("octet"));
+ lcSymbolTable.put ("any", stFactory.primitiveEntry ("any"));
+ lcSymbolTable.put ("object", object);
+ lcSymbolTable.put ("valuebase", valueBase);
+ } // addPrimEntries
+
+ /**
+ *
+ **/
+ private void specification (ModuleEntry entry) throws IOException
+ {
+ while (!token.equals (Token.EOF))
+ {
+ definition (entry);
+ addToEmitList (entry);
+ }
+ } // specification
+
+ // ModuleEntry is the topLevelModule; add its contained types to the emit list.
+ /**
+ *
+ **/
+ private void addToEmitList (ModuleEntry entry)
+ {
+ for (Enumeration e = entry.contained ().elements (); e.hasMoreElements();)
+ {
+ SymtabEntry emitEntry = (SymtabEntry)e.nextElement ();
+ if (emitEntry.emit ())
+ {
+ emitList.addElement (emitEntry);
+
+ // <d61919> I think the absence of the following statement was an
+ // oversight. If module X.Y.Z first appears in an include file, then is
+ // reopened in the main IDL source, this statement guarantees that X.Y.Z
+ // definitions within the main IDL source are emitted.
+ ///---------------------------------------------------------------------
+ // If any of this module's elements should be emitted, add
+ // this module to the emit list.
+ if (emitEntry instanceof ModuleEntry)
+ checkContained ((ModuleEntry)emitEntry);
+ if (emitEntry instanceof IncludeEntry)
+ {
+ includes.addElement (emitEntry.name ());
+ includeEntries.addElement (emitEntry);
+ }
+ }
+ else
+ // If any of this module's elements should be emitted, add
+ // this module to the emit list.
+ if (emitEntry instanceof ModuleEntry)
+ checkContained ((ModuleEntry)emitEntry);
+ }
+ entry.contained ().removeAllElements ();
+ } // addToEmitList
+
+ /**
+ *
+ **/
+ private void checkContained (ModuleEntry entry)
+ {
+ // If any of this module's elements is to be emitted,
+ // then add the module to the emit list.
+ for (Enumeration e = entry.contained ().elements (); e.hasMoreElements ();)
+ {
+ SymtabEntry contained = (SymtabEntry)e.nextElement ();
+ if (contained instanceof ModuleEntry)
+ checkContained ((ModuleEntry)contained);
+ if (contained.emit ())
+ {
+ if (!emitList.contains (entry))
+ emitList.addElement (entry);
+ entry.emit (true);
+ break;
+ }
+ }
+ } // checkContained
+
+ /**
+ *
+ **/
+ private void definition (ModuleEntry entry) throws IOException
+ {
+ try
+ {
+ switch (token.type)
+ {
+ case Token.Typedef:
+ case Token.Struct:
+ case Token.Union:
+ case Token.Enum:
+ typeDcl (entry);
+ break;
+ case Token.Const:
+ constDcl (entry);
+ break;
+ case Token.Native:
+ nativeDcl (entry);
+ break;
+ case Token.Exception:
+ exceptDcl (entry);
+ break;
+ case Token.Interface:
+ interfaceProd (entry, InterfaceEntry.NORMAL);
+ break;
+ case Token.Local:
+ match( Token.Local ) ;
+ if (token.type == Token.Interface)
+ interfaceProd( entry, InterfaceEntry.LOCAL ) ;
+ else
+ throw ParseException.syntaxError( scanner, new int[] {
+ Token.Interface }, token.type ) ;
+ break ;
+ case Token.Module:
+ module (entry);
+ break;
+ case Token.Abstract:
+ match (Token.Abstract);
+ if (token.type == Token.Interface)
+ interfaceProd (entry, InterfaceEntry.ABSTRACT);
+ else if (token.type == Token.Valuetype)
+ valueProd (entry, true);
+ else
+ throw ParseException.syntaxError (scanner, new int[] {
+ Token.Interface, Token.Valuetype }, token.type);
+ break;
+ case Token.Custom:
+ case Token.Valuetype:
+ valueProd (entry, false);
+ break;
+ default:
+ throw ParseException.syntaxError (scanner, new int[] {
+ Token.Typedef, Token.Struct, Token.Union, Token.Enum,
+ Token.Const, Token.Exception, Token.Interface, Token.Valuetype,
+ Token.Module }, token.type);
+ }
+ match (Token.Semicolon);
+ }
+ catch (ParseException e)
+ {
+ skipToSemicolon ();
+ }
+ } // definition
+
+ /**
+ *
+ **/
+ private void module (ModuleEntry entry) throws IOException, ParseException
+ {
+ match (Token.Module);
+ repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
+ ModuleEntry newEntry = newModule (entry);
+ ((IDLID)repIDStack.peek ()).appendToName (newEntry.name ());
+ // comment must immediately precede "module" keyword
+ newEntry.comment (tokenHistory.lookBack (1).comment);
+ currentModule = newEntry;
+ match (Token.Identifier);
+ prep.openScope (newEntry);
+ match (Token.LeftBrace);
+ definition (newEntry);
+ while (!token.equals (Token.EOF) && !token.equals (Token.RightBrace))
+ definition (newEntry);
+ prep.closeScope (newEntry);
+ match (Token.RightBrace);
+ currentModule = entry;
+ repIDStack.pop ();
+ } // module
+
+ /**
+ *
+ **/
+ private void interfaceProd (ModuleEntry entry, int interfaceType)
+ throws IOException, ParseException
+ {
+ match (Token.Interface);
+ String name = token.name;
+ match (Token.Identifier);
+ interface2 (entry, name, interfaceType);
+ } // interfaceProd
+
+ /**
+ *
+ **/
+ private void interface2 (ModuleEntry module, String name, int interfaceType)
+ throws IOException, ParseException
+ {
+ if (token.type == Token.Colon || token.type == Token.LeftBrace) {
+ repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
+ InterfaceEntry entry = stFactory.interfaceEntry (module,
+ (IDLID)repIDStack.peek ());
+ entry.sourceFile (scanner.fileEntry ());
+ entry.name (name);
+ entry.setInterfaceType(interfaceType);
+ // Comment must immediately precede "[local | abstract] interface" keyword
+ entry.comment (tokenHistory.lookBack (
+ entry.getInterfaceType() == InterfaceEntry.NORMAL ? 2 : 3).comment);
+
+ if (!ForwardEntry.replaceForwardDecl (entry))
+ ParseException.badAbstract (scanner, entry.fullName ());
+ pigeonhole (module, entry);
+ ((IDLID)repIDStack.peek ()).appendToName (name);
+ currentModule = entry;
+ interfaceDcl (entry);
+ currentModule = module;
+ repIDStack.pop ();
+ } else { // This is a forward declaration
+ ForwardEntry entry = stFactory.forwardEntry (module, (IDLID)repIDStack.peek ());
+ entry.sourceFile (scanner.fileEntry ());
+ entry.name (name);
+ entry.setInterfaceType(interfaceType);
+ // comment must immediately precede "interface" keyword.
+ entry.comment (tokenHistory.lookBack (
+ entry.getInterfaceType() == InterfaceEntry.NORMAL ? 2 : 3).comment);
+ pigeonhole (module, entry);
+ }
+ } // interface2
+
+ /**
+ *
+ **/
+ private void interfaceDcl (InterfaceEntry entry) throws IOException, ParseException
+ {
+ if (token.type != Token.LeftBrace)
+ inheritanceSpec (entry);
+ else if (!entry.isAbstract ()) {
+ SymtabEntry objectEntry = qualifiedEntry ("Object");
+ SymtabEntry realOEntry = typeOf (objectEntry);
+ if (objectEntry == null)
+ ; // qualifiedEntry already generated an error message
+ else if (!isInterface(realOEntry))
+ ParseException.wrongType (scanner, overrideName ("Object"),
+ "interface", objectEntry.typeName ());
+ else
+ entry.derivedFromAddElement (realOEntry, scanner);
+ }
+
+ prep.openScope (entry);
+ match (Token.LeftBrace);
+ while (token.type != Token.RightBrace)
+ export (entry);
+ prep.closeScope (entry);
+ match (Token.RightBrace);
+ } // interfaceDcl
+
+ /**
+ *
+ **/
+ private void export (InterfaceEntry entry) throws IOException
+ {
+ try
+ {
+ switch (token.type)
+ {
+ case Token.Typedef:
+ case Token.Struct:
+ case Token.Union:
+ case Token.Enum:
+ typeDcl (entry);
+ break;
+ case Token.Const:
+ constDcl (entry);
+ break;
+ case Token.Native:
+ nativeDcl (entry);
+ break;
+ case Token.Exception:
+ exceptDcl (entry);
+ break;
+ case Token.Readonly:
+ case Token.Attribute:
+ attrDcl (entry);
+ break;
+ case Token.Oneway:
+ case Token.Float:
+ case Token.Double:
+ case Token.Long:
+ case Token.Short:
+ case Token.Unsigned:
+ case Token.Char:
+ case Token.Wchar:
+ case Token.Boolean:
+ case Token.Octet:
+ case Token.Any:
+ case Token.String:
+ case Token.Wstring:
+ case Token.Identifier:
+ case Token.Object:
+ // <f46082.40> Value base type.
+ case Token.ValueBase:
+ case Token.DoubleColon:
+ case Token.Void:
+ opDcl (entry);
+ break;
+ // <f46082.51> Remove -stateful feature.
+ //case Token.State: if (parseStateful) {
+ // stateDef (entry);
+ // break; }
+ default:
+ throw ParseException.syntaxError(scanner, new int [] {
+ Token.Typedef, Token.Struct, Token.Union, Token.Enum,
+ Token.Const, Token.Exception, Token.Readonly, Token.Attribute,
+ Token.Oneway, Token.Float, Token.Double, Token.Long,
+ Token.Short, Token.Unsigned, Token.Char, Token.Wchar,
+ Token.Boolean, Token.Octet, Token.Any, Token.String,
+ Token.Wstring, Token.Identifier, Token.DoubleColon, Token.Void,
+ Token.ValueBase }, token.type);
+ }
+ match (Token.Semicolon);
+ }
+ catch (ParseException exception)
+ {
+ skipToSemicolon ();
+ }
+ } // export
+
+ private void inheritanceSpec (InterfaceEntry entry) throws IOException, ParseException
+ {
+ for (match (Token.Colon); ; match (Token.Comma)) {
+ SymtabEntry parent = scopedName (entry.container (),
+ stFactory.interfaceEntry ());
+ SymtabEntry realParent = typeOf (parent);
+
+ if (isInterfaceOnly (realParent)) {
+ boolean isInterface = (realParent instanceof InterfaceEntry);
+ if (entry.derivedFrom ().contains (realParent))
+ ParseException.alreadyDerived (scanner, realParent.fullName (), entry.fullName ());
+ else if (!entry.isAbstract () ||
+ (((InterfaceType)realParent).getInterfaceType() == InterfaceType.ABSTRACT))
+ entry.derivedFromAddElement (realParent, scanner);
+ else
+ ParseException.nonAbstractParent (scanner, entry.fullName (), parent.fullName ());
+ } else if (isForward( realParent )) {
+ ParseException.illegalForwardInheritance( scanner,
+ entry.fullName(), parent.fullName() ) ;
+ } else
+ ParseException.wrongType (scanner, parent.fullName (), "interface", entryName (parent));
+
+ if ((parent instanceof InterfaceEntry) && (((InterfaceEntry)parent).state () != null))
+ if (entry.state () == null)
+ entry.initState ();
+ else
+ throw ParseException.badState (scanner, entry.fullName ());
+
+ if (token.type != Token.Comma)
+ break;
+ }
+ } // inheritanceSpec
+
+ // <57110> Member _moduleIsLegalType may be set by any feature to allow
+ // method scopedName() and any of its helper methods -- qualifiedName(),
+ // partlyQualifiedName(), and unqualifiedName() -- to return a ModuleEntry
+ // rather than a parse error in the event a name resolves to a module. The
+ // flag must be cleared (set to false) to resume normal parsing behavior.
+ //
+ // Currently, this is used only when preprocessing the ID pragma directive.
+
+ private boolean _isModuleLegalType = false;
+
+ /**
+ *
+ **/
+ public boolean isModuleLegalType ()
+ {
+ return _isModuleLegalType;
+ }; // moduleIsLegaType
+
+ /**
+ *
+ **/
+ public void isModuleLegalType (boolean b)
+ {
+ _isModuleLegalType = b;
+ }; // moduleIsLegalType
+
+ /**
+ *
+ **/
+ SymtabEntry scopedName (SymtabEntry container,
+ SymtabEntry expected) throws IOException, ParseException
+ {
+ return scopedName( container, expected, true ) ;
+ }
+
+ SymtabEntry scopedName (SymtabEntry container, SymtabEntry expected,
+ boolean mustBeReferencable ) throws IOException, ParseException
+ {
+ boolean globalScope = false;
+ boolean partialScope = false;
+ String name = null;
+ if (token.type == Token.DoubleColon)
+ globalScope = true;
+ else
+ {
+ if (token.type == Token.Object)
+ {
+ name = "Object";
+ match (Token.Object);
+ }
+ else if (token.type == Token.ValueBase) // <f46082.40>
+ {
+ name = "ValueBase";
+ match (Token.ValueBase);
+ }
+ else
+ {
+ name = token.name;
+ match (Token.Identifier);
+ }
+ }
+ while (token.type == Token.DoubleColon)
+ {
+ match (Token.DoubleColon);
+ partialScope = true;
+ if (name != null)
+ name += '/' + token.name;
+ else name = token.name;
+ match (Token.Identifier);
+ }
+ SymtabEntry entry = null;
+ if (globalScope)
+ entry = qualifiedEntry (name);
+ else if (partialScope)
+ entry = partlyQualifiedEntry (name, container);
+ else
+ entry = unqualifiedEntry (name, container);
+
+ if (entry == null)
+ // Make the entry the expected entry. The generators will
+ // not be called now, since a semantic exception ocurred, but
+ // the parse has to finish and something valid has to be
+ // returned.
+ (entry = expected).name (name);
+ else if (!entry.isReferencable() && mustBeReferencable)
+ throw ParseException.illegalIncompleteTypeReference( scanner, name ) ;
+
+ return entry;
+ } // scopedName
+
+ private void valueProd (ModuleEntry entry, boolean isAbstract) throws IOException, ParseException
+ {
+ boolean isCustom = (token.type == Token.Custom);
+ if (isCustom)
+ match (Token.Custom);
+ match (Token.Valuetype);
+ String name = token.name;
+ match (Token.Identifier);
+
+ switch (token.type)
+ {
+ case Token.LeftBrace:
+ case Token.Colon:
+ case Token.Supports:
+ value2 (entry, name, isAbstract, isCustom);
+ return;
+ case Token.Semicolon:
+ if (isCustom)
+ break;
+ valueForwardDcl (entry, name, isAbstract);
+ return;
+ }
+ if (isCustom)
+ throw ParseException.badCustom (scanner);
+ if (isAbstract)
+ throw ParseException.abstractValueBox (scanner);
+ valueBox (entry, name);
+ } // valueProd
+
+ /**
+ *
+ **/
+ private void value2 (ModuleEntry module, String name, boolean isAbstract,
+ boolean isCustom) throws IOException, ParseException
+ {
+ repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
+ // The 'actual' repository ID will be calculated at the end of the
+ // parsing phase, since it is based on the entire contents of the
+ // declaration, and needs to have all forward references resolved:
+ ValueEntry entry = stFactory.valueEntry (module, (IDLID)repIDStack.peek ());
+ entry.sourceFile (scanner.fileEntry ());
+ entry.name (name);
+ entry.setInterfaceType (isAbstract ? InterfaceType.ABSTRACT : InterfaceType.NORMAL);
+ entry.setCustom (isCustom);
+ // Comment must immediately precede "[abstract | custom] value" keyword
+ entry.comment (tokenHistory.lookBack ((isAbstract || isCustom) ? 3 : 2).comment);
+ // If this value has been forward declared, there are probably
+ // other values which derive from a ForwardValueEntry. Replace
+ // those ForwardValueEntry's with this ValueEntry:
+ if (!ForwardEntry.replaceForwardDecl (entry))
+ ParseException.badAbstract (scanner, entry.fullName ());
+ pigeonhole (module, entry);
+ ((IDLID)repIDStack.peek ()).appendToName (name);
+ currentModule = entry;
+ valueDcl (entry);
+ entry.tagMethods ();
+ currentModule = module;
+ repIDStack.pop ();
+ } // value2
+
+ /**
+ *
+ **/
+ private void valueDcl (ValueEntry entry) throws IOException, ParseException
+ {
+ if (token.type == Token.Colon)
+ valueInheritanceSpec (entry);
+ else if (!entry.isAbstract ())
+ {
+ SymtabEntry objectEntry = qualifiedEntry ("ValueBase");
+ SymtabEntry realOEntry = typeOf (objectEntry);
+ if (objectEntry == null)
+ ; // qualifiedEntry already generated an error message
+ else if (!isValue (realOEntry))
+ ParseException.wrongType (scanner, overrideName ("ValueBase"), "value", objectEntry.typeName ());
+ else
+ entry.derivedFromAddElement (realOEntry, false, scanner);
+ }
+ if (token.type == Token.Supports)
+ valueSupportsSpec (entry);
+ prep.openScope (entry);
+ match (Token.LeftBrace);
+ while (token.type != Token.RightBrace)
+ {
+ valueElement (entry);
+ }
+ prep.closeScope (entry);
+ match (Token.RightBrace);
+ } // valueDcl
+
+ /**
+ *
+ **/
+ private void valueInheritanceSpec (ValueEntry entry) throws IOException, ParseException
+ {
+ match (Token.Colon);
+ boolean isTruncatable = (token.type == Token.Truncatable);
+ if (isTruncatable)
+ match (Token.Truncatable);
+ for (; ; match (Token.Comma), isTruncatable = false) {
+ SymtabEntry parent = scopedName (entry.container (),
+ stFactory.valueEntry ());
+ SymtabEntry realParent = typeOf (parent);
+ if (isValue (realParent) && !(realParent instanceof ValueBoxEntry))
+ entry.derivedFromAddElement (realParent, isTruncatable,
+ scanner);
+ else if (isForward(realParent))
+ ParseException.illegalForwardInheritance( scanner,
+ entry.fullName(), parent.fullName() ) ;
+ else
+ ParseException.wrongType (scanner,
+ parent.fullName (), "value", entryName (parent));
+ if (token.type != Token.Comma)
+ break;
+ }
+ } // valueInheritanceSpec
+
+ /**
+ *
+ **/
+ private void valueSupportsSpec (ValueEntry entry) throws IOException, ParseException
+ {
+ match (Token.Supports) ;
+ for (; ; match( Token.Comma ) ) {
+ SymtabEntry parent = scopedName (entry.container (), stFactory.interfaceEntry ());
+ SymtabEntry realParent = typeOf (parent);
+ if (isInterface(realParent))
+ entry.derivedFromAddElement (realParent, scanner);
+ else
+ ParseException.wrongType (scanner, parent.fullName (), "interface",
+ entryName (parent));
+
+ if (token.type != Token.Comma)
+ break;
+ }
+ } // valueSupportsSpec
+
+ private void valueElement (ValueEntry entry) throws IOException, ParseException
+ {
+ if (entry.isAbstract ())
+ export (entry);
+ else
+ switch (token.type)
+ {
+ case Token.Private:
+ case Token.Public:
+ valueStateMember (entry);
+ break;
+ case Token.Init:
+ case Token.Factory: // <d62023> "factory" supplants "init" in 2.4RTF
+ initDcl (entry);
+ break;
+ case Token.Typedef:
+ case Token.Struct:
+ case Token.Union:
+ case Token.Enum:
+ case Token.Const:
+ case Token.Native:
+ case Token.Exception:
+ case Token.Readonly:
+ case Token.Attribute:
+ case Token.Oneway:
+ case Token.Float:
+ case Token.Double:
+ case Token.Long:
+ case Token.Short:
+ case Token.Unsigned:
+ case Token.Char:
+ case Token.Wchar:
+ case Token.Boolean:
+ case Token.Octet:
+ case Token.Any:
+ case Token.String:
+ case Token.Wstring:
+ case Token.Identifier:
+ case Token.Object:
+ case Token.ValueBase:
+ case Token.DoubleColon:
+ case Token.Void:
+ export (entry);
+ break;
+ default:
+ throw ParseException.syntaxError(scanner, new int[] {
+ Token.Private, Token.Public, Token.Init, Token.ValueBase,
+ Token.Typedef, Token.Struct, Token.Union, Token.Enum,
+ Token.Const, Token.Exception, Token.Readonly, Token.Attribute,
+ Token.Oneway, Token.Float, Token.Double, Token.Long,
+ Token.Short, Token.Unsigned, Token.Char, Token.Wchar,
+ Token.Boolean, Token.Octet, Token.Any, Token.String,
+ Token.Wstring, Token.Identifier, Token.DoubleColon, Token.Void },
+ token.type);
+ } // switch
+ } // valueElement
+
+ // <f46082.40>
+ /**
+ *
+ **/
+ private void valueStateMember (ValueEntry entry) throws IOException, ParseException
+ {
+ TypedefEntry typedefEntry =
+ stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ());
+ typedefEntry.sourceFile (scanner.fileEntry ());
+ // comment must immediately precede "public", "private" keywords
+ typedefEntry.comment (token.comment);
+ boolean isPublic = (token.type == Token.Public);
+ if (isPublic)
+ match (Token.Public);
+ else
+ match (Token.Private);
+ // <f46082.40> Add constructed types declared "inline" to the contained
+ // vector of this value entry.
+ boolean isConstTypeSpec =
+ (token.type == Token.Struct || token.type == Token.Union || token.type == Token.Enum);
+ // <f46082.40> Make typedefEntry anonymous. If this line is removed,
+ // the entry will be named incorrectly. See <d50618>.
+ typedefEntry.name ("");
+ typedefEntry.type (typeSpec (typedefEntry));
+ addDeclarators (entry, typedefEntry, isPublic);
+ // <f46082.40>
+ if (isConstTypeSpec)
+ entry.addContained (typedefEntry);
+ match (Token.Semicolon);
+ } // valueStateMember
+
+
+ private void addDeclarators (ValueEntry entry, TypedefEntry typedefEntry,
+ boolean isPublic) throws IOException, ParseException
+ {
+ int modifier = isPublic ? InterfaceState.Public : InterfaceState.Private;
+ try
+ {
+ Vector typedefList = new Vector ();
+ declarators (typedefEntry, typedefList);
+ for (Enumeration e = typedefList.elements (); e.hasMoreElements ();)
+ entry.addStateElement (
+ new InterfaceState (modifier, (TypedefEntry)e.nextElement ()), scanner);
+ }
+ catch (ParseException exception)
+ {
+ skipToSemicolon ();
+ }
+ } // addDeclarators
+
+ /**
+ *
+ **/
+ private void initDcl (ValueEntry entry) throws IOException, ParseException
+ {
+ MethodEntry method = stFactory.methodEntry (entry, (IDLID)repIDStack.peek ());
+ method.sourceFile (scanner.fileEntry ());
+ // Comment must immediately precede "init" keyword:
+ method.comment (token.comment);
+ repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
+ ((IDLID)repIDStack.peek ()).appendToName (token.name);
+
+ // <d62023> In 2.3 prelim, <init_dcl> ::= "init" "(" ...
+ if (token.type == Token.Init)
+ {
+ method.name ("init");
+ match (Token.Init);
+ match (Token.LeftParen);
+ }
+ else // <d62023> In 2.4rtf, <init_dcl> ::= "factory" <Indentifier> "(" ...
+ {
+ match (Token.Factory);
+ method.name (token.name);
+ if (token.type == Token.MacroIdentifier)
+ match (Token.MacroIdentifier); // "(" already consumed.
+ else
+ {
+ match (Token.Identifier);
+ match (Token.LeftParen);
+ }
+ }
+
+ if (token.type != Token.RightParen)
+ for (;;)
+ {
+ initParamDcl (method);
+ if (token.type == Token.RightParen)
+ break;
+ match (Token.Comma);
+ }
+ entry.initializersAddElement (method, scanner);
+ match (Token.RightParen);
+ match (Token.Semicolon);
+ repIDStack.pop ();
+ } // initDcl
+
+ /**
+ *
+ **/
+ private void initParamDcl (MethodEntry entry) throws IOException, ParseException
+ {
+ ParameterEntry parmEntry = stFactory.parameterEntry (entry, (IDLID)repIDStack.peek ());
+ parmEntry.sourceFile (scanner.fileEntry());
+ // Comment must immediately precede parameter attribute
+ parmEntry.comment (token.comment);
+ match (Token.In);
+ parmEntry.passType (ParameterEntry.In);
+ parmEntry.type (paramTypeSpec (entry));
+ parmEntry.name (token.name);
+ match (Token.Identifier);
+ if (isntInList (entry.parameters (), parmEntry.name ()))
+ entry.addParameter (parmEntry);
+ } // initParamDcl
+
+ /**
+ *
+ **/
+ private void valueBox (ModuleEntry module, String name) throws IOException, ParseException
+ {
+ repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
+ // Note: The 'actual' repository ID will be calculated at the end of
+ // the parsing phase, since it is based on the entire contents of the
+ // declaration, and needs to have all forward references resolved:
+ ValueEntry entry = stFactory.valueBoxEntry (module, (IDLID)repIDStack.peek ());
+ entry.sourceFile (scanner.fileEntry ());
+ entry.name (name);
+ // comment must immediately precede "value" keyword
+ entry.comment (tokenHistory.lookBack (2).comment);
+ // <f46082.40> Value boxes may not be forwarded.
+ // If this value has been forward declared, there are probably
+ // other values which derive from a ForwardValueEntry.
+ // Replace those ForwardValueEntry's with this ValueEntry:
+ //if (!ForwardValueEntry.replaceForwardDecl (entry))
+ // ParseException.badAbstract (scanner, entry.fullName());
+ SymtabEntry valueForward = (SymtabEntry)Parser.symbolTable.get (entry.fullName ());
+ if (valueForward != null && valueForward instanceof ForwardEntry)
+ ParseException.forwardedValueBox (scanner, entry.fullName ());
+ pigeonhole (module, entry);
+ ((IDLID)repIDStack.peek ()).appendToName (name);
+ currentModule = entry;
+ TypedefEntry typedefEntry = stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ());
+ typedefEntry.sourceFile (scanner.fileEntry ());
+ typedefEntry.comment (token.comment);
+ // <d50237> Workaround to place typedefEntry in the _contained vector of
+ // this value box entry ONLY when <type_spec> is a constructed type declared
+ // at this point (i.e., not an identifier that resolves to a constructed
+ // type), so that emitters may generate bindings for it. <daz>
+ boolean isConstTypeSpec =
+ token.type == Token.Struct || token.type == Token.Union || token.type == Token.Enum;
+ // <d50618> Make typedefEntry anonymous. If this line is removed, the
+ // entry will be named incorrectly.
+ typedefEntry.name ("");
+ typedefEntry.type (typeSpec (typedefEntry));
+ // <d59067> Value boxes cannot be nested.
+ if (typedefEntry.type () instanceof ValueBoxEntry)
+ ParseException.nestedValueBox (scanner);
+ //typedefEntry.name ("");
+ entry.addStateElement (new InterfaceState (InterfaceState.Public, typedefEntry), scanner);
+ if (isConstTypeSpec)
+ entry.addContained (typedefEntry);
+ currentModule = module;
+ repIDStack.pop ();
+ } // valueBox
+
+ /**
+ *
+ **/
+ private void valueForwardDcl (ModuleEntry module, String name, boolean isAbstract)
+ throws IOException, ParseException
+ {
+ ForwardValueEntry entry = stFactory.forwardValueEntry (module, (IDLID)repIDStack.peek ());
+ entry.sourceFile (scanner.fileEntry ());
+ entry.name (name);
+ entry.setInterfaceType(isAbstract ? InterfaceType.ABSTRACT : InterfaceType.NORMAL );
+ // Comment must immediately precede "[abstract] value" keyword[s]
+ entry.comment (tokenHistory.lookBack (isAbstract? 3 : 2).comment);
+ pigeonhole (module, entry);
+ } // valueForwardDcl
+
+ private void nativeDcl (SymtabEntry entry) throws IOException, ParseException
+ {
+ match (Token.Native);
+ NativeEntry nativeEntry = stFactory.nativeEntry (entry, (IDLID)repIDStack.peek ());
+ nativeEntry.sourceFile (scanner.fileEntry ());
+ // Comment must immediately precede "native" keyword
+ nativeEntry.comment (tokenHistory.lookBack (1).comment);
+ nativeEntry.name (token.name);
+ match (Token.Identifier);
+ pigeonhole (entry, nativeEntry);
+ } // nativeDcl
+ /**
+ *
+ **/
+ private void constDcl (SymtabEntry entry) throws IOException, ParseException
+ {
+ match (Token.Const);
+ ConstEntry constEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek ());
+ constEntry.sourceFile (scanner.fileEntry ());
+ // Comment must immediately precede "const" keyword
+ constEntry.comment (tokenHistory.lookBack (1).comment);
+ constType (constEntry);
+ constEntry.name (token.name);
+ match (Token.Identifier);
+ match (Token.Equal);
+ constEntry.value (constExp (constEntry));
+ verifyConstType (constEntry.value (), typeOf (constEntry.type ()));
+ pigeonhole (entry, constEntry);
+ } // constDcl
+
+ /**
+ *
+ **/
+ private void constType (SymtabEntry entry) throws IOException, ParseException
+ {
+ switch (token.type)
+ {
+ case Token.Octet:
+ entry.type( octetType()) ;
+ break ;
+ case Token.Long:
+ case Token.Short:
+ case Token.Unsigned:
+ entry.type (integerType (entry));
+ break;
+ case Token.Char:
+ case Token.Wchar:
+ entry.type (charType ());
+ break;
+ case Token.Boolean:
+ entry.type (booleanType ());
+ break;
+ case Token.Float:
+ case Token.Double:
+ entry.type (floatingPtType ());
+ break;
+ case Token.String:
+ case Token.Wstring:
+ entry.type (stringType (entry));
+ break;
+ case Token.Identifier:
+ case Token.DoubleColon:
+ entry.type (scopedName (entry.container (), stFactory.primitiveEntry ()));
+ if (hasArrayInfo (entry.type ()))
+ ParseException.illegalArray (scanner, "const");
+ SymtabEntry entryType = typeOf (entry.type ());
+ if (!((entryType instanceof PrimitiveEntry) || (entryType instanceof StringEntry)))
+ {
+ ParseException.wrongType(scanner, entry.fullName (), "primitive or string", entryName (entry.type ()));
+ entry.type (qualifiedEntry ("long"));
+ }
+ else if (entryType instanceof PrimitiveEntry)
+ {
+ String any = overrideName ("any");
+ if (entryType.name().equals (any))
+ {
+ ParseException.wrongType (scanner, entry.fullName (), "primitive or string (except " + any + ')', any);
+ entry.type (qualifiedEntry ("long"));
+ }
+ }
+ break;
+ default:
+ throw ParseException.syntaxError (scanner, new int [] {
+ Token.Long, Token.Short, Token.Unsigned, Token.Char,
+ Token.Wchar, Token.Boolean, Token.Float, Token.Double,
+ Token.String, Token.Wstring, Token.Identifier,
+ Token.DoubleColon }, token.type);
+ }
+ } // constType
+
+ /**
+ *
+ **/
+ private boolean hasArrayInfo (SymtabEntry entry)
+ {
+ while (entry instanceof TypedefEntry)
+ {
+ if (((TypedefEntry)entry).arrayInfo ().size () != 0)
+ return true;
+ entry = entry.type ();
+ }
+ return false;
+ } // hasArrayInfo
+
+ /**
+ *
+ **/
+ public static String overrideName (String string)
+ {
+ String name = (String)overrideNames.get (string);
+ return (name == null) ? string : name;
+ } // overrideName
+
+ // If entry is boolean, expression value must be boolean
+ // If entry is float/double, expression value must be float/double
+ // If entry is integral, expression value must be integral
+ // If entry is string, expression value must be string
+
+ /**
+ *
+ **/
+ private void verifyConstType (Expression e, SymtabEntry t)
+ {
+ Object value = e.value ();
+ if (value instanceof BigInteger)
+ verifyIntegral ((Number)value, t);
+ else if (value instanceof String)
+ verifyString (e, t);
+ else if (value instanceof Boolean)
+ verifyBoolean (t);
+ else if (value instanceof Character)
+ verifyCharacter (e, t);
+ else if (value instanceof Float || value instanceof Double)
+ verifyFloat((Number)value, t);
+ else if (value instanceof ConstEntry)
+ verifyConstType (((ConstEntry)value).value (), t);
+ else
+ ParseException.wrongExprType (scanner, t.fullName (),
+ (value == null) ? "" : value.toString ());
+ } // verifyConstType
+
+ private static final int MAX_SHORT = 32767;
+ private static final int MIN_SHORT = -32768;
+ private static final int MAX_USHORT = 65535;
+
+ /**
+ *
+ **/
+ private void verifyIntegral (Number n, SymtabEntry t)
+ {
+ boolean outOfRange = false;
+ //KEEP: Useful for debugging com.sun.tools.corba.se.idl.constExpr package
+ //System.out.println ("verifyIntegral, n = " + n.toString ());
+
+ if (t == qualifiedEntry( "octet" )) {
+ if ((n.longValue() > 255) || (n.longValue() < 0))
+ outOfRange = true ;
+ } else if (t == qualifiedEntry ("long")) {
+ if (n.longValue () > Integer.MAX_VALUE || n.longValue() < Integer.MIN_VALUE)
+ outOfRange = true;
+ } else if (t == qualifiedEntry ("short")) {
+ if (n.intValue () > Short.MAX_VALUE || n.intValue () < Short.MIN_VALUE)
+ outOfRange = true;
+ } else if (t == qualifiedEntry ("unsigned long")) {
+ if (n.longValue () > (long)Integer.MAX_VALUE*2+1 || n.longValue() < 0)
+ outOfRange = true;
+ } else if (t == qualifiedEntry ("unsigned short")) {
+ if (n.intValue () > (int) Short.MAX_VALUE*2+1 || n.intValue () < 0)
+ outOfRange = true;
+ } else if (t == qualifiedEntry ("long long")) {
+ // BigInteger required because value being compared may exceed
+ // java.lang.Long.MAX_VALUE/MIN_VALUE:
+ BigInteger llMax = BigInteger.valueOf (Long.MAX_VALUE);
+ BigInteger llMin = BigInteger.valueOf (Long.MIN_VALUE);
+ if (((BigInteger)n).compareTo (llMax) > 0 ||
+ ((BigInteger)n).compareTo (llMin) < 0)
+ outOfRange = true;
+ } else if (t == qualifiedEntry ("unsigned long long")) {
+ BigInteger ullMax = BigInteger.valueOf (Long.MAX_VALUE).
+ multiply (BigInteger.valueOf (2)).
+ add (BigInteger.valueOf (1));
+ BigInteger ullMin = BigInteger.valueOf (0);
+ if (((BigInteger)n).compareTo (ullMax) > 0 ||
+ ((BigInteger)n).compareTo (ullMin) < 0)
+ outOfRange = true;
+ } else {
+ String got = null;
+ // THIS MUST BE CHANGED; BIGINTEGER IS ALWAYS THE CONTAINER
+ /*
+ if (n instanceof Short)
+ got = "short";
+ else if (n instanceof Integer)
+ got = "long";
+ else
+ got = "long long";
+ */
+ got = "long";
+ ParseException.wrongExprType (scanner, t.fullName (), got);
+ }
+
+ if (outOfRange)
+ ParseException.outOfRange (scanner, n.toString (), t.fullName ());
+ } // verifyIntegral
+
+ /**
+ *
+ **/
+ private void verifyString (Expression e, SymtabEntry t)
+ {
+ String string = (String)(e.value()) ;
+ if (!(t instanceof StringEntry)) {
+ ParseException.wrongExprType (scanner, t.fullName (), e.type() );
+ } else if (((StringEntry)t).maxSize () != null) {
+ Expression maxExp = ((StringEntry)t).maxSize ();
+ try {
+ Number max = (Number)maxExp.value ();
+ if (string.length () > max.intValue ())
+ ParseException.stringTooLong (scanner, string, max.toString ());
+ } catch (Exception exception) {
+ // If the above statement is not valid and throws an
+ // exception, then an error occurred and was reported
+ // earlier. Move on.
+ }
+ }
+
+ if (!e.type().equals( t.name())) {
+ // cannot mix strings and wide strings
+ ParseException.wrongExprType (scanner, t.name(), e.type() ) ;
+ }
+ } // verifyString
+
+ /**
+ *
+ **/
+ private void verifyBoolean (SymtabEntry t)
+ {
+ if (!t.name ().equals (overrideName ("boolean")))
+ ParseException.wrongExprType(scanner, t.name(), "boolean");
+ } // verifyBoolean
+
+ /**
+ *
+ **/
+ private void verifyCharacter (Expression e, SymtabEntry t)
+ {
+ // Bug fix 4382578: Can't compile a wchar literal.
+ // Allow a Character to be either a char or a wchar.
+ if (!t.name ().equals (overrideName ("char")) &&
+ !t.name ().equals (overrideName ("wchar")) ||
+ !t.name().equals(e.type()) )
+ ParseException.wrongExprType (scanner, t.fullName(), e.type() ) ;
+ } // verifyCharacter
+
+ /**
+ *
+ **/
+ private void verifyFloat (Number f, SymtabEntry t)
+ {
+ // <d52042> Added range checking for floats.
+ //if (!(t.name ().equals (overrideName ("float")) ||
+ // t.name ().equals (overrideName ("double"))))
+ // ParseException.wrongExprType (scanner,
+ // t.fullName (), (f instanceof Float) ? "float" : "double");
+ //KEEP: Useful for debugging com.sun.tools.corba.se.idl.constExpr package
+ //System.out.println ("verifyFloat, f = " + f.toString ());
+ boolean outOfRange = false;
+ if (t.name ().equals (overrideName ("float")))
+ {
+ double absVal = (f.doubleValue () < 0.0) ?
+ f.doubleValue () * -1.0 : f.doubleValue ();
+ if ((absVal != 0.0) &&
+ (absVal > Float.MAX_VALUE || absVal < Float.MIN_VALUE))
+ outOfRange = true;
+ }
+ else if (t.name ().equals (overrideName ("double")))
+ {
+ // Cannot check range of double until BigDecimal is the basis
+ // of all floating-point types. Currently, it is Double. The
+ // parser will fail when instantiating a Double with an exception.
+ }
+ else
+ {
+ ParseException.wrongExprType (scanner, t.fullName (),
+ (f instanceof Float) ? "float" : "double");
+ }
+ if (outOfRange)
+ ParseException.outOfRange (scanner, f.toString (), t.fullName ());
+ } // verifyFloat
+
+ /**
+ *
+ **/
+ Expression constExp (SymtabEntry entry) throws IOException, ParseException
+ {
+ // Parse the expression.
+ Expression expr = orExpr (null, entry);
+
+ // Set its target type.
+ if (expr.type() == null)
+ expr.type (entry.typeName ());
+ // Compute its value and <d53042> coerce it to the target type.
+ try
+ {
+ expr.evaluate ();
+
+ // <d54042> Coerces integral value to Double if an integer literal
+ // was used to initialize a floating-point constant expression.
+ if (expr instanceof Terminal &&
+ expr.value () instanceof BigInteger &&
+ (overrideName (expr.type ()).equals ("float") ||
+ overrideName (expr.type ()).indexOf ("double") >= 0))
+ {
+ expr.value (new Double (((BigInteger)expr.value ()).doubleValue ()));
+ }
+ }
+ catch (EvaluationException exception)
+ {
+ ParseException.evaluationError (scanner, exception.toString ());
+ }
+ return expr;
+ } // constExp
+
+ /**
+ *
+ **/
+ private Expression orExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
+ {
+ if (e == null)
+ e = xorExpr (null, entry);
+ else
+ {
+ BinaryExpr b = (BinaryExpr)e;
+ b.right (xorExpr (null, entry));
+ e.rep (e.rep () + b.right ().rep ());
+ }
+ if (token.equals (Token.Bar))
+ {
+ match (token.type);
+ Or or = exprFactory.or (e, null);
+ or.type (entry.typeName ());
+ or.rep (e.rep () + " | ");
+ return orExpr (or, entry);
+ }
+ return e;
+ } // orExpr
+
+ /**
+ *
+ **/
+ private Expression xorExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
+ {
+ if (e == null)
+ e = andExpr (null, entry);
+ else
+ {
+ BinaryExpr b = (BinaryExpr)e;
+ b.right (andExpr (null, entry));
+ e.rep (e.rep () + b.right ().rep ());
+ }
+ if (token.equals (Token.Carat))
+ {
+ match (token.type);
+ Xor xor = exprFactory.xor (e, null);
+ xor.rep (e.rep () + " ^ ");
+ xor.type (entry.typeName ());
+ return xorExpr (xor, entry);
+ }
+ return e;
+ } // xorExpr
+
+ /**
+ *
+ **/
+ private Expression andExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
+ {
+ if (e == null)
+ e = shiftExpr (null, entry);
+ else
+ {
+ BinaryExpr b = (BinaryExpr)e;
+ b.right (shiftExpr (null, entry));
+ e.rep (e.rep () + b.right ().rep ());
+ }
+ if (token.equals (Token.Ampersand))
+ {
+ match (token.type);
+ And and = exprFactory.and (e, null);
+ and.rep(e.rep () + " & ");
+ and.type (entry.typeName ());
+ return andExpr (and, entry);
+ }
+ return e;
+ } // andExpr
+
+ /**
+ *
+ **/
+ private Expression shiftExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
+ {
+ if (e == null)
+ e = addExpr (null, entry);
+ else
+ {
+ BinaryExpr b = (BinaryExpr)e;
+ b.right (addExpr (null, entry));
+ e.rep (e.rep () + b.right ().rep ());
+ }
+ if (token.equals (Token.ShiftLeft))
+ {
+ match (token.type);
+ ShiftLeft sl = exprFactory.shiftLeft (e, null);
+ sl.type (entry.typeName ());
+ sl.rep (e.rep () + " << ");
+ return shiftExpr (sl, entry);
+ }
+ if (token.equals (Token.ShiftRight))
+ {
+ match (token.type);
+ ShiftRight sr = exprFactory.shiftRight (e, null);
+ sr.type (entry.typeName ());
+ sr.rep (e.rep () + " >> ");
+ return shiftExpr (sr, entry);
+ }
+ return e;
+ } // shiftExpr
+
+ /**
+ *
+ **/
+ private Expression addExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
+ {
+ if (e == null)
+ e = multExpr (null, entry);
+ else
+ {
+ BinaryExpr b = (BinaryExpr)e;
+ b.right (multExpr (null, entry));
+ e.rep (e.rep () + b.right ().rep ());
+ }
+ if (token.equals (Token.Plus))
+ {
+ match (token.type);
+ Plus p = exprFactory.plus (e, null);
+ p.type (entry.typeName ());
+ p.rep (e.rep () + " + ");
+ return addExpr (p, entry);
+ }
+ if (token.equals (Token.Minus))
+ {
+ match (token.type);
+ Minus m = exprFactory.minus (e, null);
+ m.type (entry.typeName ());
+ m.rep (e.rep () + " - ");
+ return addExpr (m, entry);
+ }
+ return e;
+ } // addExpr
+
+ /**
+ *
+ **/
+ private Expression multExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
+ {
+ if (e == null)
+ e = unaryExpr (entry);
+ else
+ {
+ BinaryExpr b = (BinaryExpr)e;
+ b.right (unaryExpr (entry));
+ e.rep (e.rep () + b.right ().rep ());
+ }
+ if (token.equals (Token.Star))
+ {
+ match (token.type);
+ Times t = exprFactory.times (e, null);
+ t.type (entry.typeName ());
+ t.rep (e.rep () + " * ");
+ return multExpr (t, entry);
+ }
+ if (token.equals (Token.Slash))
+ {
+ match (token.type);
+ Divide d = exprFactory.divide (e, null);
+ d.type (entry.typeName ());
+ d.rep (e.rep () + " / ");
+ return multExpr (d, entry);
+ }
+ if (token.equals (Token.Percent))
+ {
+ match (token.type);
+ Modulo m = exprFactory.modulo (e, null);
+ m.type (entry.typeName ());
+ m.rep (e.rep () + " % ");
+ return multExpr (m, entry);
+ }
+ return e;
+ } // multExpr
+
+ /**
+ *
+ **/
+ private Expression unaryExpr (SymtabEntry entry) throws IOException, ParseException
+ {
+ if (token.equals (Token.Plus))
+ {
+ match (token.type);
+ Expression e = primaryExpr (entry);
+ Positive pos = exprFactory.positive (e);
+ pos.type (entry.typeName());
+ pos.rep ('+' + e.rep());
+ return pos;
+ }
+ if (token.equals (Token.Minus))
+ {
+ match (token.type);
+ Expression e = primaryExpr (entry);
+ Negative neg = exprFactory.negative (e);
+ neg.type (entry.typeName());
+ neg.rep ('-' + e.rep());
+ return neg;
+ }
+ if (token.equals (Token.Tilde))
+ {
+ match (token.type);
+ Expression e = primaryExpr (entry);
+ Not not = exprFactory.not (e);
+ not.type (entry.typeName());
+ not.rep ('~' + e.rep());
+ return not;
+ }
+ return primaryExpr (entry);
+ } // unaryExpr
+
+ /**
+ *
+ **/
+ private Expression primaryExpr (SymtabEntry entry)
+ throws IOException, ParseException
+ {
+ Expression primary = null;
+ if (parsingConditionalExpr)
+ {
+ prep.token = token; // Give current token to preprocessor
+ primary = prep.primaryExpr (entry);
+ token = prep.token; // Get the current token from preprocessor
+ }
+ else
+ switch (token.type)
+ {
+ case Token.Identifier:
+ case Token.DoubleColon:
+ ConstEntry expectedC = stFactory.constEntry ();
+ expectedC.value (exprFactory.terminal ("1", BigInteger.valueOf (1)));
+ SymtabEntry ref = scopedName (entry.container (), expectedC);
+ if (!(ref instanceof ConstEntry))
+ {
+ ParseException.invalidConst (scanner, ref.fullName ());
+ // An error occurred. Just give it some bogus value. <daz>
+ //primary = exprFactory.terminal ("1", new Long (1));
+ primary = exprFactory.terminal ("1", BigInteger.valueOf (1));
+ }
+ else
+ primary = exprFactory.terminal ((ConstEntry)ref);
+ break;
+ case Token.BooleanLiteral:
+ case Token.CharacterLiteral:
+ case Token.IntegerLiteral:
+ case Token.FloatingPointLiteral:
+ case Token.StringLiteral:
+ primary = literal (entry);
+ break;
+ case Token.LeftParen:
+ match (Token.LeftParen);
+ primary = constExp (entry);
+ match (Token.RightParen);
+ primary.rep ('(' + primary.rep () + ')');
+ break;
+ default:
+ throw ParseException.syntaxError (scanner, new int [] {
+ Token.Identifier, Token.DoubleColon, Token.Literal, Token.LeftParen},
+ token.type);
+ }
+ return primary;
+ } // primaryExpr
+
+ /**
+ *
+ **/
+ Expression literal (SymtabEntry entry) throws IOException, ParseException
+ {
+ String string = token.name;
+ Expression literal = null;
+ switch (token.type)
+ {
+ case Token.IntegerLiteral:
+ match (Token.IntegerLiteral);
+ try
+ {
+ literal = exprFactory.terminal (string, parseString (string));
+ literal.type (entry.typeName ());
+ }
+ catch (NumberFormatException exception)
+ {
+ ParseException.notANumber (scanner, string);
+ literal = exprFactory.terminal ("0", BigInteger.valueOf (0));
+ }
+ break;
+ case Token.CharacterLiteral:
+ boolean isWide = token.isWide();
+ match (Token.CharacterLiteral);
+ literal = exprFactory.terminal ("'" + string.substring (1) + "'",
+ new Character (string.charAt (0)), isWide );
+ break;
+ case Token.FloatingPointLiteral:
+ match (Token.FloatingPointLiteral);
+ try
+ {
+ literal = exprFactory.terminal (string, new Double (string));
+ literal.type (entry.typeName ());
+ }
+ catch (NumberFormatException e)
+ {
+ ParseException.notANumber (scanner, string);
+ }
+ break;
+ case Token.BooleanLiteral:
+ literal = booleanLiteral ();
+ break;
+ case Token.StringLiteral:
+ literal = stringLiteral ();
+ break;
+ default:
+ throw ParseException.syntaxError (scanner, Token.Literal,token.type);
+ }
+ return literal;
+ } // literal
+
+ /**
+ *
+ **/
+ private BigInteger parseString (String string) throws NumberFormatException
+ {
+ int radix = 10;
+ if (string.length() > 1)
+ if (string.charAt (0) == '0')
+ if (string.charAt (1) == 'x' || string.charAt (1) == 'X')
+ {
+ string = string.substring (2);
+ radix = 16;
+ }
+ else
+ radix = 8;
+ return new BigInteger (string, radix);
+ } // parseString
+
+ /**
+ *
+ **/
+ private Terminal booleanLiteral () throws IOException, ParseException
+ {
+ Boolean bool = null;
+ if (token.name.equals ("TRUE"))
+ bool = new Boolean (true);
+ else if (token.name.equals ("FALSE"))
+ bool = new Boolean (false);
+ else
+ {
+ ParseException.invalidConst (scanner, token.name);
+ bool = new Boolean (false);
+ }
+ String name = token.name;
+ match (Token.BooleanLiteral);
+ return exprFactory.terminal (name, bool);
+ } // booleanLiteral
+
+ /**
+ *
+ **/
+ private Expression stringLiteral () throws IOException, ParseException
+ {
+ // If string literals appear together, concatenate them. Ie:
+ // "Twas " "brillig " "and " "the " "slithy " "toves"
+ // becomes
+ // "Twas brillig and the slithy toves"
+ boolean isWide = token.isWide() ;
+ String literal = "";
+ do
+ {
+ literal += token.name;
+ match (Token.StringLiteral);
+ } while (token.equals (Token.StringLiteral));
+ Expression stringExpr = exprFactory.terminal (literal, isWide );
+ stringExpr.rep ('"' + literal + '"');
+ return stringExpr;
+ } // stringLiteral
+
+ /**
+ *
+ **/
+ private Expression positiveIntConst (SymtabEntry entry) throws IOException, ParseException
+ {
+ Expression e = constExp (entry);
+ Object value = e.value ();
+ while (value instanceof ConstEntry)
+ value = ((ConstEntry)value).value ().value ();
+ if (!(value instanceof Number) || value instanceof Float || value instanceof Double)
+ {
+ ParseException.notPositiveInt (scanner, e.rep ());
+ //e = exprFactory.terminal ("1", new Long (1));
+ e = exprFactory.terminal ("1", BigInteger.valueOf (1));
+ }
+ //else if (((Number)value).longValue () <= 0) {
+ // ParseException.notPositiveInt (scanner, value.toString ());
+ // e = exprFactory.terminal ("1", new Long (1)); }
+ else if (((BigInteger)value).compareTo (BigInteger.valueOf (0)) <= 0)
+ {
+ ParseException.notPositiveInt (scanner, value.toString ());
+ //e = exprFactory.terminal ("1", new Long (1)); <daz>
+ e = exprFactory.terminal ("1", BigInteger.valueOf (1));
+ }
+ return e;
+ } // positiveIntConst
+
+ /**
+ *
+ **/
+ private SymtabEntry typeDcl (SymtabEntry entry) throws IOException, ParseException
+ {
+ switch (token.type)
+ {
+ case Token.Typedef:
+ match (Token.Typedef);
+ return typeDeclarator (entry);
+ case Token.Struct:
+ return structType (entry);
+ case Token.Union:
+ return unionType (entry);
+ case Token.Enum:
+ return enumType (entry);
+ default:
+ throw ParseException.syntaxError (scanner, new int [] {
+ Token.Typedef, Token.Struct, Token.Union, Token.Enum}, token.type);
+ }
+ } // typeDcl
+
+ /**
+ *
+ **/
+ private TypedefEntry typeDeclarator (SymtabEntry entry) throws IOException, ParseException
+ {
+ TypedefEntry typedefEntry = stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ());
+ typedefEntry.sourceFile (scanner.fileEntry ());
+ // Comment must immediately precede "typedef" keyword
+ typedefEntry.comment (tokenHistory.lookBack (1).comment);
+ typedefEntry.type (typeSpec (entry));
+ Vector typedefList = new Vector ();
+ declarators (typedefEntry, typedefList);
+ for (Enumeration e = typedefList.elements(); e.hasMoreElements();)
+ pigeonhole (entry, (SymtabEntry)e.nextElement ());
+ return typedefEntry;
+ } // typeDeclarator
+
+ /**
+ *
+ **/
+ private SymtabEntry typeSpec (SymtabEntry entry) throws IOException, ParseException
+ {
+ return ((token.type == Token.Struct) ||
+ (token.type == Token.Union) ||
+ (token.type == Token.Enum))
+ ? constrTypeSpec (entry)
+ : simpleTypeSpec (entry, true);
+ } // typeSpec
+
+ /**
+ *
+ **/
+ private SymtabEntry simpleTypeSpec (SymtabEntry entry,
+ boolean mustBeReferencable ) throws IOException, ParseException
+ {
+ // <f46082.40>
+ //if ((token.type == Token.Identifier) ||
+ // (token.type == Token.DoubleColon) ||
+ // (token.type == Token.Object)) {
+ if ((token.type == Token.Identifier) ||
+ (token.type == Token.DoubleColon) ||
+ (token.type == Token.Object) ||
+ (token.type == Token.ValueBase))
+ {
+ SymtabEntry container = ((entry instanceof InterfaceEntry) ||
+ (entry instanceof ModuleEntry) ||
+ (entry instanceof StructEntry) ||
+ (entry instanceof UnionEntry))
+ ? entry
+ : entry.container ();
+ return scopedName (container, stFactory.primitiveEntry (),
+ mustBeReferencable);
+ }
+ return ((token.type == Token.Sequence) ||
+ (token.type == Token.String) ||
+ (token.type == Token.Wstring))
+ ? templateTypeSpec (entry)
+ : baseTypeSpec (entry);
+ } // simpleTypeSpec
+
+ /**
+ *
+ **/
+ private SymtabEntry baseTypeSpec (SymtabEntry entry) throws IOException, ParseException
+ {
+ switch (token.type)
+ {
+ case Token.Float:
+ case Token.Double:
+ return floatingPtType ();
+ case Token.Long:
+ case Token.Short:
+ case Token.Unsigned:
+ return integerType (entry);
+ case Token.Char:
+ case Token.Wchar:
+ return charType ();
+ case Token.Boolean:
+ return booleanType ();
+ case Token.Octet:
+ return octetType ();
+ case Token.Any:
+ return anyType ();
+ // NOTE: Object and ValueBase are <base_type_spec>s, but both
+ // are processed at simpleTypeSpec(), not here. parmTypeSpec()
+ // directly checks for these types. Could make baseTypeSpec() do
+ // the same
+ default:
+ throw ParseException.syntaxError (scanner, new int [] {
+ Token.Float, Token.Double, Token.Long, Token.Short,
+ Token.Unsigned, Token.Char, Token.Wchar, Token.Boolean,
+ Token.Octet, Token.Any}, token.type);
+ }
+ } // baseTypeSpec
+
+ /**
+ *
+ **/
+ private SymtabEntry templateTypeSpec (SymtabEntry entry) throws IOException, ParseException
+ {
+ switch (token.type)
+ {
+ case Token.Sequence:
+ return sequenceType (entry);
+ case Token.String:
+ case Token.Wstring:
+ return stringType (entry);
+ }
+ throw ParseException.syntaxError (scanner, new int [] {Token.Sequence, Token.String, Token.Wstring}, token.type);
+ } // templateTypeSpec
+
+ /**
+ *
+ **/
+ private SymtabEntry constrTypeSpec (SymtabEntry entry) throws IOException, ParseException
+ {
+ switch (token.type)
+ {
+ case Token.Struct:
+ return structType (entry);
+ case Token.Union:
+ return unionType (entry);
+ case Token.Enum:
+ return enumType (entry);
+ }
+ throw ParseException.syntaxError (scanner, new int [] {Token.Struct, Token.Union, Token.Enum}, token.type);
+ } // constrTypeSpec
+
+ /**
+ *
+ **/
+ private void declarators (TypedefEntry entry, Vector list) throws IOException, ParseException
+ {
+ for (; ; match (Token.Comma))
+ {
+ TypedefEntry newEntry = (TypedefEntry)entry.clone ();
+ declarator (newEntry);
+ if (isntInList (list, newEntry.name ()))
+ list.addElement (newEntry);
+ if (token.type != Token.Comma)
+ break;
+ }
+ } // declarators
+
+ /**
+ *
+ **/
+ private void declarator (TypedefEntry entry) throws IOException, ParseException
+ {
+ entry.name (token.name);
+ // If the declarator is commented then override the comment cloned from the parent
+ // entry. <08aug1997daz>
+ if (!token.comment.text ().equals (""))
+ entry.comment (token.comment);
+ match (Token.Identifier);
+ while (token.type == Token.LeftBracket)
+ fixedArraySize (entry);
+ } // declarator
+
+ /**
+ *
+ **/
+ private PrimitiveEntry floatingPtType () throws IOException, ParseException
+ {
+ String name = "double";
+ if (token.type == Token.Float)
+ {
+ match (Token.Float);
+ name = "float";
+ }
+ else if (token.type == Token.Double)
+ match (Token.Double);
+ else
+ {
+ int [] expected = {Token.Float, Token.Double};
+ ParseException.syntaxError (scanner, new int [] {Token.Float, Token.Double }, token.type);
+ }
+ PrimitiveEntry ret = null;
+ try
+ {
+ ret = (PrimitiveEntry)qualifiedEntry (name);
+ }
+ catch (ClassCastException exception)
+ {
+ ParseException.undeclaredType (scanner, name);
+ }
+ return ret;
+ } // floatingPtType
+
+ /**
+ *
+ **/
+ private PrimitiveEntry integerType (SymtabEntry entry) throws IOException, ParseException
+ {
+ String name = "";
+ if (token.type == Token.Unsigned)
+ {
+ match (Token.Unsigned);
+ name = "unsigned ";
+ }
+ name += signedInt();
+ PrimitiveEntry ret = null;
+ try
+ {
+ ret = (PrimitiveEntry) qualifiedEntry (name);
+ }
+ catch (ClassCastException exception)
+ {
+ ParseException.undeclaredType (scanner, name);
+ }
+ return ret;
+ } // integerType
+
+ /**
+ *
+ **/
+ private String signedInt () throws IOException, ParseException
+ {
+ String ret = "long";
+ if (token.type == Token.Long)
+ {
+ match (Token.Long);
+ // <signedInt'> ::= "long" | e
+ if (token.type == Token.Long)
+ {
+ ret = "long long";
+ match (Token.Long);
+ }
+ }
+ else if (token.type == Token.Short)
+ {
+ ret = "short";
+ match (Token.Short);
+ }
+ else
+ ParseException.syntaxError (scanner, new int [] {Token.Long, Token.Short}, token.type);
+ return ret;
+ } // signedInt
+
+ /**
+ *
+ **/
+ private PrimitiveEntry charType () throws IOException, ParseException
+ {
+ String tokenName;
+ if (token.type == Token.Char)
+ {
+ match (Token.Char);
+ tokenName = "char";
+ }
+ else
+ {
+ match (Token.Wchar);
+ tokenName = "wchar";
+ }
+ PrimitiveEntry ret = null;
+ try
+ {
+ ret = (PrimitiveEntry) qualifiedEntry (tokenName);
+ }
+ catch (ClassCastException exception)
+ {
+ ParseException.undeclaredType (scanner, overrideName (tokenName));
+ }
+ return ret;
+ } // charType
+
+ /**
+ *
+ **/
+ private PrimitiveEntry booleanType () throws IOException, ParseException
+ {
+ PrimitiveEntry ret = null;
+ match (Token.Boolean);
+ try
+ {
+ ret = (PrimitiveEntry) qualifiedEntry ("boolean");
+ }
+ catch (ClassCastException exception)
+ {
+ ParseException.undeclaredType (scanner, overrideName ("boolean"));
+ }
+ return ret;
+ } // booleanType
+
+ /**
+ *
+ **/
+ private PrimitiveEntry octetType () throws IOException, ParseException
+ {
+ PrimitiveEntry ret = null;
+ match (Token.Octet);
+ try
+ {
+ ret = (PrimitiveEntry) qualifiedEntry ("octet");
+ }
+ catch (ClassCastException exception)
+ {
+ ParseException.undeclaredType (scanner, overrideName ("octet"));
+ }
+ return ret;
+ } // octetType
+
+ /**
+ *
+ **/
+ private SymtabEntry anyType () throws IOException, ParseException
+ {
+ match (Token.Any);
+ try
+ {
+ return qualifiedEntry ("any");
+ }
+ catch (ClassCastException exception)
+ {
+ ParseException.undeclaredType (scanner, overrideName ("any"));
+ return null;
+ }
+ } // anyType
+
+ /**
+ *
+ **/
+ private StructEntry structType (SymtabEntry entry) throws IOException,
+ ParseException
+ {
+ match (Token.Struct);
+ String name = token.name;
+ match (Token.Identifier);
+ StructEntry structEntry = null ;
+
+ if (token.type == Token.LeftBrace) {
+ repIDStack.push(((IDLID)repIDStack.peek ()).clone ()) ;
+ structEntry = makeStructEntry( name, entry, false ) ;
+ ((IDLID)repIDStack.peek ()).appendToName (name);
+ prep.openScope (structEntry);
+ match (Token.LeftBrace) ;
+ member (structEntry) ;
+ memberList2 (structEntry) ;
+ prep.closeScope (structEntry);
+ match (Token.RightBrace) ;
+ repIDStack.pop() ;
+ } else if (token.equals( Token.Semicolon )) {
+ structEntry = makeStructEntry( name, entry, true ) ;
+ } else {
+ throw ParseException.syntaxError (scanner,
+ new int[] { Token.Semicolon, Token.LeftBrace }, token.type);
+ }
+ return structEntry;
+ } // structType
+
+ private StructEntry makeStructEntry( String name, SymtabEntry entry,
+ boolean isForward )
+ {
+ StructEntry structEntry = stFactory.structEntry (entry,
+ (IDLID)repIDStack.peek () );
+ structEntry.isReferencable( !isForward ) ;
+ structEntry.sourceFile (scanner.fileEntry ());
+ structEntry.name (name);
+ // Comment must immediately preceed "struct" keyword
+ structEntry.comment (tokenHistory.lookBack (1).comment);
+ pigeonhole( entry, structEntry ) ;
+ return structEntry ;
+ }
+
+ /**
+ *
+ **/
+ private void memberList2 (StructEntry entry) throws IOException
+ {
+ while (token.type != Token.RightBrace)
+ member (entry);
+ } // memberList2
+
+ /**
+ *
+ **/
+ private void member (StructEntry entry) throws IOException
+ {
+ TypedefEntry newEntry = stFactory.typedefEntry(entry, (IDLID)repIDStack.peek());
+ newEntry.sourceFile (scanner.fileEntry ());
+ // comment must immediately precede <type_spec> lexeme
+ newEntry.comment (token.comment);
+ try
+ {
+ newEntry.type (typeSpec (entry));
+ if (newEntry.type () == entry)
+ throw ParseException.recursive (scanner, entry.fullName (),
+ (token.name == null) ? "" : token.name);
+ // <d46094> Exception cannot appear within a struct, union, or exception
+ if (typeOf (newEntry) instanceof ExceptionEntry)
+ throw ParseException.illegalException (scanner, entryName (entry));
+ declarators (newEntry, entry.members ());
+ match (Token.Semicolon);
+ }
+ catch (ParseException exception)
+ {
+ skipToSemicolon ();
+ }
+ } // member
+
+ /**
+ *
+ **/
+ private final boolean isConstTypeSpec (Token t)
+ {
+ return (t.type == Token.Struct || t.type == Token.Union || t.type == Token.Enum);
+ } // isConstTypeSpec
+
+ /**
+ *
+ **/
+ private UnionEntry unionType (SymtabEntry entry) throws IOException, ParseException
+ {
+ match (Token.Union) ;
+ String name = token.name ;
+ match (Token.Identifier) ;
+ UnionEntry unionEntry = null ;
+
+ if (token.type == Token.Switch) {
+ repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
+ unionEntry = makeUnionEntry( name, entry, false ) ;
+ ((IDLID)repIDStack.peek ()).appendToName (name);
+ match (Token.Switch);
+ match (Token.LeftParen);
+ unionEntry.type (switchTypeSpec (unionEntry));
+ match (Token.RightParen);
+ prep.openScope (unionEntry);
+ match (Token.LeftBrace);
+ switchBody (unionEntry);
+ verifyUnion (unionEntry);
+ prep.closeScope (unionEntry);
+ match (Token.RightBrace);
+ repIDStack.pop ();
+ } else if (token.equals( Token.Semicolon )) {
+ unionEntry = makeUnionEntry( name, entry, true ) ;
+ } else {
+ throw ParseException.syntaxError (scanner,
+ new int[] { Token.Semicolon, Token.Switch }, token.type);
+ }
+
+ return unionEntry ;
+ } // unionType
+
+ private UnionEntry makeUnionEntry( String name, SymtabEntry entry,
+ boolean isForward )
+ {
+ UnionEntry unionEntry = stFactory.unionEntry (entry,
+ (IDLID)repIDStack.peek () );
+ unionEntry.isReferencable( !isForward ) ;
+ unionEntry.sourceFile (scanner.fileEntry ());
+ unionEntry.name (name);
+ // Comment must immediately preceed "union" keyword
+ unionEntry.comment (tokenHistory.lookBack (1).comment);
+ pigeonhole( entry, unionEntry ) ;
+ return unionEntry ;
+ }
+
+ /**
+ *
+ **/
+ private void verifyUnion (UnionEntry u)
+ {
+ if (u.typeName ().equals (overrideName ("boolean")))
+ {
+ if (caseCount (u) > 2)
+ ParseException.noDefault (scanner);
+ }
+ else if (u.type () instanceof EnumEntry)
+ {
+ if (caseCount (u) > ((EnumEntry)u.type ()).elements ().size ())
+ ParseException.noDefault (scanner);
+ }
+ } // verifyUnion
+
+ /**
+ *
+ **/
+ private long caseCount (UnionEntry u)
+ {
+ long cases = 0;
+ Enumeration branches = u.branches ().elements ();
+ while (branches.hasMoreElements ())
+ {
+ UnionBranch branch = (UnionBranch)branches.nextElement ();
+ cases += branch.labels.size ();
+ if (branch.isDefault)
+ ++cases;
+ }
+ return cases;
+ } // caseCount
+
+ /**
+ *
+ **/
+ private SymtabEntry switchTypeSpec (UnionEntry entry) throws IOException, ParseException
+ {
+ SymtabEntry ret = null;
+ switch (token.type)
+ {
+ case Token.Long:
+ case Token.Short:
+ case Token.Unsigned:
+ return integerType (entry);
+ case Token.Char:
+ case Token.Wchar:
+ return charType();
+ case Token.Boolean:
+ return booleanType();
+ case Token.Enum:
+ return enumType (entry);
+ case Token.Identifier:
+ case Token.DoubleColon:
+ ret = scopedName (entry, stFactory.primitiveEntry ());
+ if (hasArrayInfo (entry.type ()))
+ ParseException.illegalArray (scanner, "switch");
+ SymtabEntry retType = typeOf (ret);
+ if (!(retType instanceof EnumEntry || retType instanceof PrimitiveEntry))
+ ParseException.wrongType (scanner, ret.fullName (),
+ "long, unsigned long, short, unsigned short, char, boolean, enum",
+ entryName (ret.type ()));
+ else if (ret instanceof PrimitiveEntry)
+ {
+ SymtabEntry octet = qualifiedEntry ("octet");
+ SymtabEntry flt = qualifiedEntry ("float");
+ SymtabEntry dbl = qualifiedEntry ("double");
+ if (retType == octet || retType == flt || retType == dbl)
+ ParseException.wrongType (scanner, ret.fullName(),
+ "long, unsigned long, short, unsigned short, char, boolean, enum",
+ entryName(ret.type ()));
+ }
+ break;
+ default:
+ throw ParseException.syntaxError (scanner, new int [] {
+ Token.Long, Token.Short, Token.Unsigned, Token.Char,
+ Token.Boolean, Token.Enum, Token.Identifier,
+ Token.DoubleColon }, token.type);
+ }
+ return ret;
+ } // switchTypeSpec
+
+ // This is only used by the union methods
+ UnionBranch defaultBranch = null;
+
+ /**
+ *
+ **/
+ private void switchBody (UnionEntry entry) throws IOException, ParseException
+ {
+ caseProd (entry);
+ while (!token.equals (Token.RightBrace))
+ caseProd (entry);
+ entry.defaultBranch ((defaultBranch == null) ? null : defaultBranch.typedef);
+ defaultBranch = null;
+ } // switchBody
+
+ /**
+ *
+ **/
+ private void caseProd (UnionEntry entry) throws IOException, ParseException
+ {
+ UnionBranch branch = new UnionBranch ();
+ entry.addBranch (branch);
+ caseLabel (entry, branch);
+ while (token.equals (Token.Case) || token.equals (Token.Default))
+ caseLabel (entry, branch);
+ elementSpec (entry, branch);
+ match (Token.Semicolon);
+ } // caseProd
+
+ /**
+ *
+ **/
+ private void caseLabel (UnionEntry entry, UnionBranch branch) throws IOException, ParseException
+ {
+ if (token.type == Token.Case)
+ {
+ match (Token.Case);
+ ConstEntry tmpEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek ());
+ tmpEntry.sourceFile (scanner.fileEntry ());
+ tmpEntry.type (entry);
+
+ Expression label;
+ SymtabEntry type = typeOf (entry.type ());
+ if (type instanceof EnumEntry)
+ label = matchEnum ((EnumEntry)type);
+ else
+ {
+ label = constExp (tmpEntry);
+ verifyConstType (label, type);
+ }
+ if (entry.has (label))
+ ParseException.branchLabel (scanner, label.rep ());
+ branch.labels.addElement (label);
+ match (Token.Colon);
+ }
+ else if (token.type == Token.Default)
+ {
+ match (Token.Default);
+ match (Token.Colon);
+ if (entry.defaultBranch () != null)
+ ParseException.alreadyDefaulted (scanner);
+ branch.isDefault = true;
+ defaultBranch = branch;
+ }
+ else
+ throw ParseException.syntaxError (scanner, new int [] { Token.Case, Token.Default }, token.type);
+ } // caselabel
+
+ /**
+ *
+ **/
+ private Expression matchEnum (EnumEntry entry) throws IOException, ParseException
+ {
+ // Get the symbol table entry for the case label based on the
+ // scope of the EnumEntry, NOT the UnionEntry (the union could be
+ // in a different scope than the enum). Given
+ // module M { enum E {A, B, C, D}; };
+ // a case label for A could be one of the following:
+ // case A:
+ // case M::A:
+ // case ::M::A:
+ SymtabEntry label = scopedName (entry.container(), new SymtabEntry ());
+ return exprFactory.terminal (label.name (), false);
+ } // matchEnum
+
+ /**
+ *
+ **/
+ private void elementSpec (UnionEntry entry, UnionBranch branch) throws IOException, ParseException
+ {
+ TypedefEntry typedef = stFactory.typedefEntry (entry, (IDLID)repIDStack.peek ());
+ typedef.sourceFile (scanner.fileEntry ());
+ // Comment must immediately precede <type_spec> lexeme
+ typedef.comment (token.comment);
+ typedef.type (typeSpec (entry));
+ if (typedef.type () == entry)
+ throw ParseException.recursive (scanner, entry.fullName (), (token.name == null)? "" : token.name);
+ // <d46094> Exception cannot appear within a struct, union, or exception
+ if (typeOf (typedef) instanceof ExceptionEntry)
+ throw ParseException.illegalException (scanner, entryName (entry));
+ declarator (typedef);
+ branch.typedef = typedef;
+ // Ensure a branch with the same name doesn't already exist.
+ if (entry.has (typedef))
+ ParseException.branchName (scanner, typedef.name ());
+ } // elementSpec
+
+ /**
+ *
+ **/
+ private EnumEntry enumType (SymtabEntry entry) throws IOException, ParseException
+ {
+ match (Token.Enum);
+ EnumEntry enumEntry = newEnumEntry (entry);
+ // comment must immediately precede "enum" keyword
+ enumEntry.comment (tokenHistory.lookBack (1).comment);
+ enumEntry.name (token.name);
+ match (Token.Identifier);
+ prep.openScope (enumEntry);
+ match (Token.LeftBrace);
+ if (isntInStringList (enumEntry.elements (), token.name))
+ {
+ enumEntry.addElement (token.name);
+ SymtabEntry element = new SymtabEntry (entry, (IDLID)repIDStack.peek ());
+ // if block taken from EnumEntry ctor
+ if (element.module ().equals (""))
+ element.module (element.name ());
+ else if (!element.name ().equals (""))
+ element.module (element.module () + "/" + element.name ());
+ element.name (token.name);
+ // <d50237> Place the SymtabEntry representing this enumeration
+ // contant into the SymtabEntry defining its scope (e.g., InterfaceEntry,
+ // ValueEntry, etc.) rather than the SymtabEntry passed in, which
+ // may not define the contant's scope (e.g., TypedefEntry).
+ //pigeonhole (entry, element); } <daz>
+ pigeonhole (enumEntry.container (), element);
+ }
+ match (Token.Identifier);
+ enumType2 (enumEntry);
+ prep.closeScope (enumEntry);
+ match (Token.RightBrace);
+ return enumEntry;
+ } // enumType
+
+ /**
+ *
+ **/
+ private void enumType2 (EnumEntry entry) throws IOException, ParseException
+ {
+ while (token.type == Token.Comma)
+ {
+ match (Token.Comma);
+ String name = token.name;
+ match (Token.Identifier);
+ if (isntInStringList (entry.elements (), name))
+ {
+ entry.addElement (name);
+ SymtabEntry element = new SymtabEntry (entry.container (), (IDLID)repIDStack.peek ());
+ // if block taken from EnumEntry ctor:
+ if (element.module ().equals (""))
+ element.module (element.name ());
+ else if (!element.name().equals (""))
+ element.module (element.module () + "/" + element.name ());
+ element.name (name);
+ pigeonhole (entry.container (), element);
+ }
+ }
+ } // enumType2
+
+ /**
+ *
+ **/
+ private SequenceEntry sequenceType (SymtabEntry entry) throws IOException, ParseException
+ {
+ match (Token.Sequence);
+ match (Token.LessThan);
+
+ SequenceEntry newEntry = newSequenceEntry (entry);
+ SymtabEntry tsentry = simpleTypeSpec (newEntry, false );
+ newEntry.type (tsentry);
+ if (!tsentry.isReferencable()) {
+ // This is a sequence type that is referencing an
+ // incomplete forward declaration of a struct or
+ // union. Save the sequence in a list for later
+ // backpatching.
+ try {
+ List fwdTypes = (List)tsentry.dynamicVariable( ftlKey ) ;
+ if (fwdTypes == null) {
+ fwdTypes = new ArrayList() ;
+ tsentry.dynamicVariable( ftlKey, fwdTypes ) ;
+ }
+ fwdTypes.add( newEntry ) ;
+ } catch (NoSuchFieldException exc) {
+ throw new IllegalStateException() ;
+ }
+ }
+
+ if (token.type == Token.Comma)
+ {
+ match (Token.Comma);
+ ConstEntry tmpEntry = stFactory.constEntry (newEntry, (IDLID)repIDStack.peek ());
+ tmpEntry.sourceFile (scanner.fileEntry ());
+ tmpEntry.type (qualifiedEntry ("long"));
+ newEntry.maxSize (positiveIntConst (tmpEntry));
+ verifyConstType (newEntry.maxSize(), qualifiedEntry ("long"));
+ }
+ match (Token.GreaterThan);
+ return newEntry;
+ } // sequenceType
+
+ /**
+ *
+ **/
+ private StringEntry stringType (SymtabEntry entry) throws IOException, ParseException
+ {
+ StringEntry string = stFactory.stringEntry ();
+ if (token.type == Token.String)
+ {
+ string.name (overrideName ("string"));
+ match (Token.String);
+ }
+ else
+ {
+ string.name (overrideName ("wstring"));
+ match (Token.Wstring);
+ }
+ string.maxSize (stringType2 (entry));
+ return string;
+ } // stringType
+
+ /**
+ *
+ **/
+ private Expression stringType2 (SymtabEntry entry) throws IOException, ParseException
+ {
+ if (token.type == Token.LessThan)
+ {
+ match (Token.LessThan);
+
+ // START IBM.11417 failure in the IDL compiler
+ //Expression maxSize = positiveIntConst (entry); IBM.11417
+
+ ConstEntry tmpEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek
+());
+ tmpEntry.sourceFile (scanner.fileEntry ());
+ tmpEntry.type (qualifiedEntry ("long"));
+ Expression maxSize = positiveIntConst (tmpEntry);
+
+ // END IBM.11417
+
+ verifyConstType (maxSize, qualifiedEntry ("long"));
+ match (Token.GreaterThan);
+ return maxSize;
+ }
+ return null;
+ } // stringType2
+
+ /**
+ *
+ **/
+ private void fixedArraySize (TypedefEntry entry) throws IOException, ParseException
+ {
+ match (Token.LeftBracket);
+ ConstEntry tmpEntry = stFactory.constEntry (entry, (IDLID)repIDStack.peek ());
+ tmpEntry.sourceFile (scanner.fileEntry ());
+ // <d58058> Set type of tmpExpr to "long", which is the array index type.
+ // Previously, this type was erroneously set to the array element type.
+ //tmpEntry.type (entry.type ());
+ tmpEntry.type (qualifiedEntry ("long"));
+ Expression expr = positiveIntConst (tmpEntry);
+ entry.addArrayInfo (expr);
+ verifyConstType (expr, qualifiedEntry ("long"));
+ match (Token.RightBracket);
+ } // fixedArraySize
+
+ /**
+ *
+ **/
+ private void attrDcl (InterfaceEntry entry) throws IOException, ParseException
+ {
+ AttributeEntry attribute = stFactory.attributeEntry (entry, (IDLID)repIDStack.peek ());
+ attribute.sourceFile (scanner.fileEntry ());
+ // Comment must immediately precede the "attribute" keyword. Save the
+ // comment preceding the declaration for use below.
+ attribute.comment (token.comment);
+ Comment dclComment = attribute.comment ();
+
+ if (token.type == Token.Readonly)
+ {
+ match (Token.Readonly);
+ attribute.readOnly (true);
+ }
+ match (Token.Attribute);
+ attribute.type (paramTypeSpec (attribute));
+ attribute.name (token.name);
+ // Override declaration comment if attribute identifier is commented
+ if (!token.comment.text ().equals (""))
+ attribute.comment (token.comment);
+ entry.methodsAddElement (attribute, scanner);
+ pigeonholeMethod (entry, attribute);
+ // Declaration comment was overriden:
+ if (!token.comment.text ().equals (""))
+ {
+ // Create a temporary attribute with declaration comment so cloning in
+ // attrdcl2() can use declaration comment as default.
+ AttributeEntry attributeClone = (AttributeEntry) attribute.clone ();
+ attributeClone.comment (dclComment);
+
+ match (Token.Identifier);
+ attrDcl2 (entry, attributeClone);
+ }
+ else
+ {
+ match (Token.Identifier);
+ attrDcl2 (entry, attribute);
+ }
+ //match (Token.Identifier);
+ //attrDcl2 (entry, attribute);
+ } // attrDcl
+
+ /**
+ *
+ **/
+ private void attrDcl2 (InterfaceEntry entry, AttributeEntry clone)
+ throws IOException, ParseException
+ {
+ while (token.type == Token.Comma)
+ {
+ match (Token.Comma);
+ AttributeEntry attribute = (AttributeEntry)clone.clone ();
+ attribute.name (token.name);
+ // Override the declaration comment (i.e., that preceding the
+ // "attribute" keyword) if the attribute identifier is commented.
+ if (!token.comment.text ().equals (""))
+ attribute.comment (token.comment);
+ entry.methodsAddElement (attribute, scanner);
+ pigeonholeMethod (entry, attribute);
+ match (Token.Identifier);
+ }
+ } // attrDcl2
+
+ /**
+ *
+ **/
+ private void exceptDcl (SymtabEntry entry) throws IOException, ParseException
+ {
+ match (Token.Exception);
+ repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
+ ExceptionEntry exceptEntry = stFactory.exceptionEntry (entry, (IDLID)repIDStack.peek ());
+ ((IDLID)repIDStack.peek ()).appendToName (token.name);
+ exceptEntry.sourceFile (scanner.fileEntry ());
+ // Comment must immediately precede "exception" keyword
+ exceptEntry.comment (tokenHistory.lookBack (1).comment);
+ exceptEntry.name (token.name);
+ match (Token.Identifier);
+ pigeonhole (entry, exceptEntry);
+ if (token.equals (Token.LeftBrace))
+ {
+ prep.openScope (exceptEntry);
+ match (Token.LeftBrace);
+ memberList2 (exceptEntry);
+ prep.closeScope (exceptEntry);
+ match (Token.RightBrace);
+ repIDStack.pop ();
+ }
+ else
+ throw ParseException.syntaxError (scanner, Token.LeftBrace,token.type);
+ } // exceptDcl
+
+ /**
+ *
+ **/
+ private void opDcl (InterfaceEntry entry) throws IOException, ParseException
+ {
+ MethodEntry method = stFactory.methodEntry (entry, (IDLID)repIDStack.peek ());
+ method.sourceFile (scanner.fileEntry ());
+ // Comment must immediately precede "oneway" keyword or <return_type_spec>
+ method.comment (token.comment);
+ if (token.type == Token.Oneway)
+ {
+ match (Token.Oneway);
+ method.oneway (true);
+ }
+ method.type (opTypeSpec (method));
+ repIDStack.push (((IDLID)repIDStack.peek ()).clone ());
+ ((IDLID)repIDStack.peek ()).appendToName (token.name);
+ method.name (token.name);
+ entry.methodsAddElement (method, scanner);
+ pigeonholeMethod (entry, method);
+ opDcl2 (method);
+ if (method.oneway ())
+ checkIfOpLegalForOneway (method);
+ repIDStack.pop ();
+ } // opDcl
+
+ /**
+ *
+ **/
+ private void checkIfOpLegalForOneway (MethodEntry method)
+ {
+ boolean notLegal = false;
+ if ((method.type() != null) ||
+ (method.exceptions().size() != 0)) notLegal = true;
+ else
+ {
+ for (Enumeration e = method.parameters().elements(); e.hasMoreElements();)
+ {
+ if (((ParameterEntry)e.nextElement ()).passType () != ParameterEntry.In)
+ {
+ notLegal = true;
+ break;
+ }
+ }
+ }
+ if (notLegal)
+ ParseException.oneway (scanner, method.name ());
+ } // checkifOpLegalForOneway
+
+ /**
+ *
+ **/
+ private void opDcl2 (MethodEntry method) throws IOException, ParseException
+ {
+ if (token.equals (Token.MacroIdentifier))
+ {
+ match (Token.MacroIdentifier);
+ parameterDcls2 (method);
+ }
+ else
+ {
+ match (Token.Identifier);
+ parameterDcls (method);
+ }
+ opDcl3 (method);
+ } // opDcl2
+
+ /**
+ *
+ **/
+ private void opDcl3 (MethodEntry entry) throws IOException, ParseException
+ {
+ if (token.type != Token.Semicolon)
+ {
+ if (!token.equals (Token.Raises) && !token.equals (Token.Context))
+ throw ParseException.syntaxError (scanner, new int [] {
+ Token.Raises, Token.Context, Token.Semicolon }, token.type);
+ if (token.type == Token.Raises)
+ raisesExpr (entry);
+ if (token.type == Token.Context)
+ contextExpr (entry);
+ }
+ } // opDcl3
+
+ /**
+ *
+ **/
+ private SymtabEntry opTypeSpec (SymtabEntry entry) throws IOException, ParseException
+ {
+ SymtabEntry ret = null;
+ if (token.type == Token.Void)
+ match (Token.Void);
+ else
+ ret = paramTypeSpec (entry);
+ return ret;
+ } // opTypeSpec
+
+ /**
+ *
+ **/
+ private void parameterDcls (MethodEntry entry) throws IOException, ParseException
+ {
+ match (Token.LeftParen);
+ parameterDcls2 (entry);
+ } // parameterDcls
+
+ /**
+ *
+ **/
+ private void parameterDcls2 (MethodEntry entry) throws IOException, ParseException
+ {
+ if (token.type == Token.RightParen)
+ match (Token.RightParen);
+ else
+ {
+ paramDcl (entry);
+ while (token.type == Token.Comma)
+ {
+ match (Token.Comma);
+ paramDcl (entry);
+ }
+ match (Token.RightParen);
+ }
+ } // paraneterDcls2
+
+ /**
+ *
+ **/
+ private void paramDcl (MethodEntry entry) throws IOException, ParseException
+ {
+ ParameterEntry parmEntry = stFactory.parameterEntry (entry, (IDLID)repIDStack.peek ());
+ parmEntry.sourceFile (scanner.fileEntry ());
+ // Comment must immeiately precede the parameter attribute
+ parmEntry.comment (token.comment);
+ paramAttribute (parmEntry);
+ parmEntry.type (paramTypeSpec (entry));
+ parmEntry.name (token.name);
+ match (Token.Identifier);
+ if (isntInList (entry.parameters (), parmEntry.name ()))
+ entry.addParameter (parmEntry);
+ } // paramDcl
+
+ /**
+ *
+ **/
+ private void paramAttribute (ParameterEntry entry) throws IOException, ParseException
+ {
+ if (token.type == Token.In)
+ {
+ entry.passType (ParameterEntry.In);
+ match (Token.In);
+ }
+ else if (token.type == Token.Out)
+ {
+ entry.passType (ParameterEntry.Out);
+ match (Token.Out);
+ }
+ else if (token.type == Token.Inout)
+ {
+ entry.passType (ParameterEntry.Inout);
+ match (Token.Inout);
+ }
+ else
+ throw ParseException.syntaxError (scanner, new int [] {
+ Token.In, Token.Out, Token.Inout }, token.type);
+ } // paramAttribute
+
+ /**
+ *
+ **/
+ private void raisesExpr (MethodEntry entry) throws IOException, ParseException
+ {
+ match (Token.Raises);
+ match (Token.LeftParen);
+ // Comment must immediately precede <scoped_name> for exception
+ Comment tempComment = token.comment;
+ SymtabEntry exception = scopedName(entry.container (), stFactory.exceptionEntry ());
+ if (typeOf (exception) instanceof ExceptionEntry)
+ {
+ // Comment must immediately precede <scoped_name> for exception
+ exception.comment (tempComment);
+ if (isntInList (entry.exceptions (), exception))
+ entry.exceptionsAddElement ((ExceptionEntry) exception);
+ }
+ else
+ ParseException.wrongType (scanner, exception.fullName(),
+ "exception", entryName (exception.type ()));
+ raisesExpr2 (entry);
+ match (Token.RightParen);
+ } // raisesExpr
+
+ /**
+ *
+ **/
+ private void raisesExpr2 (MethodEntry entry) throws IOException, ParseException
+ {
+ while (token.type == Token.Comma)
+ {
+ match (Token.Comma);
+ // Comment must immediately precede <scoped_name> of exception
+ Comment tempComment = token.comment;
+ SymtabEntry exception = scopedName (entry.container (), stFactory.exceptionEntry ());
+ if (typeOf (exception) instanceof ExceptionEntry)
+ {
+ // Comment must immediately precede <scoped_name> of exception
+ exception.comment (tempComment);
+ if (isntInList (entry.exceptions (), exception))
+ entry.addException ((ExceptionEntry)exception);
+ }
+ else
+ ParseException.wrongType (scanner, exception.fullName (),
+ "exception", entryName (exception.type ()));
+ }
+ } // raisesExpr2
+
+ /**
+ *
+ **/
+ private void contextExpr (MethodEntry entry) throws IOException, ParseException
+ {
+ match (Token.Context);
+ match (Token.LeftParen);
+ String stringLit = (String)stringLiteral ().value ();
+ if (isntInStringList (entry.contexts (), stringLit))
+ entry.addContext (stringLit);
+ contextExpr2 (entry);
+ match (Token.RightParen);
+ } // contextExpr
+
+
+ private void contextExpr2 (MethodEntry entry) throws IOException, ParseException
+ {
+ while (token.type == Token.Comma)
+ {
+ match (Token.Comma);
+ String stringLit = (String)stringLiteral ().value ();
+ if (isntInStringList (entry.contexts (), stringLit))
+ entry.addContext (stringLit);
+ }
+ } // contextExpr2
+
+ /**
+ *
+ **/
+ private SymtabEntry paramTypeSpec (SymtabEntry entry) throws IOException, ParseException
+ {
+ SymtabEntry ret = null;
+ switch (token.type)
+ {
+ case Token.Float:
+ case Token.Double:
+ case Token.Long:
+ case Token.Short:
+ case Token.Unsigned:
+ case Token.Char:
+ case Token.Wchar:
+ case Token.Boolean:
+ case Token.Octet:
+ case Token.Any:
+ return baseTypeSpec (entry);
+ case Token.String:
+ case Token.Wstring:
+ return stringType (entry);
+ case Token.Identifier:
+ case Token.Object:
+ // <f46082.40>
+ case Token.ValueBase:
+ case Token.DoubleColon:
+ ret = scopedName (entry.container (), stFactory.primitiveEntry ());
+ if (typeOf (ret) instanceof AttributeEntry)
+ //ParseException.attributeParamType (scanner);
+ ParseException.attributeNotType (scanner, ret.name ());
+ else // <d60942>
+ if (typeOf (ret) instanceof MethodEntry)
+ ParseException.operationNotType (scanner, ret.name ());
+
+ //if (!(returnType instanceof PrimitiveEntry ||
+ // returnType instanceof StringEntry))
+ //ParseException.wrongType (scanner, ret.fullName(),
+ // "primitive or string", entryName (ret.type()));
+ break;
+ default:
+ throw ParseException.syntaxError (scanner, new int [] {
+ Token.Float, Token.Double, Token.Long, Token.Short,
+ Token.Unsigned, Token.Char, Token.Wchar, Token.Boolean,
+ Token.Octet, Token.Any, Token.String, Token.Wstring,
+ Token.Identifier, Token.DoubleColon, Token.ValueBase }, token.type);
+ }
+ return ret;
+ } // paramTypeSpec
+
+ /**
+ *
+ **/
+ private void match (int type) throws IOException, ParseException
+ {
+ ParseException exception = null;
+ if (!token.equals (type))
+ {
+ exception = ParseException.syntaxError (scanner, type, token.type);
+ // Missing a semicolon is a common error. If a semicolon was expected,
+ // assume it exists and keep the current token (don't get the next one).
+ // BEWARE!!! THIS HAS THE POTENTIAL FOR AN INFINITE LOOP!
+ if (type == Token.Semicolon)
+ return;
+ }
+ // <f46082.40> Unecessary due to new valueElement() algorithm.
+ //if (!tokenStack.empty())
+ //{
+ // token = (Token)tokenStack.pop ();
+ // return;
+ //}
+
+ // Fetch the next token.
+ token = scanner.getToken ();
+
+ // <d62023> Issue warnings about tokens.
+ issueTokenWarnings ();
+
+ // Maintain history of most recent tokens.
+ tokenHistory.insert (token);
+
+ // <d59166> Identifiers that collide with keywords are illegal. Note
+ // that escaped identifers never collide!
+ /*
+ if (token.collidesWithKeyword ())
+ {
+ // <f60858.1> Issue a warning only
+ if (corbaLevel <= 2.2f)
+ ParseException.keywordCollisionWarning (scanner, token.name);
+ else
+ exception = ParseException.keywordCollision (scanner, token.name);
+ }
+ */
+
+ while (token.isDirective ())
+ token = prep.process (token);
+
+ // If the token is a defined thingy, scan the defined string
+ // instead of the input stream for a while.
+ if (token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier))
+ {
+ String string = (String)symbols.get (token.name);
+ if (string != null && !string.equals (""))
+ {
+ // If this is a macro, parse the macro
+ if (macros.contains (token.name))
+ {
+ scanner.scanString (prep.expandMacro (string, token));
+ match (token.type);
+ }
+ else // This is just a normal define.
+ {
+ scanner.scanString (string);
+ match (token.type);
+ }
+ }
+ }
+ if (exception != null)
+ throw exception;
+ } // match
+
+ // <d62023>
+ /**
+ * Issue warnings according to attributes of current Token.
+ **/
+ private void issueTokenWarnings ()
+ {
+ if (noWarn)
+ return;
+
+ if ((token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier))
+ && !token.isEscaped ())
+ {
+ // Identifier collision with keyword in another release.
+ // Identifier collision with keyword in letter, but not in case.
+ if (token.collidesWithKeyword ())
+ ParseException.warning (scanner, Util.getMessage ("Migration.keywordCollision", token.name));
+ }
+ // Deprecated keyword.
+ if (token.isKeyword () && token.isDeprecated ())
+ ParseException.warning (scanner, Util.getMessage ("Deprecated.keyword", token.toString ()));
+ } // issueTokenWarnings
+
+ /**
+ *
+ **/
+ private ModuleEntry newModule (ModuleEntry oldEntry)
+ {
+ ModuleEntry entry = stFactory.moduleEntry (oldEntry, (IDLID)repIDStack.peek ());
+ entry.sourceFile (scanner.fileEntry ());
+ entry.name (token.name);
+ // If this named module already exists, just reopen it.
+ /* <46082.46.01> if cppModule, always create new module entry */
+ SymtabEntry prevEntry = (SymtabEntry) symbolTable.get (entry.fullName ());
+ if (!cppModule && prevEntry != null && prevEntry instanceof ModuleEntry)
+ {
+ // A module has been reopened, return that ModuleEntry.
+ entry = (ModuleEntry) prevEntry;
+ if (oldEntry == topLevelModule)
+ {
+ // Do a little checking:
+ if (!entry.emit ())
+ // The entry module is being reopened to put new stuff into it.
+ // The module itself is not marked as "emit", but the new stuff
+ // may be, so put the module on the emitList (add it to topLevelModule).
+ addToContainer (oldEntry, entry);
+ else if (!oldEntry.contained().contains (entry))
+ // <d50767> The entry module being reopened is to be emitted, but
+ // will not be placed on the emitList! I.E., it was not added to
+ // topLevelModule. Occurs when a generator manually inserts
+ // ModuleEntrys into the symbol table (e.g., org; see preParse()
+ // in ...idl.toJava.Compile). <daz>
+ addToContainer (oldEntry, entry);
+ }
+ }
+ else
+ pigeonhole (oldEntry, entry);
+ return entry;
+ } // newModule
+
+ /**
+ *
+ **/
+ private EnumEntry newEnumEntry (SymtabEntry oldEntry)
+ {
+ EnumEntry entry = stFactory.enumEntry (oldEntry, (IDLID)repIDStack.peek ());
+ entry.sourceFile (scanner.fileEntry ());
+ entry.name (token.name);
+ pigeonhole (oldEntry, entry);
+ return entry;
+ } // newEnumEntry
+
+ /**
+ *
+ **/
+ private SequenceEntry newSequenceEntry (SymtabEntry oldEntry)
+ {
+ SequenceEntry entry = stFactory.sequenceEntry (oldEntry, (IDLID)repIDStack.peek ());
+ entry.sourceFile (scanner.fileEntry ());
+ entry.name ("");
+ pigeonhole (oldEntry, entry);
+ return entry;
+ } // newSequenceEntry
+
+ private void updateSymbolTable( String fullName, SymtabEntry entry, boolean lcCheck )
+ {
+ // Check for case-insensitive collision (IDL error).
+ String lcFullName = fullName.toLowerCase();
+ if (lcCheck)
+ if (lcSymbolTable.get (lcFullName) != null) {
+ ParseException.alreadyDeclared (scanner, fullName);
+ }
+ symbolTable.put (fullName, entry);
+ lcSymbolTable.put (lcFullName, entry);
+ // <d59809> Allow fully-qualified CORBA types to be resolved by mapping
+ // short name (e.g., CORBA/StringValue) to long name, actual name.
+ String omgPrefix = "org/omg/CORBA" ;
+ if (fullName.startsWith (omgPrefix)) {
+ overrideNames.put (
+ "CORBA" + fullName.substring (omgPrefix.length()), fullName);
+ }
+ }
+
+ private void pigeonhole (SymtabEntry container, SymtabEntry entry)
+ {
+ if (entry.name().equals (""))
+ entry.name (unknownNamePrefix + ++sequence);
+
+ // If this object is not in the overrides list, then it is
+ // ok to put it in the table (if it IS in the overrides list,
+ // it is already in the table under a different name).
+ String fullName = entry.fullName();
+ if (overrideNames.get (fullName) == null) {
+ addToContainer (container, entry);
+
+ // It is an error is this name already exists in the symbol
+ // table, unless this is a redefinition of a forward decl.
+ // Re-opening a module is also legal, but not handled here.
+ SymtabEntry oldEntry = (SymtabEntry) symbolTable.get (fullName);
+
+ if (oldEntry == null) {
+ updateSymbolTable( fullName, entry, true ) ;
+ } else if (oldEntry instanceof ForwardEntry &&
+ entry instanceof InterfaceEntry) {
+
+ String repIDPrefix = ((IDLID)entry.repositoryID ()).prefix ();
+ String oldRepIDPrefix = ((IDLID)oldEntry.repositoryID ()).prefix ();
+ if (repIDPrefix.equals (oldRepIDPrefix)) {
+ updateSymbolTable( fullName, entry, false ) ;
+ } else {
+ ParseException.badRepIDPrefix (scanner, fullName,
+ oldRepIDPrefix, repIDPrefix);
+ }
+ } else if (entry instanceof ForwardEntry &&
+ (oldEntry instanceof InterfaceEntry ||
+ oldEntry instanceof ForwardEntry)) {
+ if (oldEntry instanceof ForwardEntry &&
+ entry.repositoryID () instanceof IDLID &&
+ oldEntry.repositoryID () instanceof IDLID) {
+
+ String repIDPrefix =
+ ((IDLID)entry.repositoryID ()).prefix ();
+ String oldRepIDPrefix =
+ ((IDLID)oldEntry.repositoryID ()).prefix ();
+
+ if (!(repIDPrefix.equals (oldRepIDPrefix))) {
+ // Disallow multiple ForwardEntry's having same Repository
+ // ID prefixes (CORBA 2.3).
+ ParseException.badRepIDPrefix (scanner, fullName,
+ oldRepIDPrefix, repIDPrefix);
+ }
+ }
+ } else if (cppModule && entry instanceof ModuleEntry &&
+ oldEntry instanceof ModuleEntry) {
+ // Allow multiple ModuleEntrys when user submits
+ // the -cppModule flag.
+ } else if (fullName.startsWith ("org/omg/CORBA") ||
+ fullName.startsWith ("CORBA")) {
+ // Ignore CORBA PIDL types entered at preParse() by generator.
+ } else if (isForwardable( oldEntry, entry )) {
+ // Both oldEntry and entry are structs or unions.
+ // Legality depends on isReferencable on the two entries:
+ // oldEntry Entry
+ // T T ERROR alreadyDeclared
+ // T F legal fwd decl
+ // F T if defined in same file legal,
+ // otherwise ERROR
+ // F F legal fwd decl
+ if (oldEntry.isReferencable() && entry.isReferencable())
+ ParseException.alreadyDeclared (scanner, fullName);
+
+ if (entry.isReferencable()) {
+ String firstFile =
+ oldEntry.sourceFile().absFilename() ;
+ String defFile =
+ entry.sourceFile().absFilename() ;
+ if (!firstFile.equals( defFile ))
+ ParseException.declNotInSameFile( scanner,
+ fullName, firstFile ) ;
+ else {
+ updateSymbolTable( fullName, entry, false ) ;
+
+ List oldRefList ;
+
+ try {
+ oldRefList = (List)oldEntry.dynamicVariable(
+ ftlKey ) ;
+ } catch (NoSuchFieldException exc) {
+ throw new IllegalStateException() ;
+ }
+
+ if (oldRefList != null) {
+ // Update entries in backpatch list
+ Iterator iter = oldRefList.iterator() ;
+ while (iter.hasNext()) {
+ SymtabEntry elem = (SymtabEntry)iter.next() ;
+ elem.type( entry ) ;
+ }
+ }
+ }
+ }
+ } else {
+ ParseException.alreadyDeclared (scanner, fullName);
+ }
+ }
+ } // pigeonhole
+
+ private boolean isForwardable( SymtabEntry oldEntry,
+ SymtabEntry entry )
+ {
+ return ((oldEntry instanceof StructEntry) &&
+ (entry instanceof StructEntry)) ||
+ ((oldEntry instanceof UnionEntry) &&
+ (entry instanceof UnionEntry)) ;
+ }
+
+ // pigeonhole checks to see if this entry is already in the symbol
+ // table and generates an error if it is. Methods must be checked
+ // not only against the symbol table but also against their
+ // interface's parent's methods. This is done in InterfaceEntry.
+ // verifyMethod, so no checking need be done here.
+
+ /**
+ *
+ **/
+ private void pigeonholeMethod (InterfaceEntry container, MethodEntry entry)
+ {
+ if (entry.name ().equals (""))
+ entry.name (unknownNamePrefix + ++sequence);
+
+ // If this object is not in the overrides list, then it is
+ // ok to put it in the table (if it IS in the overrides list,
+ // it is already in the table under a different name).
+ String fullName = entry.fullName ();
+ if (overrideNames.get (fullName) == null)
+ {
+ addToContainer (container, entry);
+ String lcFullName = fullName.toLowerCase ();
+ symbolTable.put (fullName, entry);
+ lcSymbolTable.put (lcFullName, entry);
+ // <d59809> Allow fully-qualified CORBA types to be resolved by mapping
+ // short name (e.g., CORBA/StringValue) to long name, actual name.
+ if (fullName.startsWith ("org/omg/CORBA"))
+ overrideNames.put ("CORBA" + fullName.substring (13), fullName);
+ }
+ } // pigeonholeMethod
+
+ /**
+ *
+ **/
+ private void addToContainer (SymtabEntry container, SymtabEntry contained)
+ {
+ if (container instanceof ModuleEntry)
+ ((ModuleEntry)container).addContained (contained);
+ else if (container instanceof InterfaceEntry)
+ ((InterfaceEntry)container).addContained (contained);
+ else if (container instanceof StructEntry)
+ ((StructEntry)container).addContained (contained);
+ else if (container instanceof UnionEntry)
+ ((UnionEntry)container).addContained (contained);
+ else if (container instanceof SequenceEntry)
+ ((SequenceEntry)container).addContained (contained);
+ } // addToContainer
+
+ // NOTE: qualifiedEntry/partlyQualifiedEntry/unqualifiedEntry and
+ // their court could probably use some performance improvements,
+ // but I'm scared to touch anything. It's the most complex bit of
+ // code in this parser.
+
+ // The qualified named type is searched for in the following order:
+ // 1. OverrideNames
+ // 2. Global scope
+ // 3. Inheritance scope (if container is an interface)
+ // A qualified name is one which begins with :: or is assumed to be
+ // in the global scope (like long, short, etc).
+
+ /**
+ *
+ **/
+ SymtabEntry qualifiedEntry (String typeName)
+ {
+ SymtabEntry type = recursiveQualifiedEntry (typeName);
+ if (type == null)
+ // Then it's not anywhere, report the error.
+ ParseException.undeclaredType (scanner, typeName);
+
+ // <d57110> Relax this retriction when parsing ID pragma directive, e.g..
+ //else if (type instanceof ModuleEntry) {
+ else if (type instanceof ModuleEntry && !_isModuleLegalType)
+ {
+ // Module's are not valid types.
+ ParseException.moduleNotType (scanner, typeName);
+ type = null;
+ }
+ return type;
+ } // qualifiedEntry
+
+ /**
+ *
+ **/
+ SymtabEntry recursiveQualifiedEntry (String typeName)
+ {
+ SymtabEntry type = null;
+ if (typeName != null && !typeName.equals ("void"))
+ {
+ int index = typeName.lastIndexOf ('/');
+ if (index >= 0)
+ {
+ // Figure out if the container of this thing exists, converting any typedefs to interfaces if necessary.
+ type = recursiveQualifiedEntry (typeName.substring (0, index));
+ if (type == null)
+ return null;
+ else if (type instanceof TypedefEntry)
+ typeName = typeOf (type).fullName () + typeName.substring (index);
+ }
+
+ // If we got this far, a container exists, start over looking
+ // for the thing itself (this is the meat of the method):
+ type = searchOverrideNames (typeName);
+ if (type == null)
+ type = (SymtabEntry) symbolTable.get (typeName); // search global scope:
+ if (type == null)
+ type = searchGlobalInheritanceScope (typeName);
+ }
+ return type;
+ } // recursiveQualifiedEntry
+
+ // A partially qualified name is of the form <scope>::<name>.
+ // First the scope is defined (meaning it is fully qualified);
+ // Then the name is searched for in the scope.
+
+ /**
+ *
+ **/
+ SymtabEntry partlyQualifiedEntry (String typeName, SymtabEntry container)
+ {
+ // This is the simple logic of this method:
+ // type = searchModuleScope (typeName.substring (0, typeName.lastIndexOf ('/')), container);
+ // type = qualifiedEntry (type.fullName () + typeName.substring (typeName.lastIndexOf ('/')));
+ // But searchModuleScope only finds the first module that fits.
+ // The name might not be in that module but in one further out
+ // in the module scope. Should others be searched?
+ SymtabEntry type = null;
+ if (typeName != null)
+ {
+ int index = typeName.lastIndexOf ('/');
+
+ // Figure out if the container of this thing exists, converting any
+ // typedefs to interfaces if necessary:
+ type = recursivePQEntry (typeName.substring (0, index), container);
+ if (type instanceof TypedefEntry)
+ typeName = typeOf (type).fullName () + typeName.substring (index);
+
+ // If we got this far, a container exists, start over looking
+ // for the thing itself.
+
+ if (container != null)
+ type = searchModuleScope (typeName.substring (0, typeName.lastIndexOf ('/')), container);
+ if (type == null)
+ type = qualifiedEntry (typeName);
+ else
+ type = qualifiedEntry (type.fullName () + typeName.substring (typeName.lastIndexOf ('/')));
+ }
+ return type;
+ } // partlyQualifiedEntry
+
+ // partlyQualifiedEntry and recursivePQEntry are almost identical.
+ // They are different because when the recursive one is looking for
+ // the existence of containers, the error check for a module type
+ // must not occur (this check is done in qualifiedEntry). Only
+ // when the full partly qualified name is being processed must this
+ // check be performed.
+
+ /**
+ *
+ **/
+ SymtabEntry recursivePQEntry (String typeName, SymtabEntry container)
+ {
+ SymtabEntry type = null;
+ if (typeName != null)
+ {
+ int index = typeName.lastIndexOf ('/');
+ if (index < 0)
+ type = searchModuleScope (typeName, container);
+ else
+ {
+ // Figure out if the container of this thing exists, converting any
+ // typedefs to interfaces if necessary:
+ type = recursivePQEntry (typeName.substring (0, index), container);
+ if (type == null)
+ return null;
+ else if (type instanceof TypedefEntry)
+ typeName = typeOf (type).fullName () + typeName.substring (index);
+
+ // If we got this far, a container exists, start over, looking
+ // for the thing itself (This is the meat of the method):
+ if (container != null)
+ type = searchModuleScope (typeName.substring (0, typeName.lastIndexOf ('/')), container);
+ if (type == null)
+ recursiveQualifiedEntry (typeName);
+ else
+ type = recursiveQualifiedEntry (type.fullName () + typeName.substring (typeName.lastIndexOf ('/')));
+ }
+ }
+ return type;
+ } // recursivePQEntry
+
+ // The named type is searched for in the following order:
+ // 1. Local scope
+ // 2. Inheritance scope
+ // 3. OverrideNames
+ // 4. Module scope
+
+ /**
+ *
+ **/
+ SymtabEntry unqualifiedEntry (String typeName, SymtabEntry container)
+ {
+ SymtabEntry type = unqualifiedEntryWMod (typeName, container);
+
+ // <d57110> Relax this retriction in special cases, e.g., when
+ // parsing a ID pragma directive.
+ //if (type instanceof ModuleEntry) {
+ if (type instanceof ModuleEntry && !_isModuleLegalType)
+ {
+ // Module's are not valid types:
+ ParseException.moduleNotType (scanner, typeName);
+ type = null;
+ }
+ return type;
+ } // unqualifiedEntry
+
+ /**
+ *
+ **/
+ SymtabEntry unqualifiedEntryWMod (String typeName, SymtabEntry container)
+ {
+ SymtabEntry type = null;
+ if ((typeName != null) && !typeName.equals ("void"))
+ {
+ // Search local scope:
+ type = (SymtabEntry)symbolTable.get (container.fullName () + '/' + typeName);
+ if (type == null)
+ type = searchLocalInheritanceScope (typeName, container);
+ if (type == null)
+ type = searchOverrideNames (typeName);
+ if ((type == null) && (container != null))
+ type = searchModuleScope (typeName, container);
+ if (type == null)
+ type = searchParentInheritanceScope (typeName, container);
+ }
+ if (type == null)
+ // Then it's not anywhere, report the error:
+ ParseException.undeclaredType (scanner, typeName);
+ return type;
+ } // unqualifiedEntryWMod
+
+ /**
+ * Walks up the enclosing scopes until it finds an interface type. Then,
+ * searches up that interface inheritance tree for the type definition.
+ *
+ * @param name type name to be searched for.
+ * @param ptype parent type entry.
+ **/
+ SymtabEntry searchParentInheritanceScope(String name, SymtabEntry ptype) {
+
+ String cname = ptype.fullName();
+
+ while ((ptype != null) && !(cname.equals ("")) &&
+ !(ptype instanceof InterfaceEntry)) {
+ int index = cname.lastIndexOf ('/');
+ if (index < 0) {
+ cname = "";
+ } else {
+ cname = cname.substring (0, index);
+ ptype = (SymtabEntry) symbolTable.get(cname);
+ }
+ }
+
+ if ((ptype == null) || !(ptype instanceof InterfaceEntry)) {
+ return null; // could not find an enclosing interface type - give up.
+ }
+
+ // check if the enclosing interface supports the type definition.
+ String fullName = ptype.fullName () + '/' + name;
+ SymtabEntry type = (SymtabEntry) symbolTable.get (fullName);
+ if (type != null) {
+ return type; // found type definition.
+ }
+
+ // search up the interface inheritance tree.
+ return searchLocalInheritanceScope(name, ptype);
+ }
+
+ /**
+ *
+ **/
+ SymtabEntry searchGlobalInheritanceScope (String name)
+ {
+ // See if the container of this named object is an interface:
+ int index = name.lastIndexOf ('/');
+ SymtabEntry entry = null;
+ if (index >= 0)
+ {
+ String containerName = name.substring (0, index);
+ entry = (SymtabEntry)symbolTable.get (containerName);
+ entry = (entry instanceof InterfaceEntry)
+ // It's an interface, now look in its inheritance scope:
+ ? searchLocalInheritanceScope (name.substring (index + 1), entry)
+ : null;
+ }
+ return entry;
+ } // searchGlobalInheritanceScope
+
+ /**
+ *
+ **/
+ SymtabEntry searchLocalInheritanceScope (String name, SymtabEntry container)
+ {
+ return (container instanceof InterfaceEntry)
+ ? searchDerivedFrom (name, (InterfaceEntry) container)
+ : null;
+ } // searchLocalInheritanceScope
+
+ /**
+ *
+ **/
+ SymtabEntry searchOverrideNames (String name)
+ {
+ String overrideName = (String)overrideNames.get (name);
+ return (overrideName != null)
+ ? (SymtabEntry)symbolTable.get (overrideName)
+ : null;
+ } // searchOverrideNames
+
+ /**
+ *
+ **/
+ SymtabEntry searchModuleScope (String name, SymtabEntry container)
+ {
+ String module = container.fullName ();
+ String fullName = module + '/' + name;
+ SymtabEntry type = (SymtabEntry)symbolTable.get (fullName);
+ while ((type == null) && !module.equals (""))
+ {
+ int index = module.lastIndexOf ('/');
+ if (index < 0)
+ module = "";
+ else
+ {
+ module = module.substring (0, index);
+ fullName = module + '/' + name;
+ type = (SymtabEntry)symbolTable.get (fullName);
+ }
+ }
+ return (type == null) ? (SymtabEntry)symbolTable.get (name) : type;
+ } // searchModuleScope
+
+ /**
+ *
+ **/
+ SymtabEntry searchDerivedFrom (String name, InterfaceEntry i)
+ {
+ for (Enumeration e = i.derivedFrom ().elements (); e.hasMoreElements ();)
+ {
+ SymtabEntry tmp = (SymtabEntry)e.nextElement ();
+ if (tmp instanceof InterfaceEntry)
+ {
+ InterfaceEntry parent = (InterfaceEntry)tmp;
+ String fullName = parent.fullName () + '/' + name;
+ SymtabEntry type = (SymtabEntry)symbolTable.get (fullName);
+ if (type != null)
+ return type;
+ type = searchDerivedFrom (name, parent);
+ if (type != null)
+ return type;
+ }
+ // else it is a ForwardEntry and nothing can be done at this point.
+ }
+ return null;
+ } // searchDerivedFrom
+
+ /**
+ *
+ **/
+ String entryName (SymtabEntry entry)
+ {
+ if (entry instanceof AttributeEntry)
+ return "attribute";
+ if (entry instanceof ConstEntry)
+ return "constant";
+ if (entry instanceof EnumEntry)
+ return "enumeration";
+ if (entry instanceof ExceptionEntry)
+ return "exception";
+ if (entry instanceof ValueBoxEntry)
+ return "value box";
+ if (entry instanceof ForwardValueEntry || entry instanceof ValueEntry)
+ return "value";
+ if (entry instanceof ForwardEntry || entry instanceof InterfaceEntry)
+ return "interface";
+ if (entry instanceof MethodEntry)
+ return "method";
+ if (entry instanceof ModuleEntry)
+ return "module";
+ if (entry instanceof ParameterEntry)
+ return "parameter";
+ if (entry instanceof PrimitiveEntry)
+ return "primitive";
+ if (entry instanceof SequenceEntry)
+ return "sequence";
+ if (entry instanceof StringEntry)
+ return "string";
+ if (entry instanceof StructEntry)
+ return "struct";
+ if (entry instanceof TypedefEntry)
+ return "typedef";
+ if (entry instanceof UnionEntry)
+ return "union";
+ return "void";
+ } // entryName
+
+ /**
+ *
+ **/
+ private boolean isInterface (SymtabEntry entry)
+ {
+ return entry instanceof InterfaceEntry || (entry instanceof ForwardEntry
+ && !(entry instanceof ForwardValueEntry)) ;
+ }
+
+ private boolean isValue (SymtabEntry entry)
+ {
+ return entry instanceof ValueEntry ; // || entry instanceof ForwardValueEntry;
+ }
+
+ private boolean isInterfaceOnly (SymtabEntry entry)
+ {
+ return entry instanceof InterfaceEntry ;
+ }
+
+ private boolean isForward(SymtabEntry entry)
+ {
+ return entry instanceof ForwardEntry ;
+ }
+
+ // list must be a vector of Strings.
+ /**
+ *
+ **/
+ private boolean isntInStringList (Vector list, String name)
+ {
+ boolean isnt = true;
+ Enumeration e = list.elements ();
+ while (e.hasMoreElements ())
+ if (name.equals ((String)e.nextElement ()))
+ {
+ ParseException.alreadyDeclared (scanner, name);
+ isnt = false;
+ break;
+ }
+ return isnt;
+ } // isntInStringList
+
+ // list must be a vector of SymtabEntry's.
+ /**
+ *
+ **/
+ private boolean isntInList (Vector list, String name)
+ {
+ boolean isnt = true;
+ for (Enumeration e = list.elements (); e.hasMoreElements ();)
+ if (name.equals (((SymtabEntry)e.nextElement ()).name ()))
+ {
+ ParseException.alreadyDeclared (scanner, name);
+ isnt = false;
+ break;
+ }
+ return isnt;
+ } // isntInList
+
+ // list must be a vector of SymtabEntry's.
+ /**
+ *
+ **/
+ private boolean isntInList (Vector list, SymtabEntry entry)
+ {
+ boolean isnt = true;
+ for (Enumeration e = list.elements (); e.hasMoreElements ();)
+ {
+ SymtabEntry eEntry = (SymtabEntry)e.nextElement ();
+ if (entry == eEntry) // && entry.fullName().equals (eEntry.fullName()))
+ {
+ ParseException.alreadyDeclared (scanner, entry.fullName ());
+ isnt = false;
+ break;
+ }
+ }
+ return isnt;
+ } // isntInList
+
+ /**
+ *
+ **/
+ public static SymtabEntry typeOf (SymtabEntry entry)
+ {
+ while (entry instanceof TypedefEntry)
+ entry = entry.type ();
+ return entry;
+ } // typeOf
+
+ /**
+ *
+ **/
+ void forwardEntryCheck ()
+ {
+ for (Enumeration e = symbolTable.elements (); e.hasMoreElements ();)
+ {
+ SymtabEntry entry = (SymtabEntry)e.nextElement ();
+ if (entry instanceof ForwardEntry)
+ ParseException.forwardEntry (scanner, entry.fullName ());
+ }
+ } // forwardEntryCheck
+
+ // <46082.03> Revert to "IDL:"-style (i.e., regular) repository ID.
+ /*
+ void updateRepositoryIds () {
+ for (Enumeration e = symbolTable.elements(); e.hasMoreElements();) {
+ SymtabEntry entry = (SymtabEntry) e.nextElement();
+ if (entry instanceof ValueEntry)
+ ((ValueEntry) entry).calcRepId();
+ }
+ } // updateRepositoryIds
+ */
+
+ ////////////////////
+ // Error Handling Methods
+
+ // A syntax error occurred. Skip until a semicolon is encountered.
+ // Ignore semicolons within {...} blocks
+ /**
+ *
+ **/
+ private void skipToSemicolon () throws IOException
+ {
+ while (!token.equals (Token.EOF) && !token.equals (Token.Semicolon))
+ {
+ if (token.equals (Token.LeftBrace))
+ skipToRightBrace();
+ try
+ {
+ match (token.type);
+ }
+ catch (ParseException exception)
+ {
+ // The error has already been reported...
+ }
+ }
+ if (token.equals (Token.EOF))
+ throw new EOFException ();
+ try
+ {
+ match (Token.Semicolon);
+ }
+ catch (Exception exception)
+ {
+ }
+ } // skipToSemicolon
+
+ /**
+ *
+ **/
+ private void skipToRightBrace () throws IOException
+ {
+ boolean firstTime = true;
+ while (!token.equals (Token.EOF) && !token.equals (Token.RightBrace))
+ {
+ if (firstTime)
+ firstTime = false;
+ else if (token.equals (Token.LeftBrace))
+ skipToRightBrace ();
+ try
+ {
+ match (token.type);
+ }
+ catch (ParseException exception)
+ {
+ // The error has already been reported...
+ }
+ }
+ if (token.equals (Token.EOF))
+ throw new EOFException();
+ } // skipToRightBrace
+
+ // Error Handling Methods
+ ////////////////////
+
+ // <d56351> In CORBA 2.3, an IDL file provides a new scope for Repository IDs.
+ // The following methods provide a means for other classes in the framework
+ // to manage this scoping (see Preprocessor and Scanner).
+
+ // public static int nPush = 0;
+ // public static int nPop = 0;
+
+ /**
+ *
+ **/
+ public static void enteringInclude ()
+ {
+ repIDStack.push (new IDLID ());
+ } // enteringInclude
+
+ /**
+ *
+ **/
+ public static void exitingInclude ()
+ {
+ repIDStack.pop ();
+ } // exitingInclude
+
+
+ public static final String unknownNamePrefix = "uN__";
+
+ static Hashtable symbolTable;
+ Hashtable lcSymbolTable = new Hashtable ();
+ static Hashtable overrideNames;
+ Vector emitList = new Vector ();
+ boolean emitAll;
+ // <f46082.46.01>
+ boolean cppModule;
+ // <d62023>
+ boolean noWarn;
+ Scanner scanner;
+ // <f46082.40> No longer necessary due to new valueElement() algorithm.
+ // Stack tokenStack = new Stack();
+ Hashtable symbols;
+ Vector macros = new Vector ();
+ Vector paths;
+
+ // Only needed for the pragma directive
+ SymtabEntry currentModule = null;
+
+ // <d56351> Static field necessary to allow Scanner access to enterind/exiting
+ // Include() methods. Must reset in Compile class, too!
+ // Stack repIDStack = new Stack ();
+ static Stack repIDStack = new Stack ();
+
+ // Dynamic variable key used for forward type lists.
+ // A struct or union X entry may have this attached,
+ // which always contains a List<SymtabEntry>.
+ // The elements are entries E such that E.type() == X.
+ // This list must be resolved in pigeonhole when the
+ // type is finally defined. This is similar to
+ // ForwardEntry.replaceForwardDecl.
+ private static int ftlKey = SymtabEntry.getVariableKey() ;
+
+ int sequence = 0;
+ Vector includes;
+ Vector includeEntries;
+
+ // Only needed in primaryExpr. Set in Preprocessor.booleanConstExpr.
+ boolean parsingConditionalExpr = false;
+
+ Token token;
+ ModuleEntry topLevelModule;
+ private Preprocessor prep;
+ private boolean verbose;
+ SymtabFactory stFactory;
+ ExprFactory exprFactory;
+ private String[] keywords;
+ // <f46082.51> Remove -stateful feature.
+ //private boolean parseStateful = false;
+
+ // Circular buffer containing most recent tokens, including the current token.
+ private TokenBuffer tokenHistory = new TokenBuffer ();
+ protected float corbaLevel; // <f60858.1>
+ private Arguments arguments;
+
+} // class Parser
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaEntry.java
new file mode 100644
index 0000000..f0f3aa2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaEntry.java
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+/**
+ * This is the symbol table entry for the #pragma statement.
+ **/
+public class PragmaEntry extends SymtabEntry
+{
+ protected PragmaEntry ()
+ {
+ super ();
+ repositoryID (Util.emptyID);
+ } // ctor
+
+ protected PragmaEntry (SymtabEntry that)
+ {
+ super (that, new IDLID ());
+ module (that.name ());
+ name ("");
+ } // ctor
+
+ protected PragmaEntry (PragmaEntry that)
+ {
+ super (that);
+ } // ctor
+
+ public Object clone ()
+ {
+ return new PragmaEntry (this);
+ } // clone
+
+ /** Invoke the Include type generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ pragmaGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the Include type generator.
+ @return an object which implements the IncludeGen interface.
+ @see IncludeGen */
+ public Generator generator ()
+ {
+ return pragmaGen;
+ } // generator
+
+ public String data ()
+ {
+ return _data;
+ } // data
+
+ public void data (String newData)
+ {
+ _data = newData;
+ } // data
+
+ static PragmaGen pragmaGen;
+
+ private String _data = null;
+} // class PragmaEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaGen.java
new file mode 100644
index 0000000..12c46f5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface PragmaGen extends Generator
+{
+ void generate (Hashtable symbolTable, PragmaEntry entry, PrintWriter stream);
+} // interface PragmaGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaHandler.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaHandler.java
new file mode 100644
index 0000000..0af3af5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PragmaHandler.java
@@ -0,0 +1,148 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// - Add openScope and closeScope.
+
+import java.io.IOException;
+
+public abstract class PragmaHandler
+{
+ public abstract boolean process (String pragma, String currentToken) throws IOException;
+
+ void init (Preprocessor p)
+ {
+ preprocessor = p;
+ } // init
+
+ // Utility methods.
+
+ /** Get the current token. */
+ protected String currentToken ()
+ {
+ return preprocessor.currentToken ();
+ } // currentToken
+
+ /** This method, given an entry name, returns the entry with that name.
+ It can take fully or partially qualified names and returns the
+ appropriate entry defined within the current scope. If no entry
+ exists, null is returned. */
+ protected SymtabEntry getEntryForName (String string)
+ {
+ return preprocessor.getEntryForName (string);
+ } // getEntryForName
+
+ /** This method returns a string of all of the characters from the input
+ file from the current position up to, but not including, the end-of-line
+ character(s). */
+ protected String getStringToEOL () throws IOException
+ {
+ return preprocessor.getStringToEOL ();
+ } // getStringToEOL
+
+ /** This method returns a string of all of the characters from the input
+ file from the current position up to, but not including, the given
+ character. It encapsulates parenthesis and quoted strings, meaning
+ it does not stop if the given character is found within parentheses
+ or quotes. For instance, given the input of `start(inside)end',
+ getUntil ('n') will return "start(inside)e" */
+ protected String getUntil (char c) throws IOException
+ {
+ return preprocessor.getUntil (c);
+ } // getUntil
+
+ /** This method returns the next token String from the input file. */
+ protected String nextToken () throws IOException
+ {
+ return preprocessor.nextToken ();
+ } // nextToken
+
+ /** This method assumes that the current token marks the beginning
+ of a scoped name. It then parses the subsequent identifier and
+ double colon tokens, builds the scoped name, and finds the symbol
+ table entry with that name. */
+ protected SymtabEntry scopedName () throws IOException
+ {
+ return preprocessor.scopedName ();
+ } // scopedName
+
+ /** Skip to the end of the line. */
+ protected void skipToEOL () throws IOException
+ {
+ preprocessor.skipToEOL ();
+ } // skipToEOL
+
+ /** This method skips the data in the input file until the specified
+ character is encountered, then it returns the next token. */
+ protected String skipUntil (char c) throws IOException
+ {
+ return preprocessor.skipUntil (c);
+ } // skipUntil
+
+ /** This method displays a Parser Exception complete with line number
+ and position information with the given message string. */
+ protected void parseException (String message)
+ {
+ preprocessor.parseException (message);
+ } // parseException
+
+ /** This method is called when the parser encounters a left curly brace.
+ An extender of PragmaHandler may find scope information useful.
+ For example, the prefix pragma takes effect as soon as it is
+ encountered and stays in effect until the current scope is closed.
+ If a similar pragma extension is desired, then the openScope and
+ closeScope methods are available for overriding.
+ @param entry the symbol table entry whose scope has just been opened.
+ Be aware that, since the scope has just been entered, this entry is
+ incomplete at this point. */
+ protected void openScope (SymtabEntry entry)
+ {
+ } // openScope
+
+ /** This method is called when the parser encounters a right curly brace.
+ An extender of PragmaHandler may find scope information useful.
+ For example, the prefix pragma takes effect as soon as it is
+ encountered and stays in effect until the current scope is closed.
+ If a similar pragma extension is desired, then the openScope and
+ closeScope methods are available for overriding.
+ @param entry the symbol table entry whose scope has just been closed. */
+ protected void closeScope (SymtabEntry entry)
+ {
+ } // closeScope
+
+ private Preprocessor preprocessor = null;
+} // class PragmaHandler
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Preprocessor.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Preprocessor.java
new file mode 100644
index 0000000..a75b59e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Preprocessor.java
@@ -0,0 +1,1431 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -D57110<daz> Allow ID pragma directive to be applied to modules and update
+// feature in accordance to CORBA 2.3.
+// -D59165<daz> Enable escaped identifiers when processing pragmas.
+// -f60858.1<daz> Support -corba option, level = 2.2: Accept identifiers that
+// collide with keywords, in letter but not case, and issue a warning.
+// -d62023 <daz> support -noWarn option; suppress inappropriate warnings when
+// parsing IBM-specific pragmas (#meta <interface_name> abstract).
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.math.BigInteger;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Stack;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.RepositoryID;
+
+import com.sun.tools.corba.se.idl.constExpr.*;
+
+/**
+ * This class should be extended if new pragmas are desired. If the
+ * preprocessor encounters a pragma name which it doesn't recognize
+ * (anything other than ID, prefix, or version), it calls the method
+ * otherPragmas. This is the only method which need be overridden.
+ * The Preprocessor base class has a number of utility-like methods
+ * which can be used by the overridden otherPragmas method.
+ **/
+public class Preprocessor
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ Preprocessor ()
+ {
+ } // ctor
+
+ /**
+ *
+ **/
+ void init (Parser p)
+ {
+ parser = p;
+ symbols = p.symbols;
+ macros = p.macros;
+ } // init
+
+ /**
+ *
+ **/
+ protected Object clone ()
+ {
+ return new Preprocessor ();
+ } // clone
+
+ /**
+ *
+ **/
+ Token process (Token t) throws IOException, ParseException
+ {
+ token = t;
+ scanner = parser.scanner;
+ // <f46082.40> Deactivate escaped identifier processing in Scanner while
+ // preprocessing.
+ //scanner.underscoreOK = true;
+ scanner.escapedOK = false;
+ try
+ {
+ switch (token.type)
+ {
+ case Token.Include:
+ include ();
+ break;
+ case Token.If:
+ ifClause ();
+ break;
+ case Token.Ifdef:
+ ifdef (false);
+ break;
+ case Token.Ifndef:
+ ifdef (true);
+ break;
+ case Token.Else:
+ if (alreadyProcessedABranch.empty ())
+ throw ParseException.elseNoIf (scanner);
+ else if (((Boolean)alreadyProcessedABranch.peek ()).booleanValue ())
+ skipToEndif ();
+ else
+ {
+ alreadyProcessedABranch.pop ();
+ alreadyProcessedABranch.push (new Boolean (true));
+ token = scanner.getToken ();
+ }
+ break;
+ case Token.Elif:
+ elif ();
+ break;
+ case Token.Endif:
+ if (alreadyProcessedABranch.empty ())
+ throw ParseException.endNoIf (scanner);
+ else
+ {
+ alreadyProcessedABranch.pop ();
+ token = scanner.getToken ();
+ break;
+ }
+ case Token.Define:
+ define ();
+ break;
+ case Token.Undef:
+ undefine ();
+ break;
+ case Token.Pragma:
+ pragma ();
+ break;
+ case Token.Unknown:
+ if (!parser.noWarn)
+ ParseException.warning (scanner, Util.getMessage ("Preprocessor.unknown", token.name));
+ case Token.Error:
+ case Token.Line:
+ case Token.Null:
+ // ignore
+ default:
+ scanner.skipLineComment ();
+ token = scanner.getToken ();
+ }
+ }
+ catch (IOException e)
+ {
+ // <f46082.40> Underscore may now precede any identifier, so underscoreOK
+ // is vestigal. The Preprocessor must reset escapedOK so that Scanner
+ // will process escaped identifiers according to specification.
+ //scanner.underscoreOK = false;
+ scanner.escapedOK = true;
+ throw e;
+ }
+ catch (ParseException e)
+ {
+ // <f46082.40> See above.
+ //scanner.underscoreOK = false;
+ scanner.escapedOK = true;
+ throw e;
+ }
+ // <f46082.40> See above.
+ //scanner.underscoreOK = false;
+ scanner.escapedOK = true;
+ return token;
+ } // process
+
+ /**
+ *
+ **/
+ private void include () throws IOException, ParseException
+ {
+ match (Token.Include);
+ IncludeEntry include = parser.stFactory.includeEntry (parser.currentModule);
+ include.sourceFile (scanner.fileEntry ());
+ scanner.fileEntry ().addInclude (include);
+ if (token.type == Token.StringLiteral)
+ include2 (include);
+ else if (token.type == Token.LessThan)
+ include3 (include);
+ else
+ {
+ int[] expected = {Token.StringLiteral, Token.LessThan};
+ throw ParseException.syntaxError (scanner, expected, token.type);
+ }
+ if (parser.currentModule instanceof ModuleEntry)
+ ((ModuleEntry)parser.currentModule).addContained (include);
+ else if (parser.currentModule instanceof InterfaceEntry)
+ ((InterfaceEntry)parser.currentModule).addContained (include);
+ } // include
+
+ /**
+ *
+ **/
+ private void include2 (IncludeEntry include) throws IOException, ParseException
+ {
+ include.name ('"' + token.name + '"');
+ include4 (include, token.name);
+ match (Token.StringLiteral);
+ } // include2
+
+ /**
+ *
+ **/
+ private void include3 (IncludeEntry include) throws IOException, ParseException
+ {
+ if (token.type != Token.LessThan)
+ // match will throw an exception
+ match (Token.LessThan);
+ else
+ {
+ try
+ {
+ String includeFile = getUntil ('>');
+ token = scanner.getToken ();
+ include.name ('<' + includeFile + '>');
+ include4 (include, includeFile);
+ match (Token.GreaterThan);
+ }
+ catch (IOException e)
+ {
+ throw ParseException.syntaxError (scanner, ">", "EOF");
+ }
+ }
+ } // include3
+
+ /**
+ *
+ **/
+ private void include4 (IncludeEntry include, String filename) throws IOException, ParseException
+ {
+ try
+ {
+ // If the #include is at the global scope, it is treated as
+ // an import statement. If it is within some other scope, it
+ // is treated as a normal #include.
+ boolean includeIsImport = parser.currentModule == parser.topLevelModule;
+ //daz
+ include.absFilename (Util.getAbsolutePath (filename, parser.paths));
+ scanner.scanIncludedFile (include, getFilename (filename), includeIsImport);
+ }
+ catch (IOException e)
+ {
+ ParseException.generic (scanner, e.toString ());
+ }
+ } // include4
+
+ /**
+ *
+ **/
+ private void define () throws IOException, ParseException
+ {
+ match (Token.Define);
+ if (token.equals (Token.Identifier))
+ {
+ String symbol = scanner.getStringToEOL ();
+ symbols.put (token.name, symbol.trim ());
+ match (Token.Identifier);
+ }
+ else if (token.equals (Token.MacroIdentifier))
+ {
+ symbols.put (token.name, '(' + scanner.getStringToEOL () . trim ());
+ macros.addElement (token.name);
+ match (Token.MacroIdentifier);
+ }
+ else
+ throw ParseException.syntaxError (scanner, Token.Identifier, token.type);
+ } // define
+
+ /**
+ *
+ **/
+ private void undefine () throws IOException, ParseException
+ {
+ match (Token.Undef);
+ if (token.equals (Token.Identifier))
+ {
+ symbols.remove (token.name);
+ macros.removeElement (token.name);
+ match (Token.Identifier);
+ }
+ else
+ throw ParseException.syntaxError (scanner, Token.Identifier, token.type);
+ } // undefine
+
+ /**
+ *
+ **/
+ private void ifClause () throws IOException, ParseException
+ {
+ match (Token.If);
+ constExpr ();
+ } // ifClause
+
+ /**
+ *
+ **/
+ private void constExpr () throws IOException, ParseException
+ {
+ SymtabEntry dummyEntry = new SymtabEntry (parser.currentModule);
+ dummyEntry.container (parser.currentModule);
+ parser.parsingConditionalExpr = true;
+ Expression boolExpr = booleanConstExpr (dummyEntry);
+ parser.parsingConditionalExpr = false;
+ boolean expr;
+ if (boolExpr.value () instanceof Boolean)
+ expr = ((Boolean)boolExpr.value ()).booleanValue ();
+ else
+ expr = ((Number)boolExpr.value ()).longValue () != 0;
+ alreadyProcessedABranch.push (new Boolean (expr));
+ if (!expr)
+ skipToEndiforElse ();
+ } // constExpr
+
+ /**
+ *
+ **/
+ Expression booleanConstExpr (SymtabEntry entry) throws IOException, ParseException
+ {
+ Expression expr = orExpr (null, entry);
+ try
+ {
+ expr.evaluate ();
+ }
+ catch (EvaluationException e)
+ {
+ ParseException.evaluationError (scanner, e.toString ());
+ }
+ return expr;
+ } // booleanConstExpr
+
+ /**
+ *
+ **/
+ private Expression orExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
+ {
+ if (e == null)
+ e = andExpr (null, entry);
+ else
+ {
+ BinaryExpr b = (BinaryExpr)e;
+ b.right (andExpr (null, entry));
+ e.rep (e.rep () + b.right ().rep ());
+ }
+ if (token.equals (Token.DoubleBar))
+ {
+ match (token.type);
+ BooleanOr or = parser.exprFactory.booleanOr (e, null);
+ or.rep (e.rep () + " || ");
+ return orExpr (or, entry);
+ }
+ else
+ return e;
+ } // orExpr
+
+ /**
+ *
+ **/
+ private Expression andExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
+ {
+ if (e == null)
+ e = notExpr (entry);
+ else
+ {
+ BinaryExpr b = (BinaryExpr)e;
+ b.right (notExpr (entry));
+ e.rep (e.rep () + b.right ().rep ());
+ }
+ if (token.equals (Token.DoubleAmpersand))
+ {
+ match (token.type);
+ BooleanAnd and = parser.exprFactory.booleanAnd (e, null);
+ and.rep (e.rep () + " && ");
+ return andExpr (and, entry);
+ }
+ else
+ return e;
+ } // andExpr
+
+ /**
+ *
+ **/
+ private Expression notExpr (/*boolean alreadySawExclamation, */SymtabEntry entry) throws IOException, ParseException
+ {
+ Expression e;
+ if (token.equals (Token.Exclamation))
+ {
+ match (Token.Exclamation);
+ e = parser.exprFactory.booleanNot (definedExpr (entry));
+ e.rep ("!" + ((BooleanNot)e).operand ().rep ());
+ }
+ else
+ e = definedExpr (entry);
+ return e;
+ } // notExpr
+
+ /**
+ *
+ **/
+ private Expression definedExpr (SymtabEntry entry) throws IOException, ParseException
+ {
+ if (token.equals (Token.Identifier) && token.name.equals ("defined"))
+ match (Token.Identifier);
+ return equalityExpr (null, entry);
+ } // definedExpr
+
+ /**
+ *
+ **/
+ private Expression equalityExpr (Expression e, SymtabEntry entry) throws IOException, ParseException
+ {
+ if (e == null)
+ {
+ parser.token = token; // Since parser to parse, give it this token
+ e = parser.constExp (entry);
+ token = parser.token; // Since parser last parsed, get its token
+ }
+ else
+ {
+ BinaryExpr b = (BinaryExpr)e;
+ parser.token = token; // Since parser to parse, give it this token
+ Expression constExpr = parser.constExp (entry);
+ token = parser.token; // Since parser last parsed, get its token
+ b.right (constExpr);
+ e.rep (e.rep () + b.right ().rep ());
+ }
+ if (token.equals (Token.DoubleEqual))
+ {
+ match (token.type);
+ Equal eq = parser.exprFactory.equal (e, null);
+ eq.rep (e.rep () + " == ");
+ return equalityExpr (eq, entry);
+ }
+ else if (token.equals (Token.NotEqual))
+ {
+ match (token.type);
+ NotEqual n = parser.exprFactory.notEqual (e, null);
+ n.rep (e.rep () + " != ");
+ return equalityExpr (n, entry);
+ }
+ else if (token.equals (Token.GreaterThan))
+ {
+ match (token.type);
+ GreaterThan g = parser.exprFactory.greaterThan (e, null);
+ g.rep (e.rep () + " > ");
+ return equalityExpr (g, entry);
+ }
+ else if (token.equals (Token.GreaterEqual))
+ {
+ match (token.type);
+ GreaterEqual g = parser.exprFactory.greaterEqual (e, null);
+ g.rep (e.rep () + " >= ");
+ return equalityExpr (g, entry);
+ }
+ else if (token.equals (Token.LessThan))
+ {
+ match (token.type);
+ LessThan l = parser.exprFactory.lessThan (e, null);
+ l.rep (e.rep () + " < ");
+ return equalityExpr (l, entry);
+ }
+ else if (token.equals (Token.LessEqual))
+ {
+ match (token.type);
+ LessEqual l = parser.exprFactory.lessEqual (e, null);
+ l.rep (e.rep () + " <= ");
+ return equalityExpr (l, entry);
+ }
+ else
+ return e;
+ } // equalityExpr
+
+ /**
+ *
+ **/
+ Expression primaryExpr (SymtabEntry entry) throws IOException, ParseException
+ {
+ Expression primary = null;
+ switch (token.type)
+ {
+ case Token.Identifier:
+ // If an identifier gets this far, it means that no
+ // preprocessor variable was defined with that name.
+ // Generate a FALSE boolean expr.
+ //daz primary = parser.exprFactory.terminal ("0", new Long (0));
+ primary = parser.exprFactory.terminal ("0", BigInteger.valueOf (0));
+ token = scanner.getToken ();
+ break;
+ case Token.BooleanLiteral:
+ case Token.CharacterLiteral:
+ case Token.IntegerLiteral:
+ case Token.FloatingPointLiteral:
+ case Token.StringLiteral:
+ //daz primary = parser.literal ();
+ primary = parser.literal (entry);
+ token = parser.token;
+ break;
+ case Token.LeftParen:
+ match (Token.LeftParen);
+ primary = booleanConstExpr (entry);
+ match (Token.RightParen);
+ primary.rep ('(' + primary.rep () + ')');
+ break;
+ default:
+ int[] expected = {Token.Literal, Token.LeftParen};
+ throw ParseException.syntaxError (scanner, expected, token.type);
+ }
+ return primary;
+ } // primaryExpr
+
+ /**
+ *
+ **/
+ private void ifDefine (boolean inParens, boolean not) throws IOException, ParseException
+ {
+ if (token.equals (Token.Identifier))
+ if ((not && symbols.containsKey (token.name)) || (!not && !symbols.containsKey (token.name)))
+ {
+ alreadyProcessedABranch.push (new Boolean (false));
+ skipToEndiforElse ();
+ }
+ else
+ {
+ alreadyProcessedABranch.push (new Boolean (true));
+ match (Token.Identifier);
+ if (inParens)
+ match (Token.RightParen);
+ }
+ else
+ throw ParseException.syntaxError (scanner, Token.Identifier, token.type);
+ } // ifDefine
+
+ /**
+ *
+ **/
+ private void ifdef (boolean not) throws IOException, ParseException
+ {
+ if (not)
+ match (Token.Ifndef);
+ else
+ match (Token.Ifdef);
+ if (token.equals (Token.Identifier))
+ if ((not && symbols.containsKey (token.name)) || (!not && !symbols.containsKey (token.name)))
+ {
+ alreadyProcessedABranch.push (new Boolean (false));
+ skipToEndiforElse ();
+ }
+ else
+ {
+ alreadyProcessedABranch.push (new Boolean (true));
+ match (Token.Identifier);
+ }
+ else
+ throw ParseException.syntaxError (scanner, Token.Identifier, token.type);
+ } // ifdef
+
+ /**
+ *
+ **/
+ private void elif () throws IOException, ParseException
+ {
+ if (alreadyProcessedABranch.empty ())
+ throw ParseException.elseNoIf (scanner);
+ else if (((Boolean)alreadyProcessedABranch.peek ()).booleanValue ())
+ skipToEndif ();
+ else
+ {
+ match (Token.Elif);
+ constExpr ();
+ }
+ } // elif
+
+ /**
+ *
+ **/
+ private void skipToEndiforElse () throws IOException, ParseException
+ {
+ while (!token.equals (Token.Endif) && !token.equals (Token.Else) && !token.equals (Token.Elif))
+ {
+ if (token.equals (Token.Ifdef) || token.equals (Token.Ifndef))
+ {
+ alreadyProcessedABranch.push (new Boolean (true));
+ skipToEndif ();
+ }
+ else
+ token = scanner.skipUntil ('#');
+ }
+ process (token);
+ } // skipToEndiforElse
+
+ /**
+ *
+ **/
+ private void skipToEndif () throws IOException, ParseException
+ {
+ while (!token.equals (Token.Endif))
+ {
+ token = scanner.skipUntil ('#');
+ if (token.equals (Token.Ifdef) || token.equals (Token.Ifndef))
+ {
+ alreadyProcessedABranch.push (new Boolean (true));
+ skipToEndif ();
+ }
+ }
+ alreadyProcessedABranch.pop ();
+ match (Token.Endif);
+ } // skipToEndif
+
+ ///////////////
+ // For Pragma
+
+ /**
+ *
+ **/
+ private void pragma () throws IOException, ParseException
+ {
+ match (Token.Pragma);
+ String pragmaType = token.name;
+
+ // <d59165> Enable escaped identifiers while processing pragma internals.
+ // Don't enable until scanning pragma name!
+ scanner.escapedOK = true;
+ match (Token.Identifier);
+
+ // Add pragma entry to container
+ PragmaEntry pragmaEntry = parser.stFactory.pragmaEntry (parser.currentModule);
+ pragmaEntry.name (pragmaType);
+ pragmaEntry.sourceFile (scanner.fileEntry ());
+ pragmaEntry.data (scanner.currentLine ());
+ if (parser.currentModule instanceof ModuleEntry)
+ ((ModuleEntry)parser.currentModule).addContained (pragmaEntry);
+ else if (parser.currentModule instanceof InterfaceEntry)
+ ((InterfaceEntry)parser.currentModule).addContained (pragmaEntry);
+
+ // If the token was an identifier, then pragmaType WILL be non-null.
+ if (pragmaType.equals ("ID"))
+ idPragma ();
+ else if (pragmaType.equals ("prefix"))
+ prefixPragma ();
+ else if (pragmaType.equals ("version"))
+ versionPragma ();
+
+ // we are adding extensions to the Sun's idlj compiler to
+ // handle correct code generation for local Objects, where
+ // the OMG is taking a long time to formalize stuff. Good
+ // example of this is poa.idl. Two proprietory pragmas
+ // sun_local and sun_localservant are defined. sun_local
+ // generates only Holder and Helper classes, where read
+ // and write methods throw marshal exceptions. sun_localservant
+ // is to generate Helper, Holder, and only Skel with _invoke
+ // throwing an exception, since it does not make sense for
+ // local objects.
+
+ else if (pragmaType.equals ("sun_local"))
+ localPragma();
+ else if (pragmaType.equals ("sun_localservant"))
+ localServantPragma();
+ else
+ {
+ otherPragmas (pragmaType, tokenToString ());
+ token = scanner.getToken ();
+ }
+
+ scanner.escapedOK = false; // <d59165> Disable escaped identifiers.
+ } // pragma
+
+ // <d57110> Pragma ID can be appiled to modules and it is an error to
+ // name a type in more than one ID pragma directive.
+
+ private Vector PragmaIDs = new Vector ();
+
+ private void localPragma () throws IOException, ParseException
+ {
+ // Before I can use a parser method, I must make sure it has the current token.
+ parser.token = token;
+ // this makes sense only for interfaces, if specified for modules,
+ // parser should throw an error
+ SymtabEntry anErrorOccurred = new SymtabEntry ();
+ SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred);
+ // Was the indicated type found in the symbol table?
+ if (entry == anErrorOccurred)
+ {
+ System.out.println("Error occured ");
+ // Don't have to generate an error, scopedName already has.
+ scanner.skipLineComment ();
+ token = scanner.getToken ();
+ }
+ else
+ {
+ // by this time we have already parsed the ModuleName and the
+ // pragma type, therefore setInterfaceType
+ if (entry instanceof InterfaceEntry) {
+ InterfaceEntry ent = (InterfaceEntry) entry;
+ ent.setInterfaceType (InterfaceEntry.LOCAL_SIGNATURE_ONLY);
+ }
+ token = parser.token;
+ String string = token.name;
+ match (Token.StringLiteral);
+ // for non-interfaces it doesn't make sense, so just ignore it
+ }
+ } // localPragma
+
+ private void localServantPragma () throws IOException, ParseException
+ {
+ // Before I can use a parser method, I must make sure it has the current token.
+ parser.token = token;
+ // this makes sense only for interfaces, if specified for modules,
+ // parser should throw an error
+ SymtabEntry anErrorOccurred = new SymtabEntry ();
+ SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred);
+
+ // Was the indicated type found in the symbol table?
+ if (entry == anErrorOccurred)
+ {
+ // Don't have to generate an error, scopedName already has.
+ scanner.skipLineComment ();
+ token = scanner.getToken ();
+ System.out.println("Error occured ");
+ }
+ else
+ {
+ // by this time we have already parsed the ModuleName and the
+ // pragma type, therefore setInterfaceType
+ if (entry instanceof InterfaceEntry) {
+ InterfaceEntry ent = (InterfaceEntry) entry;
+ ent.setInterfaceType (InterfaceEntry.LOCALSERVANT);
+ }
+ token = parser.token;
+ String string = token.name;
+ match (Token.StringLiteral);
+ // for non-interfaces it doesn't make sense, so just ignore it
+ }
+ } // localServantPragma
+
+
+ /**
+ *
+ **/
+ private void idPragma () throws IOException, ParseException
+ {
+ // Before I can use a parser method, I must make sure it has the current token.
+ parser.token = token;
+
+ // <d57110> This flag will relax the restriction that the scopedNamed
+ // in this ID pragma directive cannot resolve to a module.
+ parser.isModuleLegalType (true);
+ SymtabEntry anErrorOccurred = new SymtabEntry ();
+ SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred);
+ parser.isModuleLegalType (false); // <57110>
+
+ // Was the indicated type found in the symbol table?
+ if (entry == anErrorOccurred)
+ {
+ // Don't have to generate an error, scopedName already has.
+ scanner.skipLineComment ();
+ token = scanner.getToken ();
+ }
+ // <d57110>
+ //else if (PragmaIDs.contains (entry))
+ //{
+ // ParseException.badRepIDAlreadyAssigned (scanner, entry.name ());
+ // scanner.skipLineComment ();
+ // token = scanner.getToken ();
+ //}
+ else
+ {
+ token = parser.token;
+ String string = token.name;
+ // Do not match token until after raise exceptions, otherwise
+ // incorrect messages will be emitted!
+ if (PragmaIDs.contains (entry)) // <d57110>
+ {
+ ParseException.badRepIDAlreadyAssigned (scanner, entry.name ());
+ }
+ else if (!RepositoryID.hasValidForm (string)) // <d57110>
+ {
+ ParseException.badRepIDForm (scanner, string);
+ }
+ else
+ {
+ entry.repositoryID (new RepositoryID (string));
+ PragmaIDs.addElement (entry); // <d57110>
+ }
+ match (Token.StringLiteral);
+ }
+ } // idPragma
+
+ /**
+ *
+ **/
+ private void prefixPragma () throws IOException, ParseException
+ {
+ String string = token.name;
+ match (Token.StringLiteral);
+ ((IDLID)parser.repIDStack.peek ()).prefix (string);
+ ((IDLID)parser.repIDStack.peek ()).name ("");
+ } // prefixPragma
+
+ /**
+ *
+ **/
+ private void versionPragma () throws IOException, ParseException
+ {
+ // Before I can use a parser method, I must make sure it has the current token.
+ parser.token = token;
+ // This flag will relax the restriction that the scopedNamed
+ // in this Version pragma directive cannot resolve to a module.
+ parser.isModuleLegalType (true);
+ SymtabEntry anErrorOccurred = new SymtabEntry ();
+ SymtabEntry entry = parser.scopedName (parser.currentModule, anErrorOccurred);
+ // reset the flag to original value
+ parser.isModuleLegalType (false);
+ if (entry == anErrorOccurred)
+ {
+ // Don't have to generate an error, scopedName already has.
+ scanner.skipLineComment ();
+ token = scanner.getToken ();
+ }
+ else
+ {
+ token = parser.token;
+ String string = token.name;
+ match (Token.FloatingPointLiteral);
+ if (entry.repositoryID () instanceof IDLID)
+ ((IDLID)entry.repositoryID ()).version (string);
+ }
+ } // versionPragma
+
+ private Vector pragmaHandlers = new Vector ();
+
+ /**
+ *
+ **/
+ void registerPragma (PragmaHandler handler)
+ {
+ pragmaHandlers.addElement (handler);
+ } // registerPragma
+
+ /**
+ *
+ **/
+ private void otherPragmas (String pragmaType, String currentToken) throws IOException
+ {
+ for (int i = pragmaHandlers.size () - 1; i >= 0; --i)
+ {
+ PragmaHandler handler = (PragmaHandler)pragmaHandlers.elementAt (i);
+ if (handler.process (pragmaType, currentToken))
+ break;
+ }
+ } // otherPragmas
+
+ /*
+ * These protected methods are used by extenders, by the code
+ * which implements otherPragma.
+ */
+
+ /**
+ * Get the current token.
+ **/
+ String currentToken ()
+ {
+ return tokenToString ();
+ } // currentToken
+
+ /**
+ * This method, given an entry name, returns the entry with that name.
+ * It can take fully or partially qualified names and returns the
+ * appropriate entry defined within the current scope. If no entry
+ * exists, null is returned.
+ **/
+ SymtabEntry getEntryForName (String string)
+ {
+ boolean partialScope = false;
+ boolean globalScope = false;
+
+ // Change all ::'s to /'s
+ if (string.startsWith ("::"))
+ {
+ globalScope = true;
+ string = string.substring (2);
+ }
+ int index = string.indexOf ("::");
+ while (index >= 0)
+ {
+ partialScope = true;
+ string = string.substring (0, index) + '/' + string.substring (index + 2);
+ index = string.indexOf ("::");
+ }
+
+ // Get the entry for that string
+ SymtabEntry entry = null;
+ if (globalScope)
+ entry = parser.recursiveQualifiedEntry (string);
+ else if (partialScope)
+ entry = parser.recursivePQEntry (string, parser.currentModule);
+ else
+ entry = parser.unqualifiedEntryWMod (string, parser.currentModule);
+ return entry;
+ } // getEntryForName
+
+ /**
+ * This method returns a string of all of the characters from the
+ * input file from the current position up to, but not including,
+ * the end-of-line character(s).
+ **/
+ String getStringToEOL () throws IOException
+ {
+ return scanner.getStringToEOL ();
+ } // getStringToEOL
+
+ /**
+ * This method returns a string of all of the characters from the
+ * input file from the current position up to, but not including,
+ * the given character. It encapsulates parenthesis and quoted strings,
+ * meaning it does not stop if the given character is found within
+ * parentheses or quotes. For instance, given the input of
+ * `start(inside)end', getUntil ('n') will return "start(inside)e"
+ **/
+ String getUntil (char c) throws IOException
+ {
+ return scanner.getUntil (c);
+ } // getUntil
+
+ private boolean lastWasMacroID = false;
+
+ /**
+ *
+ **/
+ private String tokenToString ()
+ {
+ if (token.equals (Token.MacroIdentifier))
+ {
+ lastWasMacroID = true;
+ return token.name;
+ }
+ else if (token.equals (Token.Identifier))
+ return token.name;
+ else
+ return token.toString ();
+ } // tokenToString
+
+ /**
+ * This method returns the next token String from the input file.
+ **/
+ String nextToken () throws IOException
+ {
+ if (lastWasMacroID)
+ {
+ lastWasMacroID = false;
+ return "(";
+ }
+ else
+ {
+ token = scanner.getToken ();
+ return tokenToString ();
+ }
+ } // nextToken
+
+ /**
+ * This method assumes that the current token marks the beginning
+ * of a scoped name. It then parses the subsequent identifier and
+ * double colon tokens, builds the scoped name, and finds the symbol
+ * table entry with that name.
+ **/
+ SymtabEntry scopedName () throws IOException
+ {
+ boolean globalScope = false;
+ boolean partialScope = false;
+ String name = null;
+ SymtabEntry entry = null;
+ try
+ {
+ if (token.equals (Token.DoubleColon))
+ globalScope = true;
+ else
+ {
+ if (token.equals (Token.Object))
+ {
+ name = "Object";
+ match (Token.Object);
+ }
+ else if (token.type == Token.ValueBase)
+ {
+ name = "ValueBase";
+ match (Token.ValueBase);
+ }
+ else
+ {
+ name = token.name;
+ match (Token.Identifier);
+ }
+ }
+ while (token.equals (Token.DoubleColon))
+ {
+ match (Token.DoubleColon);
+ partialScope = true;
+ if (name != null)
+ name = name + '/' + token.name;
+ else
+ name = token.name;
+ match (Token.Identifier);
+ }
+ if (globalScope)
+ entry = parser.recursiveQualifiedEntry (name);
+ else if (partialScope)
+ entry = parser.recursivePQEntry (name, parser.currentModule);
+ else
+ entry = parser.unqualifiedEntryWMod (name, parser.currentModule);
+ }
+ catch (ParseException e)
+ {
+ entry = null;
+ }
+ return entry;
+ } // scopedName
+
+ /**
+ * Skip to the end of the line.
+ **/
+ void skipToEOL () throws IOException
+ {
+ scanner.skipLineComment ();
+ } // skipToEOL
+
+ /**
+ * This method skips the data in the input file until the specified
+ * character is encountered, then it returns the next token.
+ **/
+ String skipUntil (char c) throws IOException
+ {
+ if (!(lastWasMacroID && c == '('))
+ token = scanner.skipUntil (c);
+ return tokenToString ();
+ } // skipUntil
+
+ /**
+ * This method displays a Parser Exception complete with line number
+ * and position information with the given message string.
+ **/
+ void parseException (String message)
+ {
+ // <d62023> Suppress warnings
+ if (!parser.noWarn)
+ ParseException.warning (scanner, message);
+ } // parseException
+
+ // For Pragma
+ ///////////////
+ // For macro expansion
+
+ /**
+ *
+ **/
+ String expandMacro (String macroDef, Token t) throws IOException, ParseException
+ {
+ token = t;
+ // Get the parameter values from the macro 'call'
+ Vector parmValues = getParmValues ();
+
+ // Get the parameter names from the macro definition
+ // NOTE: a newline character is appended here so that when
+ // getStringToEOL is called, it stops scanning at the end
+ // of this string.
+ scanner.scanString (macroDef + '\n');
+ Vector parmNames = new Vector ();
+ macro (parmNames);
+
+ if (parmValues.size () < parmNames.size ())
+ throw ParseException.syntaxError (scanner, Token.Comma, Token.RightParen);
+ else if (parmValues.size () > parmNames.size ())
+ throw ParseException.syntaxError (scanner, Token.RightParen, Token.Comma);
+
+ macroDef = scanner.getStringToEOL ();
+ for (int i = 0; i < parmNames.size (); ++i)
+ macroDef = replaceAll (macroDef, (String)parmNames.elementAt (i), (String)parmValues.elementAt (i));
+ return removeDoublePound (macroDef);
+ } // expandMacro
+
+ // This method is only used by the macro expansion methods.
+ /**
+ *
+ **/
+ private void miniMatch (int type) throws ParseException
+ {
+ // A normal production would now execute:
+ // match (type);
+ // But match reads the next token. I don't want to do that now.
+ // Just make sure the current token is a 'type'.
+ if (!token.equals (type))
+ throw ParseException.syntaxError (scanner, type, token.type);
+ } // miniMatch
+
+ /**
+ *
+ **/
+ private Vector getParmValues () throws IOException, ParseException
+ {
+ Vector values = new Vector ();
+ if (token.equals (Token.Identifier))
+ {
+ match (Token.Identifier);
+ miniMatch (Token.LeftParen);
+ }
+ else if (!token.equals (Token.MacroIdentifier))
+ throw ParseException.syntaxError (scanner, Token.Identifier, token.type);
+
+ if (!token.equals (Token.RightParen))
+ {
+ values.addElement (scanner.getUntil (',', ')').trim ());
+ token = scanner.getToken ();
+ macroParmValues (values);
+ }
+ return values;
+ } // getParmValues
+
+ /**
+ *
+ **/
+ private void macroParmValues (Vector values) throws IOException, ParseException
+ {
+ while (!token.equals (Token.RightParen))
+ {
+ miniMatch (Token.Comma);
+ values.addElement (scanner.getUntil (',', ')').trim ());
+ token = scanner.getToken ();
+ }
+ } // macroParmValues
+
+ /**
+ *
+ **/
+ private void macro (Vector parmNames) throws IOException, ParseException
+ {
+ match (token.type);
+ match (Token.LeftParen);
+ macroParms (parmNames);
+ miniMatch (Token.RightParen);
+ } // macro
+
+ /**
+ *
+ **/
+ private void macroParms (Vector parmNames) throws IOException, ParseException
+ {
+ if (!token.equals (Token.RightParen))
+ {
+ parmNames.addElement (token.name);
+ match (Token.Identifier);
+ macroParms2 (parmNames);
+ }
+ } // macroParms
+
+ /**
+ *
+ **/
+ private void macroParms2 (Vector parmNames) throws IOException, ParseException
+ {
+ while (!token.equals (Token.RightParen))
+ {
+ match (Token.Comma);
+ parmNames.addElement (token.name);
+ match (Token.Identifier);
+ }
+ } // macroParms2
+
+ /**
+ *
+ **/
+ private String replaceAll (String string, String from, String to)
+ {
+ int index = 0;
+ while (index != -1)
+ {
+ index = string.indexOf (from, index);
+ if (index != -1)
+ {
+ if (!embedded (string, index, index + from.length ()))
+ if (index > 0 && string.charAt(index) == '#')
+ string = string.substring (0, index) + '"' + to + '"' + string.substring (index + from.length ());
+ else
+ string = string.substring (0, index) + to + string.substring (index + from.length ());
+ index += to.length ();
+ }
+ }
+ return string;
+ } // replaceAll
+
+ /**
+ *
+ **/
+ private boolean embedded (String string, int index, int endIndex)
+ {
+ // Don't replace if found substring is not an independent id.
+ // For example, don't replace "thither".indexOf ("it", 0)
+ boolean ret = false;
+ char preCh = index == 0 ? ' ' : string.charAt (index - 1);
+ char postCh = endIndex >= string.length () - 1 ? ' ' : string.charAt (endIndex);
+ if ((preCh >= 'a' && preCh <= 'z') || (preCh >= 'A' && preCh <= 'Z'))
+ ret = true;
+ else if ((postCh >= 'a' && postCh <= 'z') || (postCh >= 'A' && postCh <= 'Z') || (postCh >= '0' && postCh <= '9') || postCh == '_')
+ ret = true;
+ else
+ ret = inQuotes (string, index);
+ return ret;
+ } // embedded
+
+ /**
+ *
+ **/
+ private boolean inQuotes (String string, int index)
+ {
+ int quoteCount = 0;
+ for (int i = 0; i < index; ++i)
+ if (string.charAt (i) == '"') ++quoteCount;
+ // If there are an odd number of quotes before this region,
+ // then this region is within quotes
+ return quoteCount % 2 != 0;
+ } // inQuotes
+
+ /**
+ * Remove any occurrences of ##.
+ **/
+ private String removeDoublePound (String string)
+ {
+ int index = 0;
+ while (index != -1)
+ {
+ index = string.indexOf ("##", index);
+ if (index != -1)
+ {
+ int startSkip = index - 1;
+ int stopSkip = index + 2;
+ if (startSkip < 0)
+ startSkip = 0;
+ if (stopSkip >= string.length ())
+ stopSkip = string.length () - 1;
+ while (startSkip > 0 &&
+ (string.charAt (startSkip) == ' ' ||
+ string.charAt (startSkip) == '\t'))
+ --startSkip;
+ while (stopSkip < string.length () - 1 &&
+ (string.charAt (stopSkip) == ' ' ||
+ string.charAt (stopSkip) == '\t'))
+ ++stopSkip;
+ string = string.substring (0, startSkip + 1) + string.substring (stopSkip);
+ }
+ }
+ return string;
+ } // removeDoublePound
+
+ // For macro expansion
+ ///////////////
+
+ /**
+ *
+ **/
+ private String getFilename (String name) throws FileNotFoundException
+ {
+ String fullName = null;
+ File file = new File (name);
+ if (file.canRead ())
+ fullName = name;
+ else
+ {
+ Enumeration pathList = parser.paths.elements ();
+ while (!file.canRead () && pathList.hasMoreElements ())
+ {
+ fullName = (String)pathList.nextElement () + File.separatorChar + name;
+ file = new File (fullName);
+ }
+ if (!file.canRead ())
+ throw new FileNotFoundException (name);
+ }
+ return fullName;
+ } // getFilename
+
+ /**
+ *
+ **/
+ private void match (int type) throws IOException, ParseException
+ {
+ if (!token.equals (type))
+ throw ParseException.syntaxError (scanner, type, token.type);
+ token = scanner.getToken ();
+
+ // <d62023> Added for convenience, but commented-out because there is
+ // no reason to issue warnings for tokens scanned during preprocessing.
+ // See issueTokenWarnings().
+ //issueTokenWarnings ();
+
+ //System.out.println ("Preprocessor.match token = " + token.type);
+ //if (token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier))
+ // System.out.println ("Preprocessor.match token name = " + token.name);
+
+ // If the token is a defined thingy, scan the defined string
+ // instead of the input stream for a while.
+ if (token.equals (Token.Identifier) || token.equals (Token.MacroIdentifier))
+ {
+ String string = (String)symbols.get (token.name);
+ if (string != null && !string.equals (""))
+ // If this is a macro, parse the macro
+ if (macros.contains (token.name))
+ {
+ scanner.scanString (expandMacro (string, token));
+ token = scanner.getToken ();
+ }
+ // else this is just a normal define
+ else
+ {
+ scanner.scanString (string);
+ token = scanner.getToken ();
+ }
+ }
+ } // match
+
+ // <d62023>
+ /**
+ * Issue warnings about tokens scanned during preprocessing.
+ **/
+ private void issueTokenWarnings ()
+ {
+ if (parser.noWarn)
+ return;
+
+ // There are no keywords defined for preprocessing (only directives), so:
+ //
+ // 1.) Do not issue warnings for identifiers known to be keywords in
+ // another level of IDL.
+ // 2.) Do not issue warnings for identifiers that collide with keywords
+ // in letter, but not case.
+ // 3.) Do not issue warnings for deprecated keywords.
+ //
+ // Should we warn when a macro identifier replaces a keyword? Hmmm.
+
+ // Deprecated directives? None to date.
+ //if (token.isDirective () && token.isDeprecated ())
+ // ParseException.warning (scanner, Util.getMesage ("Deprecated.directive", token.name));
+ } // issueTokenWarnings
+
+ /**
+ * This method is called when the parser encounters a left curly brace.
+ * An extender of PragmaHandler may find scope information useful.
+ * For example, the prefix pragma takes effect as soon as it is
+ * encountered and stays in effect until the current scope is closed.
+ * If a similar pragma extension is desired, then the openScope and
+ * closeScope methods are available for overriding.
+ * @param entry the symbol table entry whose scope has just been opened.
+ * Be aware that, since the scope has just been entered, this entry is
+ * incomplete at this point.
+ **/
+ void openScope (SymtabEntry entry)
+ {
+ for (int i = pragmaHandlers.size () - 1; i >= 0; --i)
+ {
+ PragmaHandler handler = (PragmaHandler)pragmaHandlers.elementAt (i);
+ handler.openScope (entry);
+ }
+ } // openScope
+
+ /**
+ * This method is called when the parser encounters a right curly brace.
+ * An extender of PragmaHandler may find scope information useful.
+ * For example, the prefix pragma takes effect as soon as it is
+ * encountered and stays in effect until the current scope is closed.
+ * If a similar pragma extension is desired, then the openScope and
+ * closeScope methods are available for overriding.
+ * @param entry the symbol table entry whose scope has just been closed.
+ **/
+ void closeScope (SymtabEntry entry)
+ {
+ for (int i = pragmaHandlers.size () - 1; i >= 0; --i)
+ {
+ PragmaHandler handler = (PragmaHandler)pragmaHandlers.elementAt (i);
+ handler.closeScope (entry);
+ }
+ } // closeScope
+
+ private Parser parser;
+ private Scanner scanner;
+ private Hashtable symbols;
+ private Vector macros;
+
+ // The logic associated with this stack is scattered above.
+ // A concise map of the logic is:
+ // case #if false, #ifdef false, #ifndef true
+ // push (false);
+ // skipToEndifOrElse ();
+ // case #if true, #ifdef true, #ifndef false
+ // push (true);
+ // case #elif <conditional>
+ // if (top == true)
+ // skipToEndif ();
+ // else if (conditional == true)
+ // pop ();
+ // push (true);
+ // else if (conditional == false)
+ // skipToEndifOrElse ();
+ // case #else
+ // if (top == true)
+ // skipToEndif ();
+ // else
+ // pop ();
+ // push (true);
+ // case #endif
+ // pop ();
+ private Stack alreadyProcessedABranch = new Stack ();
+ Token token;
+
+ private static String indent = "";
+}
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PrimitiveEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PrimitiveEntry.java
new file mode 100644
index 0000000..0bbaadc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PrimitiveEntry.java
@@ -0,0 +1,92 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+/**
+ * This is the symbol table entry for primitive types: octet, char,
+ * short, long, long long (and unsigned versions), float, double, string.
+ **/
+public class PrimitiveEntry extends SymtabEntry
+{
+ protected PrimitiveEntry ()
+ {
+ super ();
+ repositoryID (Util.emptyID);
+ } // ctor
+
+ protected PrimitiveEntry (String name)
+ {
+ name (name);
+ module ("");
+ repositoryID (Util.emptyID);
+ } // ctor
+
+ protected PrimitiveEntry (PrimitiveEntry that)
+ {
+ super (that);
+ } // ctor
+
+ public Object clone ()
+ {
+ return new PrimitiveEntry (this);
+ } // clone
+
+ /** Invoke the primitive type generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ primitiveGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the primitive type generator.
+ @return an object which implements the PrimitiveGen interface.
+ @see PrimitiveGen */
+ public Generator generator ()
+ {
+ return primitiveGen;
+ } // generator
+
+ static PrimitiveGen primitiveGen;
+} // class PrimitiveEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PrimitiveGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PrimitiveGen.java
new file mode 100644
index 0000000..601cddc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/PrimitiveGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface PrimitiveGen extends Generator
+{
+ void generate (Hashtable symbolTable, PrimitiveEntry entry, PrintWriter stream);
+} // interface PrimitiveGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/RepositoryID.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/RepositoryID.java
new file mode 100644
index 0000000..7282ab0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/RepositoryID.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -D57110<daz> Add method to verify format (CORBA 2.3).
+
+public class RepositoryID
+{
+ public RepositoryID ()
+ {
+ _id = "";
+ } // ctor
+
+ public RepositoryID (String id)
+ {
+ _id = id;
+ } // ctor
+
+ public String ID ()
+ {
+ return _id;
+ } // ID
+
+ public Object clone ()
+ {
+ return new RepositoryID (_id);
+ } // clone
+
+ public String toString ()
+ {
+ return ID ();
+ } // toString
+
+ /**
+ * Determine is a supplied string meets the minimal format requirement
+ * for a Repository ID.
+ * @return true if supplied string has form {@code '<format>:<string>'}, where
+ * {@code <format>} is any non-empty string not containing ':'.
+ **/
+ public static boolean hasValidForm (String string)
+ {
+ return string != null && string.indexOf (':') > 0;
+ } // hasValidForm
+
+ private String _id;
+} // class RepositoryID
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ResourceBundleUtil.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ResourceBundleUtil.java
new file mode 100644
index 0000000..9a39cbf
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ResourceBundleUtil.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -capitalize and parseTypeModifier should probably be in the
+// generators package.
+// -D58319<daz> Add version() method.
+
+import java.util.ResourceBundle;
+import java.text.MessageFormat;
+import java.util.Hashtable;
+
+public class ResourceBundleUtil
+{
+ // <d58319>
+ /**
+ * Fetch the version number of this build of the IDL Parser Framework.
+ * This method may be called before or after the framework has been
+ * initialized. If the framework is inititialized, the version information
+ * is extracted from the message properties object; otherwise, it is extracted
+ * from the indicated resouce bundle.
+ * @return the version number.
+ **/
+ public static String getVersion ()
+ {
+ String version = getMessage ("Version.product", getMessage ("Version.number"));
+ return version;
+ } // getVersion
+
+
+ //////////////
+ // Message-related methods
+
+ public static String getMessage (String key)
+ {
+ return fBundle.getString(key);
+ } // getMessage
+
+ public static String getMessage (String key, String fill)
+ {
+ Object[] args = { fill };
+ return MessageFormat.format(fBundle.getString(key), args);
+ } // getMessage
+
+ public static String getMessage (String key, String[] fill)
+ {
+ return MessageFormat.format(fBundle.getString(key), fill);
+ } // getMessage
+
+
+ /** Register a ResourceBundle. This file will be searched for
+ in the CLASSPATH. */
+ public static void registerResourceBundle (ResourceBundle bundle)
+ {
+ if (bundle != null)
+ fBundle = bundle;
+ } // registerResourceBundle
+
+
+ /** Gets the current ResourceBundle. */
+ public static ResourceBundle getResourceBundle ()
+ {
+ return fBundle;
+ } // getResourceBundle
+
+ private static ResourceBundle fBundle;
+ static
+ {
+ // get the resource bundle for the locale on this machine
+ fBundle = ResourceBundle.getBundle("com.sun.tools.corba.se.idl.idl");
+ }
+
+} // class ResourceBundleUtil
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Scanner.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Scanner.java
new file mode 100644
index 0000000..e1e23e1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Scanner.java
@@ -0,0 +1,1615 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -F46082.51<daz> Remove -stateful feature.
+// -D56351<daz> Update computation of RepositoryIDs to CORBA 2.3 (see spec.).
+// -D59166<daz> Add escaped-id. info. to identifiers.
+// -F60858.1<daz> Add support for -corba option, levels 2.2 and 2.3: accept 2.3
+// keywords as ids.; accept ids. that match keywords in letter, but not in case.
+// -D62023<daz> Add support for -corba option, level 2.4: see keyword checking.
+
+import java.io.EOFException;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PushbackInputStream;
+
+import java.util.Enumeration;
+import java.util.Stack;
+import java.util.StringTokenizer;
+import java.util.Vector;
+
+/**
+ *
+ **/
+class Scanner
+{
+ // <f46082.51> -Remove stateful feature.
+ //Scanner (IncludeEntry file, String[] keywords, boolean vbose, boolean scanStateful, boolean emitAllIncludes) throws IOException
+ // <f60858.1>
+ //Scanner (IncludeEntry file, String[] keywords, boolean vbose, boolean emitAllIncludes) throws IOException
+ /**
+ *
+ **/
+ Scanner (IncludeEntry file, String[] keywords, boolean vbose,
+ boolean emitAllIncludes, float cLevel, boolean debug) throws IOException
+ {
+ readFile (file);
+ verbose = vbose;
+ // <f46082.51>
+ //stateful = scanStateful;
+ emitAll = emitAllIncludes;
+ sortKeywords (keywords);
+ corbaLevel = cLevel;
+ this.debug = debug ;
+ } // ctor
+
+ /**
+ *
+ **/
+ void sortKeywords (String[] keywords)
+ {
+ for (int i = 0; i < keywords.length; ++i)
+ if (wildcardAtEitherEnd (keywords[i]))
+ this.openEndedKeywords.addElement (keywords[i]);
+ else if (wildcardsInside (keywords[i]))
+ this.wildcardKeywords.addElement (keywords[i]);
+ else
+ this.keywords.addElement (keywords[i]);
+ } // sortKeywords
+
+ /**
+ *
+ **/
+ private boolean wildcardAtEitherEnd (String string)
+ {
+ return string.startsWith ("*") ||
+ string.startsWith ("+") ||
+ string.startsWith (".") ||
+ string.endsWith ("*") ||
+ string.endsWith ("+") ||
+ string.endsWith (".");
+ } // wildcardAtEitherEnd
+
+ /**
+ *
+ **/
+ private boolean wildcardsInside (String string)
+ {
+ return string.indexOf ("*") > 0 ||
+ string.indexOf ("+") > 0 ||
+ string.indexOf (".") > 0;
+ } // wildcardsInside
+
+ /**
+ *
+ **/
+ void readFile (IncludeEntry file) throws IOException
+ {
+ String filename = file.name ();
+ filename = filename.substring (1, filename.length () - 1);
+ readFile (file, filename);
+ } // readFile
+
+ /**
+ *
+ **/
+ void readFile (IncludeEntry file, String filename) throws IOException
+ {
+ data.fileEntry = file;
+ data.filename = filename;
+ // <f49747.1>
+ //FileInputStream stream = new FileInputStream (data.filename);
+ //data.fileBytes = new byte [stream.available ()];
+ //stream.read (data.fileBytes);
+ //stream.close (); <ajb>
+ File idlFile = new File (data.filename);
+ int len = (int)idlFile.length ();
+ FileReader fileReader = new FileReader (idlFile);
+ // <d41679> data.fileBytes = new char [len];
+ final String EOL = System.getProperty ("line.separator");
+ data.fileBytes = new char [len + EOL.length ()];
+
+ fileReader.read (data.fileBytes, 0, len);
+ fileReader.close ();
+
+ // <d41679>
+ for (int i = 0; i < EOL.length (); i++)
+ data.fileBytes[len + i] = EOL.charAt (i);
+
+ readChar ();
+ } // readFile
+
+ /**
+ *
+ **/
+ Token getToken () throws IOException
+ {
+ //System.out.println ("Scanner.getToken char = |" + data.ch + "| (ASCII " + (int)data.ch + ").");
+
+ // The token could be null if the next set of characters
+ // is not a token: white space, comments, ignored preprocessor
+ // commands.
+ Token token = null;
+ String commentText = new String ("");
+
+ while (token == null)
+ try
+ {
+ data.oldIndex = data.fileIndex;
+ data.oldLine = data.line;
+ if (data.ch <= ' ') {
+ skipWhiteSpace ();
+ continue;
+ }
+
+ // Special case for wchar and wstring literals.
+ // The values are preceded by an L.
+ //
+ // Bug fix 4382578: Can't compile a wchar literal.
+ //
+ // REVISIT. This maps wchar/wstring literals to
+ // our char/string literal types. Eventually, we
+ // need to write stronger checking to be spec
+ // compliant in negative cases such as leaving the
+ // L off of a wide string or putting it on a string.
+ if (data.ch == 'L') {
+ // Check to see if the next character is an
+ // apostrophe.
+ readChar();
+ // Note: This doesn't allow for space between
+ // the L and the apostrophe or quote.
+ if (data.ch == '\'') {
+ // It was a wchar literal. Get the value
+ // and return the token.
+ token = getCharacterToken(true);
+ readChar();
+ continue;
+ } else
+ if (data.ch == '"') {
+ // It was a wstring literal.
+ //
+ // getUntil assumes we've already passed the
+ // first quote.
+ readChar ();
+ token = new Token (Token.StringLiteral, getUntil ('"'), true);
+ readChar ();
+ continue;
+ } else {
+ // It must not have been a wchar literal.
+ // Push the input back into the buffer, and
+ // fall to the next if case.
+ unread(data.ch);
+ unread('L');
+ readChar();
+ }
+ }
+
+ if ((data.ch >= 'a' && data.ch <= 'z') ||
+ (data.ch >= 'A' && data.ch <= 'Z') ||
+ // <f46082.40> Escaped identifier; see data member comments.
+ //(data.ch == '_' && underscoreOK) || <daz>
+ (data.ch == '_') ||
+ Character.isLetter (data.ch)) {
+ token = getString ();
+ } else
+ if ((data.ch >= '0' && data.ch <= '9') || data.ch == '.') {
+ token = getNumber ();
+ } else {
+ switch (data.ch)
+ {
+ case ';':
+ token = new Token (Token.Semicolon);
+ break;
+ case '{':
+ token = new Token (Token.LeftBrace);
+ break;
+ case '}':
+ token = new Token (Token.RightBrace);
+ break;
+ case ':':
+ readChar ();
+ if (data.ch == ':')
+ token = new Token (Token.DoubleColon);
+ else
+ {
+ unread (data.ch);
+ token = new Token (Token.Colon);
+ }
+ break;
+ case ',':
+ token = new Token (Token.Comma);
+ break;
+ case '=':
+ readChar ();
+ if (data.ch == '=')
+ token = new Token (Token.DoubleEqual);
+ else
+ {
+ unread (data.ch);
+ token = new Token (Token.Equal);
+ }
+ break;
+ case '+':
+ token = new Token (Token.Plus);
+ break;
+ case '-':
+ token = new Token (Token.Minus);
+ break;
+ case '(':
+ token = new Token (Token.LeftParen);
+ break;
+ case ')':
+ token = new Token (Token.RightParen);
+ break;
+ case '<':
+ readChar ();
+ if (data.ch == '<')
+ token = new Token (Token.ShiftLeft);
+ else if (data.ch == '=')
+ token = new Token (Token.LessEqual);
+ else
+ {
+ unread (data.ch);
+ token = new Token (Token.LessThan);
+ }
+ break;
+ case '>':
+ readChar ();
+ if (data.ch == '>')
+ token = new Token (Token.ShiftRight);
+ else if (data.ch == '=')
+ token = new Token (Token.GreaterEqual);
+ else
+ {
+ unread (data.ch);
+ token = new Token (Token.GreaterThan);
+ }
+ break;
+ case '[':
+ token = new Token (Token.LeftBracket);
+ break;
+ case ']':
+ token = new Token (Token.RightBracket);
+ break;
+ case '\'':
+ token = getCharacterToken(false);
+ break;
+ case '"':
+ readChar ();
+ token = new Token (Token.StringLiteral, getUntil ('"', false, false, false));
+ break;
+ case '\\':
+ readChar ();
+ // If this is at the end of a line, then it is the
+ // line continuation character - treat it as white space
+ if (data.ch == '\n' || data.ch == '\r')
+ token = null;
+ else
+ token = new Token (Token.Backslash);
+ break;
+ case '|':
+ readChar ();
+ if (data.ch == '|')
+ token = new Token (Token.DoubleBar);
+ else
+ {
+ unread (data.ch);
+ token = new Token (Token.Bar);
+ }
+ break;
+ case '^':
+ token = new Token (Token.Carat);
+ break;
+ case '&':
+ readChar ();
+ if (data.ch == '&')
+ token = new Token (Token.DoubleAmpersand);
+ else
+ {
+ unread (data.ch);
+ token = new Token (Token.Ampersand);
+ }
+ break;
+ case '*':
+ token = new Token (Token.Star);
+ break;
+ case '/':
+ readChar ();
+ // <21jul1997daz> Extract comments rather than skipping them.
+ // Preserve only the comment immediately preceding the next token.
+ if (data.ch == '/')
+ //skipLineComment ();
+ commentText = getLineComment();
+ else if (data.ch == '*')
+ //skipBlockComment ();
+ commentText = getBlockComment();
+ else
+ {
+ unread (data.ch);
+ token = new Token (Token.Slash);
+ }
+ break;
+ case '%':
+ token = new Token (Token.Percent);
+ break;
+ case '~':
+ token = new Token (Token.Tilde);
+ break;
+
+ // The period token is recognized in getNumber.
+ // The period is only valid in a floating ponit number.
+ //case '.':
+ // token = new Token (Token.Period);
+ // break;
+
+ case '#':
+ token = getDirective ();
+ break;
+ case '!':
+ readChar ();
+ if (data.ch == '=')
+ token = new Token (Token.NotEqual);
+ else
+ {
+ unread (data.ch);
+ token = new Token (Token.Exclamation);
+ }
+ break;
+ case '?':
+ try
+ {
+ token = replaceTrigraph ();
+ break;
+ }
+ catch (InvalidCharacter e) {}
+ default:
+ throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
+ }
+ readChar ();
+ }
+ }
+ catch (EOFException e)
+ {
+ token = new Token (Token.EOF);
+ }
+
+ // Transfer comment to parser via token. <daz>21jul1997
+ token.comment = new Comment( commentText );
+
+ //System.out.println ("Scanner.getToken returning token.type = " + token.type);
+ //if (token.type == Token.Identifier || token.type == Token.MacroIdentifier || (token.type >= Token.BooleanLiteral && token.type <= Token.StringLiteral))
+ // System.out.println ("Scanner.getToken returns token.name = " + token.name);
+
+ if (debug)
+ System.out.println( "Token: " + token ) ;
+
+ return token;
+ } // getToken
+
+ /**
+ *
+ **/
+ void scanString (String string)
+ {
+ dataStack.push (data);
+
+ data = new ScannerData (data);
+
+ data.fileIndex = 0;
+ data.oldIndex = 0;
+ // <f49747.1> data.fileBytes = string.getBytes (); <ajb>
+ int strLen = string.length();
+ data.fileBytes = new char[strLen];
+ string.getChars (0, strLen, data.fileBytes, 0);
+
+ data.macrodata = true;
+
+ try {readChar ();} catch (IOException e) {}
+ } // scanString
+
+ /**
+ *
+ **/
+ void scanIncludedFile (IncludeEntry file, String filename, boolean includeIsImport) throws IOException
+ {
+ dataStack.push (data);
+ data = new ScannerData ();
+ data.indent = ((ScannerData)dataStack.peek ()).indent + ' ';
+ data.includeIsImport = includeIsImport;
+ try
+ {
+ readFile (file, filename);
+ if (!emitAll && includeIsImport)
+ SymtabEntry.enteringInclude ();
+ // <d56351> As of CORBA 2.3, include files define new scope for Repository
+ // ID prefixes. The previous Rep. ID is just below the top of the stack and
+ // must be restored when the contents of this include file are parsed (see readCh()).
+ Parser.enteringInclude ();
+
+ if (verbose)
+ System.out.println (data.indent + Util.getMessage ("Compile.parsing", filename));
+ }
+ catch (IOException e)
+ {
+ data = (ScannerData)dataStack.pop ();
+ throw e;
+ }
+ } // scanIncludedFile
+
+ /**
+ *
+ **/
+ private void unread (char ch)
+ {
+ if (ch == '\n' && !data.macrodata) --data.line;
+ --data.fileIndex;
+ } // unread
+
+ /**
+ *
+ **/
+ void readChar () throws IOException
+ {
+ if (data.fileIndex >= data.fileBytes.length)
+ if (dataStack.empty ())
+ throw new EOFException ();
+ else
+ {
+ // <d56351> Indicate end-of-scope for include file to parser.
+ //Parser.exitingInclude ();
+
+ // IBM.11666 - begin
+ //if (!emitAll && data.includeIsImport && !data.macrodata)
+ //{
+ //SymtabEntry.exitingInclude ();
+ //Parser.exitingInclude (); // <d59469>
+ //}
+ if (!data.macrodata)
+ {
+ if (!emitAll && data.includeIsImport)
+ SymtabEntry.exitingInclude();
+ Parser.exitingInclude();
+ } // IBM.11666 - end
+
+ if (verbose && !data.macrodata)
+ System.out.println (data.indent + Util.getMessage ("Compile.parseDone", data.filename));
+ data = (ScannerData)dataStack.pop ();
+ }
+ else
+ {
+ data.ch = (char)(data.fileBytes[data.fileIndex++] & 0x00ff);
+ if (data.ch == '\n' && !data.macrodata) ++data.line;
+ }
+ } // readChar
+
+ /**
+ * Starting at a quote, reads a string with possible
+ * unicode or octal values until an end quote. Doesn't
+ * handle line feeds or comments.
+ */
+ private String getWString() throws IOException
+ {
+ readChar();
+ StringBuffer result = new StringBuffer();
+
+ while (data.ch != '"') {
+ if (data.ch == '\\') {
+ // Could be a \ooo octal or
+ // unicode hex
+ readChar();
+ if (data.ch == 'u') {
+ // Unicode hex
+ int num = getNDigitHexNumber(4);
+ System.out.println("Got num: " + num);
+ System.out.println("Which is: " + (int)(char)num);
+ result.append((char)num);
+ // result.append((char)getNDigitHexNumber(4));
+ // getNDigitHexNumber reads the next
+ // character, so loop without reading another
+ continue;
+ } else
+ if (data.ch >= '0' && data.ch <= '7') {
+ // Octal
+ result.append((char)get3DigitOctalNumber());
+ // get3DigitOctalNumber reads the next
+ // character, so loop without reading another
+ continue;
+ } else {
+ // Wasn't either, so just append the
+ // slash and current character.
+ result.append('\\');
+ result.append(data.ch);
+ }
+ } else {
+ // Just append the character
+ result.append(data.ch);
+ }
+
+ // Advance to the next character
+ readChar();
+ }
+
+ return result.toString();
+ }
+
+ /**
+ *
+ **/
+ private Token getCharacterToken(boolean isWide) throws IOException
+ {
+ // The token name returned contains a string with two elements:
+ // first the character appears, then the representation of the
+ // character. These are typically the same, but they CAN be
+ // different, for example "O\117"
+ Token token = null;
+ readChar ();
+ if ( data.ch == '\\' )
+ {
+ readChar ();
+ if ((data.ch == 'x') || (data.ch == 'u'))
+ {
+ char charType = data.ch;
+ int hexNum = getNDigitHexNumber ((charType == 'x') ? 2 : 4);
+ return new Token (Token.CharacterLiteral,
+ ((char)hexNum) + "\\" + charType + Integer.toString (hexNum, 16), isWide );
+ }
+ if ((data.ch >= '0') && (data.ch <= '7'))
+ {
+ int octNum = get3DigitOctalNumber ();
+ return new Token (Token.CharacterLiteral,
+ ((char)octNum) + "\\" + Integer.toString (octNum, 8), isWide );
+ }
+ return singleCharEscapeSequence (isWide);
+ }
+ token = new Token (Token.CharacterLiteral, "" + data.ch + data.ch, isWide );
+ readChar ();
+ return token;
+ } // getCharacterToken
+
+ /**
+ *
+ **/
+ private Token singleCharEscapeSequence (boolean isWide) throws IOException
+ {
+ Token token;
+ if (data.ch == 'n')
+ // newline
+ token = new Token (Token.CharacterLiteral, "\n\\n", isWide);
+ else if (data.ch == 't')
+ // horizontal tab
+ token = new Token (Token.CharacterLiteral, "\t\\t", isWide);
+ else if (data.ch == 'v')
+ // vertical tab
+ token = new Token (Token.CharacterLiteral, "\013\\v", isWide);
+ else if (data.ch == 'b')
+ // backspace
+ token = new Token (Token.CharacterLiteral, "\b\\b", isWide);
+ else if (data.ch == 'r')
+ // carriage return
+ token = new Token (Token.CharacterLiteral, "\r\\r", isWide);
+ else if (data.ch == 'f')
+ // form feed
+ token = new Token (Token.CharacterLiteral, "\f\\f", isWide);
+ else if (data.ch == 'a')
+ // alert
+ token = new Token (Token.CharacterLiteral, "\007\\a", isWide);
+ else if (data.ch == '\\')
+ // backslash
+ token = new Token (Token.CharacterLiteral, "\\\\\\", isWide);
+ else if (data.ch == '?')
+ // question mark
+ token = new Token (Token.CharacterLiteral, "?\\?", isWide);
+ else if (data.ch == '\'')
+ // single quote
+ token = new Token (Token.CharacterLiteral, "'\\'", isWide);
+ else if (data.ch == '"')
+ // double quote
+ token = new Token (Token.CharacterLiteral, "\"\\\"", isWide);
+ else
+ throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
+ readChar ();
+ return token;
+ } // singleCharEscapeSequence
+
+ private Token getString () throws IOException
+ {
+ StringBuffer sbuf = new StringBuffer() ;
+ boolean escaped = false; // <d59166>
+ boolean[] collidesWithKeyword = { false } ; // <d62023>
+
+ // <f46082.40> An escaped id. begins with '_', which is followed by a normal
+ // identifier. Disallow prefixes of '_' having length > 1.
+ if (data.ch == '_') {
+ sbuf.append( data.ch ) ;
+ readChar ();
+ if (escaped = escapedOK)
+ if (data.ch == '_')
+ throw new InvalidCharacter (data.filename, currentLine (),
+ currentLineNumber (), currentLinePosition (), data.ch);
+ }
+
+ // Build up the string of valid characters until a non-string
+ // character is encountered.
+ while (Character.isLetterOrDigit( data.ch ) || (data.ch == '_')) {
+ sbuf.append( data.ch ) ;
+ readChar() ;
+ }
+
+ String string = sbuf.toString() ;
+
+ // <f46082.40> Escaped identifiers - If identifier has '_' prefix, ignore
+ // keyword check and strip '_'; otherwise, perform keyword check.
+
+ if (!escaped) { // Escaped id ==> ignore keyword check
+ Token result = Token.makeKeywordToken( string, corbaLevel, escapedOK,
+ collidesWithKeyword ) ;
+ if (result != null)
+ return result ;
+ }
+
+ // At this point the string is an identifier. If it is a
+ // string which is also a Java keyword, prepend an underscore
+ // so that it doesn't generate a compiler error.
+ string = getIdentifier (string);
+
+ // If a left paren immediately follows, this could be a
+ // macro definition, return a MacroIdentifier
+ if (data.ch == '(') {
+ readChar ();
+ return new Token (Token.MacroIdentifier, string, escaped,
+ collidesWithKeyword[0], false);
+ } else
+ return new Token (Token.Identifier, string, escaped,
+ collidesWithKeyword[0], false);
+ }
+
+ // Wildcard values
+ static final int Star = 0, Plus = 1, Dot = 2, None = 3;
+
+ /**
+ *
+ **/
+ private boolean matchesClosedWildKeyword (String string)
+ {
+ boolean found = true;
+ String tmpString = string;
+ Enumeration e = wildcardKeywords.elements ();
+ while (e.hasMoreElements ())
+ {
+ int wildcard = None;
+ StringTokenizer tokens = new StringTokenizer ((String)e.nextElement (), "*+.", true);
+ if (tokens.hasMoreTokens ())
+ {
+ String token = tokens.nextToken ();
+ if (tmpString.startsWith (token))
+ {
+ tmpString = tmpString.substring (token.length ());
+ while (tokens.hasMoreTokens () && found)
+ {
+ token = tokens.nextToken ();
+ if (token.equals ("*"))
+ wildcard = Star;
+ else if (token.equals ("+"))
+ wildcard = Plus;
+ else if (token.equals ("."))
+ wildcard = Dot;
+ else if (wildcard == Star)
+ {
+ int index = tmpString.indexOf (token);
+ if (index >= 0)
+ tmpString = tmpString.substring (index + token.length ());
+ else
+ found = false;
+ }
+ else if (wildcard == Plus)
+ {
+ int index = tmpString.indexOf (token);
+ if (index > 0)
+ tmpString = tmpString.substring (index + token.length ());
+ else
+ found = false;
+ }
+ else if (wildcard == Dot)
+ {
+ int index = tmpString.indexOf (token);
+ if (index == 1)
+ tmpString = tmpString.substring (1 + token.length ());
+ else
+ found = false;
+ }
+ }
+ if (found && tmpString.equals (""))
+ break;
+ }
+ }
+ }
+ return found && tmpString.equals ("");
+ } // matchesClosedWildKeyword
+
+ /**
+ *
+ **/
+ private String matchesOpenWildcard (String string)
+ {
+ Enumeration e = openEndedKeywords.elements ();
+ String prepend = "";
+ while (e.hasMoreElements ())
+ {
+ int wildcard = None;
+ boolean found = true;
+ String tmpString = string;
+ StringTokenizer tokens = new StringTokenizer ((String)e.nextElement (), "*+.", true);
+ while (tokens.hasMoreTokens () && found)
+ {
+ String token = tokens.nextToken ();
+ if (token.equals ("*"))
+ wildcard = Star;
+ else if (token.equals ("+"))
+ wildcard = Plus;
+ else if (token.equals ("."))
+ wildcard = Dot;
+ else if (wildcard == Star)
+ {
+ wildcard = None;
+ int index = tmpString.lastIndexOf (token);
+ if (index >= 0)
+ tmpString = blankOutMatch (tmpString, index, token.length ());
+ else
+ found = false;
+ }
+ else if (wildcard == Plus)
+ {
+ wildcard = None;
+ int index = tmpString.lastIndexOf (token);
+ if (index > 0)
+ tmpString = blankOutMatch (tmpString, index, token.length ());
+ else
+ found = false;
+ }
+ else if (wildcard == Dot)
+ {
+ wildcard = None;
+ int index = tmpString.lastIndexOf (token);
+ if (index == 1)
+ tmpString = blankOutMatch (tmpString, 1, token.length ());
+ else
+ found = false;
+ }
+ else if (wildcard == None)
+ if (tmpString.startsWith (token))
+ tmpString = blankOutMatch (tmpString, 0, token.length ());
+ else
+ found = false;
+ }
+
+ // Make sure that, if the last character of the keyword is a
+ // wildcard, that the string matches what the wildcard
+ // requires.
+ if (found)
+ {
+ if (wildcard == Star)
+ ;
+ else if (wildcard == Plus && tmpString.lastIndexOf (' ') != tmpString.length () - 1)
+ ;
+ else if (wildcard == Dot && tmpString.lastIndexOf (' ') == tmpString.length () - 2)
+ ;
+ else if (wildcard == None && tmpString.lastIndexOf (' ') == tmpString.length () - 1)
+ ;
+ else
+ found = false;
+ }
+ // If found, then prepend an underscore. But also try matching
+ // again after leading and trailing blanks are removed from
+ // tmpString. This isn't quite right, but it solves a problem
+ // which surfaced in the Java mapping. For example:
+ // openEndedKeywords = {"+Helper", "+Holder", "+Package"};
+ // string = fooHelperPackage.
+ // Given the mechanics of the Java mapping, _fooHelperPackage
+ // COULD have a conflict, so for each occurance of a keyword,
+ // an underscore is added, so this would cause two underscores:
+ // __fooHelperPackage. To accomplish this, the first time thru
+ // tmpString is "fooHelper " at this point, strip off the
+ // trailing blanks and try matching "fooHelper". This also
+ // matches, so two underscores are prepended.
+ if (found)
+ {
+ prepend = prepend + "_" + matchesOpenWildcard (tmpString.trim ());
+ break;
+ }
+ }
+ return prepend;
+ } // matchesOpenWildcard
+
+ /**
+ *
+ **/
+ private String blankOutMatch (String string, int start, int length)
+ {
+ char[] blanks = new char [length];
+ for (int i = 0; i < length; ++i)
+ blanks[i] = ' ';
+ return string.substring (0, start) + new String (blanks) + string.substring (start + length);
+ } // blankOutMatch
+
+ /**
+ *
+ **/
+ private String getIdentifier (String string)
+ {
+ if (keywords.contains (string))
+ // string matches a non-wildcard keyword
+ string = '_' + string;
+ else
+ {
+ // Check to see if string matches any wildcard keywords that
+ // aren't open ended (don't have a wildcard as the first or
+ // last character.
+ String prepend = "";
+ if (matchesClosedWildKeyword (string))
+ prepend = "_";
+ else
+ // string did not match any closed wildcard keywords (that
+ // is, keywords with wildcards anywhere but at the beginning
+ // or end of the word).
+ // Now check for * + or . at the beginning or end.
+ // These require special handling because they could match
+ // more than one keyword. prepend an underscore for each
+ // matched keyword.
+ prepend = matchesOpenWildcard (string);
+ string = prepend + string;
+ }
+ return string;
+ } // getIdentifier
+
+ /**
+ *
+ **/
+ private Token getDirective () throws IOException
+ {
+ readChar ();
+ String string = new String ();
+ while ((data.ch >= 'a' && data.ch <= 'z') || (data.ch >= 'A' && data.ch <= 'Z'))
+ {
+ string = string + data.ch;
+ readChar ();
+ }
+ unread (data.ch);
+ for (int i = 0; i < Token.Directives.length; ++i)
+ if (string.equals (Token.Directives[i]))
+ return new Token (Token.FirstDirective + i);
+ // If it got this far, it is an unknown preprocessor directive.
+ return new Token (Token.Unknown, string);
+ } // getDirective
+
+ /**
+ *
+ **/
+ private Token getNumber () throws IOException
+ {
+ if (data.ch == '.')
+ return getFractionNoInteger ();
+ else if (data.ch == '0')
+ return isItHex ();
+ else // the only other possibliities are 1..9
+ return getInteger ();
+ } // getNumber
+
+ /**
+ *
+ **/
+ private Token getFractionNoInteger () throws IOException
+ {
+ readChar ();
+ if (data.ch >= '0' && data.ch <= '9')
+ return getFraction (".");
+ else
+ return new Token (Token.Period);
+ } // getFractionNoInteger
+
+ /**
+ *
+ **/
+ private Token getFraction (String string) throws IOException
+ {
+ while (data.ch >= '0' && data.ch <= '9')
+ {
+ string = string + data.ch;
+ readChar ();
+ }
+ if (data.ch == 'e' || data.ch == 'E')
+ return getExponent (string + 'E');
+ else
+ return new Token (Token.FloatingPointLiteral, string);
+ } // getFraction
+
+ /**
+ *
+ **/
+ private Token getExponent (String string) throws IOException
+ {
+ readChar ();
+ if (data.ch == '+' || data.ch == '-')
+ {
+ string = string + data.ch;
+ readChar ();
+ }
+ else if (data.ch < '0' || data.ch > '9')
+ throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
+ while (data.ch >= '0' && data.ch <= '9')
+ {
+ string = string + data.ch;
+ readChar ();
+ }
+ return new Token (Token.FloatingPointLiteral, string);
+ } // getExponent
+
+ /**
+ *
+ **/
+ private Token isItHex () throws IOException
+ {
+ readChar ();
+ if (data.ch == '.')
+ {
+ readChar ();
+ return getFraction ("0.");
+ }
+ else if (data.ch == 'x' || data.ch == 'X')
+ return getHexNumber ("0x");
+ else if (data.ch == '8' || data.ch == '9')
+ throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
+ else if (data.ch >= '0' && data.ch <= '7')
+ return getOctalNumber ();
+ else if (data.ch == 'e' || data.ch == 'E')
+ return getExponent ("0E");
+ else
+ return new Token (Token.IntegerLiteral, "0");
+ } // isItHex
+
+ /**
+ *
+ **/
+ private Token getOctalNumber () throws IOException
+ {
+ String string = "0" + data.ch;
+ readChar ();
+ while ((data.ch >= '0' && data.ch <= '9'))
+ {
+ if (data.ch == '8' || data.ch == '9')
+ throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
+ string = string + data.ch;
+ readChar ();
+ }
+ return new Token (Token.IntegerLiteral, string);
+ } // getOctalNumber
+
+ /**
+ *
+ **/
+ private Token getHexNumber (String string) throws IOException
+ {
+ readChar ();
+ if ((data.ch < '0' || data.ch > '9') && (data.ch < 'a' || data.ch > 'f') && (data.ch < 'A' || data.ch > 'F'))
+ throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
+ else
+ while ((data.ch >= '0' && data.ch <= '9') || (data.ch >= 'a' && data.ch <= 'f') || (data.ch >= 'A' && data.ch <= 'F'))
+ {
+ string = string + data.ch;
+ readChar ();
+ }
+ return new Token (Token.IntegerLiteral, string);
+ } // getHexNumber
+
+ /**
+ *
+ **/
+ private int getNDigitHexNumber (int n) throws IOException
+ {
+ readChar ();
+ if (!isHexChar (data.ch))
+ throw new InvalidCharacter (data.filename, currentLine (),
+ currentLineNumber (), currentLinePosition (), data.ch);
+ String string = "" + data.ch;
+ readChar ();
+ for (int i = 2; i <= n; i++)
+ {
+ if (!isHexChar( data.ch))
+ break;
+ string += data.ch;
+ readChar ();
+ }
+ try
+ {
+ return Integer.parseInt (string, 16);
+ }
+ catch (NumberFormatException e)
+ {
+ }
+ return 0;
+ } // getNDigitHexNumber
+
+ /**
+ *
+ **/
+ private boolean isHexChar ( char hex )
+ {
+ return ((data.ch >= '0') && (data.ch <= '9')) ||
+ ((data.ch >= 'a') && (data.ch <= 'f')) ||
+ ((data.ch >= 'A') && (data.ch <= 'F'));
+ }
+
+ /**
+ *
+ **/
+ private int get3DigitOctalNumber () throws IOException
+ {
+ char firstDigit = data.ch;
+ String string = "" + data.ch;
+ readChar ();
+ if (data.ch >= '0' && data.ch <= '7')
+ {
+ string = string + data.ch;
+ readChar ();
+ if (data.ch >= '0' && data.ch <= '7')
+ {
+ string = string + data.ch;
+ if (firstDigit > '3')
+ // This is a 3-digit number bigger than 377
+ throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), firstDigit);
+ readChar ();
+ }
+ }
+ int ret = 0;
+ try
+ {
+ ret = Integer.parseInt (string, 8);
+ }
+ catch (NumberFormatException e)
+ {
+ throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), string.charAt (0));
+ }
+ return ret;
+ } // get3DigitOctalNumber
+
+ /**
+ *
+ **/
+ private Token getInteger () throws IOException
+ {
+ String string = "" + data.ch;
+ readChar ();
+ if (data.ch == '.')
+ {
+ readChar ();
+ return getFraction (string + '.');
+ }
+ else if (data.ch == 'e' || data.ch == 'E')
+ return getExponent (string + 'E');
+ else if (data.ch >= '0' && data.ch <= '9')
+ while (data.ch >= '0' && data.ch <= '9')
+ {
+ string = string + data.ch;
+ readChar ();
+ if (data.ch == '.')
+ {
+ readChar ();
+ return getFraction (string + '.');
+ }
+ }
+ return new Token (Token.IntegerLiteral, string);
+ } // getInteger
+
+ /**
+ *
+ **/
+ private Token replaceTrigraph () throws IOException
+ {
+ readChar ();
+ if (data.ch == '?')
+ {
+ readChar ();
+ if (data.ch == '=')
+ data.ch = '#';
+ else if (data.ch == '/')
+ data.ch = '\\';
+ else if (data.ch == '\'')
+ data.ch = '^';
+ else if (data.ch == '(')
+ data.ch = '[';
+ else if (data.ch == ')')
+ data.ch = ']';
+ else if (data.ch == '!')
+ data.ch = '|';
+ else if (data.ch == '<')
+ data.ch = '{';
+ else if (data.ch == '>')
+ data.ch = '}';
+ else if (data.ch == '-')
+ data.ch = '~';
+ else
+ {
+ unread (data.ch);
+ unread ('?');
+ throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
+ }
+ return getToken ();
+ }
+ else
+ {
+ unread ('?');
+ throw new InvalidCharacter (data.filename, currentLine (), currentLineNumber (), currentLinePosition (), data.ch);
+ }
+ } // replaceTrigraph
+
+ /**
+ *
+ **/
+ void skipWhiteSpace () throws IOException
+ {
+ while (data.ch <= ' ')
+ readChar ();
+ } // skipWhiteSpace
+
+ /**
+ *
+ **/
+ private void skipBlockComment () throws IOException
+ {
+ try
+ {
+ boolean done = false;
+ readChar ();
+ while (!done)
+ {
+ while (data.ch != '*')
+ readChar ();
+ readChar ();
+ if (data.ch == '/')
+ done = true;
+ }
+ }
+ catch (EOFException e)
+ {
+ ParseException.unclosedComment (data.filename);
+ throw e;
+ }
+ } // skipBlockComment
+
+ /**
+ *
+ **/
+ void skipLineComment () throws IOException
+ {
+ while (data.ch != '\n')
+ readChar ();
+ } // skipLineComment
+
+ // The following two routines added to extract comments rather
+ // than ignore them.
+
+ /**
+ * Extract a line comment from the input buffer.
+ **/
+ private String getLineComment () throws IOException
+ {
+ StringBuffer sb = new StringBuffer( "/" );
+ while (data.ch != '\n')
+ {
+ if (data.ch != '\r')
+ sb.append (data.ch);
+ readChar ();
+ }
+ return sb.toString();
+ } // getLineComment
+
+ /**
+ * Extract a block comment from the input buffer.
+ **/
+ private String getBlockComment () throws IOException
+ {
+ StringBuffer sb = new StringBuffer ("/*");
+ try
+ {
+ boolean done = false;
+ readChar ();
+ sb.append (data.ch);
+ while (!done)
+ {
+ while (data.ch != '*')
+ {
+ readChar ();
+ sb.append (data.ch);
+ }
+ readChar ();
+ sb.append (data.ch);
+ if (data.ch == '/')
+ done = true;
+ }
+ }
+ catch (EOFException e)
+ {
+ ParseException.unclosedComment (data.filename);
+ throw e;
+ }
+ return sb.toString ();
+ } // getBlockComment
+
+ /**
+ *
+ **/
+ Token skipUntil (char c) throws IOException
+ {
+ while (data.ch != c)
+ {
+ if (data.ch == '/')
+ {
+ readChar ();
+ if (data.ch == '/')
+ {
+ skipLineComment ();
+ // If this is skipping until the newline, skipLineComment
+ // reads past the newline, so it won't be seen by the
+ // while loop conditional check.
+ if (c == '\n') break;
+ }
+ else if (data.ch == '*')
+ skipBlockComment ();
+ }
+ else
+ readChar ();
+ }
+ return getToken ();
+ } // skipUntil
+
+ // getUntil is used for macro definitions and to get quoted
+ // strings, so characters within "("...")" and '"'...'"' are
+ // ignored. Ie getUntil ',' on (,,,,),X will return (,,,,)
+
+ String getUntil (char c) throws IOException
+ {
+ return getUntil (c, true, true, true);
+ }
+
+ String getUntil (char c, boolean allowQuote, boolean allowCharLit, boolean allowComment) throws IOException
+ {
+ String string = "";
+ while (data.ch != c)
+ string = appendToString (string, allowQuote, allowCharLit, allowComment);
+ return string;
+ } // getUntil
+
+ /**
+ *
+ **/
+ String getUntil (char c1, char c2) throws IOException
+ {
+ String string = "";
+ while (data.ch != c1 && data.ch != c2)
+ string = appendToString (string, false, false, false);
+ return string;
+ } // getUntil
+
+ /**
+ *
+ **/
+ private String appendToString (String string, boolean allowQuote, boolean allowCharLit, boolean allowComment) throws IOException
+ {
+ // Ignore any comments if they are allowed
+ if (allowComment && data.ch == '/')
+ {
+ readChar ();
+ if (data.ch == '/')
+ skipLineComment ();
+ else if (data.ch == '*')
+ skipBlockComment ();
+ else
+ string = string + '/';
+ }
+ // Handle line continuation character
+ else if (data.ch == '\\')
+ {
+ readChar ();
+ if (data.ch == '\n')
+ readChar ();
+ else if (data.ch == '\r')
+ {
+ readChar ();
+ if (data.ch == '\n')
+ readChar ();
+ }
+ else
+ {
+ string = string + '\\' + data.ch;
+ readChar ();
+ }
+ }
+ // characters within "("...")" and '"'...'"' are ignored.
+ // Ie getUntil ',' on (,,,,),X will return (,,,)
+ else
+ {
+ if (allowCharLit && data.ch == '"')
+ {
+ readChar ();
+ string = string + '"';
+ while (data.ch != '"')
+ string = appendToString (string, true, false, allowComment);
+ }
+ else if (allowQuote && allowCharLit && data.ch == '(')
+ {
+ readChar ();
+ string = string + '(';
+ while (data.ch != ')')
+ string = appendToString (string, false, false, allowComment);
+ }
+ else if (allowQuote && data.ch == '\'')
+ {
+ readChar ();
+ string = string + "'";
+ while (data.ch != '\'')
+ string = appendToString (string, false, true, allowComment);
+ }
+ string = string + data.ch;
+ readChar ();
+ }
+ return string;
+ } // appendToString
+
+ /**
+ *
+ **/
+ String getStringToEOL () throws IOException
+ {
+ String string = new String ();
+ while (data.ch != '\n')
+ {
+ if (data.ch == '\\')
+ {
+ readChar ();
+ if (data.ch == '\n')
+ readChar ();
+ else if (data.ch == '\r')
+ {
+ readChar ();
+ if (data.ch == '\n')
+ readChar ();
+ }
+ else
+ {
+ string = string + data.ch;
+ readChar ();
+ }
+ }
+ else
+ {
+ string = string + data.ch;
+ readChar ();
+ }
+ }
+ return string;
+ } // getStringToEOL
+
+ /**
+ *
+ **/
+ String filename ()
+ {
+ return data.filename;
+ } // filename
+
+ /**
+ *
+ **/
+ IncludeEntry fileEntry ()
+ {
+ return data.fileEntry;
+ } // fileEntry
+
+ /**
+ *
+ **/
+ int currentLineNumber ()
+ {
+ return data.line;
+ } // currentLineNumber
+
+ /**
+ *
+ **/
+ int lastTokenLineNumber ()
+ {
+ return data.oldLine;
+ } // lastTokenLineNumber
+
+ private int BOL; // Beginning Of Line
+
+ /**
+ *
+ **/
+ String currentLine ()
+ {
+ BOL = data.fileIndex - 1;
+ try
+ {
+ // If the current position is at the end of the line,
+ // set BOL to before the end of the line so the whole
+ // line is returned.
+ if (data.fileBytes[BOL - 1] == '\r' && data.fileBytes[BOL] == '\n')
+ BOL -= 2;
+ else if (data.fileBytes[BOL] == '\n')
+ --BOL;
+ while (data.fileBytes[BOL] != '\n')
+ --BOL;
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ BOL = -1;
+ }
+ ++BOL; // Go to the first character AFTER the newline
+ int EOL = data.fileIndex - 1;
+ try
+ {
+ while (data.fileBytes[EOL] != '\n' && data.fileBytes[EOL] != '\r')
+ ++EOL;
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ EOL = data.fileBytes.length;
+ }
+ if (BOL < EOL)
+ return new String (data.fileBytes, BOL, EOL - BOL);
+ else
+ return "";
+ } // currentLine
+
+ /**
+ *
+ **/
+ String lastTokenLine ()
+ {
+ int saveFileIndex = data.fileIndex;
+ data.fileIndex = data.oldIndex;
+ String ret = currentLine ();
+ data.fileIndex = saveFileIndex;
+ return ret;
+ } // lastTokenLine
+
+ /**
+ *
+ **/
+ int currentLinePosition ()
+ {
+ return data.fileIndex - BOL;
+ } // currentLinePosition
+
+ /**
+ *
+ **/
+ int lastTokenLinePosition ()
+ {
+ return data.oldIndex - BOL;
+ } // lastTokenLinePosition
+
+ // The scanner data is moved to a separate class so that all of the
+ // data can easily be pushed and popped to a stack.
+
+ // The data must be stackable for macros and #included files. When
+ // a macro is encountered: the current stack data is reserved on
+ // the stack; the stack is loaded with the macro info; processing
+ // proceeds with this data. The same is true for #included files.
+
+ // It may seem that the entire Scanner should be put on a stack in
+ // the Parser since all the scanner data is stackable. But that
+ // would mean instantiating a new scanner. The scanner must
+ // continue from where it left off; when certain things cross file
+ // boundaries, they must be handled by the scanner, not the parser,
+ // things like: block comments, quoted strings, tokens.
+ private ScannerData data = new ScannerData ();
+ private Stack dataStack = new Stack ();
+ private Vector keywords = new Vector ();
+ private Vector openEndedKeywords = new Vector ();
+ private Vector wildcardKeywords = new Vector ();
+ private boolean verbose;
+ // <f46082.40> Identifiers starting with '_' are considered "Escaped",
+ // except when scanned during preprocessing. Class Preprocessor is
+ // responsible to modify the escapedOK flag accordingly. Since preceding
+ // underscores are now legal when scanning identifiers as well as
+ // macro identifier, underscoreOK is obsolete.
+ //
+ // boolean underscoreOK = false;
+ boolean escapedOK = true;
+ // <f46082.51> Remove -stateful feature.
+ // boolean stateful;
+ private boolean emitAll;
+ private float corbaLevel;
+ private boolean debug ;
+} // class Scanner
+
+// This is a dumb class, really just a struct. It contains all of the
+// scanner class's data in one place so that that data can be easily
+// pushed and popped to a stack.
+
+/**
+ *
+ **/
+class ScannerData
+{
+ /**
+ *
+ **/
+ public ScannerData ()
+ {
+ } // ctor
+
+ /**
+ *
+ **/
+ public ScannerData (ScannerData that)
+ {
+ indent = that.indent;
+ fileEntry = that.fileEntry;
+ filename = that.filename;
+ fileBytes = that.fileBytes;
+ fileIndex = that.fileIndex;
+ oldIndex = that.oldIndex;
+ ch = that.ch;
+ line = that.line;
+ oldLine = that.oldLine;
+ macrodata = that.macrodata;
+ includeIsImport = that.includeIsImport;
+ } // copy ctor
+
+ String indent = "";
+ IncludeEntry fileEntry = null;
+ String filename = "";
+
+ // fileBytes is a byte array rather than a char array. This is
+ // safe because OMG IDL is specified to be ISO Latin-1 whose high-
+ // order byte is always 0x0. <f49747.1> Converted from byte[] to char[]
+ // to employ Reader classes, which have Character encoding features. <ajb>
+ //byte[] fileBytes = null;
+ char[] fileBytes = null;
+ int fileIndex = 0;
+ int oldIndex = 0;
+ char ch;
+ int line = 1;
+ int oldLine = 1;
+ boolean macrodata = false;
+ boolean includeIsImport = false;
+} // class ScannerData
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SequenceEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SequenceEntry.java
new file mode 100644
index 0000000..78b20f3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SequenceEntry.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.constExpr.Expression;
+
+/**
+ * This is the symbol table entry for sequences.
+ **/
+public class SequenceEntry extends SymtabEntry
+{
+ protected SequenceEntry ()
+ {
+ super ();
+ repositoryID (Util.emptyID);
+ } // ctor
+
+ protected SequenceEntry (SequenceEntry that)
+ {
+ super (that);
+ _maxSize = that._maxSize;
+ } // ctor
+
+ protected SequenceEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ if (!(that instanceof SequenceEntry))
+ // If that is a SequenceEntry, then it is a container of this sequence, but it is not a module of this sequence. It's name doesn't belong in the module name.
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ repositoryID (Util.emptyID);
+ } // ctor
+
+ public Object clone ()
+ {
+ return new SequenceEntry (this);
+ } // clone
+
+ public boolean isReferencable()
+ {
+ // A sequence is referencable if its component
+ // type is.
+ return type().isReferencable() ;
+ }
+
+ public void isReferencable( boolean value )
+ {
+ // NO-OP: this cannot be set for a sequence.
+ }
+
+ /** Invoke the sequence generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ sequenceGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the sequence generator.
+ @return an object which implements the SequenceGen interface.
+ @see SequenceGen */
+ public Generator generator ()
+ {
+ return sequenceGen;
+ } // generator
+
+ /** the constant expression defining the maximum size of the sequence.
+ If it is null, then the sequence is unbounded. */
+ public void maxSize (Expression expr)
+ {
+ _maxSize = expr;
+ } // maxSize
+
+ /** the constant expression defining the maximum size of the sequence.
+ If it is null, then the sequence is unbounded. */
+ public Expression maxSize ()
+ {
+ return _maxSize;
+ } // maxSize
+
+ /** Only sequences can be contained within sequences. */
+ public void addContained (SymtabEntry entry)
+ {
+ _contained.addElement (entry);
+ } // addContained
+
+ /** Only sequences can be contained within sequences. */
+ public Vector contained ()
+ {
+ return _contained;
+ } // contained
+
+ static SequenceGen sequenceGen;
+
+ private Expression _maxSize = null;
+ private Vector _contained = new Vector ();
+} // class SequenceEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SequenceGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SequenceGen.java
new file mode 100644
index 0000000..b26fefa
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SequenceGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface SequenceGen extends Generator
+{
+ void generate (Hashtable symbolTable, SequenceEntry entry, PrintWriter stream);
+} // interface SequenceGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StringEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StringEntry.java
new file mode 100644
index 0000000..1283be8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StringEntry.java
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.constExpr.Expression;
+
+public class StringEntry extends SymtabEntry
+{
+ protected StringEntry ()
+ {
+ super ();
+ String override = (String)Parser.overrideNames.get ("string");
+ if (override == null)
+ name ("string");
+ else
+ name (override);
+ repositoryID (Util.emptyID);
+ } // ctor
+
+ protected StringEntry (StringEntry that)
+ {
+ super (that);
+ _maxSize = that._maxSize;
+ } // ctor
+
+ protected StringEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ module ("");
+
+ String override = (String)Parser.overrideNames.get ("string");
+ if (override == null)
+ name ("string");
+ else
+ name (override);
+ repositoryID (Util.emptyID);
+ } // ctor
+
+ public Object clone ()
+ {
+ return new StringEntry (this);
+ } // clone
+
+ /** Invoke the string type generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ stringGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the primitive type generator.
+ @return an object which implements the PrimitiveGen interface.
+ @see PrimitiveGen */
+ public Generator generator ()
+ {
+ return stringGen;
+ } // generator
+
+ /** The constant expression defining the maximum size of the string.
+ If it is null, then the string is unbounded. */
+ public void maxSize (Expression expr)
+ {
+ _maxSize = expr;
+ } // maxSize
+
+ /** The constant expression defining the maximum size of the string.
+ If it is null, then the string is unbounded. */
+ public Expression maxSize ()
+ {
+ return _maxSize;
+ } // maxSize
+
+ static StringGen stringGen;
+
+ private Expression _maxSize = null;
+} // class StringEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StringGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StringGen.java
new file mode 100644
index 0000000..ef9b422
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StringGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface StringGen extends Generator
+{
+ void generate (Hashtable symbolTable, StringEntry entry, PrintWriter stream);
+} // interface StringGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StructEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StructEntry.java
new file mode 100644
index 0000000..3e50092
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StructEntry.java
@@ -0,0 +1,143 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+/**
+ * This is the symbol table entry for structs.
+ **/
+public class StructEntry extends SymtabEntry
+{
+ protected StructEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected StructEntry (StructEntry that)
+ {
+ super (that);
+ if (!name ().equals (""))
+ {
+ module (module () + name ());
+ name ("");
+ }
+ _members = (Vector)that._members.clone ();
+ _contained = (Vector)that._contained.clone ();
+ } // ctor
+
+ protected StructEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ public Object clone ()
+ {
+ return new StructEntry (this);
+ } // clone
+
+ /** Invoke the struct generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ structGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the struct generator.
+ @return an object which implements the StructGen interface.
+ @see StructGen */
+ public Generator generator ()
+ {
+ return structGen;
+ } // generator
+
+ /** Add a member to the member list. */
+ public void addMember (TypedefEntry member)
+ {
+ _members.addElement (member);
+ } // addMember
+
+ /** This is a vector of TypedefEntry's. In this context, only the name,
+ type, and arrayInfo fields hold any meaning. */
+ public Vector members ()
+ {
+ return _members;
+ } // members
+
+ public void addContained (SymtabEntry entry)
+ {
+ _contained.addElement (entry);
+ } // addContained
+
+ /** This is a vector of SymtabEntry's. It itemizes any types which
+ this struct contains. It is different than the member list.
+ For example:
+ <pre>
+ struct A
+ {
+ long x;
+ Struct B
+ {
+ long a;
+ long b;
+ } y;
+ }
+ </pre>
+ Struct B is contained within struct A.
+ The members vector will contain entries for x and y. */
+ public Vector contained ()
+ {
+ return _contained;
+ } // contained
+
+ private Vector _members = new Vector ();
+ private Vector _contained = new Vector ();
+
+ static StructGen structGen;
+} // class StructEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StructGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StructGen.java
new file mode 100644
index 0000000..cb03c72
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/StructGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface StructGen extends Generator
+{
+ void generate (Hashtable symbolTable, StructEntry entry, PrintWriter stream);
+} // interface StructGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SymtabEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SymtabEntry.java
new file mode 100644
index 0000000..ed1772c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SymtabEntry.java
@@ -0,0 +1,375 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+
+import java.util.Hashtable;
+import java.util.Stack;
+import java.util.Vector;
+
+/**
+ * This is the base class for all symbol table entries.
+ * @see AttributeEntry
+ * @see ConstEntry
+ * @see EnumEntry
+ * @see ExceptionEntry
+ * @see IncludeEntry
+ * @see InterfaceEntry
+ * @see MethodEntry
+ * @see ModuleEntry
+ * @see ParameterEntry
+ * @see PragmaEntry
+ * @see PrimitiveEntry
+ * @see SequenceEntry
+ * @see StructEntry
+ * @see TypedefEntry
+ * @see UnionEntry
+ **/
+public class SymtabEntry
+{
+ public SymtabEntry ()
+ {
+ initDynamicVars ();
+ } // ctor
+
+ SymtabEntry (SymtabEntry that, IDLID clone)
+ {
+ _module = that._module;
+ _name = that._name;
+ _type = that._type;
+ _typeName = that._typeName;
+ _sourceFile = that._sourceFile;
+ _info = that._info;
+ _repID = (RepositoryID)clone.clone ();
+ ((IDLID)_repID).appendToName (_name);
+ if (that instanceof InterfaceEntry || that instanceof ModuleEntry || that instanceof StructEntry || that instanceof UnionEntry || (that instanceof SequenceEntry && this instanceof SequenceEntry))
+ _container = that;
+ else
+ _container = that._container;
+ initDynamicVars ();
+ _comment = that._comment; // <21jul1997daz>
+ } // ctor
+
+ /** This is a shallow copy constructor */
+ SymtabEntry (SymtabEntry that)
+ {
+ _module = that._module;
+ _name = that._name;
+ _type = that._type;
+ _typeName = that._typeName;
+ _sourceFile = that._sourceFile;
+ _info = that._info;
+ _repID = (RepositoryID)that._repID.clone ();
+ _container = that._container;
+
+ if (_type instanceof ForwardEntry)
+ ((ForwardEntry)_type).types.addElement (this);
+
+ initDynamicVars ();
+ // <21JUL1997>
+ _comment = that._comment;
+ } // ctor
+
+ void initDynamicVars ()
+ {
+ _dynamicVars = new Vector (maxKey + 1);
+ for (int i = 0; i <= maxKey; ++i)
+ _dynamicVars.addElement (null);
+ } // initDynamicVars
+
+ /** This is a shallow copy clone */
+ public Object clone ()
+ {
+ return new SymtabEntry (this);
+ } // clone
+
+ /** @return the concatenation of the module and the name, delimited by '/'. */
+ public final String fullName ()
+ {
+ return _module.equals ("") ? _name : _module + '/' + _name;
+ } // fullName
+
+ /** Get the name of this entry's module. If there are modules within
+ modules, each module name is separated by '/'.
+ @return this entry's module name. */
+ public String module ()
+ {
+ return _module;
+ } // module
+
+ /** Set the module for this entry.
+ @param newName the new name of the module. */
+ public void module (String newName)
+ {
+ if (newName == null)
+ _module = "";
+ else
+ _module = newName;
+ } // module
+
+ /** @return the name of this entry. */
+ public String name ()
+ {
+ return _name;
+ } // name
+
+ /** Set the name.
+ @param newName the new name. */
+ public void name (String newName)
+ {
+ if (newName == null)
+ _name = "";
+ else
+ _name = newName;
+
+ // Update the RepositoryID
+ if (_repID instanceof IDLID)
+ ((IDLID)_repID).replaceName (newName);
+ } // name
+
+ /** @return the type name of this entry. */
+ public String typeName ()
+ {
+ return _typeName;
+ } // typeName
+
+ protected void typeName (String typeName)
+ {
+ _typeName = typeName;
+ } // typeName
+
+ /** @return the type entry of this entry */
+ public SymtabEntry type ()
+ {
+ return _type;
+ } // type
+
+ public void type (SymtabEntry newType)
+ {
+ if (newType == null)
+ typeName ("");
+ else
+ typeName (newType.fullName ());
+ _type = newType;
+
+ if (_type instanceof ForwardEntry)
+ ((ForwardEntry)_type).types.addElement (this);
+ } // type
+
+ /** The file name in which this entry was defined. */
+ public IncludeEntry sourceFile ()
+ {
+ return _sourceFile;
+ } // sourceFile
+
+ /** The file name in which this entry was defined. */
+ public void sourceFile (IncludeEntry file)
+ {
+ _sourceFile = file;
+ } // sourceFile
+
+ /** This must be either an InterfaceEntry or a ModuleEntry.
+ It can be nothing else. */
+ public SymtabEntry container ()
+ {
+ return _container;
+ } // container
+
+ /** This must be either an InterfaceEntry or a ModuleEntry.
+ It can be nothing else. */
+ public void container (SymtabEntry newContainer)
+ {
+ if (newContainer instanceof InterfaceEntry || newContainer instanceof ModuleEntry)
+ _container = newContainer;
+ } // container
+
+ /** @return the repository ID for this entry. */
+ public RepositoryID repositoryID ()
+ {
+ return _repID;
+ } // repositoryID
+
+ /** Set the repository ID for this entry.
+ @param id the new repository ID. */
+ public void repositoryID (RepositoryID id)
+ {
+ _repID = id;
+ } // repositoryID
+
+ /** Should this type be emitted? */
+ public boolean emit ()
+ {
+ return _emit && _isReferencable ;
+ } // emit
+
+ public void emit (boolean emit)
+ {
+ _emit = emit;
+ } // emit
+
+ /* <21jul1997daz> Accessors for comment */
+
+ public Comment comment()
+ {
+ return _comment;
+ }
+
+ public void comment( Comment comment )
+ {
+ _comment = comment;
+ }
+
+ public boolean isReferencable()
+ {
+ return _isReferencable ;
+ }
+
+ public void isReferencable( boolean value )
+ {
+ _isReferencable = value ;
+ }
+
+ static Stack includeStack = new Stack ();
+
+ static void enteringInclude ()
+ {
+ includeStack.push (new Boolean (setEmit));
+ setEmit = false;
+ } // enteringInclude
+
+ static void exitingInclude ()
+ {
+ setEmit = ((Boolean)includeStack.pop ()).booleanValue ();
+ } // exitingInclude
+
+ /** Other variables besides the default ones can be dynamically placed
+ into SymTabEntry (and therefore on all symbol table entries) by
+ extenders. Before such a variable can exist, its key must be
+ obtained by calling getVariableKey. */
+ public static int getVariableKey ()
+ {
+ return ++maxKey;
+ } // dynamicVariable
+
+ /** Other variables besides the default ones can be dynamically placed
+ into SymTabEntry (and therefore on all symbol table entries) by
+ extenders. This method assigns the value to the variable of the
+ given key. A valid key must be obtained by calling the method
+ getVariableKey. If the key is invalid, NoSuchFieldException is
+ thrown. */
+ public void dynamicVariable (int key, Object value) throws NoSuchFieldException
+ {
+ if (key > maxKey)
+ throw new NoSuchFieldException (Integer.toString (key));
+ else
+ {
+ if (key >= _dynamicVars.size ())
+ growVars ();
+ _dynamicVars.setElementAt (value, key);
+ }
+ } // dynamicVariable
+
+ /** Other variables besides the default ones can be dynamically placed
+ into SymTabEntry (and therefore on all symbol table entries) by
+ extenders. This method gets the value of the variable of the
+ given key. A valid key must be obtained by calling the method
+ getVariableKey. If the key is invalid, NoSuchFieldException is
+ thrown. */
+ public Object dynamicVariable (int key) throws NoSuchFieldException
+ {
+ if (key > maxKey)
+ throw new NoSuchFieldException (Integer.toString (key));
+ else
+ {
+ if (key >= _dynamicVars.size ())
+ growVars ();
+ return _dynamicVars.elementAt (key);
+ }
+ } // dynamicVariable
+
+ void growVars ()
+ {
+ int diff = maxKey - _dynamicVars.size () + 1;
+ for (int i = 0; i < diff; ++i)
+ _dynamicVars.addElement (null);
+ } // growVars
+
+ /** Invoke a generator. A call to this method is only meaningful
+ for subclasses of SymtabEntry. If called on this class, it
+ is a no-op.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output. */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ } // generate
+
+ /** Access a generator. A call to this method is only meaningful
+ for subclasses of SymtabEntry. If called on this class, it
+ is a no-op.
+ @return an object which implements the Generator interface. */
+ public Generator generator ()
+ {
+ return null;
+ } // generator
+
+ static boolean setEmit = true;
+ static int maxKey = -1;
+
+ private SymtabEntry _container = null;
+ private String _module = "";
+ private String _name = "";
+ private String _typeName = "";
+ private SymtabEntry _type = null;
+ private IncludeEntry _sourceFile = null;
+ private Object _info = null;
+ private RepositoryID _repID = new IDLID ("", "", "1.0");
+ private boolean _emit = setEmit;
+ private Comment _comment = null;
+ private Vector _dynamicVars;
+ private boolean _isReferencable = true ;
+} // class SymtabEntry
+
+/*=======================================================================================
+ DATE<AUTHOR> ACTION
+ ---------------------------------------------------------------------------------------
+ 21jul1997<daz> Added _comment data member to afford transferring comments from source
+ file to target; added acessor methods for comment.
+ =======================================================================================*/
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SymtabFactory.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SymtabFactory.java
new file mode 100644
index 0000000..e41d993
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/SymtabFactory.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+/**
+ * Each entry must have three ways in which it can be instantiated:
+ * <ul>
+ * <li>with no parameters;
+ * <li>cloned from a copy of itself;
+ * <li>the normal-use instantiation (usually with 2 parameters: the container and the id of the container).
+ * </ul>
+ **/
+public interface SymtabFactory
+{
+ AttributeEntry attributeEntry ();
+ AttributeEntry attributeEntry (InterfaceEntry container, IDLID id);
+
+ ConstEntry constEntry ();
+ ConstEntry constEntry (SymtabEntry container, IDLID id);
+
+ NativeEntry nativeEntry ();
+ NativeEntry nativeEntry (SymtabEntry container, IDLID id);
+
+ EnumEntry enumEntry ();
+ EnumEntry enumEntry (SymtabEntry container, IDLID id);
+
+ ExceptionEntry exceptionEntry ();
+ ExceptionEntry exceptionEntry (SymtabEntry container, IDLID id);
+
+ ForwardEntry forwardEntry ();
+ ForwardEntry forwardEntry (ModuleEntry container, IDLID id);
+
+ ForwardValueEntry forwardValueEntry ();
+ ForwardValueEntry forwardValueEntry (ModuleEntry container, IDLID id);
+
+ IncludeEntry includeEntry ();
+ IncludeEntry includeEntry (SymtabEntry container);
+
+ InterfaceEntry interfaceEntry ();
+ InterfaceEntry interfaceEntry (ModuleEntry container, IDLID id);
+
+ ValueEntry valueEntry ();
+ ValueEntry valueEntry (ModuleEntry container, IDLID id);
+
+ ValueBoxEntry valueBoxEntry ();
+ ValueBoxEntry valueBoxEntry (ModuleEntry container, IDLID id);
+
+ MethodEntry methodEntry ();
+ MethodEntry methodEntry (InterfaceEntry container, IDLID id);
+
+ ModuleEntry moduleEntry ();
+ ModuleEntry moduleEntry (ModuleEntry container, IDLID id);
+
+ ParameterEntry parameterEntry ();
+ ParameterEntry parameterEntry (MethodEntry container, IDLID id);
+
+ PragmaEntry pragmaEntry ();
+ PragmaEntry pragmaEntry (SymtabEntry container);
+
+ PrimitiveEntry primitiveEntry ();
+ /** name can be, but is not limited to, the primitive idl type names:
+ char, octet, short, long, etc. The reason it is not limited to
+ these is that, as an extender, you may wish to override these names.
+ For instance, when generating Java code, octet translates to byte,
+ so there is an entry in Compile.overrideNames: {@code <"octet", "byte">}
+ and a PrimitiveEntry in the symbol table for "byte". */
+ PrimitiveEntry primitiveEntry (String name);
+
+ SequenceEntry sequenceEntry ();
+ SequenceEntry sequenceEntry (SymtabEntry container, IDLID id);
+
+ StringEntry stringEntry ();
+
+ StructEntry structEntry ();
+ StructEntry structEntry (SymtabEntry container, IDLID id);
+
+ TypedefEntry typedefEntry ();
+ TypedefEntry typedefEntry (SymtabEntry container, IDLID id);
+
+ UnionEntry unionEntry ();
+ UnionEntry unionEntry (SymtabEntry container, IDLID id);
+} // interface SymtabFactory
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Token.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Token.java
new file mode 100644
index 0000000..c758a56
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Token.java
@@ -0,0 +1,689 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -F46082.51<daz> Remove -stateful feature.
+// -D59166<daz> Add support for keyword/identifier collision detection. This
+// feature is implemented here, rather than class Scanner, to allow the Parser
+// to handle the problem.
+// -F60858.1<daz> Support -corba option, level <= 2.2: identify 2.3 keywords.
+// -D62023<daz> Support -corba option, level <= 2.3, identify 2.4 keywords.
+// KMC Support -corba, level <= 3.0. Added 3.0 keywords.
+//
+// Should escaped Identifier should be a type rather than an attribute?
+//
+
+/**
+ * Class Token represents a lexeme appearing within an IDL source. Every
+ * Token has a type. Depending on its type and on the supported version
+ * of IDL, a Token will have other associated attributes, such as a name
+ * (identifier, e.g.), and whether it is escaped, deprecated, or is a type
+ * that is known to be in a future version of IDL.
+ **/
+class Token
+{
+ ///////////////
+ // Available types
+
+ static final int // Keywords
+ Any = 0, // 2.2
+ Attribute = 1, // |
+ Boolean = 2, // .
+ Case = 3, // .
+ Char = 4, // .
+ Const = 5,
+ Context = 6,
+ Default = 7,
+ Double = 8,
+ Enum = 9,
+ Exception = 10,
+ FALSE = 11,
+ Fixed = 12, // New addition
+ Float = 13,
+ In = 14,
+ Inout = 15,
+ Interface = 16,
+ Long = 17,
+ Module = 18,
+ Native = 19, // New addition
+ Object = 20,
+ Octet = 21,
+ Oneway = 22,
+ Out = 23,
+ Raises = 24,
+ Readonly = 25,
+ Sequence = 26,
+ Short = 27,
+ String = 28,
+ Struct = 29,
+ Switch = 30,
+ TRUE = 31,
+ Typedef = 32,
+ Unsigned = 33, // .
+ Union = 34, // .
+ Void = 35, // .
+ Wchar = 36, // |
+ Wstring = 37, // 2.2
+ // <f46082.40> New OBV keywords...
+ // <d62023> In 2.4rtf, "factory" is synonymous to "init" in 2.3
+ Init = 38, // 2.3 only
+ Abstract = 39, // 2.3 2.4rtf
+ Custom = 40, // | |
+ Private = 41, // | |
+ Public = 42, // | |
+ Supports = 43, // | |
+ Truncatable = 44, // | |
+ ValueBase = 45, // | |
+ Valuetype = 46, // 2.3 2.4rtf
+ Factory = 47, // 2.4rtf only
+
+ // Keywords in CORBA 3.0
+ Component = 48,
+ Consumes = 49,
+ Emits = 50,
+ Finder = 51,
+ GetRaises = 52,
+ Home = 53,
+ Import = 54,
+ Local = 55,
+ Manages = 56,
+ Multiple = 57,
+ PrimaryKey = 58,
+ Provides = 59,
+ Publishes = 60,
+ SetRaises = 61,
+ TypeId = 62,
+ TypePrefix = 63,
+ Uses = 64,
+
+ Identifier = 80, // Identifier
+ MacroIdentifier = 81, // Macro Identifier
+
+ Semicolon = 100, // Symbols
+ LeftBrace = 101,
+ RightBrace = 102,
+ Colon = 103,
+ Comma = 104,
+ Equal = 105,
+ Plus = 106,
+ Minus = 107,
+ LeftParen = 108,
+ RightParen = 109,
+ LessThan = 110,
+ GreaterThan = 111,
+ LeftBracket = 112,
+ RightBracket = 113,
+ Apostrophe = 114,
+ Quote = 115,
+ Backslash = 116,
+ Bar = 117,
+ Carat = 118,
+ Ampersand = 119,
+ Star = 120,
+ Slash = 121,
+ Percent = 122,
+ Tilde = 123,
+ DoubleColon = 124,
+ ShiftLeft = 125,
+ ShiftRight = 126,
+ Period = 127,
+ Hash = 128,
+ Exclamation = 129,
+ DoubleEqual = 130,
+ NotEqual = 131,
+ GreaterEqual = 132,
+ LessEqual = 133,
+ DoubleBar = 134,
+ DoubleAmpersand = 135,
+
+ BooleanLiteral = 200, // Literals
+ CharacterLiteral = 201,
+ IntegerLiteral = 202,
+ FloatingPointLiteral = 203,
+ StringLiteral = 204,
+ Literal = 205,
+
+ Define = 300, // Directives
+ Undef = 301,
+ If = 302,
+ Ifdef = 303,
+ Ifndef = 304,
+ Else = 305,
+ Elif = 306,
+ Include = 307,
+ Endif = 308,
+ Line = 309,
+ Error = 310,
+ Pragma = 311,
+ Null = 312,
+ Unknown = 313,
+
+ Defined = 400,
+
+ // <f46082.40> Keyword identifiers.
+ //Abstract = 500,
+ //Custom = 501,
+ //Init = 502,
+ //Private2 = 503,
+ //Public2 = 504,
+ //Supports = 505,
+ //Truncatable = 506,
+ //ValueBase = 507,
+ //Valuetype = 508,
+
+ EOF = 999; // End of Input
+
+ // Available types
+ ///////////////
+ // Keywords
+
+ static final String [] Keywords = {
+ "any", "attribute", "boolean",
+ "case", "char", "const",
+ "context", "default", "double",
+ "enum", "exception", "FALSE", "fixed",
+ "float", "in", "inout",
+ "interface", "long", "module", "native",
+ "Object", "octet", "oneway",
+ "out", "raises", "readonly",
+ "sequence", "short", "string",
+ "struct", "switch", "TRUE",
+ "typedef", "unsigned", "union",
+ "void", "wchar", "wstring",
+ "init", // In 2.3 only
+ "abstract", "custom", "private", // 2.3 and 2.4rtf
+ "public", "supports", "truncatable",
+ "ValueBase", "valuetype",
+ "factory", // In 2.4rtf only
+ // CORBA 3.0 keywords
+ "component", "consumes", "emits",
+ "finder", "getRaises", "home",
+ "import", "local", "manages",
+ "multiple", "primaryKey", "provides",
+ "publishes", "setRaises", "supports",
+ "typeId", "typePrefix", "uses" } ;
+
+ // <f46082.40> Remove keyword identifiers.
+ //static final int
+ // FirstKeywordIdentifier = 500,
+ // LastKeywordIdentifier = Valuetype;
+ //
+ //static final String[] KeywordIdentifiers = {
+ // "abstract", "custom", "init",
+ // "private", "public", "supports",
+ // "truncatable", "valueBase", "valuetype"};
+
+ /**
+ * Determine whether this token is a keyword.
+ * @return true iff this token is a keyword.
+ **/
+ boolean isKeyword ()
+ {
+ return type >= FirstKeyword && type <= LastKeyword;
+ } // isKeyword
+
+ private static final int
+ FirstKeyword = Any, // 0
+ LastKeyword = Uses;
+
+ // <f60858.1> Keywords in CORBA 2.2 that we support.
+ private static final int
+ First22Keyword = Any, // 0
+ Last22Keyword = Wstring;
+
+ // <f60858.1> New keywords in CORBA 2.3 (preliminary) that we support.
+ private static final int
+ First23Keyword = Init,
+ Last23Keyword = Valuetype;
+
+ // <d62023> New keywords in CORBA 2.4rtf (accepted 2.3) that we support.
+ // Note that "factory" replaces "init". Scanner must account for this in
+ // keyword scan.
+ private static final int
+ First24rtfKeyword = Abstract,
+ Last24rtfKeyword = Factory;
+
+ // New keywords in CORBA 3.0 (from CORBA components v. 1)
+ private static final int
+ First30Keyword = Component,
+ Last30Keyword = Uses;
+
+ // Current valid CORBA levels:
+ // 2.2 (or <2.3): the default: no OBV support
+ // 2.3: add OBV with init
+ // >2.3: OBV with init replcaed by factory
+ // 3.0: adds components, attr exceptions, local interfaces, type repository
+ // decls.
+
+ private static final int CORBA_LEVEL_22 = 0 ;
+ private static final int CORBA_LEVEL_23 = 1 ;
+ private static final int CORBA_LEVEL_24RTF = 2 ;
+ private static final int CORBA_LEVEL_30 = 3 ;
+
+ // Do the conversion from a floating point CORBA level to an int
+ private static int getLevel( float cLevel )
+ {
+ if (cLevel < 2.3f)
+ return CORBA_LEVEL_22 ;
+ if (Util.absDelta( cLevel, 2.3f ) < 0.001f)
+ return CORBA_LEVEL_23 ;
+ if (cLevel < 3.0f)
+ return CORBA_LEVEL_24RTF ;
+ return CORBA_LEVEL_30 ;
+ }
+
+ // Return the last keyword corresponding to a particular CORBA level
+ private static int getLastKeyword( int level )
+ {
+ if (level == CORBA_LEVEL_22)
+ return Last22Keyword ;
+ if (level == CORBA_LEVEL_23)
+ return Last23Keyword ;
+ if (level == CORBA_LEVEL_24RTF)
+ return Last24rtfKeyword ;
+ return Last30Keyword ;
+ }
+
+ /** Create a keyword token from a string.
+ * Determines whether the string is an IDL keyword based on the corbaLevel.
+ * Strings that are keywords at higher CORBA levels than the corbaLevel
+ * argument create identifier tokens that are marked as "collidesWithKeyword", unless
+ * escapedOK is FALSE, which is the case only when preprocessing is taking place.
+ * In the case of the "init" keyword, which was only defined in CORBA 2.3, init is
+ * marked deprecated in CORBA 2.3 since it is not supported in higher levels.
+ * @param String string The string we are converting to a token.
+ * @param float corbaLevel The CORBA level, currently in the interval [2.2, 3.0].
+ * @param boolean escapedOK Flag set true if _ is used to escape an IDL keyword for use
+ * as an identifier.
+ * @param boolean[] collidesWithKeyword is an array containing one value: a flag
+ * representing whether this string is an identifier that collides with a keyword.
+ * This is set by this method.
+ * @return Token The resulting Token corresponding to string.
+ */
+ public static Token makeKeywordToken(
+ String string, float corbaLevel, boolean escapedOK, boolean[] collision )
+ {
+ int level = getLevel( corbaLevel ) ;
+ int lastKeyword = getLastKeyword( level ) ;
+ boolean deprecated = false ;
+ collision[0] = false ;
+
+ // If the string is a keyword token, return that token
+ for (int i = Token.FirstKeyword; i <= Token.LastKeyword; ++i) {
+ if (string.equals (Token.Keywords[i])) {
+ // <f60858.1><d62023> Return identifier if lexeme is a keyword in a
+ // greater CORBA level; collect attributes indicating future keyword/
+ // identifier collision and deprecations.
+
+ // Init is really a funny case. I don't want to mark it as
+ // a keyword collision in the 2.2 case, since it was only
+ // defined to be a keyword briefly in 2.3.
+ if (i == Token.Init) {
+ if (level == CORBA_LEVEL_23)
+ deprecated = true ;
+ else
+ break ;
+ }
+
+ if (i > lastKeyword) {
+ collision[0] |= escapedOK; // escapedOK true iff not preprocessing
+ break ;
+ }
+
+ if (string.equals ("TRUE") || string.equals ("FALSE"))
+ return new Token (Token.BooleanLiteral, string) ;
+ else
+ return new Token (i, deprecated);
+ } else if (string.equalsIgnoreCase (Token.Keywords[i])) {
+ // <d62023> PU! This will go away in a future release, because
+ // case-insensitive keyword checking will be standard. For now,
+ // indicate that a keyword collision has occurred.
+ collision[0] |= true;
+ break;
+ }
+ } // for i <= lastKeyword
+
+ return null ;
+ } // makeKeywordToken
+
+ // Keywords
+ ///////////////
+ // Symbols
+
+ static final int
+ FirstSymbol = 100,
+ LastSymbol = 199;
+
+ static final String [] Symbols = {
+ ";", "{", "}", ":", ",", "=", "+", "-",
+ "(", ")", "<", ">", "[", "]", "'", "\"",
+ "\\", "|", "^", "&", "*", "/", "%", "~",
+ "::", "<<", ">>", ".", "#", "!", "==", "!=",
+ ">=", "<=", "||", "&&"};
+
+ // Symbols
+ ///////////////
+ // Literals
+
+ static final int
+ FirstLiteral = 200,
+ LastLiteral = 299;
+
+ static final String [] Literals = {
+ Util.getMessage ("Token.boolLit"),
+ Util.getMessage ("Token.charLit"),
+ Util.getMessage ("Token.intLit"),
+ Util.getMessage ("Token.floatLit"),
+ Util.getMessage ("Token.stringLit"),
+ Util.getMessage ("Token.literal")};
+
+ // Literals
+ ///////////////
+ // Directives
+
+ /**
+ * Determine whether this token is a preprocessor directive.
+ * @return true iff this token is a preprocessor directive.
+ **/
+ boolean isDirective ()
+ {
+ return type >= FirstDirective && type <= LastDirective;
+ } // isDirective
+
+ static final int
+ FirstDirective = 300,
+ LastDirective = 399;
+
+ static final String [] Directives = {
+ "define", "undef", "if",
+ "ifdef", "ifndef", "else",
+ "elif", "include","endif",
+ "line", "error", "pragma",
+ ""};
+
+ // Directives
+ ///////////////
+ // Specials
+
+ static final int
+ FirstSpecial = 400,
+ LastSpecial = 499;
+
+ static final String [] Special = {
+ "defined"};
+
+ // Specials
+ ///////////////
+
+ /**
+ * Constructor.
+ * @return a Token of the supplied type.
+ **/
+ Token (int tokenType)
+ {
+ type = tokenType;
+ } // ctor
+
+ // <d62023>
+ /**
+ * Constructor.
+ * @return a Token having the supplied attributes.
+ **/
+ Token (int tokenType, boolean deprecated)
+ {
+ this.type = tokenType;
+ this.isDeprecated = deprecated;
+ } // ctor
+
+ /**
+ * Constructor.
+ * @return a Token having the supplied attributes.
+ **/
+ Token (int tokenType, String tokenName)
+ {
+ type = tokenType;
+ name = tokenName;
+ } // ctor
+
+ /**
+ * Constructor.
+ * @return a Token having the supplied attribtues.
+ * having
+ **/
+ Token (int tokenType, String tokenName, boolean isWide)
+ {
+ this (tokenType, tokenName);
+ this.isWide = isWide;
+ } // ctor
+
+
+ // <d62023>
+ /**
+ * Constructor.
+ * @return a Token having the supplied attributes.
+ **/
+ Token (int tokenType, String tokenName, boolean escaped,
+ boolean collision, boolean deprecated)
+ {
+ this (tokenType, tokenName);
+ this.isEscaped = escaped;
+ this.collidesWithKeyword = collision;
+ this.isDeprecated = deprecated;
+ } // ctor
+
+ // <f46082.40> Remove keyword identifiers.
+ ///**
+ // * Constructor.
+ // * @return a Token having the supplied attributes.
+ // **/
+ //Token (int tokenType, int tokenSubType, String tokenName)
+ //{
+ // type = tokenType;
+ // subType = tokenSubType;
+ // name = tokenName;
+ //} // ctor
+
+ /**
+ * Get the String representation of this Token.
+ * @return a String containing representation of this Token.
+ **/
+ public String toString ()
+ {
+ if (type == Identifier)
+ return name;
+ if (type == MacroIdentifier)
+ return name + '(';
+ return Token.toString (type);
+ } // toString
+
+ /**
+ * Get the String representation of a supplied Token type.
+ * @return A String containing the name of the supplied Token type.
+ **/
+ static String toString (int type)
+ {
+ if (type <= LastKeyword)
+ return Keywords[type];
+ // <f46082.40> Remove keyword identifiers.
+ //if ( (type >= FirstKeywordIdentifier) && (type <= LastKeywordIdentifier) )
+ // return KeywordIdentifiers[ type - FirstKeywordIdentifier ];
+ if (type == Identifier || type == MacroIdentifier)
+ return Util.getMessage ("Token.identifier");
+ if (type <= LastSymbol)
+ return Symbols[type - FirstSymbol];
+ if (type <= LastLiteral)
+ return Literals[type - FirstLiteral];
+ if (type <= LastDirective)
+ return Directives[type - FirstDirective];
+ if (type <= LastSpecial)
+ return Special[type - FirstSpecial];
+ if (type == EOF)
+ return Util.getMessage ("Token.endOfFile");
+ return Util.getMessage ("Token.unknown");
+ } // toString
+
+ ///////////////
+ // Accessors and Predicates
+
+ /**
+ * Determine whether this token equals a supplied token.
+ * @return true iff the types and names of this and the supplied
+ * Token are equal.
+ **/
+ boolean equals (Token that)
+ {
+ if (this.type == that.type)
+ if (this.name == null)
+ return that.name == null;
+ else
+ return this.name.equals (that.name);
+ return false;
+ } // equals
+
+ /**
+ * Determine whether the this token is of a supplied type.
+ * @return true iff the type of this Token equals that supplied.
+ **/
+ boolean equals (int type)
+ {
+ return this.type == type;
+ } // equals
+
+ /**
+ * Determine whether this identifier has the supplied name.
+ * @return true iff this Token is an identifier having the supplied name.
+ **/
+ boolean equals (String name)
+ {
+ return (this.type == Identifier && this.name.equals (name));
+ } // equals
+
+ // Although isEscaped is an independent attribute, it may be true only
+ // when type is Identifer.
+ /**
+ * Accessor.
+ * @return true iff this token is an escaped identifier.
+ **/
+ public boolean isEscaped ()
+ {
+ return type == Identifier && isEscaped;
+ } // isEscaped
+
+ // <d62023>
+ /**
+ * Accessor.
+ * @return true iff this token is an identifier having a name matching
+ * a keyword in a version of CORBA greater than the specified CORBA level,
+ * or iff it matches a keyword in letter, but note case.
+ **/
+ public boolean collidesWithKeyword ()
+ {
+ return collidesWithKeyword;
+ } // collidesWithKeyword
+
+ // <d62023> Storing deprecation information in a token seems a natural
+ // means to notify the parser about deprecated types.
+ /**
+ * Accessor.
+ * @return true iff this token is a deprecated lexeme or lexical type with
+ * respect to the specified CORBA level.
+ **/
+ public boolean isDeprecated ()
+ {
+ return isDeprecated;
+ }
+ // isDeprecated
+
+ public boolean isWide()
+ {
+ return isWide ;
+ }
+
+ // <d59166><d62023> It's more efficient if Scanner determines this attribute.
+ /**
+ * Determine whether this token collides with an IDL keyword.
+ **/
+ //public boolean collidesWithKeyword ()
+ //{
+ // if (name != null && type == Identifier && !isEscaped)
+ // {
+ // String lcName = name.toLowerCase ();
+ // for (int i = FirstKeyword; i <= LastKeyword; ++i)
+ // if (lcName.equals (Token.Keywords [i].toLowerCase ()))
+ // return true;
+ // }
+ // return false;
+ //} // collidesWithKeyword
+
+ // Accessors and Predicates
+ ///////////////
+
+ /**
+ * Code identifying the lexical class to which this token belongs, e.g.,
+ * Keyword, Identifier, ...
+ **/
+ int type;
+ /**
+ * Lexeme extracted from the source for this token.
+ **/
+ String name = null;
+ /**
+ * Source comment associated with this token.
+ **/
+ Comment comment = null;
+ /**
+ * True iff this token is an escaped identifier.
+ **/
+ boolean isEscaped = false; // <d59165>
+ /**
+ * True iff this token is an identifier that is known to be a keyword
+ * in another version of CORBA or matches a keyword in letter, but not case.
+ **/
+ boolean collidesWithKeyword = false; // <d62023>
+ /**
+ * True iff this token is deprecated.
+ **/
+ boolean isDeprecated = false; // <d62023>
+ // <f46082.40> Remove keyword identifier implementation.
+ ///**
+ // * Non-zero only when type = [Macro]Identifier
+ // **/
+ //int subType = 0;
+
+ boolean isWide = false ; // Only for string and char literals: indicates that this is
+ // a wide string or char.
+} // class Token
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TokenBuffer.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TokenBuffer.java
new file mode 100644
index 0000000..6e153ae
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TokenBuffer.java
@@ -0,0 +1,91 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+class TokenBuffer
+{
+ private final int DEFAULT_SIZE = 10;
+
+ private int _size = 0;
+ private Token _buffer [] = null;
+ private int _currPos = -1;
+
+ TokenBuffer ()
+ {
+ _size = DEFAULT_SIZE;
+ _buffer = new Token [_size];
+ _currPos = -1;
+ } // ctor
+
+ TokenBuffer (int size) throws Exception
+ {
+ _size = size; // _size == 0 is legal, but useless and problematic
+ _buffer = new Token [_size];
+ _currPos = -1;
+ } // ctor
+
+ /** Inserts a token at the head of the buffer. */
+ void insert (Token token)
+ {
+ // _size == 0 ==> ArithmeticException: divide by zero
+ _currPos = ++_currPos % _size;
+ _buffer [_currPos] = token;
+ }
+
+ /** Returns the token residing "i" elements from the head of the buffer. */
+ Token lookBack (int i)
+ {
+ // Beware: i > _size ==> idx < 0 ==> ArrayOutOfBoundsException
+ return _buffer [(_currPos - i) >= 0 ? _currPos - i : _currPos - i + _size];
+ }
+
+ /** Return the token most recently inserted into the buffer (i.e., the head of the buffer.) */
+ Token current ()
+ {
+ // Beware: _buffer empty || _size == 0 ==> ArrayOutOfBoundsException
+ return _buffer [_currPos];
+ }
+} // class TokenBuffer
+
+
+/*==================================================================================
+ DATE<AUTHOR> ACTION
+ ----------------------------------------------------------------------------------
+ 11aug1997<daz> Initial version completed. Buffer used to maintain history of
+ comments extracted from source file during parse.
+ ==================================================================================*/
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TypedefEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TypedefEntry.java
new file mode 100644
index 0000000..9a617b5
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TypedefEntry.java
@@ -0,0 +1,123 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.constExpr.Expression;
+
+/**
+ * This is the symbol table entry for typedefs.
+ **/
+public class TypedefEntry extends SymtabEntry
+{
+ protected TypedefEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected TypedefEntry (TypedefEntry that)
+ {
+ super (that);
+ _arrayInfo = (Vector)that._arrayInfo.clone ();
+ } // ctor
+
+ protected TypedefEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ /** This method returns a vector of Expressions, each expression
+ represents a dimension in an array. A zero-length vector indicates
+ no array information.*/
+ public Vector arrayInfo ()
+ {
+ return _arrayInfo;
+ } // arrayInfo
+
+ public void addArrayInfo (Expression e)
+ {
+ _arrayInfo.addElement (e);
+ } // addArrayInfo
+
+ public Object clone ()
+ {
+ return new TypedefEntry (this);
+ } // clone
+
+ /** Invoke the typedef generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ typedefGen.generate (symbolTable, this, stream);
+ } // generate
+
+ public boolean isReferencable()
+ {
+ // A typedef is referencable if its component
+ // type is.
+ return type().isReferencable() ;
+ }
+
+ public void isReferencable( boolean value )
+ {
+ // NO-OP: this cannot be set for a typedef.
+ }
+
+ /** Access the typedef generator.
+ @return an object which implements the TypedefGen interface.
+ @see TypedefGen */
+ public Generator generator ()
+ {
+ return typedefGen;
+ } // generator
+
+ private Vector _arrayInfo = new Vector ();
+
+ static TypedefGen typedefGen;
+} // class TypedefEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TypedefGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TypedefGen.java
new file mode 100644
index 0000000..c451292
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/TypedefGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface TypedefGen extends Generator
+{
+ void generate (Hashtable symbolTable, TypedefEntry entry, PrintWriter stream);
+} // interface TypedefGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionBranch.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionBranch.java
new file mode 100644
index 0000000..55a7aa4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionBranch.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.TypedefEntry;
+
+/**
+ * This class encapsulates one branch of a union. Here are some examples
+ * of what it may contain:
+ * <dl>
+ * <dt>
+ * {@code case 1: short x;}
+ * <dd>{@code <short x, <1>, false>}
+ * <dt>
+ * {@code case 0:}<br>
+ * {@code case 8:}<br>
+ * {@code case 2: long x;}
+ * <dd>{@code <long x, <0, 8, 2>, false>}
+ * <dt>
+ * {@code default: long x;}
+ * <dd>{@code <long x, <>, true>}
+ * <dt>
+ * {@code case 0:}<br>
+ * {@code case 2:}<br>
+ * {@code default: char c;}
+ * <dd>{@code <char c, <0, 2>, true>}
+ * </dl>
+ **/
+public class UnionBranch
+{
+ /** The type definition for the branch. */
+ public TypedefEntry typedef;
+ /** A vector of Expression's, one for each label in the order in which
+ they appear in the IDL file. The default branch has no label. */
+ public Vector labels = new Vector ();
+ /** true if this is the default branch. */
+ public boolean isDefault = false;
+} // class UnionBranch
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionEntry.java
new file mode 100644
index 0000000..0d438a6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionEntry.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.constExpr.Expression;
+
+/**
+ * This is the symbol table entry for unions.
+ **/
+public class UnionEntry extends SymtabEntry
+{
+ protected UnionEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected UnionEntry (UnionEntry that)
+ {
+ super (that);
+ if (!name ().equals (""))
+ {
+ module (module () + name ());
+ name ("");
+ }
+ _branches = (Vector)that._branches.clone ();
+ _defaultBranch = that._defaultBranch;
+ _contained = that._contained;
+ } // ctor
+
+ protected UnionEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ if (module ().equals (""))
+ module (name ());
+ else if (!name ().equals (""))
+ module (module () + "/" + name ());
+ } // ctor
+
+ public Object clone ()
+ {
+ return new UnionEntry (this);
+ } // clone
+
+ /** Invoke the union generator.
+ @param symbolTable the symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ unionGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the union generator.
+ @return an object which implements the UnionGen interface.
+ @see UnionGen */
+ public Generator generator ()
+ {
+ return unionGen;
+ } // generator
+
+ public void addBranch (UnionBranch branch)
+ {
+ _branches.addElement (branch);
+ } // addBranch
+
+ /** This is a vector of UnionBranch's. */
+ public Vector branches ()
+ {
+ return _branches;
+ } // branches
+
+ /** This TypedefEntry describes the type and name for the default branch.
+ Like the entries in the branches vector, only the type and name fields
+ are pertinent. */
+ public void defaultBranch (TypedefEntry branch)
+ {
+ _defaultBranch = branch;
+ } // defaultBranch
+
+ /** This TypedefEntry describes the type and name for the default branch.
+ Like the entries in the branches vector, only the type and name fields
+ are pertinent. */
+ public TypedefEntry defaultBranch ()
+ {
+ return _defaultBranch;
+ } // defaultBranch
+
+ public void addContained (SymtabEntry entry)
+ {
+ _contained.addElement (entry);
+ } // addContained
+
+ /** This is a vector of SymtabEntry's. It itemizes any types which
+ this union contains. For example:
+
+ <pre>
+ union A
+ switch (long)
+ {
+ case 0: long x;
+ case 1:
+ Struct B
+ {
+ long a;
+ long b;
+ } y;
+ }
+ </pre>
+ Struct B is contained within union A. */
+ public Vector contained ()
+ {
+ return _contained;
+ } // contained
+
+ boolean has (Expression label)
+ {
+ Enumeration eBranches = _branches.elements ();
+ while (eBranches.hasMoreElements ())
+ {
+ Enumeration eLabels = ((UnionBranch)eBranches.nextElement ()).labels.elements ();
+ while (eLabels.hasMoreElements ())
+ {
+ Expression exp = (Expression)eLabels.nextElement ();
+ if (exp.equals (label) || exp.value ().equals (label.value ()))
+ return true;
+ }
+ }
+ return false;
+ } // has
+
+ boolean has (TypedefEntry typedef)
+ {
+ Enumeration e = _branches.elements ();
+ while (e.hasMoreElements ())
+ {
+ UnionBranch branch = (UnionBranch)e.nextElement ();
+ if (!branch.typedef.equals (typedef) && branch.typedef.name ().equals (typedef.name ()))
+ return true;
+ }
+ return false;
+ } // has
+
+ /** A vector of UnionBranch's. */
+ private Vector _branches = new Vector ();
+ private TypedefEntry _defaultBranch = null;
+ private Vector _contained = new Vector ();
+
+ static UnionGen unionGen;
+} // class UnionEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionGen.java
new file mode 100644
index 0000000..fc009a4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/UnionGen.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+public interface UnionGen extends Generator
+{
+ void generate (Hashtable symtab, UnionEntry entry, PrintWriter stream);
+} // interface UnionGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Util.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Util.java
new file mode 100644
index 0000000..7621859
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/Util.java
@@ -0,0 +1,379 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+// -capitalize and parseTypeModifier should probably be in the
+// generators package.
+// -D58319<daz> Add version() method.
+// -D62023<daz> Add absDelta() method to support float computations.
+
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.som.cff.FileLocator;
+
+public class Util
+{
+ // <d58319>
+ /**
+ * Fetch the version number of this build of the IDL Parser Framework
+ * from the appropriate properties file.
+ * @return the version number contained within the appropriate properties
+ * file, which indicates the build of this IDL Parser Framework.
+ **/
+ public static String getVersion ()
+ {
+ return getVersion ("com/sun/tools/corba/se/idl/idl.prp");
+ } // getVersion
+
+ /**
+ * Fetch the version number of this build of the IDL Parser Framework.
+ * This method may be called before or after the framework has been
+ * initialized. If the framework is inititialized, the version information
+ * is extracted from the message properties object; otherwise, it is extracted
+ * from the indicated messages file.
+ * @return the version number.
+ **/
+ public static String getVersion (String filename)
+ {
+ String version = "";
+ if (messages == null) // Use supplied file
+ {
+ Vector oldMsgFiles = msgFiles;
+ if (filename == null || filename.equals (""))
+ filename = "com/sun/tools/corba/se/idl/idl.prp";
+ filename = filename.replace ('/', File.separatorChar);
+ registerMessageFile (filename);
+ version = getMessage ("Version.product", getMessage ("Version.number"));
+ msgFiles = oldMsgFiles;
+ messages = null;
+ }
+ else
+ {
+ version = getMessage ("Version.product", getMessage ("Version.number"));
+ }
+ return version;
+ } // getVersion
+
+ public static boolean isAttribute (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof AttributeEntry;
+ } // isAttribute
+
+ public static boolean isConst (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof ConstEntry;
+ } // isConst
+
+ public static boolean isEnum (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof EnumEntry;
+ } // isEnum
+
+ public static boolean isException (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof ExceptionEntry;
+ } // isException
+
+ public static boolean isInterface (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof InterfaceEntry;
+ } // isInterface
+
+ public static boolean isMethod (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof MethodEntry;
+ } // isMethod
+
+ public static boolean isModule (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof ModuleEntry;
+ } // isModule
+
+ public static boolean isParameter (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof ParameterEntry;
+ } // isParameter
+
+ public static boolean isPrimitive (String name, Hashtable symbolTable)
+ {
+ // Distinguish "string" because the name could be something like:
+ // string(25 + 1)
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ if (entry == null)
+ {
+ // If it is null then it may be of the form string(<exp>).
+ // Don't just check for string because the name "string" may
+ // have been overridden.
+ int parenIndex = name.indexOf ('(');
+ if (parenIndex >= 0)
+ entry = (SymtabEntry)symbolTable.get (name.substring (0, parenIndex));
+ }
+ return entry == null ? false : entry instanceof PrimitiveEntry;
+ } // isPrimitive
+
+ public static boolean isSequence (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof SequenceEntry;
+ } // isSequence
+
+ public static boolean isStruct (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof StructEntry;
+ } // isStruct
+
+ public static boolean isString (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof StringEntry;
+ } // isString
+
+ public static boolean isTypedef (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof TypedefEntry;
+ } // isTypedef
+
+ public static boolean isUnion (String name, Hashtable symbolTable)
+ {
+ SymtabEntry entry = (SymtabEntry)symbolTable.get (name);
+ return entry == null ? false : entry instanceof UnionEntry;
+ } // isUnion
+
+ //////////////
+ // Message-related methods
+
+ public static String getMessage (String key)
+ {
+ if (messages == null)
+ readMessages ();
+ String message = messages.getProperty (key);
+ if (message == null)
+ message = getDefaultMessage (key);
+ return message;
+ } // getMessage
+
+ public static String getMessage (String key, String fill)
+ {
+ if (messages == null)
+ readMessages ();
+ String message = messages.getProperty (key);
+ if (message == null)
+ message = getDefaultMessage (key);
+ else
+ {
+ int index = message.indexOf ("%0");
+ if (index >= 0)
+ message = message.substring (0, index) + fill + message.substring (index + 2);
+ }
+ return message;
+ } // getMessage
+
+ public static String getMessage (String key, String[] fill)
+ {
+ if (messages == null)
+ readMessages ();
+ String message = messages.getProperty (key);
+ if (message == null)
+ message = getDefaultMessage (key);
+ else
+ for (int i = 0; i < fill.length; ++i)
+ {
+ int index = message.indexOf ("%" + i);
+ if (index >= 0)
+ message = message.substring (0, index) + fill[i] + message.substring (index + 2);
+ }
+ return message;
+ } // getMessage
+
+ private static String getDefaultMessage (String keyNotFound)
+ {
+ String message = messages.getProperty (defaultKey);
+ int index = message.indexOf ("%0");
+ if (index > 0)
+ message = message.substring (0, index) + keyNotFound;
+ return message;
+ } // getDefaultMessage
+
+ /*
+ findFile is no longer used now that FileLocator has been provided
+ by Larry Raper of the Shasta team.
+
+ static File findFile (String name) throws FileNotFoundException
+ {
+ String classpath = System.getProperty ("java.class.path");
+ String separator = System.getProperty ("path.separator");
+ int end = -separator.length (); // so the first pass classpath == original classpath
+ File file;
+ do
+ {
+ classpath = classpath.substring (end + separator.length ());
+ end = classpath.indexOf (separator);
+ if (end < 0) end = classpath.length ();
+ file = new File (classpath.substring (0, end) + File.separator + "com" + File.separator + "ibm" + File.separator + "idl" + File.separator + name);
+ } while (!file.exists () && end != classpath.length ());
+ if (!file.exists ()) throw new FileNotFoundException ();
+ return file;
+ } // findFile
+ */
+
+ private static void readMessages ()
+ {
+ messages = new Properties ();
+ Enumeration fileList = msgFiles.elements ();
+ DataInputStream stream;
+ while (fileList.hasMoreElements ())
+ try
+ {
+ stream = FileLocator.locateLocaleSpecificFileInClassPath ((String)fileList.nextElement ());
+ messages.load (stream);
+ }
+ catch (IOException e)
+ {
+ }
+ if (messages.size () == 0)
+ messages.put (defaultKey, "Error reading Messages File.");
+ } // readMessages
+
+ /** Register a message file. This file will be searched for
+ in the CLASSPATH. */
+ public static void registerMessageFile (String filename)
+ {
+ if (filename != null)
+ if (messages == null)
+ msgFiles.addElement (filename);
+ else
+ try
+ {
+ DataInputStream stream = FileLocator.locateLocaleSpecificFileInClassPath (filename);
+ messages.load (stream);
+ }
+ catch (IOException e)
+ {
+ }
+ } // registerMessageFile
+
+ private static Properties messages = null;
+ private static String defaultKey = "default";
+ private static Vector msgFiles = new Vector ();
+ static
+ {
+ msgFiles.addElement ("com/sun/tools/corba/se/idl/idl.prp");
+ }
+
+ // Message-related methods
+ ///////////////
+
+ public static String capitalize (String lc)
+ {
+ String first = new String (lc.substring (0, 1));
+ first = first.toUpperCase ();
+ return first + lc.substring (1);
+ } // capitalize
+
+ ///////////////
+ // General file methods
+
+ /** Searches the current user directory and a list of directories for
+ a given short file name and returns its absolute file specification.
+ @return Absolute file name of a given short filename
+ @throws FileNotFoundException The file does not exist in the
+ current user or specified directories.
+ @see java.io.File.getAbsolutePath */
+ public static String getAbsolutePath (String filename, Vector includePaths) throws FileNotFoundException
+ {
+ String filepath = null;
+ File file = new File (filename);
+ if (file.canRead ())
+ filepath = file.getAbsolutePath ();
+ else
+ {
+ String fullname = null;
+ Enumeration pathList = includePaths.elements ();
+ while (!file.canRead () && pathList.hasMoreElements ())
+ {
+ fullname = (String)pathList.nextElement () + File.separatorChar + filename;
+ file = new File (fullname);
+ }
+ if (file.canRead ())
+ filepath = file.getPath ();
+ else
+ throw new FileNotFoundException (filename);
+ }
+ return filepath;
+ } // getAbsolutePath
+
+ // General file methods
+ ///////////////
+
+ ///////////////
+ // Numeric computations
+
+ // <d62023>
+ /**
+ * Compute the absolute value of the difference between two floating-point
+ * numbers having single precision.
+ * @return the absolute value of the difference between two floats.
+ **/
+ public static float absDelta (float f1, float f2)
+ {
+ double delta = f1 - f2;
+ return (float)((delta < 0) ? delta * -1.0 : delta);
+ } // absDelta
+
+ // Numeric computations
+ ///////////////
+
+ static RepositoryID emptyID = new RepositoryID ();
+} // class Util
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueBoxEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueBoxEntry.java
new file mode 100644
index 0000000..9a231e4
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueBoxEntry.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+/**
+ * This is the symbol table entry for valuesBoxes.
+ **/
+public class ValueBoxEntry extends ValueEntry
+{
+ protected ValueBoxEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected ValueBoxEntry (ValueBoxEntry that)
+ {
+ super (that);
+ } // ctor
+
+ protected ValueBoxEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ } // ctor
+
+ public Object clone ()
+ {
+ return new ValueBoxEntry (this);
+ } // clone
+
+ /** Invoke the interface generator.
+ @param symbolTable the symbol table is a hash table whose key is a fully
+ qualified type name and whose value is a SymtabEntry or a subclass of
+ SymtabEntry.
+ @param stream the stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ valueBoxGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the value generator.
+ @return an object which implements the ValueGen interface.
+ @see ValueGen */
+ public Generator generator ()
+ {
+ return valueBoxGen;
+ } // generator
+
+ static ValueBoxGen valueBoxGen;
+} // class ValueEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueBoxGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueBoxGen.java
new file mode 100644
index 0000000..e8317b0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueBoxGen.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import com.sun.tools.corba.se.idl.*;
+
+public interface ValueBoxGen extends Generator
+{
+ void generate (Hashtable symbolTable, ValueBoxEntry entry, PrintWriter stream);
+} // interface ValueBoxGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueEntry.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueEntry.java
new file mode 100644
index 0000000..093ee99
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueEntry.java
@@ -0,0 +1,414 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+import com.sun.tools.corba.se.idl.constExpr.Expression;
+//<daz> import com.sun.tools.corba.se.idl.som.idlemit.TypeCode;
+
+/**
+* This is the symbol table entry for values.
+**/
+public class ValueEntry extends InterfaceEntry
+{
+ protected ValueEntry ()
+ {
+ super ();
+ } // ctor
+
+ protected ValueEntry (ValueEntry that)
+ {
+ super (that);
+ _supportsNames = (Vector)that._supportsNames.clone ();
+ _supports = (Vector)that._supports.clone ();
+ _initializers = (Vector)that._initializers.clone ();
+ _custom = that._custom;
+ _isSafe = that._isSafe;
+ } // ctor
+
+ protected ValueEntry (SymtabEntry that, IDLID clone)
+ {
+ super (that, clone);
+ } // ctor
+
+ public Object clone ()
+ {
+ return new ValueEntry (this);
+ } // clone
+
+ /** Invoke the interface generator.
+ @param symbolTable The symbol table is a hash table whose key is
+ a fully qualified type name and whose value is a SymtabEntry or
+ a subclass of SymtabEntry.
+ @param stream The stream to which the generator should sent its output.
+ @see SymtabEntry */
+ public void generate (Hashtable symbolTable, PrintWriter stream)
+ {
+ valueGen.generate (symbolTable, this, stream);
+ } // generate
+
+ /** Access the value generator.
+ @return an object which implements the ValueGen interface.
+ @see ValueGen */
+ public Generator generator ()
+ {
+ return valueGen;
+ } // generator
+
+ /** Add an InterfaceEntry to the list of interfaces which this value
+ supports. During parsing, the parameter to this method COULD be a
+ ForwardEntry, but when parsing is complete, calling supports will
+ return a vector which only contains InterfaceEntry's. */
+ public void addSupport (SymtabEntry supports)
+ {
+ _supports.addElement (supports);
+ } // addSupport
+
+ /** This method returns a vector of InterfaceEntry's. */
+ public Vector supports ()
+ {
+ return _supports;
+ } // supports
+
+ /** Add to the list of support names. */
+ public void addSupportName (String name)
+ {
+ _supportsNames.addElement (name);
+ } // addSupportName
+
+ /** This method returns a vector of Strings, each of which is a fully
+ qualified name of an interface. This vector corresponds to the
+ supports vector. The first element of this vector is the name of
+ the first element of the supports vector, etc. */
+ public Vector supportsNames ()
+ {
+ return _supportsNames;
+ } // supportsNames
+
+ /** Add a parent value type to the list of parent types for the value.
+ This method:
+ <UL>
+ <LI> Allows only the first added class to be concrete if the receiver is
+ concrete.
+ <LI> Does not allow any added classes to be concrete if the receiver is
+ abstract.
+ <LI> Does not allow duplicate classes to be added.
+ </UL> */
+ void derivedFromAddElement (SymtabEntry e, boolean isSafe, Scanner scanner)
+ {
+ if (((InterfaceType)e).getInterfaceType() != InterfaceType.ABSTRACT) {
+ if (isAbstract ())
+ ParseException.nonAbstractParent2 (scanner, fullName (), e.fullName ());
+ else if (derivedFrom ().size () > 0)
+ ParseException.nonAbstractParent3 (scanner, fullName (), e.fullName ());
+ }
+
+ if (derivedFrom ().contains (e))
+ ParseException.alreadyDerived (scanner, e.fullName (), fullName ());
+
+ if (isSafe)
+ _isSafe = true;
+
+ addDerivedFrom (e);
+ addDerivedFromName (e.fullName ());
+ addParentType (e, scanner);
+ } // derivedFromAddElement
+
+ void derivedFromAddElement (SymtabEntry e, Scanner scanner)
+ {
+ // This code must check for duplicate interfaces being supported...
+ addSupport (e);
+ addSupportName (e.fullName ());
+ addParentType (e, scanner);
+ } // derivedFromAddElement
+
+ public boolean replaceForwardDecl (ForwardEntry oldEntry, InterfaceEntry newEntry)
+ {
+ if (super.replaceForwardDecl (oldEntry, newEntry))
+ return true;
+ int index = _supports.indexOf (oldEntry);
+ if ( index >= 0)
+ _supports.setElementAt (newEntry, index);
+ return (index >= 0);
+ }
+
+ void initializersAddElement (MethodEntry method, Scanner scanner)
+ {
+ // Check to see if the parameter signature is a duplicate:
+ Vector params = method.parameters ();
+ int args = params.size ();
+ for (Enumeration e = _initializers.elements (); e.hasMoreElements ();)
+ {
+ Vector params2 = ( (MethodEntry) e.nextElement ()).parameters ();
+ if (args == params2.size ())
+ {
+ int i = 0;
+ for (; i < args; i++)
+ if (!((ParameterEntry)params.elementAt (i)).type ().equals (
+ ((ParameterEntry)params2.elementAt (i)).type ()))
+ break;
+ if (i >= args)
+ ParseException.duplicateInit (scanner);
+ }
+ }
+ _initializers.addElement (method);
+ } // initializersAddElement
+
+ public Vector initializers ()
+ {
+ return _initializers;
+ }
+
+ /** Tag all methods introduced by the value type as 'value methods' so
+ they can be differentiated in the emitters from any interface methods
+ that the value type supports. */
+ public void tagMethods ()
+ {
+ for (Enumeration e = methods ().elements (); e.hasMoreElements ();)
+ ((MethodEntry)e.nextElement ()).valueMethod (true);
+ }
+
+ // <46082.03> Revert to "IDL:"-style (i.e., regular) repository ID.
+
+ /** Calculate the 'repository ID' for the value. This method should not be
+ called before the complete value type has been parsed, since it computes
+ the repository ID by computing hashcodes using all information contained
+ in the value type definition, not just the value type's fully qualified
+ name.*/
+ /*
+ public void calcRepId ()
+ {
+ ValueRepositoryId repId = new ValueRepositoryId ();
+ repId.addType (this);
+ calcRepId (repId);
+ String scopedName = fullName ();
+ // KLR - following switched to new format 8/26/98 per Simon's request
+ repositoryID (new RepositoryID ( "H:" + repId.getHashcode() + ":" + scopedName));
+ } // calcRepId
+ */
+
+ /*
+ public void calcRepId (ValueRepositoryId repId)
+ {
+ Vector baseClasses = derivedFrom ();
+ if (baseClasses.size () >= 1)
+ ((ValueEntry)baseClasses.elementAt (0)).calcRepId (repId);
+ Vector state = state ();
+ if (state != null)
+ for (Enumeration e = state.elements (); e.hasMoreElements ();)
+ calcTypedefType (((InterfaceState)e.nextElement ()).entry, repId);
+ } // calcRepId
+
+ private void calcValueType (ValueEntry entry, ValueRepositoryId repId)
+ {
+ if (repId.isNewType (entry))
+ {
+ //<daz> repId.addValue (TypeCode.tk_value);
+ repId.addValue (org.omg.CORBA.TCKind._tk_value);
+ entry.calcRepId (repId);
+ }
+ } // calcValueType
+
+ private void calcValueBoxType (ValueBoxEntry entry, ValueRepositoryId repId)
+ {
+ if (repId.isNewType (entry))
+ {
+ //<daz> repId.addValue (TypeCode.tk_value_box);
+ repId.addValue (org.omg.CORBA.TCKind._tk_value_box);
+ entry.calcRepId (repId);
+ }
+ } // calcValueBoxType
+
+ private void calcTypedefType (TypedefEntry entry, ValueRepositoryId repId)
+ {
+ if (repId.isNewType (entry))
+ {
+ Vector arrayInfo = entry.arrayInfo ();
+ if (arrayInfo.size () > 0)
+ {
+ //<daz> repId.addValue (TypeCode.tk_array);
+ repId.addValue (org.omg.CORBA.TCKind._tk_array);
+ for (Enumeration e = arrayInfo.elements (); e.hasMoreElements ();)
+ repId.addValue (((Number)((Expression)e.nextElement ()).value ()).intValue ());
+ }
+ calcType (entry.type (), repId);
+ }
+ } // calcTypedefType
+
+ private void calcType (SymtabEntry entry, ValueRepositoryId repId)
+ {
+ if (entry instanceof TypedefEntry)
+ calcTypedefType ((TypedefEntry)entry, repId);
+ else if (entry instanceof PrimitiveEntry)
+ calcPrimitiveType (entry, repId);
+ else if (entry instanceof InterfaceEntry)
+ //<daz> repId.addValue (TypeCode._tk_objref);
+ repId.addValue (org.omg.CORBA.TCKind._tk_objref);
+ else if (entry instanceof EnumEntry)
+ //<daz> repId.addValue (TypeCode._tk_enum);
+ repId.addValue (org.omg.CORBA.TCKind._tk_enum);
+ else if (entry instanceof StringEntry)
+ calcStringType ( (StringEntry) entry, repId);
+ else if (entry instanceof SequenceEntry)
+ calcSequenceType ( (SequenceEntry) entry, repId);
+ else if (entry instanceof StructEntry)
+ calcStructType ( (StructEntry) entry, repId);
+ else if (entry instanceof UnionEntry)
+ calcUnionType ( (UnionEntry) entry, repId);
+ else if (entry instanceof ValueBoxEntry)
+ calcValueBoxType ( (ValueBoxEntry) entry, repId);
+ else if (entry instanceof ValueEntry)
+ calcValueType ( (ValueEntry) entry, repId);
+ } // calcType
+
+ private static Hashtable primTypes;
+
+ private void calcPrimitiveType (SymtabEntry entry, ValueRepositoryId repId)
+ {
+ if (primTypes == null)
+ {
+ primTypes = new Hashtable ();
+ //<daz> primTypes.put ("short", new Integer (TypeCode.tk_short ));
+ primTypes.put ("short", new Integer (org.omg.CORBA.TCKind._tk_short ));
+ //<daz> primTypes.put ("long", new Integer (TypeCode.tk_long ));
+ primTypes.put ("long", new Integer (org.omg.CORBA.TCKind._tk_long ));
+ //<daz> primTypes.put ("unsigned short", new Integer (TypeCode.tk_ushort ));
+ primTypes.put ("unsigned short", new Integer (org.omg.CORBA.TCKind._tk_ushort ));
+ //<daz> primTypes.put ("unsigned long", new Integer (TypeCode.tk_ulong ));
+ primTypes.put ("unsigned long", new Integer (org.omg.CORBA.TCKind._tk_ulong ));
+ //<daz> primTypes.put ("char", new Integer (TypeCode.tk_char ));
+ primTypes.put ("char", new Integer (org.omg.CORBA.TCKind._tk_char ));
+ //<daz> primTypes.put ("wchar", new Integer (TypeCode.tk_wchar ));
+ primTypes.put ("wchar", new Integer (org.omg.CORBA.TCKind._tk_wchar ));
+ //<daz> primTypes.put ("float", new Integer (TypeCode.tk_float ));
+ primTypes.put ("float", new Integer (org.omg.CORBA.TCKind._tk_float ));
+ //<daz> primTypes.put ("double", new Integer (TypeCode.tk_double ));
+ primTypes.put ("double", new Integer (org.omg.CORBA.TCKind._tk_double ));
+ //<daz> primTypes.put ("boolean", new Integer (TypeCode.tk_boolean));
+ primTypes.put ("boolean", new Integer (org.omg.CORBA.TCKind._tk_boolean));
+ //<daz> primTypes.put ("octet", new Integer (TypeCode.tk_octet ));
+ primTypes.put ("octet", new Integer (org.omg.CORBA.TCKind._tk_octet ));
+ //<daz> primTypes.put ("any", new Integer (TypeCode.tk_any )); }
+ primTypes.put ("any", new Integer (org.omg.CORBA.TCKind._tk_any ));
+ }
+ repId.addValue (((Integer)primTypes.get (entry.name ())).intValue ());
+ } // calcPrimitiveType
+
+ private void calcStringType (StringEntry entry, ValueRepositoryId repId)
+ {
+ repId.addValue (entry.name ().equals (Parser.overrideName ("string")) ?
+ //<daz> TypeCode.tk_string:
+ org.omg.CORBA.TCKind._tk_string :
+ //<daz> TypeCode.tk_wstring);
+ org.omg.CORBA.TCKind._tk_wstring);
+ if (entry.maxSize () != null)
+ try
+ {
+ repId.addValue ( ( (Number) (entry.maxSize ()).value ()). intValue ());
+ }
+ catch (Exception exception)
+ {}
+ } // calcStringType
+
+ private void calcSequenceType (SequenceEntry entry, ValueRepositoryId repId)
+ {
+ //<daz> repId.addValue (TypeCode.tk_sequence);
+ repId.addValue (org.omg.CORBA.TCKind._tk_sequence);
+ if (entry.maxSize () != null)
+ try
+ {
+ repId.addValue (((Number)(entry.maxSize ()).value ()).intValue ());
+ }
+ catch (Exception exception)
+ {}
+ } // calcSequenceType
+
+ private void calcStructType (StructEntry entry, ValueRepositoryId repId)
+ {
+ if (repId.isNewType (entry))
+ {
+ //<daz> repId.addValue (TypeCode.tk_struct);
+ repId.addValue (org.omg.CORBA.TCKind._tk_struct);
+ for (Enumeration e = entry.members ().elements (); e.hasMoreElements ();)
+ calcTypedefType ( (TypedefEntry) e.nextElement (), repId);
+ }
+ } // calcStructType
+
+ private void calcUnionType (UnionEntry entry, ValueRepositoryId repId)
+ {
+ if (repId.isNewType (entry))
+ {
+ //<daz> repId.addValue (TypeCode.tk_union);
+ repId.addValue (org.omg.CORBA.TCKind._tk_union);
+ calcType (entry.type (), repId);
+ for (Enumeration e = entry.branches ().elements (); e.hasMoreElements ();)
+ calcTypedefType ( ( (UnionBranch) e.nextElement ()).typedef, repId);
+ }
+ } // calcUnionType
+*/
+
+ /** Get the 'custom' marshaling property. */
+ public boolean isCustom ()
+ {
+ return _custom;
+ }
+
+ /** Set the 'custom' marshaling property. */
+ public void setCustom (boolean isCustom)
+ {
+ _custom = isCustom;
+ }
+
+ /** Return whether or not the value type can be "safely" truncated to
+ its concrete parent type. */
+ public boolean isSafe ()
+ {
+ return _isSafe;
+ }
+
+ private Vector _supportsNames = new Vector ();
+ private Vector _supports = new Vector ();
+ private Vector _initializers = new Vector ();
+ private boolean _custom = false;
+ private boolean _isSafe = false;
+
+ static ValueGen valueGen;
+} // class ValueEntry
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueGen.java
new file mode 100644
index 0000000..0af0398
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueGen.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import com.sun.tools.corba.se.idl.*;
+
+public interface ValueGen extends Generator {
+ void generate ( Hashtable symbolTable, ValueEntry entry, PrintWriter stream);
+} // interface ValueGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueRepositoryId.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueRepositoryId.java
new file mode 100644
index 0000000..0aaeb0d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ValueRepositoryId.java
@@ -0,0 +1,131 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl;
+
+// NOTES:
+
+import java.security.MessageDigest;
+import java.util.Hashtable;
+
+/**
+ *
+ **/
+public class ValueRepositoryId
+{
+ private MessageDigest sha; // Message digest used to compute SHA-1
+ private int index; // Current index in the 'logical' sequence
+ private Hashtable types; // Already processed types
+ private String hashcode; // The computed hashcode
+
+ public ValueRepositoryId ()
+ {
+ try
+ {
+ sha = MessageDigest.getInstance ("SHA-1");
+ }
+ catch (Exception exception)
+ {}
+ index = 0;
+ types = new Hashtable ();
+ hashcode = null;
+ } // ctor
+
+ /**Add a value to the hashcode being computed.
+ @param value the value to be added to the value RepositoryID. */
+ public void addValue (int value)
+ {
+ sha.update ((byte)((value >> 24) & 0x0F));
+ sha.update ((byte)((value >> 16) & 0x0F));
+ sha.update ((byte)((value >> 8) & 0x0F));
+ sha.update ((byte)(value & 0x0F));
+ index++;
+ } // addValue
+
+ /** Add a type to the list of types which have already been included.
+ Note that the type should be added prior to its value.
+ @param entry the type to be added to the value RepositoryID. */
+ public void addType (SymtabEntry entry)
+ {
+ types.put (entry, new Integer (index));
+ }
+
+ /** Check to see if a specified type has already been processed. If so,
+ add the appropriate 'previously processed' code (0xFFFFFFFF) and
+ sequence offset, and return false; otherwise add the symbol table entry
+ and current offset to the hashtable and return false.
+ @param entry the type to be checked
+ @return true if the symbol table entry has not been previously added;
+ and false otherwise. */
+ public boolean isNewType (SymtabEntry entry)
+ {
+ Object index = types.get (entry);
+ if (index == null)
+ {
+ addType (entry);
+ return true;
+ }
+ addValue (0xFFFFFFFF);
+ addValue (((Integer)index).intValue ());
+ return false;
+ } // isNewType
+
+ /** Get the hashcode computed for the value type. This method MUST not be
+ called until all fields have been added, since it computes the hash
+ code from the values entered for each field.
+ @return the 64 bit hashcode for the value type represented as a
+ 16 character hexadecimal string. */
+ public String getHashcode ()
+ {
+ if (hashcode == null)
+ {
+ byte [] digest = sha.digest ();
+ hashcode = hexOf (digest[0]) + hexOf (digest[1]) +
+ hexOf (digest[2]) + hexOf (digest[3]) +
+ hexOf (digest[4]) + hexOf (digest[5]) +
+ hexOf (digest[6]) + hexOf (digest[7]);
+ }
+ return hashcode;
+ } // getHashCode
+
+ // Convert a byte to a two character hex string:
+ private static String hexOf (byte value)
+ {
+ int d1 = (value >> 4) & 0x0F;
+ int d2 = value & 0x0F;
+ return "0123456789ABCDEF".substring (d1, d1 + 1) +
+ "0123456789ABCDEF".substring (d2, d2 + 1);
+ } // hexOf
+} // class ValueRepositoryId
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/And.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/And.java
new file mode 100644
index 0000000..d382eb7
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/And.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class And extends BinaryExpr
+{
+ protected And (Expression leftOperand, Expression rightOperand)
+ {
+ super ("&", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.and"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ // Arithmetic and (&)
+ //daz value (new Long (l.longValue () & r.longValue ()));
+ BigInteger uL = (BigInteger)coerceToTarget ((BigInteger)l);
+ BigInteger uR = (BigInteger)coerceToTarget ((BigInteger)r);
+ value (uL.and (uR));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.and"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class And
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BinaryExpr.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BinaryExpr.java
new file mode 100644
index 0000000..4d4206a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BinaryExpr.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public abstract class BinaryExpr extends Expression
+{
+ public BinaryExpr (String operation, Expression leftOperand, Expression rightOperand)
+ {
+ _op = operation;
+ _left = leftOperand;
+ _right = rightOperand;
+ } // ctor
+
+ public void op (String op) {_op = (op == null)? "": op;}
+ public String op () {return _op;}
+
+ public void left (Expression left) {_left = left;}
+ public Expression left () {return _left;}
+
+ public void right (Expression right) {_right = right;}
+ public Expression right () {return _right;}
+
+ private String _op = "";
+ private Expression _left = null;
+ private Expression _right = null;
+} // class BinaryExpr
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanAnd.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanAnd.java
new file mode 100644
index 0000000..79b11f6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanAnd.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class BooleanAnd extends BinaryExpr
+{
+ protected BooleanAnd (Expression leftOperand, Expression rightOperand)
+ {
+ super ("&&", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Object tmpL = left ().evaluate ();
+ Object tmpR = right ().evaluate ();
+ Boolean l;
+ Boolean r;
+
+ //daz if (tmpL instanceof Number)
+ // l = new Boolean (((Number)tmpL).longValue () != 0);
+ // else
+ // l = (Boolean)tmpL;
+ if (tmpL instanceof Number)
+ {
+ if (tmpL instanceof BigInteger)
+ l = new Boolean (((BigInteger)tmpL).compareTo (BigInteger.valueOf (0)) != 0);
+ else
+ l = new Boolean (((Number)tmpL).longValue () != 0);
+ }
+ else
+ l = (Boolean)tmpL;
+ //daz if (tmpR instanceof Number)
+ // r = new Boolean (((Number)tmpR).longValue () != 0);
+ // else
+ // r = (Boolean)tmpR;
+ if (tmpR instanceof Number)
+ {
+ if (tmpR instanceof BigInteger)
+ r = new Boolean (((BigInteger)tmpR).compareTo (zero) != 0);
+ else
+ r = new Boolean (((Number)tmpR).longValue () != 0);
+ }
+ else
+ r = (Boolean)tmpR;
+
+ value (new Boolean (l.booleanValue () && r.booleanValue ()));
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.booleanAnd"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class BooleanAnd
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanNot.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanNot.java
new file mode 100644
index 0000000..5c15a44
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanNot.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class BooleanNot extends UnaryExpr
+{
+ protected BooleanNot (Expression operand)
+ {
+ super ("!", operand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Object tmp = operand ().evaluate ();
+ Boolean op;
+ //daz if (tmp instanceof Number)
+ // op = new Boolean (((Number)tmp).longValue () != 0);
+ // else
+ // op = (Boolean)tmp;
+ if (tmp instanceof Number)
+ {
+ if (tmp instanceof BigInteger)
+ op = new Boolean (((BigInteger)tmp).compareTo (zero) != 0);
+ else
+ op = new Boolean (((Number)tmp).longValue () != 0);
+ }
+ else
+ op = (Boolean)tmp;
+
+ value (new Boolean (!op.booleanValue ()));
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.booleanNot"), operand ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class BooleanNot
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanOr.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanOr.java
new file mode 100644
index 0000000..d225e75
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/BooleanOr.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class BooleanOr extends BinaryExpr
+{
+ protected BooleanOr (Expression leftOperand, Expression rightOperand)
+ {
+ super ("||", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Object tmpL = left ().evaluate ();
+ Object tmpR = right ().evaluate ();
+ Boolean l;
+ Boolean r;
+
+ //daz if (tmpL instanceof Number)
+ // l = new Boolean (((Number)tmpL).longValue () != 0);
+ // else
+ // l = (Boolean)tmpL;
+ if (tmpL instanceof Number)
+ {
+ if (tmpL instanceof BigInteger)
+ l = new Boolean (((BigInteger)tmpL).compareTo (zero) != 0);
+ else
+ l = new Boolean (((Number)tmpL).longValue () != 0);
+ }
+ else
+ l = (Boolean)tmpL;
+ //daz if (tmpR instanceof Number)
+ // r = new Boolean (((Number)tmpR).longValue () != 0);
+ // else
+ // r = (Boolean)tmpR;
+ if (tmpR instanceof Number)
+ {
+ if (tmpR instanceof BigInteger)
+ r = new Boolean (((BigInteger)tmpR).compareTo (BigInteger.valueOf (0)) != 0);
+ else
+ r = new Boolean (((Number)tmpR).longValue () != 0);
+ }
+ else
+ r = (Boolean)tmpR;
+ value (new Boolean (l.booleanValue () || r.booleanValue ()));
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.booleanOr"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class BooleanOr
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/DefaultExprFactory.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/DefaultExprFactory.java
new file mode 100644
index 0000000..d6984c0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/DefaultExprFactory.java
@@ -0,0 +1,191 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.ConstEntry;
+import java.math.BigInteger;
+
+public class DefaultExprFactory implements ExprFactory
+{
+ public And and (Expression left, Expression right)
+ {
+ return new And (left, right);
+ } // and
+
+ public BooleanAnd booleanAnd (Expression left, Expression right)
+ {
+ return new BooleanAnd (left, right);
+ } // booleanAnd
+
+ public BooleanNot booleanNot (Expression operand)
+ {
+ return new BooleanNot (operand);
+ } // booleanNot
+
+ public BooleanOr booleanOr (Expression left, Expression right)
+ {
+ return new BooleanOr (left, right);
+ } // booleanOr
+
+ public Divide divide (Expression left, Expression right)
+ {
+ return new Divide (left, right);
+ } // divide
+
+ public Equal equal (Expression left, Expression right)
+ {
+ return new Equal (left, right);
+ } // equal
+
+ public GreaterEqual greaterEqual (Expression left, Expression right)
+ {
+ return new GreaterEqual (left, right);
+ } // greaterEqual
+
+ public GreaterThan greaterThan (Expression left, Expression right)
+ {
+ return new GreaterThan (left, right);
+ } // greaterThan
+
+ public LessEqual lessEqual (Expression left, Expression right)
+ {
+ return new LessEqual (left, right);
+ } // lessEqual
+
+ public LessThan lessThan (Expression left, Expression right)
+ {
+ return new LessThan (left, right);
+ } // lessThan
+
+ public Minus minus (Expression left, Expression right)
+ {
+ return new Minus (left, right);
+ } // minus
+
+ public Modulo modulo (Expression left, Expression right)
+ {
+ return new Modulo (left, right);
+ } // modulo
+
+ public Negative negative (Expression operand)
+ {
+ return new Negative (operand);
+ } // negative
+
+ public Not not (Expression operand)
+ {
+ return new Not (operand);
+ } // not
+
+ public NotEqual notEqual (Expression left, Expression right)
+ {
+ return new NotEqual (left, right);
+ } // notEqual
+
+ public Or or (Expression left, Expression right)
+ {
+ return new Or (left, right);
+ } // or
+
+ public Plus plus (Expression left, Expression right)
+ {
+ return new Plus (left, right);
+ } // plus
+
+ public Positive positive (Expression operand)
+ {
+ return new Positive (operand);
+ } // positive
+
+ public ShiftLeft shiftLeft (Expression left, Expression right)
+ {
+ return new ShiftLeft (left, right);
+ } // shiftLeft
+
+ public ShiftRight shiftRight (Expression left, Expression right)
+ {
+ return new ShiftRight (left, right);
+ } // shiftRight
+
+ public Terminal terminal (String representation, Character charValue,
+ boolean isWide )
+ {
+ return new Terminal (representation, charValue, isWide );
+ } // ctor
+
+ public Terminal terminal (String representation, Boolean booleanValue)
+ {
+ return new Terminal (representation, booleanValue);
+ } // ctor
+
+ // Support long long <daz>
+ public Terminal terminal (String representation, BigInteger bigIntegerValue)
+ {
+ return new Terminal (representation, bigIntegerValue);
+ } // ctor
+
+ //daz public Terminal terminal (String representation, Long longValue)
+ // {
+ // return new Terminal (representation, longValue);
+ // } // ctor
+
+ public Terminal terminal (String representation, Double doubleValue)
+ {
+ return new Terminal (representation, doubleValue);
+ } // ctor
+
+ public Terminal terminal (String stringValue, boolean isWide )
+ {
+ return new Terminal (stringValue, isWide);
+ } // ctor
+
+ public Terminal terminal (ConstEntry constReference)
+ {
+ return new Terminal (constReference);
+ } // ctor
+
+ public Times times (Expression left, Expression right)
+ {
+ return new Times (left, right);
+ } // times
+
+ public Xor xor (Expression left, Expression right)
+ {
+ return new Xor (left, right);
+ } // xor
+} // class DefaultExprFactory
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Divide.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Divide.java
new file mode 100644
index 0000000..ab02e96
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Divide.java
@@ -0,0 +1,132 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+// -D52042<daz> Added protypical code for computing mixed-operand binary
+// expressions, which promotes result to Double only when the target type
+// is floating-point. Code violates spec, but may be usable at some future
+// time.
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+/**
+ *
+ **/
+public class Divide extends BinaryExpr
+{
+ /**
+ * Constructor: set operation and operands.
+ **/
+ protected Divide (Expression leftOperand, Expression rightOperand)
+ {
+ super ("/", leftOperand, rightOperand);
+ } // ctor
+
+ /**
+ *
+ **/
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ boolean lIsNonInteger = l instanceof Float || l instanceof Double;
+ boolean rIsNonInteger = r instanceof Float || r instanceof Double;
+
+ if (lIsNonInteger && rIsNonInteger)
+ value (new Double (l.doubleValue () / r.doubleValue ()));
+ else if (lIsNonInteger || rIsNonInteger)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.divide"),
+ left ().value ().getClass ().getName (),
+ right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
+ value (tmpL.divide (tmpR));
+ }
+ // <d52042> Allow evaluation over mixed operands. Supplant code above.
+ /*
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ boolean lIsNonInteger = l instanceof Float || l instanceof Double;
+ boolean rIsNonInteger = r instanceof Float || r instanceof Double;
+
+ // Floating-point operands.
+ if (lIsNonInteger && rIsNonInteger)
+ {
+ value (new Double (l.doubleValue () / r.doubleValue ()));
+ }
+ // Integral operands.
+ else if (!(lIsNonInteger || rIsNonInteger))
+ {
+ BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
+ value (tmpL.divide (tmpR));
+ }
+ // Mixed operands: one operand is floating-point, the other is integral.
+ else
+ {
+ // Legal over floating-point types only.
+ if (type ().equals ("float") ||
+ type ().equals ("double"))
+ {
+ value (new Double (l.doubleValue () / r.doubleValue ()));
+ }
+ else
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.divide"),
+ left ().value ().getClass ().getName (),
+ right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ }
+ */
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.divide"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Divide
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Equal.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Equal.java
new file mode 100644
index 0000000..c43c010
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Equal.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class Equal extends BinaryExpr
+{
+ protected Equal (Expression leftOperand, Expression rightOperand)
+ {
+ super ("==", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Object left = left ().evaluate ();
+ if (left instanceof Boolean)
+ {
+ Boolean l = (Boolean)left;
+ Boolean r = (Boolean)right ().evaluate ();
+ value (new Boolean (l.booleanValue () == r.booleanValue()));
+ }
+ else
+ {
+ Number l = (Number)left;
+ Number r = (Number)right ().evaluate ();
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ value (new Boolean (l.doubleValue () == r.doubleValue ()));
+ else
+ //daz value (new Boolean (l.longValue () == r.longValue ()));
+ value (new Boolean (((BigInteger)l).equals ((BigInteger)r)));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.equal"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Equal
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/EvaluationException.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/EvaluationException.java
new file mode 100644
index 0000000..c04fa34
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/EvaluationException.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+public class EvaluationException extends Exception
+{
+ public EvaluationException (String message)
+ {
+ super (message);
+ } // ctor
+} // class EvaluationException
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ExprFactory.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ExprFactory.java
new file mode 100644
index 0000000..f017a64
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ExprFactory.java
@@ -0,0 +1,75 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.ConstEntry;
+import java.math.BigInteger;
+
+public interface ExprFactory
+{
+ And and (Expression left, Expression right);
+ BooleanAnd booleanAnd (Expression left, Expression right);
+ BooleanNot booleanNot (Expression operand);
+ BooleanOr booleanOr (Expression left, Expression right);
+ Divide divide (Expression left, Expression right);
+ Equal equal (Expression left, Expression right);
+ GreaterEqual greaterEqual (Expression left, Expression right);
+ GreaterThan greaterThan (Expression left, Expression right);
+ LessEqual lessEqual (Expression left, Expression right);
+ LessThan lessThan (Expression left, Expression right);
+ Minus minus (Expression left, Expression right);
+ Modulo modulo (Expression left, Expression right);
+ Negative negative (Expression operand);
+ Not not (Expression operand);
+ NotEqual notEqual (Expression left, Expression right);
+ Or or (Expression left, Expression right);
+ Plus plus (Expression left, Expression right);
+ Positive positive (Expression operand);
+ ShiftLeft shiftLeft (Expression left, Expression right);
+ ShiftRight shiftRight (Expression left, Expression right);
+ Terminal terminal (String representation, Character charValue,
+ boolean isWide );
+ Terminal terminal (String representation, Boolean booleanValue);
+ //daz Terminal terminal (String representation, Long longValue);
+ Terminal terminal (String representation, Double doubleValue);
+ Terminal terminal (String representation, BigInteger bigIntegerValue);
+ Terminal terminal (String stringValue, boolean isWide );
+ Terminal terminal (ConstEntry constReference);
+ Times times (Expression left, Expression right);
+ Xor xor (Expression left, Expression right);
+} // interface ExprFactory
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Expression.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Expression.java
new file mode 100644
index 0000000..84a1873
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Expression.java
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import java.math.BigInteger;
+
+public abstract class Expression
+{
+ /**
+ * Compute the value of this expression.
+ **/
+ public abstract Object evaluate () throws EvaluationException;
+
+ /**
+ * Set the value of this expression.
+ **/
+ public void value (Object value)
+ {
+ _value = value;
+ }
+ /**
+ * Get the value of this expression.
+ **/
+ public Object value ()
+ {
+ return _value;
+ }
+
+ /**
+ * Set the representation of this expression.
+ **/
+ public void rep (String rep)
+ {
+ _rep = rep;
+ }
+ /**
+ * Get the representation of this expression.
+ **/
+ public String rep ()
+ {
+ return _rep;
+ }
+
+ /**
+ * Set the target type of this expression.
+ **/
+ public void type (String type)
+ {
+ _type = type;
+ }
+ /**
+ * Get the target type of this expression.
+ **/
+ public String type ()
+ {
+ return _type;
+ }
+
+ /**
+ * Return the default computation type for the given target type.
+ **/
+ protected static String defaultType (String targetType)
+ {
+ return (targetType == null) ? new String ("") : targetType;
+ } // defaultType
+
+ // BigInteger is a multi-precision number whose representation contains
+ // a signum (sign-number = 1, -1) and a magnitude. To support "long long",
+ // all integer expressions are now performed over BigInteger and stored as
+ // such. During the evaluation of an integer expression, the signum of its
+ // value may toggle, which may cause the value of an expression to conflict
+ // with its target type: [Case 1] If the resulting value is negative
+ // (signum=-1) and the target type is unsigned; or [Case 2] if the resulting
+ // value is positive (signum=1) and greater than 2**(target-type-length - 1),
+ // and the target type is signed, then the resulting value will be out of
+ // range. However, this value is correct and must be coerced to the target
+ // type. E.G., After appying "not" to a BigInteger, the result is
+ // a BigInteger that represents its 2's-complement (~5 => -6 in a byte-space).
+ // In this example, the signum toggles and the magnatude is 6. If the target
+ // type of this value were unsigned short, it must be coerced to a positive
+ // number whose bits truly represent -6 in 2's-complement (250 in a byte-space).
+ //
+ // Also, floating types may now be intialized with any integer expression.
+ // The result must be coerced to Double.
+ //
+ // Use the following routines to coerce this expression's value to its
+ // "target" type.
+
+ /**
+ * Coerces a number to the target type of this expression.
+ * @param obj The number to coerce.
+ * @return the value of number coerced to the (target) type of
+ * this expression.
+ **/
+ public Object coerceToTarget (Object obj)
+ {
+ if (obj instanceof BigInteger)
+ {
+ if (type ().indexOf ("unsigned") >= 0)
+ return toUnsignedTarget ((BigInteger)obj);
+ else
+ return toSignedTarget ((BigInteger)obj);
+ }
+ return obj;
+ } // coerceToTarget
+
+ /**
+ * Coerces an integral value (BigInteger) to its corresponding unsigned
+ * representation, if the target type of this expression is unsigned.
+ * @param b The BigInteger to be coerced.
+ * @return the value of an integral type coerced to its corresponding
+ * unsigned integral type, if the target type of this expression is
+ * unsigned.
+ **/
+ protected BigInteger toUnsignedTarget (BigInteger b)
+ {
+ if (type ().equals ("unsigned short")) // target type of this expression
+ {
+ if (b != null && b.compareTo (zero) < 0) // error if value < min = -(2**(l-1)).
+ return b.add (twoPow16);
+ }
+ else if (type ().equals ("unsigned long"))
+ {
+ if (b != null && b.compareTo (zero) < 0)
+ return b.add (twoPow32);
+ }
+ else if (type ().equals ("unsigned long long"))
+ {
+ if (b != null && b.compareTo (zero) < 0)
+ return b.add (twoPow64);
+ }
+ return b;
+ } // toUnsignedTarget
+
+ /**
+ * Coerces an integral value (BigInteger) to its corresponding signed
+ * representation, if the target type of this expression is signed.
+ * @param b The BigInteger to be coerced.
+ * @return the value of an integral type coerced to its corresponding
+ * signed integral type, if the target type of this expression is
+ * signed.
+ **/
+ protected BigInteger toSignedTarget (BigInteger b)
+ {
+ if (type ().equals ("short"))
+ {
+ if (b != null && b.compareTo (sMax) > 0)
+ return b.subtract (twoPow16);
+ }
+ else if (type ().equals ("long"))
+ {
+ if (b != null && b.compareTo (lMax) > 0)
+ return b.subtract (twoPow32);
+ }
+ else if (type ().equals ("long long"))
+ {
+ if (b != null && b.compareTo (llMax) > 0)
+ return b.subtract (twoPow64);
+ }
+ return b;
+ } // toSignedTarget
+
+ /**
+ * Return the unsigned value of a BigInteger.
+ **/
+ protected BigInteger toUnsigned (BigInteger b)
+ {
+ if (b != null && b.signum () == -1)
+ if (type ().equals ("short"))
+ return b.add (twoPow16);
+ else if (type ().equals ("long"))
+ return b.add (twoPow32);
+ else if (type ().equals ("long long"))
+ return b.add (twoPow64);
+ return b;
+ }
+
+ // Integral-type boundaries.
+
+ public static final BigInteger negOne = BigInteger.valueOf (-1);
+ public static final BigInteger zero = BigInteger.valueOf (0);
+ public static final BigInteger one = BigInteger.valueOf (1);
+ public static final BigInteger two = BigInteger.valueOf (2);
+
+ public static final BigInteger twoPow15 = two.pow (15);
+ public static final BigInteger twoPow16 = two.pow (16);
+ public static final BigInteger twoPow31 = two.pow (31);
+ public static final BigInteger twoPow32 = two.pow (32);
+ public static final BigInteger twoPow63 = two.pow (63);
+ public static final BigInteger twoPow64 = two.pow (64);
+
+ public static final BigInteger sMax = BigInteger.valueOf (Short.MAX_VALUE);
+ public static final BigInteger sMin = BigInteger.valueOf (Short.MAX_VALUE);
+
+ public static final BigInteger usMax = sMax.multiply (two).add (one);
+ public static final BigInteger usMin = zero;
+
+ public static final BigInteger lMax = BigInteger.valueOf (Integer.MAX_VALUE);
+ public static final BigInteger lMin = BigInteger.valueOf (Integer.MAX_VALUE);
+
+ public static final BigInteger ulMax = lMax.multiply (two).add (one);
+ public static final BigInteger ulMin = zero;
+
+ public static final BigInteger llMax = BigInteger.valueOf (Long.MAX_VALUE);
+ public static final BigInteger llMin = BigInteger.valueOf (Long.MIN_VALUE);
+
+ public static final BigInteger ullMax = llMax.multiply (two).add (one);
+ public static final BigInteger ullMin = zero;
+
+ /**
+ * Value of this expression: Boolean, Char, Byte, BigInteger, Double,
+ * String, Expression, ConstEntry.
+ **/
+ private Object _value = null;
+ /**
+ * String representation of this expression.
+ **/
+ private String _rep = null;
+ /**
+ * Computation type of this (sub)expression = Target type for now.
+ **/
+ private String _type = null;
+} // abstract class Expression
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterEqual.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterEqual.java
new file mode 100644
index 0000000..729eb6d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterEqual.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class GreaterEqual extends BinaryExpr
+{
+ protected GreaterEqual (Expression leftOperand, Expression rightOperand)
+ {
+ super (">=", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Object left = left ().evaluate ();
+ Object right = right ().evaluate ();
+ if (left instanceof Boolean)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.greaterEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ Number l = (Number)left;
+ Number r = (Number)right ().evaluate ();
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ value (new Boolean (l.doubleValue () >= r.doubleValue ()));
+ else
+ //daz value (new Boolean (l.longValue () >= r.longValue ()));
+ value (new Boolean ( ((BigInteger)l).compareTo ((BigInteger)r) >= 0));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.greaterEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class GreaterEqual
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterThan.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterThan.java
new file mode 100644
index 0000000..bcc2b19
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/GreaterThan.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class GreaterThan extends BinaryExpr
+{
+ protected GreaterThan (Expression leftOperand, Expression rightOperand)
+ {
+ super (">", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Object left = left ().evaluate ();
+ Object right = right ().evaluate ();
+ if (left instanceof Boolean)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.greaterThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ Number l = (Number)left;
+ Number r = (Number)right ().evaluate ();
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ value (new Boolean (l.doubleValue () > r.doubleValue ()));
+ else
+ //daz value (new Boolean (l.longValue () > r.longValue ()));
+ value (new Boolean ( ((BigInteger)l).compareTo ((BigInteger)r) > 0));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.greaterThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class GreaterThan
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/LessEqual.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/LessEqual.java
new file mode 100644
index 0000000..6d4f305
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/LessEqual.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class LessEqual extends BinaryExpr
+{
+ protected LessEqual (Expression leftOperand, Expression rightOperand)
+ {
+ super ("<=", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Object left = left ().evaluate ();
+ Object right = right ().evaluate ();
+ if (left instanceof Boolean)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.lessEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ Number l = (Number)left;
+ Number r = (Number)right ().evaluate ();
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ value (new Boolean (l.doubleValue () <= r.doubleValue ()));
+ else
+ //daz value (new Boolean (l.longValue () <= r.longValue ()));
+ value (new Boolean ( ((BigInteger)l).compareTo ((BigInteger)r) <= 0));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.lessEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class LessEqual
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/LessThan.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/LessThan.java
new file mode 100644
index 0000000..40eed04
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/LessThan.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class LessThan extends BinaryExpr
+{
+ protected LessThan (Expression leftOperand, Expression rightOperand)
+ {
+ super ("<", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Object left = left ().evaluate ();
+ Object right = right ().evaluate ();
+ if (left instanceof Boolean)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.lessThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ Number l = (Number)left;
+ Number r = (Number)right ().evaluate ();
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ value (new Boolean (l.doubleValue () < r.doubleValue ()));
+ else
+ //daz value (new Boolean (l.longValue () < r.longValue ()));
+ value (new Boolean (((BigInteger)l).compareTo ((BigInteger)r) < 0));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.lessThan"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class LessThan
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Minus.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Minus.java
new file mode 100644
index 0000000..6c5af1a
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Minus.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class Minus extends BinaryExpr
+{
+ protected Minus (Expression leftOperand, Expression rightOperand)
+ {
+ super ("-", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ boolean lIsNonInteger = l instanceof Float || l instanceof Double;
+ boolean rIsNonInteger = r instanceof Float || r instanceof Double;
+
+ if (lIsNonInteger && rIsNonInteger)
+ value (new Double (l.doubleValue () - r.doubleValue ()));
+ else if (lIsNonInteger || rIsNonInteger)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.minus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ // Subtraction (-)
+ BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
+ value (tmpL.subtract (tmpR));
+ //daz value (new Long (l.longValue () - r.longValue ()));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.minus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Minus
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Modulo.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Modulo.java
new file mode 100644
index 0000000..53b2eef
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Modulo.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class Modulo extends BinaryExpr
+{
+ protected Modulo (Expression leftOperand, Expression rightOperand)
+ {
+ super ("%", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.mod"), left().value ().getClass ().getName (), right().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ // Modulo (%)
+ BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
+ value (tmpL.remainder (tmpR));
+ //daz value (tmpL.mod (tmpR)); Requires positive modulus; not required by IDL.
+ //daz value (new Long (l.longValue () % r.longValue ()));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.mod"), left().value ().getClass ().getName (), right().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Modulo
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Negative.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Negative.java
new file mode 100644
index 0000000..1cc9491
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Negative.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class Negative extends UnaryExpr
+{
+ protected Negative (Expression operand)
+ {
+ super ("-", operand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number op = (Number)operand ().evaluate ();
+
+ if (op instanceof Float || op instanceof Double)
+ value (new Double (-op.doubleValue ()));
+ else
+ {
+ // Multiply by -1
+ //daz value (new Long (-op.longValue ()));
+ BigInteger tmpOp = (BigInteger)op;
+ value (tmpOp.multiply (BigInteger.valueOf (-1)));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.neg"), operand ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Negative
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Not.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Not.java
new file mode 100644
index 0000000..007b1e1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Not.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class Not extends UnaryExpr
+{
+ protected Not (Expression operand)
+ {
+ super ("~", operand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number op = (Number)operand ().evaluate ();
+
+ if (op instanceof Float || op instanceof Double)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.not"), operand ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters));
+ }
+ else
+ {
+ // Complement (~)
+ //daz value (new Long (~op.longValue ()));
+ BigInteger b = (BigInteger)coerceToTarget((BigInteger)op);
+
+ // Compute according to CORBA 2.1 specifications for specified type.
+ if (type ().equals ("short") || type ().equals ("long") || type ().equals ("long long"))
+ value (b.add (one).multiply (negOne));
+ else if (type ().equals("unsigned short"))
+ // "short" not CORBA compliant, but necessary for logical operations--size matters!
+ value (twoPow16.subtract (one).subtract (b));
+ else if (type ().equals ("unsigned long"))
+ value (twoPow32.subtract (one).subtract (b));
+ else if (type ().equals ("unsigned long long"))
+ value (twoPow64.subtract (one).subtract (b));
+ else
+ value (b.not ()); // Should never execute...
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.not"), operand ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Not
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/NotEqual.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/NotEqual.java
new file mode 100644
index 0000000..5ce0d68
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/NotEqual.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class NotEqual extends BinaryExpr
+{
+ protected NotEqual (Expression leftOperand, Expression rightOperand)
+ {
+ super ("!=", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Object left = left ().evaluate ();
+ if (left instanceof Boolean)
+ {
+ Boolean l = (Boolean)left;
+ Boolean r = (Boolean)right ().evaluate ();
+ value (new Boolean (l.booleanValue () != r.booleanValue()));
+ }
+ else
+ {
+ Number l = (Number)left;
+ Number r = (Number)right ().evaluate ();
+
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ value (new Boolean (l.doubleValue () != r.doubleValue ()));
+ else
+ //daz value (new Boolean (l.longValue () != r.longValue ()));
+ value (new Boolean (!((BigInteger)l).equals ((BigInteger)r)));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.notEqual"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class NotEqual
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Or.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Or.java
new file mode 100644
index 0000000..b5906b1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Or.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class Or extends BinaryExpr
+{
+ protected Or (Expression leftOperand, Expression rightOperand)
+ {
+ super ("|", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.or"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ // or
+ //daz value (new Long (l.longValue () | r.longValue ()));
+ BigInteger uL = (BigInteger)toUnsigned((BigInteger)l);
+ BigInteger uR = (BigInteger)toUnsigned((BigInteger)r);
+ value((BigInteger)coerceToTarget(uL.or (uR)));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.or"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Or
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Plus.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Plus.java
new file mode 100644
index 0000000..d936501
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Plus.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class Plus extends BinaryExpr
+{
+ protected Plus (Expression leftOperand, Expression rightOperand)
+ {
+ super ("+", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ boolean lIsNonInteger = l instanceof Float || l instanceof Double;
+ boolean rIsNonInteger = r instanceof Float || r instanceof Double;
+
+ if (lIsNonInteger && rIsNonInteger)
+ value (new Double (l.doubleValue () + r.doubleValue ()));
+ else if (lIsNonInteger || rIsNonInteger)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.plus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ // Addition (+)
+ BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
+ value (tmpL.add (tmpR));
+ //daz value (new Long (l.longValue () + r.longValue ()));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.plus"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Plus
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Positive.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Positive.java
new file mode 100644
index 0000000..dbc822b
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Positive.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class Positive extends UnaryExpr
+{
+ protected Positive (Expression operand)
+ {
+ super ("+", operand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number op = (Number)operand ().evaluate ();
+
+ if (op instanceof Float || op instanceof Double)
+ value (new Double (+op.doubleValue ()));
+ else
+ {
+ // Multiply by sign
+ //daz value (new Long (+op.longValue ()));
+ value (((BigInteger)op).multiply (BigInteger.valueOf (((BigInteger)op).signum ())));
+ //promote ();
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.pos"), operand ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.2", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Positive
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftLeft.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftLeft.java
new file mode 100644
index 0000000..8ebb7dd
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftLeft.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class ShiftLeft extends BinaryExpr
+{
+ protected ShiftLeft (Expression leftOperand, Expression rightOperand)
+ {
+ super ("<<", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.left"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ // Shift left (<<)
+ //daz value (new Long (l.longValue () << r.longValue ()));
+ BigInteger bL = (BigInteger)coerceToTarget (l);
+ BigInteger bR = (BigInteger)r;
+
+ BigInteger ls = bL.shiftLeft (bR.intValue ());
+
+ if (type ().indexOf ("short") >= 0)
+ ls = ls.mod (twoPow16);
+ else if (type ().indexOf ("long") >= 0)
+ ls = ls.mod (twoPow32);
+ else if (type ().indexOf ("long long") >= 0)
+ ls = ls.mod (twoPow64);
+
+ value (coerceToTarget (ls));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.left"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class ShiftLeft
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftRight.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftRight.java
new file mode 100644
index 0000000..f832738
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/ShiftRight.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class ShiftRight extends BinaryExpr
+{
+ protected ShiftRight (Expression leftOperand, Expression rightOperand)
+ {
+ super (">>", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.right"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ // Shift right (>>)
+ //daz value (new Long (l.longValue () >> r.longValue ()));
+ BigInteger bL = (BigInteger)coerceToTarget ((BigInteger)l);
+ BigInteger bR = (BigInteger)r;
+
+ // Change signed to unsigned (Clear sign bit--can be done when setting bL!)
+ if (bL.signum () == -1)
+ if (type ().equals ("short"))
+ bL = bL.add (twoPow16);
+ else if (type ().equals ("long"))
+ bL = bL.add (twoPow32);
+ else if (type ().equals ("long long"))
+ bL = bL.add (twoPow64);
+
+ value (bL.shiftRight (bR.intValue ()));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.right"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class ShiftRight
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Terminal.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Terminal.java
new file mode 100644
index 0000000..ebe3fd2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Terminal.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.ConstEntry;
+import java.math.BigInteger;
+
+/**
+ * This class contains values. Objects of this class are the terminal
+ * nodes of an expression tree.
+ * <p>
+ * Note that there is a constructor for Double values, but not Float.
+ * CORBA defines that all floating point expressions are evaluated as
+ * double, and that the result is coerced back to float if necessary.
+ * <p>
+ * Note also that there is a constructor for long values, but not for
+ * int or short. CORBA defines that all integral expressions are evaluated
+ * as unsigned long. A CORBA long is a Java int. There is no unsigned int
+ * in Java, so the next larger type, long, is used.
+ **/
+public class Terminal extends Expression
+{
+ protected Terminal (String representation, Character charValue,
+ boolean isWide)
+ {
+ rep (representation);
+ value (charValue);
+ if (isWide)
+ type( "wchar" ) ;
+ else
+ type( "char" ) ;
+ } // ctor
+
+ protected Terminal (String representation, Boolean booleanValue)
+ {
+ rep (representation);
+ value (booleanValue);
+ } // ctor
+
+ // Support long long <daz>
+ protected Terminal (String representation, BigInteger bigIntegerValue)
+ {
+ rep (representation);
+ value (bigIntegerValue);
+ } // ctor
+
+ protected Terminal (String representation, Long longValue)
+ {
+ long lv = longValue.longValue ();
+ rep (representation);
+ if (lv > Integer.MAX_VALUE || lv < Integer.MIN_VALUE)
+ value (longValue);
+ else
+ value (new Integer (longValue.intValue ()));
+ } // ctor
+
+ protected Terminal (String representation, Double doubleValue)
+ {
+ rep (representation);
+ value (doubleValue);
+ } // ctor
+
+ protected Terminal (String stringValue, boolean isWide )
+ {
+ rep (stringValue);
+ value (stringValue);
+ if (isWide)
+ type( "wstring" ) ;
+ else
+ type( "string" ) ;
+ } // ctor
+
+ protected Terminal (ConstEntry constReference)
+ {
+ rep (constReference.fullName ());
+ value (constReference);
+ } // ctor
+
+ ///// INSTANCE METHODS
+ public Object evaluate () throws EvaluationException
+ {
+ if (value () instanceof ConstEntry)
+ return ((ConstEntry)value ()).value ().evaluate ();
+ else
+ return value ();
+ } // evaluate
+} // class Terminal
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Times.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Times.java
new file mode 100644
index 0000000..77c4ce8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Times.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class Times extends BinaryExpr
+{
+ protected Times (Expression leftOperand, Expression rightOperand)
+ {
+ super ("*", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ boolean lIsNonInteger = l instanceof Float || l instanceof Double;
+ boolean rIsNonInteger = r instanceof Float || r instanceof Double;
+
+ if (lIsNonInteger && rIsNonInteger)
+ value (new Double (l.doubleValue () * r.doubleValue ()));
+ else if (lIsNonInteger || rIsNonInteger)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.times"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ // Multiplication (*)
+ BigInteger tmpL = (BigInteger)l, tmpR = (BigInteger)r;
+ value (tmpL.multiply (tmpR));
+ //daz value (new Long (l.longValue () * r.longValue ()));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.times"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Times
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/UnaryExpr.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/UnaryExpr.java
new file mode 100644
index 0000000..06fdc6c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/UnaryExpr.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public abstract class UnaryExpr extends Expression
+{
+ public UnaryExpr (String operation, Expression unaryOperand)
+ {
+ _op = operation;
+ _operand = unaryOperand;
+ } // ctor
+
+ public void op (String op) {_op = (op == null)? "": op;}
+ public String op () {return _op;}
+
+ public void operand (Expression operand) {_operand = operand;}
+ public Expression operand () {return _operand;}
+
+ private String _op = "";
+ private Expression _operand = null;
+} // class UnaryExpr
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Xor.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Xor.java
new file mode 100644
index 0000000..6cb4913
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/constExpr/Xor.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.constExpr;
+
+// NOTES:
+
+import com.sun.tools.corba.se.idl.Util;
+import java.math.BigInteger;
+
+public class Xor extends BinaryExpr
+{
+ protected Xor (Expression leftOperand, Expression rightOperand)
+ {
+ super ("^", leftOperand, rightOperand);
+ } // ctor
+
+ public Object evaluate () throws EvaluationException
+ {
+ try
+ {
+ Number l = (Number)left ().evaluate ();
+ Number r = (Number)right ().evaluate ();
+
+ if (l instanceof Float || l instanceof Double || r instanceof Float || r instanceof Double)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.xor"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ else
+ {
+ // Xor (^)
+ //daz value (new Long (l.longValue () ^ r.longValue ()));
+ //BigInteger uL = (BigInteger)toUnsigned((BigInteger)l);
+ //BigInteger uR = (BigInteger)toUnsigned((BigInteger)r);
+ //value (coerceToTarget(uL.xor (uR)));
+ BigInteger uL = (BigInteger)coerceToTarget((BigInteger)l);
+ BigInteger uR = (BigInteger)coerceToTarget((BigInteger)r);
+ value (uL.xor (uR));
+ }
+ }
+ catch (ClassCastException e)
+ {
+ String[] parameters = {Util.getMessage ("EvaluationException.xor"), left ().value ().getClass ().getName (), right ().value ().getClass ().getName ()};
+ throw new EvaluationException (Util.getMessage ("EvaluationException.1", parameters));
+ }
+ return value ();
+ } // evaluate
+} // class Xor
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/first.set b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/first.set
new file mode 100644
index 0000000..ff7f966
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/first.set
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998
+ *
+ */
+
+CORBA IDL
+---------------
+
+<specification> typedef, struct, union, enum, const, exception, interface, module
+
+<specification'> <FOLLOW>, typedef, struct, union, enum, const, exception, interface, module
+
+<definition> typedef, struct, union, enum, const, exception, interface, module
+
+<module> module
+
+<module'> typedef, struct, union, enum, const, exception, interface, module
+
+<module''> typedef, struct, union, enum, const, exception, interface, module, <FOLLOW>
+
+<interface> interface
+
+<interface'> <FOLLOW>, :, {
+
+<interface_dcl> :, {
+
+<interface_body> typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state
+
+<interface_body'> <FOLLOW>, typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state
+
+<export> typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state
+
+<state_def> state
+
+<state_def'> private, protected, public, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum, <FOLLOW>
+
+<state_member> private, protected, public, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<state_modifier> private, protected, public
+
+<inheritance_spec> :
+
+<inheritance_spec'> <FOLLOW>, ","
+
+<scoped_name> id, ::
+
+<scoped_name'> <FOLLOW>, ::
+
+<const_dcl> const
+
+<const_type> long, short, unsigned, char, boolean, float, double, string, id, ::
+
+<const_exp> -, +, ~, id, ::, literal, (
+
+<or_expr> -, +, ~, id, ::, literal, (
+
+<or_expr'> <FOLLOW>, |
+
+<xor_expr> -, +, ~, id, ::, literal, (
+
+<xor_expr'> <FOLLOW>, ^
+
+<and_expr> -, +, ~, id, ::, literal, (
+
+<and_expr'> <FOLLOW>, &
+
+<shift_expr> -, +, ~, id, ::, literal, (
+
+<shift_expr'> <FOLLOW>, >>, <<
+
+<add_expr> -, +, ~, id, ::, literal, (
+
+<add_expr'> <FOLLOW>, +, -
+
+<mult_expr> -, +, ~, id, ::, literal, (
+
+<mult_expr'> <FOLLOW>, *, /, %
+
+<unary_expr> -, +, ~, id, ::, literal, (
+
+<unary_operator> -, +, ~
+
+<primary_expr> id, ::, literal, (
+
+<literal> literals
+
+<positive_int_const> -, +, ~, id, ::, literal, (
+
+<type_dcl> typedef, struct, union, enum
+
+<type_declarator> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<type_spec> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<simple_type_spec> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::
+
+<base_type_spec> float, double, long, short, unsigned, char, boolean, octet, any
+
+<template_type_spec> sequence, string
+
+<constr_type_spec> struct, union, enum
+
+<declarators> id
+
+<declarators'> <FOLLOW>, ","
+
+<declarator> id
+
+<declarator'> <FOLLOW>, [
+
+<floating_pt_type> float, double
+
+<integer_type> long, short, unsigned
+
+<signed_int> long, short
+
+<unsigned_int> unsigned
+
+<char_type> char
+
+<boolean_type> boolean
+
+<octet_type> octet
+
+<any_type> any
+
+<struct_type> struct
+
+<member_list> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<member_list'> <FOLLOW>, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<member> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<union_type> union
+
+<switch_type_spec> long, short, unsigned, char, boolean, enum, id, ::
+
+<switch_body> case, default
+
+<switch_body'> <FOLLOW>, case, default
+
+<case> case, default
+
+<case'> <FOLLOW>, case, default
+
+<case_label> case, default
+
+<element_spec> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<enum_type> enum
+
+<enum_type'> <FOLLOW>, ","
+
+<sequence_type> sequence
+
+<sequence_type'> ",", >
+
+<string_type> string
+
+<string_type'> <FOLLOW>, <
+
+<fixed_array_size> [
+
+<attr_dcl> readonly, attribute
+
+<attr_dcl'> <FOLLOW>, ","
+
+<except_dcl> exception
+
+<except_dcl'> <FOLLOW>, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<op_dcl> oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void
+
+<op_dcl'> id, macroID
+
+<op_dcl''> <FOLLOW>, raises, context, ;
+
+<op_dcl'''> <FOLLOW>, context
+
+<op_attribute> oneway
+
+<op_type_spec> float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void
+
+<parameter_dcls> (
+
+<parameter_dcls'> in, out, inout, )
+
+<parameter_dcls''> <FOLLOW>, ","
+
+<param_dcl> in, out, inout
+
+<param_attribute> in, out, inout
+
+<raises_expr> raises
+
+<raises_expr'> <FOLLOW>, ","
+
+<context_expr> context
+
+<context_expr'> <FOLLOW>, ","
+
+<param_type_spec> float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::
+
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/follow.set b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/follow.set
new file mode 100644
index 0000000..bdd1d57
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/follow.set
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998
+ *
+ */
+
+CORBA IDL
+-----------------
+
+<specification> EOF
+
+<specification'> EOF
+
+<definition> EOF, typedef, struct, union, enum, const, exception, interface, module, }
+
+<module> ;
+
+<module'> }
+
+<module''> }
+
+<interface> ;
+
+<interface'> ;
+
+<interface_dcl> ;
+
+<interface_body> }
+
+<interface_body'> }
+
+<export> typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state, }
+
+<state_def> typedef, struct, union, enum, const, exception, readonly, attribute, oneway, float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void, state, }
+
+<state_def'> }
+
+<state_member> private, protected, public, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum, }
+
+<state_modifier> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<inheritance_spec> {
+
+<inheritance_spec'> {
+
+<scoped_name> ",", {, id, ::, literal, (, >, ), macroID
+
+<scoped_name'> ",", {, id, ::, literal, (, >, ), macroID
+
+<const_dcl> ;
+
+<const_type> id
+
+<const_exp> ;, ), >, ], :
+
+<or_expr> ;, ), >, ], :
+
+<or_expr'> ;, ), >, ], :
+
+<xor_expr> |, ;, ), >, ], :
+
+<xor_expr'> | ;, ), >, ], :
+
+<and_expr> ^, |, ;, ), >, ], :
+
+<and_expr'> ^, |, ;, ), >, ], :
+
+<shift_expr> &, ^, |, ;, ), >, ], :
+
+<shift_expr'> &, ^, |, ;, ), >, ], :
+
+<add_expr> >>, <<, &, ^, |, ;, ), >, ], :
+
+<add_expr'> >>, <<, &, ^, |, ;, ), >, ], :
+
+<mult_expr> >>, <<, &, ^, |, ;, ), >, ], :
+
+<mult_expr'> +, -, >>, <<, &, ^, |, ;, ), >, ], :
+
+<unary_expr> *, /, %, +, -, >>, <<, &, ^, |, ;, ), >, ], :
+
+<unary_operator> id, ::, literal, (
+
+<primary_expr> *, /, %, +, -, >>, <<, &, ^, |, ;, ), >, ], :
+
+<literal> *, /, %, +, -, >>, <<, &, ^, |, ;, ), >, ], : (and , for string literal in <context_expr>)
+
+<positive_int_const> >, ]
+
+<type_dcl> ;
+
+<type_declarator> ;
+
+<type_spec> id
+
+<simple_type_spec> id, ",", >
+
+<base_type_spec> id, ",", >, macroID
+
+<template_type_spec> id, ",", >
+
+<constr_type_spec> id
+
+<declarators> ;
+
+<declarators'> ;
+
+<declarator> ",", ;
+
+<declarator'> ",", ;
+
+<floating_pt_type> id, ",", >, macroID
+
+<integer_type> id, ",", >, macroID, )
+
+<signed_int> id, ",", >, macroID, )
+
+<unsigned_int> id, ",", >, macroID, )
+
+<char_type> id, ",", >, macroID, )
+
+<boolean_type> id, ",", >, macroID, )
+
+<octet_type> id, ",", >, macroID
+
+<any_type> id, ",", >, macroID
+
+<struct_type> ;, id
+
+<member_list> }
+
+<member_list'> }
+
+<member> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum, }
+
+<union_type> ;, id
+
+<switch_type_spec> )
+
+<switch_body> }
+
+<switch_body'> }
+
+<case> case, default, }
+
+<case'> float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<case_label> case, default, float, double, long, short, unsigned, char, boolean, octet, any, sequence, string, id, ::, struct, union, enum
+
+<element_spec> ;
+
+<enum_type> ;, id, )
+
+<enum_type'> }
+
+<sequence_type> id, ",", >
+
+<sequence_type'> id, ",", >
+
+<string_type> id, ",", >, macroID
+
+<string_type'> id, ",", >, macroID
+
+<fixed_array_size> [, ",", ;
+
+<attr_dcl> ;
+
+<attr_dcl'> ;
+
+<except_dcl> ;
+
+<except_dcl'> }
+
+<op_dcl> ;
+
+<op_dcl'> ;
+
+<op_dcl''> ;
+
+<op_dcl'''> ;
+
+<op_attribute> float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::, void
+
+<op_type_spec> id, macroID
+
+<parameter_dcls> raises, context, ;
+
+<parameter_dcls'> raises, context, ;
+
+<parameter_dcls''> )
+
+<param_dcl> , )
+
+<param_attribute> float, double, long, short, unsigned, char, boolean, octet, any, string, id, ::
+
+<raises_expr> context, ;
+
+<raises_expr'> )
+
+<context_expr> ;
+
+<context_expr'> )
+
+<param_type_spec> id, macroID
+
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/grammar.idl b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/grammar.idl
new file mode 100644
index 0000000..3848083
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/grammar.idl
@@ -0,0 +1,422 @@
+/*
+ * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998
+ *
+ */
+
+CORBA 2.3 IDL
+---------------
+
+(1) <specification> <definition><specification'>
+
+(1) <specification'> e
+ <definition><specification'>
+
+(2) <definition> <type_dcl> ";"
+ <const_dcl> ";"
+ <except_dcl> ";"
+ <interface> ";"
+ <module> ";"
+ <value> ";"
+
+(3) <module> "module" <id> "{" <module'> "}"
+
+(3) <module'> <definition><module''>
+
+(3) <module''> <definition><module''>
+ e
+
+(4) <interface> <interface_dcl>
+ <forward_dcl>
+
+(5) <interface_dcl> <interface_header> "{" <interface_body> "}"
+
+(6) <forward_dcl> "abstract" "interface" <id>
+ "interface" <id>
+
+(7) <interface_header> "abstract" "interface" <id> <interface_header'>
+ "interface" <id> <interface_header'>
+
+(7) <interface_header'> e
+ <interface_inheritance_spec>
+
+(8) <interface_body> <export><interface_body'>
+
+(8) <interface_body'> e
+ <export><interface_body'>
+
+(9) <export> <type_dcl> ";"
+ <const_dcl> ";"
+ <except_dcl> ";"
+ <attr_dcl> ";"
+ <op_dcl> ";"
+
+
+
+(10) <interface_inheritance_spec> ":" <scoped_name> <inheritance_spec'>
+
+(10) <interface_inheritance_spec'> e
+ "," <scoped_name> <inheritance_spec'>
+
+(12) <scoped_name> <id> <scoped_name'>
+ "::" <id> <scoped_name'>
+
+(12) <scoped_name'> e
+ "::" <id> <scoped_name'>
+
+(13) <value> <value_dcl>
+ <value_abs_dcl>
+ <value_box_dcl>
+ <value_forward_dcl>
+
+(14) <value_forward_dcl> "abstract" "valuetype" <id>
+ "valuetype" <id>
+
+(15) <value_box_dcl> "valuetype" <id> <type_spec>
+
+(16) <value_abs_dcl> "abstract" "valuetype" <id> <value_inheritance_spec> "{" <export> <vad> "}"
+ "abstract" "valuetype" <id> "{" <export> <vad> "}"
+
+(16) <vad> e
+ <export> <vad>
+
+(17) <value_dcl> <value_header> "{" <value_element> <ve> "}"
+
+(17) <ve> e
+ <value_element> <ve>
+
+(18) <value_header> "custom" "valuetype" <id> <value_inheritance_spec>
+ "valuetype" <id> <value_inheritance_spec>
+ "custom" "valuetype" <id>
+ "valuetype" <id>
+
+(19) <value_inheritance_spec> <opt_inherits> <opt_supports>
+
+(19) <opt_inherits> e
+ ":" "truncatable" <value_name> <value_name_list>
+ ":" <value_name> <value_name_list>
+
+(19) <value_name_list> e
+ "," <value_name> <value_name_list>
+
+(19) <opt_supports> e
+ "supports" <interface_name> <interface_name_list>
+
+(19) <interface_name_list> e
+ "," <interface_name> <interface_name_list>
+
+(20) <value_name> <scoped_name>
+
+(21) <value_element> <export>
+ <state_member>
+ <init_dcl>
+
+(22) <state_member> "public" <type_spec> <declarators> ";"
+ "private" <type_spec> <declarators> ";"
+
+(23) <init_dcl> "factory" <id> "(" ")"
+ "factory" <id> "(" <init_param_dcls> ")"
+
+(24) <init_param_dcls> <init_param_decl>
+ <init_param_decl> "," <init_param_dcls>
+
+(25) <init_param_dcl> <init_param_attribute> <param_type_spec> <simple_declarator>
+
+(26) <init_param_attribute> "in"
+
+(27) <const_dcl> "const" <const_type> <id> "=" <const_exp>
+
+(28) <const_type> <integer_type>
+ <char_type>
+ <wide_char_type>
+ <boolean_type>
+ <floating_pt_type>
+ <string_type>
+ <wide_string_type>
+ <scoped_name>
+ <octet_type>
+
+(29) <const_exp> <or_expr>
+
+(30) <or_expr> <xor_expr> <or_expr'>
+
+(30) <or_expr'> e
+ "|" <xor_expr> <or_expr'>
+
+(31) <xor_expr> <and_expr> <xor_expr'>
+
+(31) <xor_expr'> e
+ "^" <and_expr> <xor_expr'>
+
+(32) <and_expr> <shift_expr><and_expr'>
+
+(32) <and_expr'> e
+ "&" <shift_expr> <and_expr'>
+
+(33) <shift_expr> <add_expr> <shift_expr'>
+
+(33) <shift_expr'> e
+ ">>" <add_expr> <shift_expr'>
+ "<<" <add_expr> <shift_expr'>
+
+(34) <add_expr> <mult_expr> <add_expr'>
+
+(34) <add_expr'> e
+ "+" <mult_expr> <add_expr'>
+ "-" <mult_expr> <add_expr'>
+
+(35) <mult_expr> <unary_expr> <mult_expr'>
+
+(35) <mult_expr'> e
+ "*" <unary_expr> <mult_expr'>
+ "/" <unary_expr> <mult_expr'>
+ "%" <unary_expr> <mult_expr'>
+
+(36) <unary_expr> <unary_operator> <primary_expr>
+ <primary_expr>
+
+(37) <unary_operator> "-"
+ "+"
+ "~"
+
+(38) <primary_expr> <scoped_name>
+ <literal>
+ "(" <const_exp> ")"
+
+(39) <literal> <<integer_literal>>
+ <<string_literal>>>
+ <<wide_string_literal>>>
+ <<character_literal>>
+ <<wide_character_literal>>
+ <<fixed_pt_literal>>
+ <<floating_pt_literal>>
+ <<boolean_literal>>
+
+(40) <boolean_literal> "TRUE"
+ "FALSE"
+
+(41) <positive_int_const> <const_exp>
+
+(42) <type_dcl> "typedef" <type_declarator>
+ <struct_type>
+ <union_type>
+ <enum_type>
+ "native" <simple_declarator>
+
+(43) <type_declarator> <type_spec> <declarators>
+
+(44) <type_spec> <simple_type_spec>
+ <constr_type_spec>
+
+(45) <simple_type_spec> <base_type_spec>
+ <template_type_spec>
+ <scoped_name>
+
+(46) <base_type_spec> <floating_pt_type>
+ <integer_type>
+ <char_type>
+ <wide_char_type>
+ <boolean_type>
+ <octet_type>
+ <any_type>
+ <object_type>
+ <value_base_type>
+
+(47) <template_type_spec> <sequence_type>
+ <string_type>
+ <wide_string_type>
+ <fixed_pt_type>
+
+(48) <constr_type_spec> <struct_type>
+ <union_type>
+ <enum_type>
+
+(49) <declarators> <declarator> <declarators'>
+
+(49) <declarators'> e
+ "," <declarator> <declarators'>
+
+(50) <declarator> <simple_declarator>
+ <complex_declarator>
+
+(51) <simple_declarator> <id>
+
+(52) <complex_declarator> <array_declarator>
+
+(53) <floating_pt_type> "float"
+ "double"
+ "long" "double"
+
+(54) <integer_type> <signed_int>
+ <unsigned_int>
+
+(55) <signed_int> "long"
+ "short"
+ "long" "long"
+
+// 56-58 omitted
+
+(59) <unsigned_int> "unsigned" <signed_int>
+
+// 60-62 omitted
+
+(63) <char_type> "char"
+
+(64) <wide_char_type> "wchar"
+
+(65) <boolean_type> "boolean"
+
+(66) <octet_type> "octet"
+
+(67) <any_type> "any"
+
+(68) <object_type> "Object"
+
+(69) <struct_type> "struct" <id> "{" <member_list> "}"
+
+(70) <member_list> <member> <member_list'>
+
+(70) <member_list'> e
+ <member> <member_list'>
+
+(71) <member> <type_spec> <declarators> ";"
+
+(72) <union_type> "union" <id> "switch" "(" <switch_type_spec> ")" "{" <switch_body> "}"
+
+(73) <switch_type_spec> <integer_type>
+ <char_type>
+ <boolean_type>
+ <enum_type>
+ <scoped_name>
+
+(74) <switch_body> <case> <switch_body'>
+
+(74) <switch_body'> e
+ <case> <switch_body'>
+
+(75) <case> <case_label> <case'> <element_spec> ";"
+
+(75) <case'> e
+ <case_label> <case'>
+
+(76) <case_label> "case" <const_exp> ":"
+ "default" ":"
+
+(77) <element_spec> <type_spec> <declarator>
+
+(78) <enum_type> "enum" <id> "{" <id> <enum_type'> "}"
+
+(78) <enum_type'> e
+ "," <id> <enum_type'>
+
+// 79 omitted
+
+(80) <sequence_type> "sequence" "<" <simple_type_spec> <sequence_type'>
+
+(80) <sequence_type'> "," <positive_int_const> ">"
+ ">"
+
+(81) <string_type> "string"
+ "string" "<" <positive_int_const> ">"
+
+(82) <wide_string_type> "wstring"
+ "wstring" "<" <positive_int_const> ">"
+
+(83) <array_declarator> <id> <fixed_array_size>
+
+(84) <fixed_array_size> "[" <positive_int_const> "]"
+
+(85) <attr_dcl> "readonly" "attribute" <param_type_spec> <id> <attr_dcl'>
+ "attribute" <param_type_spec> <id> <attr_dcl'>
+
+(85) <attr_dcl'> e
+ "," <id> <attr_dcl'>
+
+(86) <except_dcl> "exception" <id> "{" <except_dcl'> "}"
+
+(86) <except_dcl'> e
+ <member> <except_dcl'>
+
+(87) <op_dcl> <op_attribute> <op_type_spec> <op_dcl'>
+ <op_type_spec> <op_dcl'>
+
+(87) <op_dcl'> <id> <parameter_dcls> <op_dcl''>
+ <macroID> <parameter_dcls'> <op_dcl''>
+
+(87) <op_dcl''> e
+ <context_expr>
+ <raises_expr>
+ <raises_expr> <context_expr>
+
+(88) <op_attribute> "oneway"
+
+(89) <op_type_spec> <param_type_spec>
+ "void"
+
+(90) <parameter_dcls> "(" <parameter_dcls'>
+
+(90) <parameter_dcls'> <param_dcl> <parameter_dcls''> ")"
+ ")"
+
+(90) <parameter_dcls''> e
+ "," <param_dcl> <parameter_dcls''>
+
+(91) <param_dcl> <param_attribute> <param_type_spec> <id>
+
+(92) <param_attribute> "in"
+ "out"
+ "inout"
+
+(93) <raises_expr> "raises" "(" <scoped_name> <raises_expr'> ")"
+
+(93) <raises_expr'> e
+ "," <scoped_name> <raises_expr'>
+
+(94) <context_expr> "context" "(" <string_literal> <context_expr'> ")"
+
+(94) <context_expr'> e
+ "," <string_literal> <context_expr'>
+
+(95) <param_type_spec> <base_type_spec>
+ <string_type>
+ <wide_string_type>
+ <scoped_name>
+
+(96) <fixed_pt_type> "fixed" "<" <positive_int_const> "," <positive_int_const> ">"
+
+(97) <fixed_pt_const_type> "fixed"
+
+(98) <value_base_type> "ValueBase"
+
+NOTES:
+
+- #define id(id, id, ...) token-string is a macro definition. There can be no space between the first id and the left paren. Since id( must be treated as a token and id( can also appear in op_dcl, see that production for the effect of this token.
+
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/grammar3.idl b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/grammar3.idl
new file mode 100644
index 0000000..e009e42
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/grammar3.idl
@@ -0,0 +1,539 @@
+/*
+ * Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * COMPONENT_NAME: idl.parser
+ *
+ * ORIGINS: 27
+ *
+ * 5639-D57, (C) COPYRIGHT International Business Machines Corp., 1997, 1998
+ *
+ */
+
+(1) <specification> <imports> <definition> <specification'> // CORBA3
+
+(1) <imports> e // CORBA3
+ <import> <imports> // CORBA3
+
+(1) <import> "import" <imported_scope> ";" // CORBA3
+
+(1) <imported_scope> <scoped_name> // CORBA3
+ <string_literal> // CORBA3
+
+(1) <specification'> e
+ <definition><specification'>
+
+(2) <definition> <type_dcl> ";"
+ <const_dcl> ";"
+ <except_dcl> ";"
+ <interface> ";"
+ <module> ";"
+ <value> ";"
+ <type_id_dcl> ";" // CORBA3
+ <type_prefix_dcl> ";" // CORBA3
+ <component> ";" // CORBA3
+ <home_dcl> ";" // CORBA3
+
+(2) <type_id_dcl> "typeId" <scoped_name> <string_literal> // CORBA3
+
+(2) <type_prefix_dcl> "typePrefix" <scoped_name> <string_literal> // CORBA3
+
+(3) <module> "module" <id> "{" <module'> "}"
+
+(3) <module'> <definition><module''>
+
+(3) <module''> <definition><module''>
+ e
+
+(4) <interface> <interface_dcl>
+ <forward_dcl>
+
+(5) <interface_dcl> <interface_header> "{" <interface_body> "}"
+
+(6) <forward_dcl> "abstract" "interface" <id>
+ "local" "interface" <id> // CORBA3
+ "interface" <id>
+
+(7) <interface_header> "abstract" "interface" <id> <interface_header'>
+ "local" "interface" <id> <interface_header'> // CORBA3
+ "interface" <id> <interface_header'>
+
+(7) <interface_header'> e
+ <interface_inheritance_spec>
+
+(8) <interface_body> <export><interface_body'>
+
+(8) <interface_body'> e
+ <export><interface_body'>
+
+(9) <export> <type_dcl> ";"
+ <const_dcl> ";"
+ <except_dcl> ";"
+ <attr_dcl> ";"
+ <op_dcl> ";"
+ <type_id_dcl> ";" // CORBA3
+ <type_prefix_dcl> ";" // CORBA3
+
+(10) <interface_inheritance_spec> ":" <scoped_name> <inheritance_spec'>
+
+(10) <interface_inheritance_spec'> e
+ "," <scoped_name> <inheritance_spec'>
+
+(12) <scoped_name> <id> <scoped_name'>
+ "::" <id> <scoped_name'>
+
+(12) <scoped_name'> e
+ "::" <id> <scoped_name'>
+
+(13) <value> <value_dcl>
+ <value_abs_dcl>
+ <value_box_dcl>
+ <value_forward_dcl>
+
+(14) <value_forward_dcl> "abstract" "valuetype" <id>
+ "valuetype" <id>
+
+(15) <value_box_dcl> "valuetype" <id> <type_spec>
+
+(16) <value_abs_dcl> "abstract" "valuetype" <id> <value_inheritance_spec> "{" <export> <vad> "}"
+ "abstract" "valuetype" <id> "{" <export> <vad> "}"
+
+(16) <vad> e
+ <export> <vad>
+
+(17) <value_dcl> <value_header> "{" <value_element> <ve> "}"
+
+(17) <ve> e
+ <value_element> <ve>
+
+(18) <value_header> "custom" "valuetype" <id> <value_inheritance_spec>
+ "valuetype" <id> <value_inheritance_spec>
+ "custom" "valuetype" <id>
+ "valuetype" <id>
+
+(19) <value_inheritance_spec> <opt_inherits> <opt_supports>
+
+(19) <opt_inherits> e
+ ":" "truncatable" <value_name> <value_name_list>
+ ":" <value_name> <value_name_list>
+
+(19) <value_name_list> e
+ "," <value_name> <value_name_list>
+
+(19) <opt_supports> e
+ "supports" <interface_name> <interface_name_list>
+
+(19) <interface_name_list> e
+ "," <interface_name> <interface_name_list>
+
+(20) <value_name> <scoped_name>
+
+(21) <value_element> <export>
+ <state_member>
+ <init_dcl>
+
+(22) <state_member> "public" <type_spec> <declarators> ";"
+ "private" <type_spec> <declarators> ";"
+
+(23) <init_dcl> "factory" <id> "(" ")"
+ "factory" <id> "(" <init_param_dcls> ")"
+
+(24) <init_param_dcls> <init_param_dcl>
+ <init_param_dcl> "," <init_param_dcls>
+
+(25) <init_param_dcl> <init_param_attribute> <param_type_spec> <simple_declarator>
+
+(26) <init_param_attribute> "in"
+
+(27) <const_dcl> "const" <const_type> <id> "=" <const_exp>
+
+(28) <const_type> <integer_type>
+ <char_type>
+ <wide_char_type>
+ <boolean_type>
+ <floating_pt_type>
+ <string_type>
+ <wide_string_type>
+ <scoped_name>
+ <octet_type>
+
+(29) <const_exp> <or_expr>
+
+(30) <or_expr> <xor_expr> <or_expr'>
+
+(30) <or_expr'> e
+ "|" <xor_expr> <or_expr'>
+
+(31) <xor_expr> <and_expr> <xor_expr'>
+
+(31) <xor_expr'> e
+ "^" <and_expr> <xor_expr'>
+
+(32) <and_expr> <shift_expr><and_expr'>
+
+(32) <and_expr'> e
+ "&" <shift_expr> <and_expr'>
+
+(33) <shift_expr> <add_expr> <shift_expr'>
+
+(33) <shift_expr'> e
+ ">>" <add_expr> <shift_expr'>
+ "<<" <add_expr> <shift_expr'>
+
+(34) <add_expr> <mult_expr> <add_expr'>
+
+(34) <add_expr'> e
+ "+" <mult_expr> <add_expr'>
+ "-" <mult_expr> <add_expr'>
+
+(35) <mult_expr> <unary_expr> <mult_expr'>
+
+(35) <mult_expr'> e
+ "*" <unary_expr> <mult_expr'>
+ "/" <unary_expr> <mult_expr'>
+ "%" <unary_expr> <mult_expr'>
+
+(36) <unary_expr> <unary_operator> <primary_expr>
+ <primary_expr>
+
+(37) <unary_operator> "-"
+ "+"
+ "~"
+
+(38) <primary_expr> <scoped_name>
+ <literal>
+ "(" <const_exp> ")"
+
+(39) <literal> <<integer_literal>>
+ <<string_literal>>>
+ <<wide_string_literal>>>
+ <<character_literal>>
+ <<wide_character_literal>>
+ <<fixed_pt_literal>>
+ <<floating_pt_literal>>
+ <<boolean_literal>>
+
+(40) <boolean_literal> "TRUE"
+ "FALSE"
+
+(41) <positive_int_const> <const_exp>
+
+(42) <type_dcl> "typedef" <type_declarator>
+ <struct_type>
+ <union_type>
+ <enum_type>
+ "native" <simple_declarator>
+
+(43) <type_declarator> <type_spec> <declarators>
+
+(44) <type_spec> <simple_type_spec>
+ <constr_type_spec>
+
+(45) <simple_type_spec> <base_type_spec>
+ <template_type_spec>
+ <scoped_name>
+
+(46) <base_type_spec> <floating_pt_type>
+ <integer_type>
+ <char_type>
+ <wide_char_type>
+ <boolean_type>
+ <octet_type>
+ <any_type>
+ <object_type>
+ <value_base_type>
+
+(47) <template_type_spec> <sequence_type>
+ <string_type>
+ <wide_string_type>
+ <fixed_pt_type>
+
+(48) <constr_type_spec> <struct_type>
+ <union_type>
+ <enum_type>
+
+(49) <declarators> <declarator> <declarators'>
+
+(49) <declarators'> e
+ "," <declarator> <declarators'>
+
+(50) <declarator> <simple_declarator>
+ <complex_declarator>
+
+(51) <simple_declarator> <id>
+
+(52) <complex_declarator> <array_declarator>
+
+(53) <floating_pt_type> "float"
+ "double"
+ "long" "double"
+
+(54) <integer_type> <signed_int>
+ <unsigned_int>
+
+(55) <signed_int> "long"
+ "short"
+ "long" "long"
+
+// 56-58 omitted
+
+(59) <unsigned_int> "unsigned" <signed_int>
+
+// 60-62 omitted
+
+(63) <char_type> "char"
+
+(64) <wide_char_type> "wchar"
+
+(65) <boolean_type> "boolean"
+
+(66) <octet_type> "octet"
+
+(67) <any_type> "any"
+
+(68) <object_type> "Object"
+
+(69) <struct_type> "struct" <id> "{" <member_list> "}"
+
+(70) <member_list> <member> <member_list'>
+
+(70) <member_list'> e
+ <member> <member_list'>
+
+(71) <member> <type_spec> <declarators> ";"
+
+(72) <union_type> "union" <id> "switch" "(" <switch_type_spec> ")" "{" <switch_body> "}"
+
+(73) <switch_type_spec> <integer_type>
+ <char_type>
+ <boolean_type>
+ <enum_type>
+ <scoped_name>
+
+(74) <switch_body> <case> <switch_body'>
+
+(74) <switch_body'> e
+ <case> <switch_body'>
+
+(75) <case> <case_label> <case'> <element_spec> ";"
+
+(75) <case'> e
+ <case_label> <case'>
+
+(76) <case_label> "case" <const_exp> ":"
+ "default" ":"
+
+(77) <element_spec> <type_spec> <declarator>
+
+(78) <enum_type> "enum" <id> "{" <id> <enum_type'> "}"
+
+(78) <enum_type'> e
+ "," <id> <enum_type'>
+
+// 79 omitted
+
+(80) <sequence_type> "sequence" "<" <simple_type_spec> <sequence_type'>
+
+(80) <sequence_type'> "," <positive_int_const> ">"
+ ">"
+
+(81) <string_type> "string"
+ "string" "<" <positive_int_const> ">"
+
+(82) <wide_string_type> "wstring"
+ "wstring" "<" <positive_int_const> ">"
+
+(83) <array_declarator> <id> <fixed_array_size>
+
+(84) <fixed_array_size> "[" <positive_int_const> "]"
+
+(85) <attr_dcl> <readonly_attr_spec> // CORBA3
+ <attr_spec> // CORBA3
+
+(85) <readonly_attr_spec> <readonly_attr_header> <readonly_attr_declarator> // CORBA3
+
+(85) <readonly_attr_header> "readonly" "attribute" <param_type_spec> // CORBA3
+
+(85) <readonly_attr_declarator> <simple_declarator> <get_excep_expr> // CORBA3
+ <simple_declarator> <sds> // CORBA3
+
+(85) <sds> e // CORBA3
+ <simple_declarator> <sds> // CORBA3
+
+(85) <attr_spec> "attribute" <param_type_spec> <attr_declarator> // CORBA3
+
+(85) <attr_declarator> <simple_declarator> <attr_raises_expr> // CORBA3
+ <simple_declarator> <sds> // CORBA3
+
+(85) <attr_raises_expr> <get_excep_expr> // CORBA3
+ <get_excep_expr> <set_excep_expr> // CORBA3
+ <set_excep_expr> // CORBA3
+
+(85) <get_excep_expr> "getRaises" <exception_list> // CORBA3
+
+(85) <set_excep_expr> "setRaises" <exception_list> // CORBA3
+
+(85) <exception_list> "(" <scoped_name> <els> ")" // CORBA3
+
+(85) <els> e // CORBA3
+ "," <scoped_name> <els> // CORBA3
+
+(86) <except_dcl> "exception" <id> "{" <except_dcl'> "}"
+
+(86) <except_dcl'> e
+ <member> <except_dcl'>
+
+(87) <op_dcl> <op_attribute> <op_type_spec> <op_dcl'>
+ <op_type_spec> <op_dcl'>
+
+(87) <op_dcl'> <id> <parameter_dcls> <op_dcl''>
+ <macroID> <parameter_dcls'> <op_dcl''>
+
+(87) <op_dcl''> e
+ <context_expr>
+ <raises_expr>
+ <raises_expr> <context_expr>
+
+(88) <op_attribute> "oneway"
+
+(89) <op_type_spec> <param_type_spec>
+ "void"
+
+(90) <parameter_dcls> "(" <parameter_dcls'>
+
+(90) <parameter_dcls'> <param_dcl> <parameter_dcls''> ")"
+ ")"
+
+(90) <parameter_dcls''> e
+ "," <param_dcl> <parameter_dcls''>
+
+(91) <param_dcl> <param_attribute> <param_type_spec> <id>
+
+(92) <param_attribute> "in"
+ "out"
+ "inout"
+
+(93) <raises_expr> "raises" "(" <scoped_name> <raises_expr'> ")"
+
+(93) <raises_expr'> e
+ "," <scoped_name> <raises_expr'>
+
+(94) <context_expr> "context" "(" <string_literal> <context_expr'> ")"
+
+(94) <context_expr'> e
+ "," <string_literal> <context_expr'>
+
+(95) <param_type_spec> <base_type_spec>
+ <string_type>
+ <wide_string_type>
+ <scoped_name>
+
+(96) <fixed_pt_type> "fixed" "<" <positive_int_const> "," <positive_int_const> ">"
+
+(97) <fixed_pt_const_type> "fixed"
+
+(98) <value_base_type> "ValueBase"
+
+// CORBA3 Component and Home IDL
+
+(200) <component> <component_dcl>
+ <component_forward_dcl>
+
+(201) <component_forward_dcl> "component" <id>
+
+(202) <component_dcl> <component_header> "{" <component_body> "}"
+
+(203) <component_header> "component" <id>
+ "component" <id> <component_inheritance_spec>
+ "component" <id> <supported_interface_spec>
+ "component" <id> <component_inheritance_spec> <supported_interface_spec>
+
+(204) <supported_interface_spec> "supports" <scoped_name> <snames>
+
+(204) <snames> e
+ "," <scoped_name> <snames>
+
+(205) <component_inheritance_spec> ":" <scoped_name>
+
+(206) <component_body> <component_export> <ces>
+
+(206) <ces> e
+ <component_export> <ces>
+
+(207) <component_export> <provides_dcl> ";"
+ <uses_dcl> ";"
+ <emits_dcl> ";"
+ <publishes_dcl> ";"
+ <consumes_dcl> ";"
+ <attr_dcl> ";"
+
+(208) <provides_dcl> "provides" <interface_type> <id>
+
+(209) <interface_type> <scoped_name>
+ "Object"
+
+(210) <uses_dcl> "uses" <interface_type> <id>
+ "uses" "multiple" <interface_type> <id>
+
+(211) <emits_dcl> "emits" <scoped_name> <id>
+
+(212) <publishes_dcl> "publishes" <scoped_name> <id>
+
+(213) <consumes_dcl> "consumes" <scoped_name> <id>
+
+(214) <home_dcl> <home_header> <home_body>
+
+(215) <home_header> "home" <id> <home_inheritance_spec> "manages" <scoped_name>
+ "home" <id> "manages" <scoped_name>
+ "home" <id> <home_inheritance_spec> "manages" <scoped_name> <primary_key_spec>
+ "home" <id> "manages" <scoped_name> <primary_key_spec>
+
+(216) <home_inheritance_spec> ":" <scoped_name>
+
+(217) <primary_key_spec> "primaryKey" <scoped_name>
+
+(218) <home_body> "{" <home_export> <hes> "}"
+
+(218) <hes> e
+ <home_export> <hes>
+
+(219) <home_export> <export>
+ <factory_dcl> ";"
+ <finder_dcl> ";"
+
+(220) <factory_dcl> "factory" <id> "(" <init_param_dcls> ")" <raises_expr>
+ "factory" <id> "(" ")" <raises_expr>
+ "factory" <id> "(" <init_param_dcls> ")"
+ "factory" <id> "(" ")"
+
+(221) <finder_dcl> "finder" <id> "(" <init_param_dcls> ")" <raises_expr>
+ "finder" <id> "(" ")" <raises_expr>
+ "finder" <id> "(" <init_param_dcls> ")"
+ "finder" <id> "(" ")"
+
+NOTES:
+
+- #define id(id, id, ...) token-string is a macro definition. There can be no space between the first id and the left paren. Since id( must be treated as a token and id( can also appear in op_dcl, see that production for the effect of this token.
+
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl.prp b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl.prp
new file mode 100644
index 0000000..a07db3f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl.prp
@@ -0,0 +1,195 @@
+#
+# Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# COMPONENT_NAME: idl.parser
+#
+# ORIGINS: 27
+#
+# Licensed Materials - Property of IBM
+# 5639-D57 (C) COPYRIGHT International Business Machines Corp., 1997, 1999
+# RMI-IIOP v1.0
+#
+
+# Translator: Each line below is of the form "<key>=<message>".
+# The keys are NOT to be translated.
+# The messages ARE to be translated.
+#
+# DO NOT translate the following:
+# ASCII
+# #else
+# #endif
+# IDL
+#
+# %0, %1, etc. are postional parameters to the message. Do not
+# translate these. The number order is the order they are given to
+# the message writer. It is OK to change their order in the message
+# if the language grammar so dictates.
+#
+# Lines of the form "%0 (line %1): <some message>\n%x\n%y" are error
+# messages: %0 is a filename; %1 is a line number; %x is line %1 from
+# %0; %y is the error marker. So the message comes out looking like:
+# <filename> (line xxx): <some message>
+# Line xxx from <filename> where the carat points to the error
+# ^
+# So the first two and the last two parameters of these messages must
+# remain in their positions.
+#
+# A backslash (\) at the end of a line is a line continuation
+# character. A backslash at the beginning of a line means don't
+# ignore leading blanks (they normally are). These backslashes
+# should remain in the message.
+#
+# Translator: Start Translating
+
+Compile.parsing=Parsing %0
+Compile.parseDone=done - %0
+Compile.generating=Generating %0
+Compile.genDone=done - %0
+Deprecated.keyword=WARNING: Keyword `%0' is deprecated.
+EvaluationException.1=Operands of %0 operator are inconsistent: %1 and %2.
+EvaluationException.2=Operand of %0 operator must be a number, not a %1.
+EvaluationException.or=bitwise or
+EvaluationException.xor=bitwise xor
+EvaluationException.and=bitwise and
+EvaluationException.plus=addition
+EvaluationException.minus=subtraction
+EvaluationException.left=left shift
+EvaluationException.right=right shift
+EvaluationException.times=multiplication
+EvaluationException.divide=division
+EvaluationException.mod=modulo
+EvaluationException.pos=unary positive
+EvaluationException.neg=unary negation
+EvaluationException.not=bitwise not
+EvaluationException.booleanNot=boolean not
+EvaluationException.booleanAnd=boolean and
+EvaluationException.booleanOr=boolean or
+EvaluationException.equal=equal
+EvaluationException.notEqual=not equal
+EvaluationException.greaterThan=greater than
+EvaluationException.lessThan=less than
+EvaluationException.greaterEqual=greater than or equal
+EvaluationException.lessEqual=less than or equal
+GenFileStream.1=%0 could not be generated: %1
+InvalidArgument.1=Invalid argument: %0.
+InvalidArgument.2=No IDL file was specified.
+InvalidCharacter.1=%0 (line %1): invalid character: %2 (ASCII %3).\n%4\n%5
+Migration.futureKeyword=WARNING: Identifier `%0' collides with a keyword; use an escaped identifier to ensure future compatibility.
+Migration.keywordCollision=WARNING: Identifier `%0' collides with a keyword; use an escaped identifier to ensure future compatibility.
+ParseException.abstractValueBox=%0 (line %1): A value box cannot be declared abstract.\n%2\n%3
+ParseException.alreadyDeclared=%0 (line %1): %2 has already been declared.\n%3\n%4
+ParseException.declNotInSameFile=%0 (line %1): %2 was declared previously in a forward declaration in file %3.\n%4\n%5
+ParseException.alreadyDerived=%0 (line %1): %2 has already been declared as a parent of %3.\n%4\n%5
+ParseException.alreadyDefaulted=%0 (line %1): The default branch has already been encountered.\n%2\n%3
+ParseException.alreadyRaised=%0 (line %1): %2 already specified in raises clause.\n%3\n%4
+ParseException.attributeNotType=%0 (line %1): %2 is an attribute. It cannot be used as a type.\n%3\n%4
+ParseException.badAbstract=%0 (line %1): The forward and actual declaration of %2 is inconsistent. One is abstract and the other is not.\n%3\n%4
+ParseException.badCustom=%0 (line %1): A forward value declaration cannot be declared custom.\n%2\n%3
+ParseException.badRepIDAlreadyAssigned=%0 (line %1): Type %2 has already been assigned a Repository ID in a previous ID pragma directive.\n%3\n%4
+ParseException.badRepIDForm=%0 (line %1): Repository ID '%2' should have form '<format>:<string>'.\n%3\n%4
+ParseException.badRepIDPrefix=%0 (line %1): Interface %2 should have Repository ID prefix `%3', not '%4'.\n%5\n%6
+ParseException.badState=%0 (line %1): %2 cannot be a stateful interface; it has more than one stateful parent.\n%3\n%4
+ParseException.branchLabel=%0 (line %1): case %2 has already been declared.\n%3\n%4
+ParseException.branchName=%0 (line %1): A branch named %2 has already been declared.\n%3\n%4
+ParseException.duplicateInit=%0 (line %1): An initializer has the same signature as a previous initializer.\n%2\n%3
+ParseException.duplicateState=%0 (line %1): The data member %2 has the same name as a previous data member.\n%3\n%4
+ParseException.elseNoIf=%0 (line %1): #else encountered without a matching #if.\n%2\n%3
+ParseException.endNoIf=%0 (line %1): #endif encountered without a matching #if.\n%2\n%3
+ParseException.evaluation=%0 (line %1): %2\n%3\n%4
+ParseException.forwardEntry=%0 (line %1): There is a forward reference to %2, but it is not defined.\n%3\n%4
+ParseException.forwardedValueBox=%0 (line %1): %2 has a forward declaration. A value box cannot be forward declared.\n%3\n%4
+ParseException.forwardInheritance=%0 (line %1): It is illegal for %2 to inherit from the incomplete forward declaration of %3.\n%4\n%5
+ParseException.generic=%0 (line %1): %2\n%3\n%4
+ParseException.illegalArray=%0 (line %1): An array is not a legal type in a %2.\n%3\n%4
+ParseException.illegalException=%0 (line %1): Exceptions cannot appear within %2s.\n%3\n%4
+ParseException.invalidConst1=%0 (line %1): Constant expression must be of type %2, not %3.\n%4\n%5
+ParseException.invalidConst2=%0 (line %1): Identifiers in constant expressions must be constants, not %2.\n%3\n%4
+ParseException.keywordCollision=%0 (line %1): Identifier `%2' collides with keyword; use escaped identifier if necessary.\n%3\n%4
+ParseException.methodClash=%0 (line %1): Method name clash in interface %2: %3.\n%4\n%5
+ParseException.moduleNotType=%0 (line %1): %2 is a module. It cannot be used as a type.\n%3\n%4
+ParseException.nestedValueBox=%0 (line %1): Value boxes cannot be nested.\n%2\n%3
+ParseException.noDefault=%0 (line %1): A default branch is not allowed when all possible cases are fully covered.\n%2\n%3
+ParseException.nonAbstractParent=%0 (line %1): The abstract interface %2 cannot inherit from the non-abstract interface %3.\n%4\n%5
+ParseException.nonAbstractParent2=%0 (line %1): The abstract value %2 cannot inherit from the non-abstract value %3.\n%4\n%5
+ParseException.nonAbstractParent3=%0 (line %1): The value %2 cannot inherit from the non-abstract value %3 as specified.\n%4\n%5
+ParseException.notANumber=%0 (line %1): A number was expected. %2 is not a valid number.\n%3\n%4
+ParseException.nothing=%0 is empty. There is nothing to compile.
+ParseException.notPosInt=%0 (line %1): Expected a positive integer constant, not %2.\n%3\n%4
+ParseException.oneway=%0 (line %1): %2 is declared to be oneway. Oneway methods must: return void; have only in parameters; raise no exceptions.\n%3\n%4
+ParseException.operationNotType=%0 (line %1): %2 is an operation. It cannot be used as a type.\n%3\n%4
+ParseException.outOfRange=%0 (line %1): The value of the constant expression, %2, is out of range for type %3.\n%4\n%5
+ParseException.recursive=%0 (line %1): The only legal recursive definition is: sequence<%2> %3.\n%4\n%5
+ParseException.selfInherit=%0 (line %1): %2 cannot inherit from itself.\n%3\n%4
+ParseException.stringTooLong=%0 (line %1): "%2" cannot be more than %3 characters long.\n%4\n%5
+ParseException.syntax1=%0 (line %1): Expected `%2'; encountered `%3'.\n%4\n%5
+ParseException.syntax2=%0 (line %1): Expected one of%2; encountered `%3'.\n%4\n%5
+ParseException.unclosed=%0: Unexpected end of file encountered in comment.
+ParseException.undeclaredType=%0 (line %1): %2 is an undeclared type.\n%3\n%4
+ParseException.warning=%0 (line %1): %2\n%3\n%4
+ParseException.constExprType=%0 (line %1): The type of the constant expression is %2, but it should be %3.\n%4\n%5
+ParseException.wrongType=%0 (line %1): The type of %2 is %3, but it should be %4.\n%5\n%6
+ParseException.illegalIncompleteTypeReference=%0 (line %1): Illegal reference to incomplete forward declaration of type %2.\n%3\n%4
+Preprocessor.unknown=Unknown preprocessor directive, `%0'. Line ignored.
+Preprocessor.unknownPragma=Unknown pragma `%0'. Line ignored.
+Preprocessor.undefinedName=Undefined type name for pragma %0: %1. Line ignored.
+Token.boolLit=<boolean literal>
+Token.charLit=<character literal>
+Token.intLit=<integer literal>
+Token.floatLit=<floating point literal>
+Token.stringLit=<string literal>
+Token.literal=<literal>
+Token.identifier=<identifier>
+Token.endOfFile=EOF
+Token.unknown=?
+Util.cantCreatePkg=Cannot create the package %0.
+Version.product=IDL Parser Framework, version "%0"
+Version.number=3.2
+default=Error! A message was requested which does not exist. The messages file does not contain the key: %0.
+
+# Translator: In the list of options below, do not translate:
+# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define
+# Do not translate the string "java com.sun.tools.corba.se.idl.Compile"
+
+usage=Compiler Usage:\n\
+\ java com.sun.tools.corba.se.idl.Compile [options] <idl file>\n\
+where <idl file> is the name of a file containing IDL definitions, and\n\
+[options] is any combination of the options listed below. The options\n\
+are optional and may appear in any order; <idl file> is required and\n\
+must appear last.\n\
+\ \n\
+Options:\n\
+ -d <symbol> This is equivalent to the following line in an\n\
+\ IDL file: #define <symbol>\n\
+ -emitAll Emit all types, including those found in #included\n\
+\ files.\n\
+ -i <include path> By default, the current directory is scanned for\n\
+\ included files. This option adds another directory.\n\
+ -keep If a file to be generated already exists, do not\n\
+\ overwrite it. By default it is overwritten.\n\
+ -noWarn Suppress warnings.\n\
+ -v, -verbose Verbose mode.\n\
+ -version Display the version number.\n
+
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp
new file mode 100644
index 0000000..47ba5c6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl_ja.prp
@@ -0,0 +1,177 @@
+#
+# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# COMPONENT_NAME: idl.parser
+#
+# ORIGINS: 27
+#
+# Licensed Materials - Property of IBM
+# 5639-D57 (C) COPYRIGHT International Business Machines Corp., 1997, 1999
+# RMI-IIOP v1.0
+#
+
+# Translator: Each line below is of the form "<key>=<message>".
+# The keys are NOT to be translated.
+# The messages ARE to be translated.
+#
+# DO NOT translate the following:
+# ASCII
+# #else
+# #endif
+# IDL
+#
+# %0, %1, etc. are postional parameters to the message. Do not
+# translate these. The number order is the order they are given to
+# the message writer. It is OK to change their order in the message
+# if the language grammar so dictates.
+#
+# Lines of the form "%0 (line %1): <some message>\n%x\n%y" are error
+# messages: %0 is a filename; %1 is a line number; %x is line %1 from
+# %0; %y is the error marker. So the message comes out looking like:
+# <filename> (line xxx): <some message>
+# Line xxx from <filename> where the carat points to the error
+# ^
+# So the first two and the last two parameters of these messages must
+# remain in their positions.
+#
+# A backslash (\) at the end of a line is a line continuation
+# character. A backslash at the beginning of a line means don't
+# ignore leading blanks (they normally are). These backslashes
+# should remain in the message.
+#
+# Translator: Start Translating
+
+Compile.parsing=%0\u306E\u89E3\u6790\u4E2D
+Compile.parseDone=\u5B8C\u4E86 - %0
+Compile.generating=%0\u306E\u751F\u6210\u4E2D
+Compile.genDone=\u5B8C\u4E86 - %0
+Deprecated.keyword=\u8B66\u544A: \u30AD\u30FC\u30EF\u30FC\u30C9`%0'\u306F\u975E\u63A8\u5968\u3067\u3059\u3002
+EvaluationException.1=%0\u6F14\u7B97\u5B50\u306E\u30AA\u30DA\u30E9\u30F3\u30C9\u306B\u4E00\u8CAB\u6027\u304C\u3042\u308A\u307E\u305B\u3093: %1\u304A\u3088\u3073%2\u3002
+EvaluationException.2=%0\u6F14\u7B97\u5B50\u306E\u30AA\u30DA\u30E9\u30F3\u30C9\u306F\u3001%1\u3067\u306F\u306A\u304F\u6570\u5024\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002
+EvaluationException.or=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EOR\u6F14\u7B97
+EvaluationException.xor=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EXOR\u6F14\u7B97
+EvaluationException.and=\u30D3\u30C3\u30C8\u5358\u4F4D\u306EAND\u6F14\u7B97
+EvaluationException.plus=\u52A0\u7B97
+EvaluationException.minus=\u6E1B\u7B97
+EvaluationException.left=\u5DE6\u30B7\u30D5\u30C8
+EvaluationException.right=\u53F3\u30B7\u30D5\u30C8
+EvaluationException.times=\u4E57\u7B97
+EvaluationException.divide=\u9664\u7B97
+EvaluationException.mod=\u3079\u304D\u4E57
+EvaluationException.pos=\u5358\u9805\u30D7\u30E9\u30B9
+EvaluationException.neg=\u5358\u9805\u30DE\u30A4\u30CA\u30B9
+EvaluationException.not=\u30D3\u30C3\u30C8\u5358\u4F4D\u306ENOT\u6F14\u7B97
+EvaluationException.booleanNot=boolean NOT
+EvaluationException.booleanAnd=boolean AND
+EvaluationException.booleanOr=boolean OR
+EvaluationException.equal=\u6B21\u3068\u7B49\u3057\u3044
+EvaluationException.notEqual=\u6B21\u3068\u7B49\u3057\u304F\u306A\u3044
+EvaluationException.greaterThan=\u304C\u6B21\u306E\u5024\u3088\u308A\u5927\u304D\u3044
+EvaluationException.lessThan=\u304C\u6B21\u306E\u5024\u3088\u308A\u5C0F\u3055\u3044
+EvaluationException.greaterEqual=\u304C\u6B21\u306E\u5024\u4EE5\u4E0A
+EvaluationException.lessEqual=\u304C\u6B21\u306E\u5024\u4EE5\u4E0B
+GenFileStream.1=%0\u3092\u751F\u6210\u3067\u304D\u307E\u305B\u3093\u3067\u3057\u305F: %1
+InvalidArgument.1=\u5F15\u6570\u304C\u7121\u52B9\u3067\u3059: %0\u3002
+InvalidArgument.2=IDL\u30D5\u30A1\u30A4\u30EB\u304C\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
+InvalidCharacter.1=%0 (\u884C%1): \u6587\u5B57\u304C\u7121\u52B9\u3067\u3059: %2 (ASCII %3)\u3002\n%4\n%5
+Migration.futureKeyword=\u8B66\u544A: \u8B58\u5225\u5B50`%0'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5C06\u6765\u306E\u4E92\u63DB\u6027\u306E\u305F\u3081\u306B\u3001\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+Migration.keywordCollision=\u8B66\u544A: \u8B58\u5225\u5B50`%0'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5C06\u6765\u306E\u4E92\u63DB\u6027\u306E\u305F\u3081\u306B\u3001\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002
+ParseException.abstractValueBox=%0 (\u884C%1): \u5024\u30DC\u30C3\u30AF\u30B9\u306Fabstract\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3
+ParseException.alreadyDeclared=%0 (\u884C%1): %2\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
+ParseException.declNotInSameFile=%0 (\u884C%1): %2\u306F\u30D5\u30A1\u30A4\u30EB%3\u306Eforward\u5BA3\u8A00\u3067\u4EE5\u524D\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%4\n%5
+ParseException.alreadyDerived=%0 (\u884C%1): %2\u306F%3\u306E\u89AA\u3068\u3057\u3066\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%4\n%5
+ParseException.alreadyDefaulted=%0 (\u884C%1): \u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u5206\u5C90\u306F\u3059\u3067\u306B\u691C\u51FA\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%2\n%3
+ParseException.alreadyRaised=%0 (\u884C%1): %2\u306Fraises\u53E5\u3067\u3059\u3067\u306B\u6307\u5B9A\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
+ParseException.attributeNotType=%0 (\u884C%1): %2\u306F\u5C5E\u6027\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.badAbstract=%0 (\u884C%1): %2\u306Eforward\u5BA3\u8A00\u3068\u5B9F\u969B\u306E\u5BA3\u8A00\u306B\u4E00\u8CAB\u6027\u304C\u3042\u308A\u307E\u305B\u3093\u3002\u4E00\u65B9\u306Fabstract\u3067\u3059\u304C\u3001\u3082\u3046\u4E00\u65B9\u306Fabstract\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.badCustom=%0 (\u884C%1): forward\u5024\u5BA3\u8A00\u306Fcustom\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3
+ParseException.badRepIDAlreadyAssigned=%0 (\u884C%1): \u578B%2\u306B\u306F\u3001\u524D\u306EID\u30D7\u30E9\u30B0\u30DE\u30FB\u30C7\u30A3\u30EC\u30AF\u30C6\u30A3\u30D6\u306E\u30EA\u30DD\u30B8\u30C8\u30EAID\u304C\u3059\u3067\u306B\u5272\u308A\u5F53\u3066\u3089\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
+ParseException.badRepIDForm=%0 (\u884C%1): \u30EA\u30DD\u30B8\u30C8\u30EAID '%2'\u306E\u5F62\u5F0F\u306F'<format>:<string>'\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
+ParseException.badRepIDPrefix=%0 (\u884C%1): \u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u306B\u306F\u3001'%4'\u3067\u306F\u306A\u304F\u30EA\u30DD\u30B8\u30C8\u30EAID\u63A5\u982D\u8F9E`%3'\u304C\u5FC5\u8981\u3067\u3059\u3002\n%5\n%6
+ParseException.badState=%0 (\u884C%1): %2\u306F\u30B9\u30C6\u30FC\u30C8\u30D5\u30EB\u30FB\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9\u306B\u3067\u304D\u307E\u305B\u3093\u3002\u8907\u6570\u306E\u30B9\u30C6\u30FC\u30C8\u30D5\u30EB\u89AA\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
+ParseException.branchLabel=%0 (\u884C%1): case %2\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
+ParseException.branchName=%0 (\u884C%1): %2\u3068\u3044\u3046\u540D\u524D\u306E\u5206\u5C90\u306F\u3059\u3067\u306B\u5BA3\u8A00\u3055\u308C\u3066\u3044\u307E\u3059\u3002\n%3\n%4
+ParseException.duplicateInit=%0 (\u884C%1): \u521D\u671F\u5316\u5B50\u306B\u306F\u524D\u306E\u521D\u671F\u5316\u5B50\u3068\u540C\u3058\u30B7\u30B0\u30CD\u30C1\u30E3\u304C\u3042\u308A\u307E\u3059\u3002\n%2\n%3
+ParseException.duplicateState=%0 (\u884C%1): \u30C7\u30FC\u30BF\u30FB\u30E1\u30F3\u30D0\u30FC%2\u306E\u540D\u524D\u304C\u524D\u306E\u30C7\u30FC\u30BF\u30FB\u30E1\u30F3\u30D0\u30FC\u3068\u540C\u3058\u3067\u3059\u3002\n%3\n%4
+ParseException.elseNoIf=%0 (\u884C%1): \u4E00\u81F4\u3059\u308B#if\u304C\u306A\u3044#else\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%2\n%3
+ParseException.endNoIf=%0 (\u884C%1): \u4E00\u81F4\u3059\u308B#if\u304C\u306A\u3044#endif\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%2\n%3
+ParseException.evaluation=%0 (\u884C%1): %2\n%3\n%4
+ParseException.forwardEntry=%0 (\u884C%1): %2\u3078\u306E\u524D\u65B9\u53C2\u7167\u304C\u3042\u308A\u307E\u3059\u304C\u3001\u5B9A\u7FA9\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.forwardedValueBox=%0 (\u884C%1): %2\u306B\u306Fforward\u5BA3\u8A00\u304C\u3042\u308A\u307E\u3059\u3002\u5024\u30DC\u30C3\u30AF\u30B9\u306Fforward\u3068\u3057\u3066\u5BA3\u8A00\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.forwardInheritance=%0 (\u884C%1): %3\u306E\u4E0D\u5B8C\u5168\u306Aforward\u5BA3\u8A00\u304B\u3089\u306E%2\u306E\u7D99\u627F\u306F\u7121\u52B9\u3067\u3059\u3002\n%4\n%5
+ParseException.generic=%0 (\u884C%1): %2\n%3\n%4
+ParseException.illegalArray=%0 (\u884C%1): \u914D\u5217\u306F%2\u306E\u6B63\u3057\u3044\u578B\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.illegalException=%0 (\u884C%1): \u4F8B\u5916\u3092%2s\u5185\u306B\u8868\u793A\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.invalidConst1=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306F%3\u578B\u3067\u306F\u306A\u304F%2\u578B\u3067\u3042\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%4\n%5
+ParseException.invalidConst2=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u8B58\u5225\u5B50\u306F\u3001%2\u3067\u306F\u306A\u304F\u5B9A\u6570\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
+ParseException.keywordCollision=%0 (\u884C%1): \u8B58\u5225\u5B50`%2'\u304C\u30AD\u30FC\u30EF\u30FC\u30C9\u3068\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059\u3002\u5FC5\u8981\u306A\u5834\u5408\u306F\u30A8\u30B9\u30B1\u30FC\u30D7\u3055\u308C\u305F\u8B58\u5225\u5B50\u3092\u4F7F\u7528\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n%3\n%4
+ParseException.methodClash=%0 (\u884C%1): \u30E1\u30BD\u30C3\u30C9\u540D\u304C\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u3067\u7AF6\u5408\u3057\u3066\u3044\u307E\u3059: %3\u3002\n%4\n%5
+ParseException.moduleNotType=%0 (\u884C%1): %2\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.nestedValueBox=%0 (\u884C%1): \u5024\u30DC\u30C3\u30AF\u30B9\u306F\u30CD\u30B9\u30C8\u3067\u304D\u307E\u305B\u3093\u3002\n%2\n%3
+ParseException.noDefault=%0 (\u884C%1): \u8003\u3048\u3089\u308C\u308B\u3059\u3079\u3066\u306Ecase\u304C\u5B8C\u5168\u306B\u9069\u7528\u3055\u308C\u308B\u5834\u5408\u3001\u30C7\u30D5\u30A9\u30EB\u30C8\u306E\u5206\u5C90\u306F\u8A31\u53EF\u3055\u308C\u307E\u305B\u3093\u3002\n%2\n%3
+ParseException.nonAbstractParent=%0 (\u884C%1): abstract\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%2\u306F\u975Eabstract\u30A4\u30F3\u30BF\u30D5\u30A7\u30FC\u30B9%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5
+ParseException.nonAbstractParent2=%0 (\u884C%1): abstract\u5024%2\u306F\u975Eabstract\u5024%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5
+ParseException.nonAbstractParent3=%0 (\u884C%1): \u5024%2\u306F\u6307\u5B9A\u3069\u304A\u308A\u306B\u975Eabstract\u5024%3\u304B\u3089\u7D99\u627F\u3067\u304D\u307E\u305B\u3093\u3002\n%4\n%5
+ParseException.notANumber=%0 (\u884C%1): \u6570\u5024\u304C\u5FC5\u8981\u3067\u3059\u3002%2\u306F\u6709\u52B9\u306A\u6570\u5024\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.nothing=%0\u306F\u7A7A\u3067\u3059\u3002\u30B3\u30F3\u30D1\u30A4\u30EB\u3059\u308B\u3082\u306E\u304C\u3042\u308A\u307E\u305B\u3093\u3002
+ParseException.notPosInt=%0 (\u884C%1): %2\u3067\u306F\u306A\u304F\u6B63\u306E\u6574\u6570\u306E\u5B9A\u6570\u304C\u5FC5\u8981\u3067\u3059\u3002\n%3\n%4
+ParseException.oneway=%0 (\u884C%1): %2\u306Foneway\u306B\u306A\u308B\u3088\u3046\u306B\u5BA3\u8A00\u3055\u308C\u307E\u3059\u3002oneway\u30E1\u30BD\u30C3\u30C9\u306F\u3001void\u3092\u8FD4\u3057\u3001\u30D1\u30E9\u30E1\u30FC\u30BF\u5185\u3067\u306E\u307F\u4F7F\u7528\u3057\u3001\u4F8B\u5916\u3092\u767A\u751F\u3057\u306A\u3044\u3088\u3046\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%3\n%4
+ParseException.operationNotType=%0 (\u884C%1): %2\u306F\u64CD\u4F5C\u3067\u3059\u3002\u578B\u3068\u3057\u3066\u4F7F\u7528\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.outOfRange=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u5024%2\u304C\u578B%3\u306E\u7BC4\u56F2\u3092\u8D85\u3048\u3066\u3044\u307E\u3059\u3002\n%4\n%5
+ParseException.recursive=%0 (\u884C%1): \u552F\u4E00\u306E\u6B63\u3057\u3044\u518D\u5E30\u7684\u5B9A\u7FA9\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059: \u30B7\u30FC\u30B1\u30F3\u30B9<%2> %3\u3002\n%4\n%5
+ParseException.selfInherit=%0 (\u884C%1): %2\u3092\u305D\u308C\u81EA\u4F53\u304B\u3089\u7D99\u627F\u3059\u308B\u3053\u3068\u306F\u3067\u304D\u307E\u305B\u3093\u3002\n%3\n%4
+ParseException.stringTooLong=%0 (\u884C%1): "%2"\u306F%3\u6587\u5B57\u4EE5\u5185\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002\n%4\n%5
+ParseException.syntax1=%0 (\u884C%1): `%2'\u304C\u5FC5\u8981\u3067\u3059\u304C\u3001`%3'\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%4\n%5
+ParseException.syntax2=%0 (\u884C%1): %2\u306E1\u3064\u304C\u5FC5\u8981\u3067\u3059\u304C\u3001`%3'\u304C\u691C\u51FA\u3055\u308C\u307E\u3057\u305F\u3002\n%4\n%5
+ParseException.unclosed=%0: \u30B3\u30E1\u30F3\u30C8\u3067\u4E88\u671F\u3057\u306A\u3044\u30D5\u30A1\u30A4\u30EB\u306E\u7D42\u308F\u308A\u3092\u691C\u51FA\u3057\u307E\u3057\u305F\u3002
+ParseException.undeclaredType=%0 (\u884C%1): %2\u306F\u5BA3\u8A00\u3055\u308C\u3066\u3044\u306A\u3044\u578B\u3067\u3059\u3002\n%3\n%4
+ParseException.warning=%0 (\u884C%1): %2\n%3\n%4
+ParseException.constExprType=%0 (\u884C%1): \u5B9A\u6570\u5F0F\u306E\u578B\u306F%2\u3067\u3059\u304C\u3001%3\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%4\n%5
+ParseException.wrongType=%0 (\u884C%1): %2\u306E\u578B\u306F%3\u3067\u3059\u304C\u3001%4\u306B\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n%5\n%6
+ParseException.illegalIncompleteTypeReference=%0 (\u884C%1): %2\u578B\u306E\u4E0D\u5B8C\u5168\u306Aforward\u5BA3\u8A00\u3078\u306E\u7121\u52B9\u306A\u53C2\u7167\u3067\u3059\u3002\n%3\n%4
+Preprocessor.unknown=\u4E0D\u660E\u306A\u30D7\u30EA\u30D7\u30ED\u30BB\u30C3\u30B5\u30FB\u30C7\u30A3\u30EC\u30AF\u30C6\u30A3\u30D6`%0'\u3067\u3059\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002
+Preprocessor.unknownPragma=\u4E0D\u660E\u306A\u30D7\u30E9\u30B0\u30DE`%0'\u3067\u3059\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002
+Preprocessor.undefinedName=\u30D7\u30E9\u30B0\u30DE%0\u306E\u578B\u540D\u304C\u672A\u5B9A\u7FA9\u3067\u3059: %1\u3002\u884C\u306F\u7121\u8996\u3055\u308C\u307E\u3057\u305F\u3002
+Token.boolLit=<boolean literal>
+Token.charLit=<character literal>
+Token.intLit=<integer literal>
+Token.floatLit=<floating point literal>
+Token.stringLit=<string literal>
+Token.literal=<literal>
+Token.identifier=<identifier>
+Token.endOfFile=EOF
+Token.unknown=?
+Util.cantCreatePkg=\u30D1\u30C3\u30B1\u30FC\u30B8%0\u3092\u4F5C\u6210\u3067\u304D\u307E\u305B\u3093\u3002
+Version.product=IDL\u30D1\u30FC\u30B5\u30FC\u30FB\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF\u3001\u30D0\u30FC\u30B8\u30E7\u30F3"%0"
+Version.number=3.2
+default=\u30A8\u30E9\u30FC\u3002\u5B58\u5728\u3057\u306A\u3044\u30E1\u30C3\u30BB\u30FC\u30B8\u304C\u30EA\u30AF\u30A8\u30B9\u30C8\u3055\u308C\u307E\u3057\u305F\u3002\u30E1\u30C3\u30BB\u30FC\u30B8\u30FB\u30D5\u30A1\u30A4\u30EB\u306B\u30AD\u30FC\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093: %0\u3002
+
+# Translator: In the list of options below, do not translate:
+# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define
+# Do not translate the string "java com.sun.tools.corba.se.idl.Compile"
+
+usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n java com.sun.tools.corba.se.idl.Compile [options] <idl file>\n<idl file>\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002<idl file>\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d <symbol> IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n \u540C\u3058\u3067\u3059: #define <symbol>\n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\n \u767A\u884C\u3057\u307E\u3059\u3002\n-i <include path> \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u307E\u3059\u3002\n
+
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp
new file mode 100644
index 0000000..aa2279c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/idl_zh_CN.prp
@@ -0,0 +1,177 @@
+#
+# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# COMPONENT_NAME: idl.parser
+#
+# ORIGINS: 27
+#
+# Licensed Materials - Property of IBM
+# 5639-D57 (C) COPYRIGHT International Business Machines Corp., 1997, 1999
+# RMI-IIOP v1.0
+#
+
+# Translator: Each line below is of the form "<key>=<message>".
+# The keys are NOT to be translated.
+# The messages ARE to be translated.
+#
+# DO NOT translate the following:
+# ASCII
+# #else
+# #endif
+# IDL
+#
+# %0, %1, etc. are postional parameters to the message. Do not
+# translate these. The number order is the order they are given to
+# the message writer. It is OK to change their order in the message
+# if the language grammar so dictates.
+#
+# Lines of the form "%0 (line %1): <some message>\n%x\n%y" are error
+# messages: %0 is a filename; %1 is a line number; %x is line %1 from
+# %0; %y is the error marker. So the message comes out looking like:
+# <filename> (line xxx): <some message>
+# Line xxx from <filename> where the carat points to the error
+# ^
+# So the first two and the last two parameters of these messages must
+# remain in their positions.
+#
+# A backslash (\) at the end of a line is a line continuation
+# character. A backslash at the beginning of a line means don't
+# ignore leading blanks (they normally are). These backslashes
+# should remain in the message.
+#
+# Translator: Start Translating
+
+Compile.parsing=\u6B63\u5728\u89E3\u6790 %0
+Compile.parseDone=\u5B8C\u6210 - %0
+Compile.generating=\u6B63\u5728\u751F\u6210 %0
+Compile.genDone=\u5B8C\u6210 - %0
+Deprecated.keyword=\u8B66\u544A: \u5173\u952E\u5B57 `%0' \u5DF2\u8FC7\u65F6\u3002
+EvaluationException.1=%0 \u8FD0\u7B97\u7B26\u7684\u64CD\u4F5C\u6570\u4E0D\u4E00\u81F4: %1 \u548C %2\u3002
+EvaluationException.2=%0 \u8FD0\u7B97\u7B26\u7684\u64CD\u4F5C\u6570\u5FC5\u987B\u662F\u6570\u5B57, \u800C\u4E0D\u662F %1\u3002
+EvaluationException.or=\u6309\u4F4D\u6216
+EvaluationException.xor=\u6309\u4F4D\u5F02\u6216
+EvaluationException.and=\u6309\u4F4D\u4E0E
+EvaluationException.plus=\u6DFB\u52A0
+EvaluationException.minus=\u51CF\u6CD5
+EvaluationException.left=\u5411\u5DE6\u79FB\u4F4D
+EvaluationException.right=\u5411\u53F3\u79FB\u4F4D
+EvaluationException.times=\u4E58\u6CD5
+EvaluationException.divide=\u9664\u6CD5
+EvaluationException.mod=\u53D6\u6A21
+EvaluationException.pos=\u4E00\u5143\u6B63\u6570
+EvaluationException.neg=\u4E00\u5143\u8D1F\u6570
+EvaluationException.not=\u6309\u4F4D\u975E
+EvaluationException.booleanNot=\u5E03\u5C14\u975E
+EvaluationException.booleanAnd=\u5E03\u5C14\u4E0E
+EvaluationException.booleanOr=\u5E03\u5C14\u6216
+EvaluationException.equal=\u7B49\u4E8E
+EvaluationException.notEqual=\u4E0D\u7B49\u4E8E
+EvaluationException.greaterThan=\u5927\u4E8E
+EvaluationException.lessThan=\u5C0F\u4E8E
+EvaluationException.greaterEqual=\u5927\u4E8E\u7B49\u4E8E
+EvaluationException.lessEqual=\u5C0F\u4E8E\u7B49\u4E8E
+GenFileStream.1=\u65E0\u6CD5\u751F\u6210%0: %1
+InvalidArgument.1=\u53C2\u6570\u65E0\u6548: %0\u3002
+InvalidArgument.2=\u672A\u6307\u5B9A IDL \u6587\u4EF6\u3002
+InvalidCharacter.1=%0 (\u884C %1): \u5B57\u7B26\u65E0\u6548: %2 (ASCII %3)\u3002\n%4\n%5
+Migration.futureKeyword=\u8B66\u544A: \u6807\u8BC6\u7B26 `%0' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u4EE5\u786E\u4FDD\u5C06\u6765\u517C\u5BB9\u3002
+Migration.keywordCollision=\u8B66\u544A: \u6807\u8BC6\u7B26 `%0' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u4EE5\u786E\u4FDD\u5C06\u6765\u517C\u5BB9\u3002
+ParseException.abstractValueBox=%0 (\u884C %1): \u4E0D\u80FD\u5C06\u503C\u6846\u58F0\u660E\u4E3A\u62BD\u8C61\u3002\n%2\n%3
+ParseException.alreadyDeclared=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u3002\n%3\n%4
+ParseException.declNotInSameFile=%0 (\u884C %1): %2\u4EE5\u524D\u66FE\u5728\u6587\u4EF6%3\u7684\u524D\u5411\u58F0\u660E\u4E2D\u58F0\u660E\u3002\n%4\n%5
+ParseException.alreadyDerived=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u4E3A%3\u7684\u7236\u7EA7\u3002\n%4\n%5
+ParseException.alreadyDefaulted=%0 (\u884C %1): \u5DF2\u9047\u5230\u9ED8\u8BA4\u5206\u652F\u3002\n%2\n%3
+ParseException.alreadyRaised=%0 (\u884C %1): %2\u5DF2\u5728 raise \u5B50\u53E5\u4E2D\u6307\u5B9A\u3002\n%3\n%4
+ParseException.attributeNotType=%0 (\u884C %1): %2 \u662F\u5C5E\u6027\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4
+ParseException.badAbstract=%0 (\u884C %1): %2\u7684\u524D\u5411\u58F0\u660E\u548C\u5B9E\u9645\u58F0\u660E\u4E0D\u4E00\u81F4\u3002\u4E00\u4E2A\u662F\u62BD\u8C61\u7684, \u800C\u53E6\u4E00\u4E2A\u4E0D\u662F\u62BD\u8C61\u7684\u3002\n%3\n%4
+ParseException.badCustom=%0 (\u884C %1): \u65E0\u6CD5\u5C06\u524D\u5411\u503C\u58F0\u660E\u58F0\u660E\u4E3A\u5B9A\u5236\u3002\n%2\n%3
+ParseException.badRepIDAlreadyAssigned=%0 (\u884C %1): \u5DF2\u5728\u4E0A\u4E00\u4E2A ID \u7F16\u8BD1\u6307\u793A\u6307\u4EE4\u4E2D\u4E3A\u7C7B\u578B%2\u5206\u914D\u4E86\u8D44\u6599\u6863\u6848\u5E93 ID\u3002\n%3\n%4
+ParseException.badRepIDForm=%0 (\u884C %1): \u8D44\u6599\u6863\u6848\u5E93 ID '%2' \u7684\u683C\u5F0F\u5E94\u4E3A '<format>:<string>'\u3002\n%3\n%4
+ParseException.badRepIDPrefix=%0 (\u884C %1): \u63A5\u53E3 %2 \u7684\u8D44\u6599\u6863\u6848\u5E93 ID \u524D\u7F00\u5E94\u4E3A `%3', \u800C\u975E '%4'\u3002\n%5\n%6
+ParseException.badState=%0 (\u884C %1): %2 \u4E0D\u80FD\u662F\u6709\u72B6\u6001\u63A5\u53E3; \u5B83\u5305\u542B\u591A\u4E2A\u6709\u72B6\u6001\u7236\u7EA7\u3002\n%3\n%4
+ParseException.branchLabel=%0 (\u884C %1): case %2\u5DF2\u58F0\u660E\u3002\n%3\n%4
+ParseException.branchName=%0 (\u884C %1): \u540D\u4E3A%2\u7684\u5206\u652F\u5DF2\u58F0\u660E\u3002\n%3\n%4
+ParseException.duplicateInit=%0 (\u884C %1): \u67D0\u4E2A\u521D\u59CB\u5316\u7A0B\u5E8F\u4E0E\u4E0A\u4E00\u4E2A\u521D\u59CB\u5316\u7A0B\u5E8F\u5177\u6709\u76F8\u540C\u7684\u7B7E\u540D\u3002\n%2\n%3
+ParseException.duplicateState=%0 (\u884C %1): \u6570\u636E\u6210\u5458 %2 \u4E0E\u4E0A\u4E00\u4E2A\u6570\u636E\u6210\u5458\u5177\u6709\u76F8\u540C\u7684\u540D\u79F0\u3002\n%3\n%4
+ParseException.elseNoIf=%0 (\u884C %1): \u9047\u5230\u4E86 #else, \u4F46\u6CA1\u6709\u5339\u914D\u7684 #if\u3002\n%2\n%3
+ParseException.endNoIf=%0 (\u884C %1): \u9047\u5230\u4E86 #endif, \u4F46\u6CA1\u6709\u5339\u914D\u7684 #if\u3002\n%2\n%3
+ParseException.evaluation=%0 (\u884C %1): %2\n%3\n%4
+ParseException.forwardEntry=%0 (\u884C %1): \u5B58\u5728\u9488\u5BF9%2\u7684\u524D\u5411\u5F15\u7528, \u4F46\u5B83\u5C1A\u672A\u5B9A\u4E49\u3002\n%3\n%4
+ParseException.forwardedValueBox=%0 (\u884C %1): %2 \u5177\u6709\u524D\u5411\u58F0\u660E\u3002\u4E0D\u80FD\u5BF9\u503C\u6846\u8FDB\u884C\u524D\u5411\u58F0\u660E\u3002\n%3\n%4
+ParseException.forwardInheritance=%0 (\u884C %1): \u5BF9\u4E8E%2, \u4ECE%3\u7684\u4E0D\u5B8C\u6574\u524D\u5411\u58F0\u660E\u8FDB\u884C\u7EE7\u627F\u662F\u975E\u6CD5\u7684\u3002\n%4\n%5
+ParseException.generic=%0 (\u884C %1): %2\n%3\n%4
+ParseException.illegalArray=%0 (\u884C %1): %2\u4E2D\u67D0\u4E2A\u6570\u7EC4\u7684\u7C7B\u578B\u975E\u6CD5\u3002\n%3\n%4
+ParseException.illegalException=%0 (\u884C %1): %2s \u4E2D\u4E0D\u80FD\u51FA\u73B0\u5F02\u5E38\u9519\u8BEF\u3002\n%3\n%4
+ParseException.invalidConst1=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u7684\u7C7B\u578B\u5FC5\u987B\u662F%2, \u800C\u4E0D\u80FD\u662F%3\u3002\n%4\n%5
+ParseException.invalidConst2=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u4E2D\u7684\u6807\u8BC6\u7B26\u5FC5\u987B\u662F\u5E38\u91CF, \u800C\u4E0D\u80FD\u662F%2\u3002\n%3\n%4
+ParseException.keywordCollision=%0 (\u884C %1): \u6807\u8BC6\u7B26 `%2' \u4E0E\u5173\u952E\u5B57\u51B2\u7A81; \u5982\u6709\u5FC5\u8981, \u8BF7\u4F7F\u7528\u8F6C\u4E49\u6807\u8BC6\u7B26\u3002\n%3\n%4
+ParseException.methodClash=%0 (\u884C %1): \u63A5\u53E3 %2 \u4E2D\u7684\u65B9\u6CD5\u540D\u51B2\u7A81: %3\u3002\n%4\n%5
+ParseException.moduleNotType=%0 (\u884C %1): %2 \u662F\u6A21\u5757\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4
+ParseException.nestedValueBox=%0 (\u884C %1): \u503C\u6846\u4E0D\u80FD\u5D4C\u5957\u3002\n%2\n%3
+ParseException.noDefault=%0 (\u884C %1): \u5F53\u5B8C\u5168\u6D89\u53CA\u6240\u6709\u53EF\u80FD\u7684 case \u65F6, \u4E0D\u5141\u8BB8\u4F7F\u7528\u9ED8\u8BA4\u5206\u652F\u3002\n%2\n%3
+ParseException.nonAbstractParent=%0 (\u884C %1): \u62BD\u8C61\u63A5\u53E3 %2 \u4E0D\u80FD\u4ECE\u975E\u62BD\u8C61\u63A5\u53E3 %3 \u7EE7\u627F\u3002\n%4\n%5
+ParseException.nonAbstractParent2=%0 (\u884C %1): \u62BD\u8C61\u503C %2 \u4E0D\u80FD\u4ECE\u975E\u62BD\u8C61\u503C %3 \u7EE7\u627F\u3002\n%4\n%5
+ParseException.nonAbstractParent3=%0 (\u884C %1): \u503C %2 \u4E0D\u80FD\u6839\u636E\u6307\u5B9A\u4ECE\u975E\u62BD\u8C61\u503C %3 \u7EE7\u627F\u3002\n%4\n%5
+ParseException.notANumber=%0 (\u884C %1): \u5E94\u4E3A\u6570\u5B57\u3002%2\u4E0D\u662F\u6709\u6548\u7684\u6570\u5B57\u3002\n%3\n%4
+ParseException.nothing=%0\u4E3A\u7A7A\u3002\u6CA1\u6709\u8981\u7F16\u8BD1\u7684\u5BF9\u8C61\u3002
+ParseException.notPosInt=%0 (\u884C %1): \u5E94\u4E3A\u6B63\u6574\u6570\u5E38\u91CF, \u800C\u975E%2\u3002\n%3\n%4
+ParseException.oneway=%0 (\u884C %1): %2\u5DF2\u58F0\u660E\u4E3A\u5355\u5411\u3002\u5355\u5411\u65B9\u6CD5\u5FC5\u987B: \u8FD4\u56DE\u7A7A\u503C; \u53EA\u6709 in \u53C2\u6570; \u4E0D\u5F15\u53D1\u5F02\u5E38\u9519\u8BEF\u3002\n%3\n%4
+ParseException.operationNotType=%0 (\u884C %1): %2\u662F\u8FD0\u7B97\u3002\u4E0D\u80FD\u5C06\u5176\u7528\u4F5C\u7C7B\u578B\u3002\n%3\n%4
+ParseException.outOfRange=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F %2 \u7684\u503C\u8D85\u51FA\u4E86\u7C7B\u578B%3\u7684\u8303\u56F4\u3002\n%4\n%5
+ParseException.recursive=%0 (\u884C %1): \u552F\u4E00\u7684\u5408\u6CD5\u9012\u5F52\u5B9A\u4E49\u662F: sequence<%2> %3\u3002\n%4\n%5
+ParseException.selfInherit=%0 (\u884C %1): %2 \u4E0D\u80FD\u4ECE\u81EA\u8EAB\u7EE7\u627F\u3002\n%3\n%4
+ParseException.stringTooLong=%0 (\u884C %1): "%2" \u7684\u957F\u5EA6\u4E0D\u80FD\u8D85\u8FC7 %3 \u4E2A\u5B57\u7B26\u3002\n%4\n%5
+ParseException.syntax1=%0 (\u884C %1): \u5E94\u4E3A `%2'; \u4F46\u9047\u5230 `%3'\u3002\n%4\n%5
+ParseException.syntax2=%0 (\u884C %1): \u5E94\u4E3A %2 \u4E4B\u4E00; \u4F46\u9047\u5230 `%3'\u3002\n%4\n%5
+ParseException.unclosed=%0: \u5728\u6CE8\u91CA\u4E2D\u9047\u5230\u610F\u5916\u7684\u6587\u4EF6\u7ED3\u5C3E\u3002
+ParseException.undeclaredType=%0 (\u884C %1): %2 \u662F\u672A\u58F0\u660E\u7684\u7C7B\u578B\u3002\n%3\n%4
+ParseException.warning=%0 (\u884C %1): %2\n%3\n%4
+ParseException.constExprType=%0 (\u884C %1): \u5E38\u91CF\u8868\u8FBE\u5F0F\u7684\u7C7B\u578B\u4E3A %2, \u4F46\u5E94\u4E3A %3\u3002\n%4\n%5
+ParseException.wrongType=%0 (\u884C %1): %2\u7684\u7C7B\u578B\u4E3A%3, \u4F46\u5E94\u4E3A%4\u3002\n%5\n%6
+ParseException.illegalIncompleteTypeReference=%0 (\u884C %1): \u5BF9\u7C7B\u578B%2\u7684\u4E0D\u5B8C\u6574\u524D\u5411\u58F0\u660E\u7684\u5F15\u7528\u975E\u6CD5\u3002\n%3\n%4
+Preprocessor.unknown=\u672A\u77E5\u7684\u9884\u5904\u7406\u7A0B\u5E8F\u6307\u4EE4 `%0'\u3002\u5DF2\u5FFD\u7565\u884C\u3002
+Preprocessor.unknownPragma=\u672A\u77E5\u7684\u7F16\u8BD1\u6307\u793A\u6307\u4EE4 `%0'\u3002\u5DF2\u5FFD\u7565\u884C\u3002
+Preprocessor.undefinedName=\u7F16\u8BD1\u6307\u793A %0 \u7684\u672A\u5B9A\u4E49\u7C7B\u578B\u540D: %1\u3002\u5DF2\u5FFD\u7565\u884C\u3002
+Token.boolLit=<\u5E03\u5C14\u6587\u5B57>
+Token.charLit=<\u5B57\u7B26\u6587\u5B57>
+Token.intLit=<\u6574\u578B\u6587\u5B57>
+Token.floatLit=<\u6D6E\u70B9\u6587\u5B57>
+Token.stringLit=<\u5B57\u7B26\u4E32\u6587\u5B57>
+Token.literal=<\u6587\u5B57>
+Token.identifier=<\u6807\u8BC6\u7B26>
+Token.endOfFile=EOF
+Token.unknown=?
+Util.cantCreatePkg=\u65E0\u6CD5\u521B\u5EFA\u7A0B\u5E8F\u5305%0\u3002
+Version.product=IDL \u89E3\u6790\u5668\u6846\u67B6, \u7248\u672C "%0"
+Version.number=3.2
+default=\u9519\u8BEF! \u8BF7\u6C42\u4E86\u4E0D\u5B58\u5728\u7684\u6D88\u606F\u3002\u6D88\u606F\u6587\u4EF6\u672A\u5305\u542B\u5173\u952E\u5B57: %0\u3002
+
+# Translator: In the list of options below, do not translate:
+# -i, -d, -keep, -emitAll, -noWarn, -v, -verbose, -version, #define
+# Do not translate the string "java com.sun.tools.corba.se.idl.Compile"
+
+usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n java com.sun.tools.corba.se.idl.Compile [\u9009\u9879] <idl \u6587\u4EF6>\n\u5176\u4E2D, <idl \u6587\u4EF6> \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u8FD9\u4E9B\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; <idl \u6587\u4EF6> \u662F\u5FC5\u9700\u7684\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included\n \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u3002\n
+
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl
new file mode 100644
index 0000000..921a7cf
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/ir.idl
@@ -0,0 +1,778 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file contains OMG IDL from CORBA V2.0, July 1995.
+ * It also contains the TypeCode creation APIs in CORBA::ORB
+ **/
+
+#pragma prefix "omg.org"
+
+module CORBA {
+ typedef string Identifier;
+ typedef string ScopedName;
+ typedef string RepositoryId;
+
+ enum DefinitionKind {
+ 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, // orbos 98-01-18: Objects By Value
+ dk_Native
+ };
+
+
+ interface IRObject
+ /**
+ An IRObject IDL interface represents the most generic interface
+ from which all other Interface Repository interfaces are derived,
+ even the Repository itself.
+ */
+ {
+ // read interface
+ readonly attribute DefinitionKind def_kind;
+
+ // write interface
+ void destroy ();
+ };
+
+
+
+ typedef string VersionSpec;
+
+ interface Contained;
+ interface Repository;
+ interface Container;
+
+ interface Contained : IRObject
+ /**
+ The Contained Interface is inherited by all Interface Repository
+ interfaces that are contained by other objects.
+ */
+ {
+ // read/write interface
+
+ attribute RepositoryId id;
+ attribute Identifier name;
+ attribute VersionSpec version;
+
+ // read interface
+
+ readonly attribute Container defined_in;
+ readonly attribute ScopedName absolute_name;
+ readonly attribute Repository containing_repository;
+
+ struct Description {
+ DefinitionKind kind;
+ any value;
+ };
+
+ Description describe ();
+
+ // write interface
+
+ void move (
+ in Container new_container,
+ in Identifier new_name,
+ in VersionSpec new_version
+ );
+ };
+
+
+ interface ModuleDef;
+ interface ConstantDef;
+ interface IDLType;
+ interface StructDef;
+ interface UnionDef;
+ interface EnumDef;
+ interface AliasDef;
+ interface InterfaceDef;
+ interface ExceptionDef;
+ interface ValueDef; // orbos 98-01-18: Objects By Value
+ interface ValueMemberDef; // orbos 98-01-18: Objects By Value
+ interface ValueBoxDef; // orbos 98-01-18: Objects By Value
+ interface NativeDef;
+
+
+ typedef sequence <InterfaceDef> InterfaceDefSeq;
+
+
+ typedef sequence <Contained> ContainedSeq;
+
+ struct StructMember {
+ Identifier name;
+ TypeCode type;
+ IDLType type_def;
+ };
+ typedef sequence <StructMember> StructMemberSeq;
+
+ struct UnionMember {
+ Identifier name;
+ any label;
+ TypeCode type;
+ IDLType type_def;
+ };
+ typedef sequence <UnionMember> UnionMemberSeq;
+
+
+ typedef sequence <Identifier> EnumMemberSeq;
+
+ // orbos 98-01-18: Objects By Value -- begin
+ typedef short Visibility;
+ const Visibility PRIVATE_MEMBER = 0;
+ const Visibility PUBLIC_MEMBER = 1;
+
+ struct ValueMember {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ IDLType type_def;
+ Visibility access;
+ };
+ typedef sequence <ValueMember> ValueMemberSeq;
+
+ struct Initializer {
+ StructMemberSeq members;
+ };
+ typedef sequence <Initializer> InitializerSeq;
+
+ typedef sequence <ValueDef> ValueDefSeq;
+
+ // orbos 98-01-18: Objects By Value -- end
+
+
+ interface Container : IRObject
+ /**
+ The Container interface is used to form a containment hierarchy
+ in the Interface Repository. A Container can contain any number
+ of objects derived from the Contained interface.
+ */
+ {
+ // read interface
+
+ Contained lookup ( in ScopedName search_name);
+
+ ContainedSeq contents (
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited
+ );
+
+ ContainedSeq lookup_name (
+ in Identifier search_name,
+ in long levels_to_search,
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited
+ );
+
+ struct Description {
+ Contained contained_object;
+ DefinitionKind kind;
+ any value;
+ };
+
+ typedef sequence<Description> DescriptionSeq;
+
+ DescriptionSeq describe_contents (
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited,
+ in long max_returned_objs
+ );
+
+ // write interface
+
+ ModuleDef create_module (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version
+ );
+
+ ConstantDef create_constant (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in any value
+ );
+
+ StructDef create_struct (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in StructMemberSeq members
+ );
+
+ UnionDef create_union (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType discriminator_type,
+ in UnionMemberSeq members
+ );
+
+ EnumDef create_enum (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in EnumMemberSeq members
+ );
+
+ AliasDef create_alias (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType original_type
+ );
+
+ ExceptionDef create_exception (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in StructMemberSeq members
+ );
+
+
+ InterfaceDef create_interface (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_abstract,
+ in InterfaceDefSeq base_interfaces
+ );
+
+ // orbos 98-01-18: Objects By Value
+ ValueDef create_value(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_custom,
+ in boolean is_abstract,
+ in octet flags, // must be 0
+ in ValueDef base_value,
+ in boolean has_safe_base,
+ in ValueDefSeq abstract_base_values,
+ in InterfaceDefSeq supported_interfaces,
+ in InitializerSeq initializers
+ );
+
+ // orbos 98-01-18: Objects By Value
+ ValueBoxDef create_value_box(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType original_type_def
+ );
+
+ NativeDef create_native(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version
+ );
+
+ };
+
+
+
+ interface IDLType : IRObject
+ /**
+ The IDLType interface is an abstract interface inherited by all
+ IR objects that represent the OMG IDL types. It provides access
+ to the TypeCode describing the type, and is used in defining the
+ other interfaces wherever definitions of IDLType must be referenced.
+ */
+ {
+ readonly attribute TypeCode type;
+ };
+
+
+
+ interface PrimitiveDef;
+ interface StringDef;
+ interface SequenceDef;
+ interface ArrayDef;
+
+ enum PrimitiveKind {
+ pk_null, pk_void, pk_short, pk_long, pk_ushort, pk_ulong,
+ pk_float, pk_double, pk_boolean, pk_char, pk_octet,
+ pk_any, pk_TypeCode, pk_Principal, pk_string, pk_objref
+ };
+
+ interface Repository : Container
+ /**
+ Repository is an interface that provides global access to the
+ Interface Repository. Repository objects can contain constants,
+ typedefs, exceptions, interfaces, and modules.
+ */
+ {
+ // read interface
+
+ Contained lookup_id (in RepositoryId search_id);
+
+ PrimitiveDef get_primitive (in PrimitiveKind kind);
+
+ // write interface
+
+ StringDef create_string (in unsigned long bound);
+
+ SequenceDef create_sequence (
+ in unsigned long bound,
+ in IDLType element_type
+ );
+
+ ArrayDef create_array (
+ in unsigned long length,
+ in IDLType element_type
+ );
+ };
+
+
+ interface ModuleDef : Container, Contained
+ /**
+ A ModuleDef can contain constants, typedefs, exceptions, interfaces,
+ and other module objects.
+ */
+ {
+ };
+
+ struct ModuleDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ };
+
+
+ interface ConstantDef : Contained
+ /**
+ A ConstantDef object defines a named constant.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute any value;
+ };
+
+ struct ConstantDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ any value;
+ };
+
+
+ interface TypedefDef : Contained, IDLType
+ /**
+ TypedefDef is an abstract interface used as a base interface for
+ all named non-object types(structures, unions, enumerations,
+ aliases). The TypedefDef interface is not inherited by the definition
+ objects for the primitive or anonymous types.
+ */
+ {
+ };
+
+ struct TypeDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ };
+
+
+ interface StructDef : TypedefDef, Container
+ /**
+ A StructDef represents an OMG IDL structure definition.
+ */
+ {
+ attribute StructMemberSeq members;
+ };
+
+
+ interface UnionDef : TypedefDef, Container
+ /**
+ A UnionDef represents an OMG IDL union definition.
+ */
+ {
+ readonly attribute TypeCode discriminator_type;
+ attribute IDLType discriminator_type_def;
+ attribute UnionMemberSeq members;
+ };
+
+
+ interface EnumDef : TypedefDef
+ /**
+ A EnumDef represents an OMG IDL enum definition.
+ */
+ {
+ attribute EnumMemberSeq members;
+ };
+
+
+ interface AliasDef : TypedefDef
+ /**
+ An AliasDef represents an OMG IDL typedef that aliases other
+ definition.
+ */
+ {
+ attribute IDLType original_type_def;
+ };
+
+
+ interface PrimitiveDef: IDLType
+ /**
+ A PrimitiveDef represents one of the IDL primitive types. As
+ primitive types are unnamed, this interface is not derived from
+ TypedefDef or Contained.
+ */
+ {
+ readonly attribute PrimitiveKind kind;
+ };
+
+
+ interface StringDef : IDLType
+ /**
+ A StringDef represents an OMG IDL string type. As string
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long bound;
+ };
+
+
+ interface SequenceDef : IDLType
+ /**
+ A SequenceDef represents an OMG IDL sequence type. As sequence
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long bound;
+ readonly attribute TypeCode element_type;
+ attribute IDLType element_type_def;
+ };
+
+ interface ArrayDef : IDLType
+ /**
+ An ArrayDef represents an OMG IDL array type. As array
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long length;
+ readonly attribute TypeCode element_type;
+ attribute IDLType element_type_def;
+ };
+
+
+ interface ExceptionDef : Contained, Container
+ /**
+ An ExceptionDef represents an exception definition.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute StructMemberSeq members;
+ };
+ struct ExceptionDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ };
+
+
+
+ enum AttributeMode {ATTR_NORMAL, ATTR_READONLY};
+
+ interface AttributeDef : Contained
+ /**
+ An AttributeDef represents the information that defines an
+ attribute of an interface.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute AttributeMode mode;
+ };
+
+ struct AttributeDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ AttributeMode mode;
+ };
+
+
+
+ enum OperationMode {OP_NORMAL, OP_ONEWAY};
+
+ enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT};
+ struct ParameterDescription {
+ Identifier name;
+ TypeCode type;
+ IDLType type_def;
+ ParameterMode mode;
+ };
+ typedef sequence <ParameterDescription> ParDescriptionSeq;
+
+ typedef Identifier ContextIdentifier;
+ typedef sequence <ContextIdentifier> ContextIdSeq;
+
+ typedef sequence <ExceptionDef> ExceptionDefSeq;
+ typedef sequence <ExceptionDescription> ExcDescriptionSeq;
+
+ interface OperationDef : Contained
+ /**
+ An OperationDef represents the information that defines an
+ operation of an interface.
+ */
+ {
+ readonly attribute TypeCode result;
+ attribute IDLType result_def;
+ attribute ParDescriptionSeq params;
+ attribute OperationMode mode;
+ attribute ContextIdSeq contexts;
+ attribute ExceptionDefSeq exceptions;
+ };
+
+ struct OperationDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode result;
+ OperationMode mode;
+ ContextIdSeq contexts;
+ ParDescriptionSeq parameters;
+ ExcDescriptionSeq exceptions;
+ };
+
+
+
+ typedef sequence <RepositoryId> RepositoryIdSeq;
+ typedef sequence <OperationDescription> OpDescriptionSeq;
+ typedef sequence <AttributeDescription> AttrDescriptionSeq;
+
+ interface InterfaceDef : Container, Contained, IDLType
+ /**
+ An InterfaceDef object represents an interface definition. It can
+ contains constants, typedefs, exceptions, operations, and
+ attributes.
+ */
+ {
+ // read/write interface
+
+ attribute InterfaceDefSeq base_interfaces;
+ attribute boolean is_abstract;
+
+ // read interface
+
+ boolean is_a (in RepositoryId interface_id);
+
+ struct FullInterfaceDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ boolean is_abstract;
+ OpDescriptionSeq operations;
+ AttrDescriptionSeq attributes;
+ RepositoryIdSeq base_interfaces;
+ TypeCode type;
+ };
+
+ FullInterfaceDescription describe_interface();
+
+ // write interface
+
+ AttributeDef create_attribute (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode
+ );
+
+ OperationDef create_operation (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType result,
+ in OperationMode mode,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions,
+ in ContextIdSeq contexts
+ );
+ };
+
+ struct InterfaceDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryIdSeq base_interfaces;
+ };
+
+
+ // orbos 98-01-18: Objects By Value -- begin
+
+ interface ValueMemberDef : Contained
+
+ /** A <code>ValueMemberDef</code> object represents the public
+ and private data member definition of a <code>Value</code> type
+ */
+
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute Visibility access;
+ };
+
+ interface ValueDef : Container, Contained, IDLType
+ /**
+ A ValueDef object represents the definition of the
+ <code>Value</code> object used to pass the object state
+ between hosts
+ */
+
+ {
+ // read/write interface
+ attribute InterfaceDefSeq supported_interfaces;
+ attribute InitializerSeq initializers;
+ attribute ValueDef base_value;
+ attribute ValueDefSeq abstract_base_values;
+ attribute boolean is_abstract;
+ attribute boolean is_custom;
+ attribute octet flags; // always 0
+ attribute boolean has_safe_base;
+
+ // read interface
+ boolean is_a(in RepositoryId value_id);
+
+ struct FullValueDescription {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ octet flags; // always 0
+ RepositoryId defined_in;
+ VersionSpec version;
+ OpDescriptionSeq operations;
+ AttrDescriptionSeq attributes;
+ ValueMemberSeq members;
+ InitializerSeq initializers;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean has_safe_base;
+ RepositoryId base_value;
+ TypeCode type;
+ };
+
+ FullValueDescription describe_value();
+
+ // write interface
+
+ ValueMemberDef create_value_member(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type_def,
+ in Visibility access
+ );
+
+ AttributeDef create_attribute(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode
+ );
+
+ OperationDef create_operation(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType result,
+ in OperationMode mode,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions,
+ in ContextIdSeq contexts
+ );
+ };
+ struct ValueDescription {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ octet flags; // always 0
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean has_safe_base;
+ RepositoryId base_value;
+ };
+
+ interface ValueBoxDef : IDLType
+
+ /** ValueBoxDef is an interface that reresents a value type with
+ a single data member inside its state section and no
+ inheritance or methods. For example, when transmitting a
+ string or sequence as an actual parameter on an interface
+ operation or as a data member of a value type that is an
+ actual parameter, it may be important to preserve any sharing
+ of the string or sequence within the object graph being
+ transmitted. Because current IDL data types do not preserve
+ referential integrity in this way, this requirement is
+ conveniently handled by using a value type. Value types also
+ support the transmission of nulls (as a distinguished value),
+ whereas IDL data types such as string and sequence (which are
+ mapped to empty strings and sequences) do not. The Java to IDL
+ mapping requires both preservation of referential integrity
+ and transmission of nulls. Because it would be cumbersome to
+ require the full IDL syntax for a value type for this specific
+ usage, this shorthand notation is introduced to cover this use
+ of value types for simple containment of a single data member.
+ */
+
+{
+ attribute IDLType original_type_def;
+ };
+
+ // orbos 98-01-18: Objects By Value -- end
+
+ interface NativeDef : TypedefDef {
+ };
+};
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/keywords b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/keywords
new file mode 100644
index 0000000..fddd6f2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/keywords
@@ -0,0 +1,81 @@
+IDL Tokens:
+
+Grouping: ( ) [ ] { }
+Separators: : :: ;
+Operators: % & * + , - / < << = > >> ^ | ~
+
+Keywords:
+ CORBA 2.2 or earlier:
+ any
+ attribute
+ boolean
+ case
+ char
+ const
+ context
+ default
+ double
+ enum
+ exception
+ FALSE
+ float
+ in
+ inout
+ interface
+ long
+ module
+ Object
+ octet
+ oneway
+ out
+ raises
+ readonly
+ sequence
+ short
+ string
+ struct
+ switch
+ TRUE
+ typedef
+ unsigned
+ union
+ void
+ wchar
+ wstring
+
+ CORBA 2.3 only:
+ init (replaced by factory)
+
+ CORBA 2.3 and 2.4rtf:
+ abstract
+ custom
+ private
+ public
+ truncatable
+ ValueBase
+ valuetype
+ factory
+
+ CORBA 2.3, not supported by IBM compiler
+ native
+ fixed
+
+ CORBA 3.0:
+ component
+ consumes
+ emits
+ finder
+ getRaises
+ home
+ import
+ local
+ manages
+ multiple
+ primaryKey
+ provides
+ publishes
+ setRaises
+ supports
+ typeId
+ typePrefix
+ uses
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl
new file mode 100644
index 0000000..81ed1af
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/orb.idl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// IDL not generated by rmic, do not edit
+// These are all in IDL module CORBA
+// The Java classes are in the package org.omg.CORBA
+// See ValueType Semantics:Standard Value Box Definitions (5.3) in CORBA 2.3 spec
+
+#ifndef __org_omg_CORBA__
+#define __org_omg_CORBA__
+
+#pragma prefix "omg.org"
+
+module CORBA{
+
+ valuetype StringValue string;
+ valuetype WStringValue wstring;
+
+};
+
+#include "ir.idl"
+
+#pragma prefix ""
+
+#endif
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/FileLocator.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/FileLocator.java
new file mode 100644
index 0000000..d6e00e9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/FileLocator.java
@@ -0,0 +1,418 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997,1998
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.som.cff;
+
+import java.lang.Exception;
+import java.lang.String;
+import java.lang.System;
+import java.io.BufferedInputStream;
+import java.io.DataInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.InputStream;
+import java.io.IOException;
+import java.util.Locale;
+import java.util.NoSuchElementException;
+import java.util.Properties;
+import java.util.StringTokenizer;
+import java.util.zip.*;
+
+/**
+ * FileLocator is an abstract class (one that cannot be instantiated) that
+ * provides class methods for finding files in the directories or zip
+ * archives that make up the CLASSPATH.
+ *
+ * @author Larry K. Raper
+ */
+public abstract class FileLocator extends Object {
+
+ /* Class variables */
+
+
+ static final Properties pp = System.getProperties ();
+ static final String classPath = pp.getProperty ("java.class.path", ".");
+ static final String pathSeparator = pp.getProperty ("path.separator", ";");
+
+ /* Instance variables */
+
+ /* [None, no instances of this class are ever instantiated.] */
+
+ /**
+ * locateClassFile returns a DataInputStream with mark/reset
+ * capability that can be used to read the requested class file. The
+ * CLASSPATH is used to locate the class.
+ *
+ * @param classFileName The name of the class to locate. The class name
+ * should be given in fully-qualified form, for example:
+ * <pre>
+ * java.lang.Object
+ * java.io.DataInputStream
+ * </pre>
+ *
+ * @exception java.io.FileNotFoundException The requested class file
+ * could not be found.
+ * @exception java.io.IOException The requested class file
+ * could not be opened.
+ */
+ public static DataInputStream locateClassFile (String classFileName)
+ throws FileNotFoundException, IOException {
+
+ boolean notFound = true;
+ StringTokenizer st;
+ String path = "";
+ String pathNameForm;
+ File cf = null;
+ NamedDataInputStream result;
+
+ st = new StringTokenizer (classPath, pathSeparator, false);
+ pathNameForm = classFileName.replace ('.', File.separatorChar) +
+ ".class";
+
+ while (st.hasMoreTokens () && notFound) {
+
+ try {path = st.nextToken ();}
+ catch (NoSuchElementException nse) {break;}
+ int pLen = path.length ();
+ String pathLast4 = pLen > 3 ? path.substring (pLen - 4) : "";
+ if (pathLast4.equalsIgnoreCase (".zip") ||
+ pathLast4.equalsIgnoreCase (".jar")) {
+
+ try {
+
+ result = locateInZipFile (path, classFileName, true, true);
+ if (result == null)
+ continue;
+ return (DataInputStream) result;
+
+ } catch (ZipException zfe) {
+ continue;
+ } catch (IOException ioe) {
+ continue;
+ }
+
+ } else {
+ try {cf = new File (path + File.separator + pathNameForm);
+ } catch (NullPointerException npe) { continue; }
+ if ((cf != null) && cf.exists ())
+ notFound = false;
+ }
+ }
+
+ if (notFound) {
+
+ /* Make one last attempt to find the file in the current
+ * directory
+ */
+
+ int lastdot = classFileName.lastIndexOf ('.');
+ String simpleName =
+ (lastdot >= 0) ? classFileName.substring (lastdot+1) :
+ classFileName;
+
+ result = new NamedDataInputStream (new BufferedInputStream (
+ new FileInputStream (simpleName + ".class")),
+ simpleName + ".class", false);
+ return (DataInputStream) result;
+ }
+
+ result = new NamedDataInputStream (new BufferedInputStream (
+ new FileInputStream (cf)), path + File.separator + pathNameForm,
+ false);
+ return (DataInputStream) result;
+
+ }
+
+ /**
+ * locateLocaleSpecificFileInClassPath returns a DataInputStream that
+ * can be used to read the requested file, but the name of the file is
+ * determined using information from the current locale and the supplied
+ * file name (which is treated as a "base" name, and is supplemented with
+ * country and language related suffixes, obtained from the current
+ * locale). The CLASSPATH is used to locate the file.
+ *
+ * @param fileName The name of the file to locate. The file name
+ * may be qualified with a partial path name, using '/' as the separator
+ * character or using separator characters appropriate for the host file
+ * system, in which case each directory or zip file in the CLASSPATH will
+ * be used as a base for finding the fully-qualified file.
+ * Here is an example of how the supplied fileName is used as a base
+ * for locating a locale-specific file:
+ *
+ * <pre>
+ * Supplied fileName: a/b/c/x.y, current locale: US English
+ *
+ * Look first for: a/b/c/x_en_US.y
+ * (if that fails) Look next for: a/b/c/x_en.y
+ * (if that fails) Look last for: a/b/c/x.y
+ *
+ * All elements of the class path are searched for each name,
+ * before the next possible name is tried.
+ * </pre>
+ *
+ * @exception java.io.FileNotFoundException The requested class file
+ * could not be found.
+ * @exception java.io.IOException The requested class file
+ * could not be opened.
+ */
+ public static DataInputStream locateLocaleSpecificFileInClassPath (
+ String fileName) throws FileNotFoundException, IOException {
+
+ String localeSuffix = "_" + Locale.getDefault ().toString ();
+ int lastSlash = fileName.lastIndexOf ('/');
+ int lastDot = fileName.lastIndexOf ('.');
+ String fnFront, fnEnd;
+ DataInputStream result = null;
+ boolean lastAttempt = false;
+
+ if ((lastDot > 0) && (lastDot > lastSlash)) {
+ fnFront = fileName.substring (0, lastDot);
+ fnEnd = fileName.substring (lastDot);
+ } else {
+ fnFront = fileName;
+ fnEnd = "";
+ }
+
+ while (true) {
+ if (lastAttempt)
+ result = locateFileInClassPath (fileName);
+ else try {
+ result = locateFileInClassPath (fnFront + localeSuffix + fnEnd);
+ } catch (Exception e) { /* ignore */ }
+ if ((result != null) || lastAttempt)
+ break;
+ int lastUnderbar = localeSuffix.lastIndexOf ('_');
+ if (lastUnderbar > 0)
+ localeSuffix = localeSuffix.substring (0, lastUnderbar);
+ else
+ lastAttempt = true;
+ }
+ return result;
+
+ }
+
+ /**
+ * locateFileInClassPath returns a DataInputStream that can be used
+ * to read the requested file. The resource is located in the java.corba
+ * module or if not found, then the CLASSPATH is searched.
+ *
+ * @param fileName The name of the file to locate. The file name
+ * may be qualified with a partial path name, using '/' as the separator
+ * character or using separator characters appropriate for the host file
+ * system, in which case each directory or zip file in the CLASSPATH will
+ * be used as a base for finding the fully-qualified file.
+ *
+ * @exception java.io.FileNotFoundException The requested class file
+ * could not be found.
+ * @exception java.io.IOException The requested class file
+ * could not be opened.
+ */
+ public static DataInputStream locateFileInClassPath (String fileName)
+ throws FileNotFoundException, IOException {
+
+ // The resource should be in the java.corba module
+ InputStream in = FileLocator.class.getResourceAsStream("/" + fileName);
+ if (in != null) {
+ return new DataInputStream(in);
+ }
+
+ boolean notFound = true;
+ StringTokenizer st;
+ String path = "";
+ File cf = null;
+ NamedDataInputStream result;
+
+ String zipEntryName = File.separatorChar == '/' ? fileName :
+ fileName.replace (File.separatorChar, '/');
+
+ String localFileName = File.separatorChar == '/' ? fileName :
+ fileName.replace ('/', File.separatorChar);
+
+ st = new StringTokenizer (classPath, pathSeparator, false);
+
+ while (st.hasMoreTokens () && notFound) {
+
+ try {path = st.nextToken ();}
+ catch (NoSuchElementException nse) {break;}
+ int pLen = path.length ();
+ String pathLast4 = pLen > 3 ? path.substring (pLen - 4) : "";
+ if (pathLast4.equalsIgnoreCase (".zip") ||
+ pathLast4.equalsIgnoreCase (".jar")) {
+
+ try {
+
+ result = locateInZipFile (path, zipEntryName, false, false);
+ if (result == null)
+ continue;
+ return (DataInputStream) result;
+
+ } catch (ZipException zfe) {
+ continue;
+ } catch (IOException ioe) {
+ continue;
+ }
+
+ } else {
+ try {cf = new File (path + File.separator + localFileName);
+ } catch (NullPointerException npe) { continue; }
+ if ((cf != null) && cf.exists ())
+ notFound = false;
+ }
+ }
+
+ if (notFound) {
+
+ /* Make one last attempt to find the file in the current
+ * directory
+ */
+
+ int lastpart = localFileName.lastIndexOf (File.separator);
+ String simpleName =
+ (lastpart >= 0) ? localFileName.substring (lastpart+1) :
+ localFileName;
+
+ result = new NamedDataInputStream (new BufferedInputStream (
+ new FileInputStream (simpleName)), simpleName, false);
+ return (DataInputStream) result;
+ }
+
+ result = new NamedDataInputStream (new BufferedInputStream (
+ new FileInputStream (cf)), path + File.separator + localFileName,
+ false);
+ return (DataInputStream) result;
+
+ }
+
+ /**
+ * Returns the fully qualified file name associated with the passed
+ * DataInputStream <i>if the DataInputStream was created using one
+ * of the static locate methods supplied with this class</i>, otherwise
+ * returns a zero length string.
+ */
+ public static String getFileNameFromStream (DataInputStream ds) {
+
+ if (ds instanceof NamedDataInputStream)
+ return ((NamedDataInputStream) ds).fullyQualifiedFileName;
+ return "";
+
+ }
+
+ /**
+ * Returns an indication of whether the passed DataInputStream is
+ * associated with a member of a zip file <i>if the DataInputStream was
+ * created using one of the static locate methods supplied with this
+ * class</i>, otherwise returns false.
+ */
+ public static boolean isZipFileAssociatedWithStream (DataInputStream ds) {
+
+ if (ds instanceof NamedDataInputStream)
+ return ((NamedDataInputStream) ds).inZipFile;
+ return false;
+
+ }
+
+ private static NamedDataInputStream locateInZipFile (String zipFileName,
+ String fileName, boolean wantClass, boolean buffered)
+ throws ZipException, IOException {
+
+ ZipFile zf;
+ ZipEntry ze;
+ zf = new ZipFile (zipFileName);
+
+ if (zf == null)
+ return null;
+ String zeName = wantClass ?
+ fileName.replace ('.', '/') + ".class" :
+ fileName;
+
+ // This code works with JDK 1.0 level SUN zip classes
+ //
+
+ // ze = zf.get (zeName);
+ // if (ze == null)
+ // return null;
+ // return new NamedDataInputStream (
+ // new BufferedInputStream (new ZipInputStream (ze)),
+ // zipFileName + '(' +zeName + ')', true);
+
+ // This code works with JDK 1.0.2 and JDK 1.1 level SUN zip classes
+ //
+
+ ze = zf.getEntry (zeName);
+ if (ze == null) {
+ zf.close(); // D55355, D56419
+ zf = null;
+ return null;
+ }
+ InputStream istream = zf.getInputStream(ze);
+ if (buffered)
+ istream = new BufferedInputStream(istream);
+ return new NamedDataInputStream (istream,
+ zipFileName + '(' + zeName + ')', true);
+
+ }
+
+}
+
+/**
+ * This class is used to associate a filename with a DataInputStream
+ * The host platform's file naming conventions are assumed for the filename.
+ *
+ * @author Larry K. Raper
+ *
+ */
+/* default access */ class NamedDataInputStream extends DataInputStream {
+
+ /* Instance variables */
+
+ /**
+ * The name of the file associated with the DataInputStream.
+ */
+ public String fullyQualifiedFileName;
+
+ /**
+ * Indicates whether or not the file is contained in a .zip file.
+ */
+ public boolean inZipFile;
+
+ /* Constructors */
+
+ protected NamedDataInputStream (InputStream in, String fullyQualifiedName,
+ boolean inZipFile) {
+
+ super (in);
+ this.fullyQualifiedFileName = fullyQualifiedName;
+ this.inZipFile = inZipFile;
+
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/Messages.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/Messages.java
new file mode 100644
index 0000000..60dd7c3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/cff/Messages.java
@@ -0,0 +1,356 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997,1998
+ * RMI-IIOP v1.0
+ *
+ * Defect History
+ *
+ * #26964 LKR 11/25/96 \u0020 at end-of-message not handled properly by Java.
+ * #31840 LKR 06/05/97 Replace \n in templates with Java's line separator.
+ *
+ */
+
+package com.sun.tools.corba.se.idl.som.cff;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.Properties;
+import java.lang.String;
+import java.lang.System;
+
+/**
+ * This class provides messaging services for accessing, and merging
+ * parameters into, translatable message text. The text is presumed
+ * to reside in a .properties file. A "cff.properties" file that
+ * contains all of the message text needed for the CFF framework itself
+ * is loaded during class initialization. All of the messages in the
+ * cff.properties file that are needed by the CFF framework contain keys
+ * that begin with the string "cff.".
+ * <p>
+ * The static method Messages.msgLoad may be used to merge additional
+ * message text .properties files needed by other frameworks or user
+ * programs.
+ *
+ * @see com.sun.tools.corba.se.idl.som.cff.Messages#msgLoad
+ *
+ * @author Larry K. Raper
+ */
+
+public abstract class Messages {
+
+ /* Class variables */
+
+
+ /* Metasymbol for leading or trailing blank */
+ private static final String LTB = "%B";
+ /* Metasymbol for line separator */
+ private static final char NL = '\n';
+
+ private static final String lineSeparator =
+ System.getProperty ("line.separator");
+
+ private static final Properties m = new Properties ();
+ private static boolean loadNeeded = true;
+
+ /* Class methods for message loading and formatting */
+
+ private static final synchronized void loadDefaultProperties () {
+
+ if (!loadNeeded)
+ return;
+ try {
+ m.load (FileLocator.locateLocaleSpecificFileInClassPath (
+ "com/sun/tools/corba/se/idl/som/cff/cff.properties"));
+ } catch (IOException ioe) { }
+ fixMessages (m); /* #26964 Replace any metasymbols */
+ loadNeeded = false;
+
+ }
+
+ /**
+ * This method was introduced to fix defect #26964. For Java 1.0.2
+ * on Win NT, the escape sequence \u0020 was not being handled
+ * correctly by the Java Properties class when it was the final
+ * character of a line. Instead the trailing blank was dropped
+ * and the next line was swallowed as a continuation. To work
+ * around the problem, we introduced our own metasymbol to represent
+ * a trailing blank. Hence:
+ *
+ * Performs substitution for any metasymbols in the message
+ * templates. So far only %B is needed. This was introduced
+ * to make it more convenient for .properties files to
+ * contain message templates with leading or trailing blanks
+ * (although %B may actually occur anywhere in a template).
+ * Subsequently, checking for '\n' has also been added. Now,
+ * wherever '\n' occurs in a message template, it is replaced
+ * with the value of System.getProperty ("line.separator").
+ */
+ private static final void fixMessages (Properties p) {
+
+ Enumeration keys = p.keys ();
+ Enumeration elems = p.elements ();
+ while (keys.hasMoreElements ()) {
+ String key = (String) keys.nextElement ();
+ String elem = (String) elems.nextElement ();
+ int i = elem.indexOf (LTB);
+ boolean changed = false;
+ while (i != -1) {
+ if (i == 0)
+ elem = " " + elem.substring (2);
+ else
+ elem = elem.substring (0, i) + " " + elem.substring (i+2);
+ changed = true;
+ i = elem.indexOf (LTB);
+ }
+ int lsIncr = lineSeparator.length () - 1;
+ for (i=0; i<elem.length (); i++) {
+ if (elem.charAt (i) == NL) {
+ elem = elem.substring (0, i) +
+ lineSeparator + elem.substring (i+1);
+ i += lsIncr;
+ changed = true;
+ }
+ }
+ if (changed)
+ p.put (key, elem);
+ }
+
+ }
+
+ /**
+ * Loads additional message keys and text found in the passed
+ * properties file. The specified properties file is assumed to
+ * reside in the CLASSPATH. An IOException is thrown if the loading fails.
+ */
+ public static final synchronized void msgLoad (String propertyFileName)
+ throws IOException {
+
+ m.load (FileLocator.locateLocaleSpecificFileInClassPath (
+ propertyFileName));
+ fixMessages (m); /* #26964 Replace any metasymbols */
+ loadNeeded = false;
+
+ }
+
+ /**
+ * Returns the message text corresponding to the passed msgkey
+ * string. If the msgkey cannot be found, its value is returned
+ * as the output message text.
+ */
+ public static final String msg (String msgkey) {
+
+ if (loadNeeded)
+ loadDefaultProperties ();
+ String msgtext = m.getProperty (msgkey, msgkey);
+ return msgtext;
+
+ }
+
+ /**
+ * Returns the message text corresponding to the passed msgkey
+ * string. The message text is assumed to require the insertion
+ * of a single argument, supplied by the "parm" parameter.
+ * If the message text does not contain the meta characters "%1"
+ * that indicate where to place the argument, the passed argument
+ * is appended at the end of the message text.
+ * <p>
+ * If the msgkey cannot be found, its value is used as the
+ * message text.
+ */
+ public static final String msg (String msgkey, String parm) {
+
+ if (loadNeeded)
+ loadDefaultProperties ();
+ String msgtext = m.getProperty (msgkey, msgkey);
+ int i = msgtext.indexOf ("%1");
+ if (i >= 0) {
+ String ending = "";
+ if ((i+2) < msgtext.length ())
+ ending = msgtext.substring (i+2);
+ return msgtext.substring (0, i) + parm + ending;
+ } else
+ msgtext += " " + parm;
+ return msgtext;
+
+ }
+
+ /**
+ * Returns the message text corresponding to the passed msgkey
+ * string. The message text is assumed to require the insertion
+ * of a single argument, supplied by the "parm" parameter.
+ * If the message text does not contain the meta characters "%1"
+ * that indicate where to place the argument, the passed argument
+ * is appended at the end of the message text.
+ * <p>
+ * If the msgkey cannot be found, its value is used as the
+ * message text.
+ */
+ public static final String msg (String msgkey, int parm) {
+
+ return msg (msgkey, String.valueOf (parm));
+
+ }
+
+ /**
+ * Returns the message text corresponding to the passed msgkey
+ * string. The message text is assumed to require the insertion
+ * of two arguments, supplied by the "parm1" and "parm2" parameters.
+ * If the message text does not contain the meta characters "%1" and
+ * "%2" that indicate where to place the arguments, the passed arguments
+ * are appended at the end of the message text.
+ * <p>
+ * If the msgkey cannot be found, its value is used as the
+ * message text.
+ */
+ public static final String msg (String msgkey, String parm1, String parm2) {
+
+ if (loadNeeded)
+ loadDefaultProperties ();
+ String result = m.getProperty (msgkey, msgkey);
+ String ending = "";
+ int i = result.indexOf ("%1");
+ if (i >= 0) {
+ if ((i+2) < result.length ())
+ ending = result.substring (i+2);
+ result = result.substring (0, i) + parm1 + ending;
+ } else
+ result += " " + parm1;
+ i = result.indexOf ("%2");
+ if (i >= 0) {
+ ending = "";
+ if ((i+2) < result.length ())
+ ending = result.substring (i+2);
+ result = result.substring (0, i) + parm2 + ending;
+ } else
+ result += " " + parm2;
+ return result;
+
+ }
+
+ /**
+ * Returns the message text corresponding to the passed msgkey
+ * string. The message text is assumed to require the insertion
+ * of two arguments, supplied by the "parm1" and "parm2" parameters.
+ * If the message text does not contain the meta characters "%1" and
+ * "%2" that indicate where to place the arguments, the passed arguments
+ * are appended at the end of the message text.
+ * <p>
+ * If the msgkey cannot be found, its value is used as the
+ * message text.
+ */
+ public static final String msg (String msgkey, int parm1, String parm2) {
+
+ return msg (msgkey, String.valueOf (parm1), parm2);
+
+ }
+
+ /**
+ * Returns the message text corresponding to the passed msgkey
+ * string. The message text is assumed to require the insertion
+ * of two arguments, supplied by the "parm1" and "parm2" parameters.
+ * If the message text does not contain the meta characters "%1" and
+ * "%2" that indicate where to place the arguments, the passed arguments
+ * are appended at the end of the message text.
+ * <p>
+ * If the msgkey cannot be found, its value is used as the
+ * message text.
+ */
+ public static final String msg (String msgkey, String parm1, int parm2) {
+
+ return msg (msgkey, parm1, String.valueOf (parm2));
+
+ }
+
+ /**
+ * Returns the message text corresponding to the passed msgkey
+ * string. The message text is assumed to require the insertion
+ * of two arguments, supplied by the "parm1" and "parm2" parameters.
+ * If the message text does not contain the meta characters "%1" and
+ * "%2" that indicate where to place the arguments, the passed arguments
+ * are appended at the end of the message text.
+ * <p>
+ * If the msgkey cannot be found, its value is used as the
+ * message text.
+ */
+ public static final String msg (String msgkey, int parm1, int parm2) {
+
+ return msg (msgkey, String.valueOf (parm1), String.valueOf (parm2));
+
+ }
+
+
+ /**
+ * Returns the message text corresponding to the passed msgkey
+ * string. The message text is assumed to require the insertion
+ * of three arguments, supplied by the "parm1", "parm2" and "parm3"
+ * parameters.
+ * If the message text does not contain the meta characters "%1" and
+ * "%2" that indicate where to place the arguments, the passed arguments
+ * are appended at the end of the message text.
+ * <p>
+ * If the msgkey cannot be found, its value is used as the
+ * message text.
+ */
+ public static final String msg (String msgkey, String parm1,
+ String parm2, String parm3) {
+ if (loadNeeded)
+ loadDefaultProperties ();
+ String result = m.getProperty (msgkey, msgkey);
+ result = substituteString(result, 1, parm1);
+ result = substituteString(result, 2, parm2);
+ result = substituteString(result, 3, parm3);
+
+ return result;
+ }
+
+ /* helper function for string substition.
+ @return the substituted string, it substitution is possible.
+ Otherwise, return a new string with subst at the end.
+ @orig: original string
+ @paramNum the parameter number to search. For example,
+ paramNam == 1 means search for "%1".
+ @subst: string for the substitution.
+ */
+ private static String substituteString(String orig, int paramNum,
+ String subst){
+ String result = orig;
+ String paramSubst = "%"+ paramNum;
+ int len = paramSubst.length();
+ int index = result.indexOf (paramSubst);
+ String ending = "";
+ if (index >= 0) {
+ if ((index+len) < result.length ())
+ ending = result.substring (index+len);
+ result = result.substring (0, index) + subst + ending;
+ }
+ else result += " " + subst;
+
+ return result;
+ }
+
+
+}
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java
new file mode 100644
index 0000000..262a2d2
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/som/idlemit/MetaPragma.java
@@ -0,0 +1,259 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: shasta
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997,1998,1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.som.idlemit;
+import java.util.Vector;
+import com.sun.tools.corba.se.idl.som.cff.Messages;
+/**
+ * This is an implementation that handles
+ * #pragma meta scoped_name string
+ * where
+ * <UL>
+ * <LI> scoped_name == "::" separated scoped name
+ * <LI> string == separated identifiers, such as "localonly",
+ * "abstract", or "init".
+ * D59407: NOTE: any non-white-space is grouped
+ * as part of the identifier.
+ * </UL>
+ *
+ * This pragma handler places a vector of Strings into the dynamicVariable()
+ * part of the SymtabEntry. The key to access the dynamicVariable()
+ * is com.sun.tools.corba.se.idl.som.idlemit.MetaPragma.metaKey
+ *
+ * It is possible to associate a meta pragma with a forward entry.
+ * At some point after the parser has completed,
+ * the method processForward(ForwardEntry entry) should be called
+ * for each ForwardEntry so that the meta information can be folded from
+ * the ForwardEntry into the corresponding InterfaceEntry.
+ */
+public class MetaPragma extends com.sun.tools.corba.se.idl.PragmaHandler {
+ /* Class variables */
+
+ /* key to access the Cached meta info in com.sun.tools.corba.se.idl.SymtabEntry */
+ public static int metaKey = com.sun.tools.corba.se.idl.SymtabEntry.getVariableKey();
+
+
+ /**
+ * Main entry point for the MetaPragma handler
+ * @param pragma string for pragma name
+ * @param currentToken next token in the input stream.
+ * @return true if this is a meta pragma.
+ */
+ public boolean process(String pragma, String currentToken) {
+ if ( !pragma.equals("meta"))
+ return false;
+
+ com.sun.tools.corba.se.idl.SymtabEntry entry ;
+ String msg;
+ try {
+ entry = scopedName();
+ if ( entry == null){
+ /* scoped name not found */
+ parseException(Messages.msg("idlemit.MetaPragma.scopedNameNotFound"));
+ skipToEOL();
+ }
+ else {
+ msg = (currentToken()+ getStringToEOL());
+// System.out.println(entry + ": " + msg);
+ Vector v;
+ v = (Vector) entry.dynamicVariable(metaKey);
+ if ( v== null){
+ v = new Vector();
+ entry.dynamicVariable(metaKey, v);
+ }
+ parseMsg(v, msg);
+ }
+ } catch(Exception e){
+// System.out.println("exception in MetaPragma");
+ }
+ return true;
+ }
+
+
+ /**
+ * Fold the meta info from the forward entry into its corresponding
+ * interface entry.
+ * @param forwardEntry the forward entry to process
+ */
+ static public void processForward(com.sun.tools.corba.se.idl.ForwardEntry forwardEntry){
+
+ Vector forwardMeta;
+ try {
+ forwardMeta = (Vector)forwardEntry.dynamicVariable(metaKey);
+ } catch (Exception e){
+ forwardMeta = null;
+ }
+ com.sun.tools.corba.se.idl.SymtabEntry forwardInterface = forwardEntry.type();
+ if (forwardMeta != null && forwardInterface!= null) {
+ Vector interfaceMeta;
+ try {
+ interfaceMeta= (Vector)forwardInterface.dynamicVariable(metaKey);
+ } catch ( Exception e){
+ interfaceMeta = null;
+ }
+
+ if ( interfaceMeta == null) {
+ /* set */
+ try {
+ forwardInterface.dynamicVariable(MetaPragma.metaKey, forwardMeta);
+ } catch(Exception e){};
+ }
+ else if (interfaceMeta != forwardMeta) {
+ /* The above check is needed because sometimes
+ a forward entry is processed more the once.
+ Not sure why */
+ /* merge */
+ for (int i=0; i < forwardMeta.size(); i++){
+ try {
+ Object obj = forwardMeta.elementAt(i);
+ interfaceMeta.addElement(obj);
+ } catch (Exception e){};
+ }
+ }
+ }
+ }
+
+ /**
+ * parse pragma message and place into vector v.
+ * @param v: vector to add message
+ * @param msg: string of comma separated message, perhaps with comment.
+ * This is implemented as a state machine as follows:
+ *
+ * State token next action
+ * -----------------------------------------------------
+ * initial whitespace initial
+ * initial SlashStar comment
+ * initial SlashSlash final
+ * initial no more final
+ * initial text text add to text buffer
+ * initial StarSlash initial
+ * comment StarSlash initial
+ * comment SlashStar comment
+ * comment whitespace comment
+ * comment SlashSlash comment
+ * comment text comment
+ * comment no more final
+ * text text text add to buffer
+ * text SlashStar comment put in vector
+ * text whitespace initial put in vector
+ * text SlashSlash final put in vector
+ * text StarSlash initial put in vector
+ * text no more final put in vector
+ *
+ */
+ private static int initialState = 0;
+ private static int commentState = 1;
+ private static int textState = 2;
+ private static int finalState =3;
+
+ private void parseMsg(Vector v, String msg){
+ int state = initialState;
+ String text = "";
+ int index = 0;
+ while ( state != finalState ){
+ boolean isNoMore = index >= msg.length();
+ char ch = ' ';
+ boolean isSlashStar = false;
+ boolean isSlashSlash = false;
+ boolean isWhiteSpace = false;
+ boolean isStarSlash = false;
+ boolean isText = false;
+ if (!isNoMore ){
+ ch = msg.charAt(index);
+ if (ch == '/' && index+1 < msg.length()){
+ if (msg.charAt(index+1) == '/'){
+ isSlashSlash = true;
+ index++;
+ }
+ else if (msg.charAt(index+1) == '*'){
+ isSlashStar= true;
+ index++;
+ } else isText = true;
+ }
+ else if (ch == '*' && index+1 < msg.length() ){
+ if (msg.charAt(index+1) == '/'){
+ isStarSlash = true;
+ index++;
+ } else isText = true;
+ }
+ else if ( Character.isSpace(ch) || (ch == ',') // 59601
+ || (ch == ';') ) // 59683
+ isWhiteSpace = true;
+ else isText = true;
+ }
+
+ if (state == initialState){
+ if (isSlashStar){
+ state = commentState;
+ }
+ else if (isSlashSlash || isNoMore){
+ state = finalState;
+ }
+ else if (isText){
+ state = textState;
+ text = text+ ch;
+ }
+ }
+ else if (state == commentState){
+ if (isNoMore){
+ state = finalState;
+ }
+ else if ( isStarSlash){
+ state = initialState;
+ }
+ }
+ else if (state == textState){
+ if (isNoMore || isStarSlash || isSlashSlash ||
+ isSlashStar || isWhiteSpace ){
+ if (!text.equals("")) {
+ v.addElement(text);
+// System.err.println("adding " + text);
+ text = "";
+ }
+ if (isNoMore)
+ state = finalState;
+ else if (isSlashStar)
+ state = commentState;
+ else state = initialState;
+ }
+ else if (isText){
+ text = text+ch;
+ }
+ }
+ index++;
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java
new file mode 100644
index 0000000..6620608
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Arguments.java
@@ -0,0 +1,342 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -09/23/98 <klr> Ported -td option to change output directory
+// -09/23/98 <klr> Ported -m option to generate make dependencies
+// -F46082.51<daz> Transferred -m, -mmin, mall, -mdepend options to com.sun.tools.corba.se.idl.toJava
+// since these are IBM-specific (see f46838); cleaned-out dead code.
+// -D57482 <klr> Added method setDefaultEmitter so could be overridden.
+// -F60858.1<daz> Set corba level to 2.3.
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Properties;
+import java.util.Vector;
+import java.io.File;
+
+import com.sun.tools.corba.se.idl.InvalidArgument;
+
+/**
+ *
+ **/
+public class Arguments extends com.sun.tools.corba.se.idl.Arguments
+{
+ /**
+ * Public, zero-argument constructor.
+ **/
+ public Arguments ()
+ {
+ super ();
+ corbaLevel = 2.4f;
+ } // ctor
+
+ /**
+ *
+ **/
+ protected void parseOtherArgs (String[] args,
+ Properties properties) throws InvalidArgument
+ {
+ String skeletonPattern = null ;
+ String tiePattern = null ;
+
+ // Get package prefixes from user's properties file.
+ packages.put ("CORBA", "org.omg"); // klr - always needed
+ packageFromProps (properties);
+
+ // Now get package prefixes from command line (along with other args).
+ // This order has the effect of making command line packages
+ // supercede any idl.config file packages.
+ try
+ {
+ Vector unknownArgs = new Vector ();
+
+ // Process command line parameters
+ for (int i = 0; i < args.length; ++i)
+ {
+ String lcArg = args[i].toLowerCase ();
+
+ if (lcArg.charAt (0) != '-' && lcArg.charAt (0) != '/')
+ throw new InvalidArgument (args[i]);
+ if (lcArg.charAt (0) == '-' ) {
+ lcArg = lcArg.substring (1);
+ }
+
+ // Proxy options; default is -fclient.
+ if (lcArg.startsWith ("f"))
+ {
+ // If the command line had '-f client', make it '-fclient'
+ if (lcArg.equals ("f"))
+ lcArg = 'f' + args[++i].toLowerCase ();
+
+ // Determine whether to emit bindings for client, server or both; and
+ // whether to emit delegate-style (TIE) rather than derived-style
+ // skeletons, which are the default.
+
+ if (lcArg.equals ("fclient"))
+ {
+ emit = ((emit == Server || emit == All) ? All : Client);
+ }
+ else if (lcArg.equals ("fserver"))
+ {
+ emit = ((emit == Client || emit == All) ? All : Server);
+ TIEServer = false;
+ }
+ else if (lcArg.equals ("fall"))
+ {
+ emit = All;
+ TIEServer = false;
+ //Should be removed and incorporated in the clause below
+ // POAServer = true;
+ }
+ else if (lcArg.equals ("fservertie"))
+ {
+ emit = ((emit == Client || emit == All) ? All : Server);
+ TIEServer = true;
+ }
+ else if (lcArg.equals ("falltie"))
+ {
+ emit = All;
+ TIEServer = true;
+ }
+ else
+ i = collectUnknownArg (args, i, unknownArgs);
+ }
+ else if (lcArg.equals ("pkgtranslate"))
+ {
+ if (i + 2 >= args.length)
+ throw new InvalidArgument( args[i] ) ;
+
+ String orig = args[++i] ;
+ String trans = args[++i] ;
+ checkPackageNameValid( orig ) ;
+ checkPackageNameValid( trans ) ;
+ if (orig.equals( "org" ) || orig.startsWith( "org.omg" ))
+ throw new InvalidArgument( args[i] ) ;
+ orig = orig.replace( '.', '/' ) ;
+ trans = trans.replace( '.', '/' ) ;
+ packageTranslation.put( orig, trans ) ;
+ }
+ // Package prefix
+ else if (lcArg.equals ("pkgprefix"))
+ {
+ if (i + 2 >= args.length)
+ throw new InvalidArgument (args[i]);
+
+ String type = args[++i];
+ String pkg = args[++i];
+ checkPackageNameValid( type ) ;
+ checkPackageNameValid( pkg ) ;
+ packages.put (type, pkg);
+ }
+ // Target directory
+ else if (lcArg.equals ("td")) // <f46838.4>
+ {
+ if (i + 1 >= args.length)
+ throw new InvalidArgument (args[i]);
+ String trgtDir = args[++i];
+ if (trgtDir.charAt (0) == '-')
+ throw new InvalidArgument (args[i - 1]);
+ else
+ {
+ targetDir = trgtDir.replace ('/', File.separatorChar);
+ if (targetDir.charAt (targetDir.length () - 1) != File.separatorChar)
+ targetDir = targetDir + File.separatorChar;
+ }
+ }
+ // Separator
+ else if (lcArg.equals ("sep"))
+ {
+ if (i + 1 >= args.length)
+ throw new InvalidArgument (args[i]);
+ separator = args[++i];
+ }
+ // POA flag ?
+ else if (lcArg.equals ("oldimplbase")){
+ POAServer = false;
+ }
+ else if (lcArg.equals("skeletonname")){
+ if (i + 1 >= args.length)
+ throw new InvalidArgument (args[i]);
+ skeletonPattern = args[++i];
+ }
+ else if (lcArg.equals("tiename")){
+ if (i + 1 >= args.length)
+ throw new InvalidArgument (args[i]);
+ tiePattern = args[++i];
+ }
+ else if (lcArg.equals("localoptimization")) {
+ LocalOptimization = true;
+ }
+ else i = collectUnknownArg (args, i, unknownArgs);
+ }
+
+ // Encountered unknown arguments?
+ if (unknownArgs.size () > 0)
+ {
+ String [] otherArgs = new String [unknownArgs.size ()];
+ unknownArgs.copyInto (otherArgs);
+ // Throws InvalidArgument by default
+ super.parseOtherArgs (otherArgs, properties);
+ }
+
+ setDefaultEmitter(); // d57482 <klr>
+ setNameModifiers( skeletonPattern, tiePattern ) ;
+ }
+ catch (ArrayIndexOutOfBoundsException e)
+ {
+ // If there is any array indexing problem, it is probably
+ // because the qualifier on the last argument is missing.
+ // Report that this last argument is invalid.
+ throw new InvalidArgument (args[args.length - 1]);
+ }
+ } // parseOtherArgs
+
+ /**
+ *
+ **/
+ protected int collectUnknownArg (String[] args, int i, Vector unknownArgs)
+ {
+ unknownArgs.addElement (args [i]);
+ ++i;
+ while (i < args.length && args[i].charAt (0) != '-' && args[i].charAt (0) != '/')
+ unknownArgs.addElement (args[i++]);
+ return --i;
+ } // collectUnknownArg
+
+ /**
+ *
+ **/
+ // XXX Either generalize this facility or remove it completely.
+ protected void packageFromProps (Properties props) throws InvalidArgument
+ {
+ Enumeration propsEnum = props.propertyNames ();
+ while (propsEnum.hasMoreElements ())
+ {
+ String prop = (String)propsEnum.nextElement ();
+ if (prop.startsWith ("PkgPrefix."))
+ {
+ String type = prop.substring (10);
+ String pkg = props.getProperty (prop);
+ checkPackageNameValid( pkg ) ;
+ checkPackageNameValid( type ) ;
+ packages.put (type, pkg);
+ }
+ }
+ } // packageFromProps
+
+ /**
+ * d57482 (klr) method added so default emitter check could be overriden.
+ **/
+ protected void setDefaultEmitter () {
+ // If the flag -fclient was not found, assume it.
+ if (emit == None) emit = Client;
+ }
+
+ protected void setNameModifiers( String skeletonPattern,
+ String tiePattern ) {
+ if (emit>Client) {
+ String tp ;
+ String sp ;
+
+ if (skeletonPattern != null)
+ sp = skeletonPattern ;
+ else if (POAServer)
+ sp = "%POA" ;
+ else
+ sp = "_%ImplBase" ;
+
+ if (tiePattern != null)
+ tp = tiePattern ;
+ else if (POAServer)
+ tp = "%POATie" ;
+ else
+ tp = "%_Tie" ;
+
+ skeletonNameModifier = new NameModifierImpl( sp ) ;
+ tieNameModifier = new NameModifierImpl( tp ) ;
+ }
+ }
+
+ /**
+ *
+ **/
+ private void checkPackageNameValid (String name) throws InvalidArgument
+ {
+ if (name.charAt (0) == '.')
+ throw new InvalidArgument (name);
+ for (int i = 0; i < name.length ();++i)
+ if (name.charAt (i) == '.')
+ {
+ if (i == name.length () - 1 || !Character.isJavaIdentifierStart (name.charAt (++i)))
+ throw new InvalidArgument (name);
+ }
+ else if (!Character.isJavaIdentifierPart (name.charAt (i)))
+ throw new InvalidArgument (name);
+ } // validatePackageName
+
+ // <46082.03><46838> Modified access restrictions from protected to public.
+
+ // This is a hash table whose keys are top-level typenames and
+ // whose values are the package prefixes to those types.
+ // For instance, <"CORBA", "org.omg"> is a possible entry.
+ public Hashtable packages = new Hashtable ();
+
+ public String separator = null;
+
+ public static final int
+ None = 0,
+ Client = 1,
+ Server = 2,
+ All = 3;
+ public int emit = None;
+ public boolean TIEServer = false;
+ public boolean POAServer = true;
+ // By default we do not generate Locally Optimized stub because of an
+ // unresolved PI problem. We will generate only if -localOptimization flag
+ // is passed
+ public boolean LocalOptimization = false;
+ public NameModifier skeletonNameModifier = null ;
+ public NameModifier tieNameModifier = null ;
+
+ // Key is original package name; value is translated package name.
+ // Note that this translation happens AFTER prefixes are added in the
+ // packages table.
+ public Hashtable packageTranslation = new Hashtable() ;
+
+ public String targetDir = ""; // <f46838.4>
+} // class Arguments
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen.java
new file mode 100644
index 0000000..6e7c7b1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.AttributeEntry;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.ParameterEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+
+/**
+ *
+ **/
+public class AttributeGen extends MethodGen implements com.sun.tools.corba.se.idl.AttributeGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public AttributeGen ()
+ {
+ } // ctor
+
+ /**
+ *
+ **/
+ private boolean unique (InterfaceEntry entry, String name)
+ {
+ // Compare the name to the methods of this interface
+ Enumeration methods = entry.methods ().elements ();
+ while (methods.hasMoreElements ())
+ {
+ SymtabEntry method = (SymtabEntry)methods.nextElement ();
+ if (name.equals (method.name ()))
+ return false;
+ }
+
+ // Recursively call unique on each derivedFrom interface
+ Enumeration derivedFrom = entry.derivedFrom ().elements ();
+ while (derivedFrom.hasMoreElements ())
+ if (!unique ((InterfaceEntry)derivedFrom.nextElement (), name))
+ return false;
+
+ // If the name isn't in any method, nor in any method of the
+ // derivedFrom interfaces, then the name is unique.
+ return true;
+ } // unique
+
+ /**
+ * Method generate() is not used in MethodGen. They are replaced by the
+ * more granular interfaceMethod, stub, skeleton, dispatchSkeleton.
+ **/
+ public void generate (Hashtable symbolTable, AttributeEntry m, PrintWriter stream)
+ {
+ } // generate
+
+ /**
+ *
+ **/
+ protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
+ {
+ AttributeEntry a = (AttributeEntry)m;
+
+ // Generate for the get method
+ super.interfaceMethod (symbolTable, a, stream);
+
+ // Generate for the set method if the attribute is not readonly
+ if (!a.readOnly ())
+ {
+ setupForSetMethod ();
+ super.interfaceMethod (symbolTable, a, stream);
+ clear ();
+ }
+ } // interfaceMethod
+
+ /**
+ *
+ **/
+ protected void stub (String className, boolean isAbstract, Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
+ {
+ AttributeEntry a = (AttributeEntry)m;
+
+ // Generate for the get method
+ super.stub (className, isAbstract, symbolTable, a, stream, index);
+
+ // Generate for the set method if the attribute is not readonly
+ if (!a.readOnly ())
+ {
+ setupForSetMethod ();
+ super.stub (className, isAbstract, symbolTable, a, stream, index + 1);
+ clear ();
+ }
+ } // stub
+
+ /**
+ *
+ **/
+ protected void skeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
+ {
+ AttributeEntry a = (AttributeEntry)m;
+
+ // Generate for the get method
+ super.skeleton (symbolTable, a, stream, index);
+
+ // Generate for the set method if the attribute is not readonly
+ if (!a.readOnly ())
+ {
+ setupForSetMethod ();
+ super.skeleton (symbolTable, a, stream, index + 1);
+ clear ();
+ }
+ } // skeleton
+
+ /**
+ *
+ **/
+ protected void dispatchSkeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
+ {
+ AttributeEntry a = (AttributeEntry)m;
+
+ // Generate for the get method
+ super.dispatchSkeleton (symbolTable, a, stream, index);
+
+ // Generate for the set method if the attribute is not readonly
+ if (!a.readOnly ())
+ {
+ setupForSetMethod ();
+ super.dispatchSkeleton (symbolTable, m, stream, index + 1);
+ clear ();
+ }
+ } // dispatchSkeleton
+
+ private SymtabEntry realType = null;
+
+ /**
+ *
+ **/
+ protected void setupForSetMethod ()
+ {
+ ParameterEntry parm = Compile.compiler.factory.parameterEntry ();
+ parm.type (m.type ());
+ parm.name ("new" + Util.capitalize (m.name ()));
+ m.parameters ().addElement (parm);
+ realType = m.type ();
+ m.type (null);
+ } // setupForSetMethod
+
+ /**
+ *
+ **/
+ protected void clear ()
+ {
+ // Set back to normal
+ m.parameters ().removeAllElements ();
+ m.type (realType);
+ } // clear
+} // class AttributeGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen24.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen24.java
new file mode 100644
index 0000000..a069043
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AttributeGen24.java
@@ -0,0 +1,104 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D62023 <klr> New file to implement CORBA 2.4 RTF
+// REVISIT: These changes should be folded into AttributeGen.
+
+import java.io.PrintWriter;
+
+import java.util.Enumeration;
+import java.util.Vector;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.ParameterEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.AttributeEntry;
+
+/**
+ *
+ **/
+public class AttributeGen24 extends MethodGenClone24
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public AttributeGen24 ()
+ {
+ } // ctor
+
+ /**
+ * (d62023-klr) Added for 2.4 RTF
+ **/
+ protected void abstractMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
+ {
+ AttributeEntry a = (AttributeEntry)m;
+
+ // Generate for the get method
+ super.abstractMethod (symbolTable, a, stream);
+
+ // Generate for the set method if the attribute is not readonly
+ if (!a.readOnly ())
+ {
+ setupForSetMethod ();
+ super.abstractMethod (symbolTable, a, stream);
+ clear ();
+ }
+ } // abstractMethod
+
+ /**
+ * (d62023-klr) Added for 2.4 RTF
+ **/
+ protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
+ {
+ AttributeEntry a = (AttributeEntry)m;
+
+ // Generate for the get method
+ super.interfaceMethod (symbolTable, a, stream);
+
+ // Generate for the set method if the attribute is not readonly
+ if (!a.readOnly ())
+ {
+ setupForSetMethod ();
+ super.interfaceMethod (symbolTable, a, stream);
+ clear ();
+ }
+ } // interfaceMethod
+
+} // class AttributeGen24
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AuxGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AuxGen.java
new file mode 100644
index 0000000..d9071ca
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/AuxGen.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+/**
+ *
+ **/
+public interface AuxGen
+{
+ void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry);
+} // interface AuxGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Compile.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Compile.java
new file mode 100644
index 0000000..08aecd1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Compile.java
@@ -0,0 +1,430 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -09/23/98 KLR Ported -m updates (F46838.1-3)
+// -f46082.51<daz> Transferred makefile list generation (for ODE delta-builds,
+// see f46838) to toJava; cleaned-out dead code.
+// -D58319<daz> Display version info. for -version option.
+// -D58951<daz> Modify to allow QuickTest to build.
+// -D49526<daz> Remove "TypeCode" symbol from preParse().
+// -D58591<daz> Publicise _factories and compile for QuickTest. Need to revert
+// t0 private and add accessor methods.
+// -D59437<daz> Fill typename information for value boxes.
+
+import java.io.File;
+import java.io.IOException;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.SymtabFactory;
+import com.sun.tools.corba.se.idl.IncludeEntry;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.ModuleEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StructEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.UnionBranch;
+import com.sun.tools.corba.se.idl.UnionEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.InvalidArgument;
+
+/**
+ * Compiler usage:
+ * <br><br>
+ *
+ * java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] &lt;idl file&gt;
+ * <br><br>
+ *
+ * where &lt;idl file&gt; is the name of a file containing IDL definitions,
+ * and [options] is any combination of the options listed below. The options
+ * may appear in any order.
+ * <br><br>
+ *
+ * Options:
+ * <dl>
+ * <dt>{@code -i <include path>}
+ * <dd>By default, the current directory is scanned for included files.
+ * This option adds another directory. See also the note below.
+ *
+ * <dt>{@code -d <symbol>}
+ * <dd>This is equivalent to the following line in an IDL file:
+ * {@code #define <symbol>}
+ *
+ * <dt>{@code -f <side>}
+ * <dd>Defines what bindings to emit. {@code <side>} is one of client, server, all,
+ * serverTIE, allTIE. serverTIE and allTIE cause delegate model skeletons
+ * to be emitted. If this flag is not used, -fclient is assumed.
+ * allPOA has the same effect as all, except for generation POA type skeletons.
+ *
+ * <dt>{@code -keep}
+ * <dd>If a file to be generated already exists, do not overwrite it. By
+ * default it is overwritten.
+ *
+ * <dt>{@code -sep <string>}
+ * <dd>Only valid with -m. Replace the file separator character with
+ * {@code <string>} in the file names listed in the .u file.
+ *
+ * <dt>{@code -emitAll}
+ * <dd>Emit all types, including those found in #included files.
+ *
+ * <dt>{@code -v}
+ * <dd>Verbose mode.
+ *
+ * <dt>{@code -pkgPrefix <type> <package>}
+ * <dd>Whereever {@code <type>} is encountered, make sure it resides within
+ * {@code <package>} in all generated files. {@code <type>} is a fully
+ * qualified, java-style name.
+ * </dl>
+ *
+ * <B>Note:</B> If you have an include path or paths that you will always
+ * be using, it can get tedious putting these on the command with the -i
+ * option all the time. Instead, these can be placed into a config file
+ * called idl.config. This file must be in the CLASSPATH. The format of
+ * the includes line is:
+ *
+ * <pre>{@code
+ * includes=<path1>;<path2>;...;<pathN>
+ * }</pre>
+ *
+ * Note that the path separator character, here shown as a semicolon,
+ * is machine dependent. For instance, on Windows 95 this character
+ * is a semicolon, on UNIX it is a colon.
+ **/
+public class Compile extends com.sun.tools.corba.se.idl.Compile
+{
+ /**
+ *
+ **/
+ public static void main (String[] args)
+ {
+ compiler = new Compile ();
+ compiler.start (args);
+ } // main
+
+ /**
+ *
+ **/
+ public void start (String[] args)
+ {
+ try
+ {
+ // <f46082.51> Use generator-specific messages file.
+ //Util.registerMessageFile ("com/sun/corba/se/idl/toJavaPortable/toJava.prp");
+ Util.registerMessageFile ("com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp");
+ init (args);
+ if (arguments.versionRequest)
+ displayVersion ();
+ else
+ {
+ preParse ();
+ Enumeration e = parse ();
+ if (e != null)
+ {
+ preEmit (e);
+ generate ();
+ // <f46082.03> Move ODE delta-build support to toJava
+ //if (((Arguments)arguments).genMakefileLists)
+ // generateMakefileLists ();
+ }
+ }
+ }
+ catch (InvalidArgument e)
+ {
+ System.err.println (e);
+ }
+ catch (IOException e)
+ {
+ System.err.println (e);
+ }
+ } // start
+
+ /**
+ *
+ **/
+ protected Compile ()
+ {
+ factory = factories ().symtabFactory ();
+ } // ctor
+
+ // <d58591> _factories was made public for QuickTest to operate correctly,
+ // but the code needs to be changed to this:
+ //private Factories _factories = null;
+ //protected com.sun.tools.corba.se.idl.Factories factories ()
+ //{
+ // if (_factories == null)
+ // _factories = new Factories ();
+ // return _factories;
+ //} // factories
+
+ public Factories _factories = new Factories (); // 58974 - changed for quicktest
+ protected com.sun.tools.corba.se.idl.Factories factories ()
+ {
+ return _factories;
+ } // factories
+
+
+ ModuleEntry org;
+ ModuleEntry omg;
+ ModuleEntry corba;
+ InterfaceEntry object;
+
+ /**
+ *
+ **/
+ protected void preParse ()
+ {
+ Util.setSymbolTable (symbolTable);
+ Util.setPackageTranslation( ((Arguments)arguments).packageTranslation ) ;
+
+ // Need modules for the predefined objects
+ org = factory.moduleEntry ();
+ // <d61919> Suppress generation of this module. If the parser reopens it
+ // while parsing the main IDL source, any definitions appearing in the module
+ // -- and not appearing in a global-scope include file -- will be added to
+ // the emit list with emit=true for eventual generation.
+ org.emit (false);
+ org.name ("org");
+ org.container (null);
+ omg = factory.moduleEntry ();
+ omg.emit (false); // <d61919>
+ omg.name ("omg");
+ omg.module ("org");
+ omg.container (org);
+ org.addContained (omg);
+ corba = factory.moduleEntry ();
+ corba.emit (false); // <d61919>
+ corba.name ("CORBA");
+ corba.module ("org/omg");
+ corba.container (omg);
+ omg.addContained (corba);
+ symbolTable.put ("org", org);
+ symbolTable.put ("org/omg", omg);
+ symbolTable.put ("org/omg/CORBA", corba);
+
+ // Add CORBA::Object to symbol table.
+ object = (InterfaceEntry)symbolTable.get ("Object");
+ object.module ("org/omg/CORBA");
+ object.container (corba);
+ symbolTable.put ("org/omg/CORBA/Object", object);
+
+ // <d61961> Add PIDL type (primitive) CORBA::TypeCode to symbol table.
+ PrimitiveEntry pEntry = factory.primitiveEntry ();
+ pEntry.name ("TypeCode");
+ pEntry.module ("org/omg/CORBA");
+ pEntry.container (corba);
+ symbolTable.put ("org/omg/CORBA/TypeCode", pEntry);
+ symbolTable.put ("CORBA/TypeCode", pEntry); // <d55699>
+ overrideNames.put ("CORBA/TypeCode", "org/omg/CORBA/TypeCode"); // <d55699>
+ overrideNames.put ("org/omg/CORBA/TypeCode", "CORBA/TypeCode"); // <d55699>
+ // <d49526> Allow user to specify types named "TypeCode"
+ //symbolTable.put ("TypeCode", pEntry);
+ //overrideNames.put ("TypeCode", "org/omg/CORBA/TypeCode");
+
+ // CORBA::Principal is deprecated!
+ // <d61961> Add PIDL type (primitive) CORBA::Principal to symbol table.
+ pEntry = factory.primitiveEntry ();
+ pEntry.name ("Principal");
+ pEntry.module ("org/omg/CORBA");
+ pEntry.container (corba);
+ symbolTable.put ("org/omg/CORBA/Principle", pEntry);
+ symbolTable.put ("CORBA/Principal", pEntry);
+ overrideNames.put ("CORBA/Principal", "org/omg/CORBA/Principal");
+ overrideNames.put ("org/omg/CORBA/Principal", "CORBA/Principal");
+
+ // <d61961> Add PIDL type (interface) CORBA::Current to symbol table.
+ //InterfaceEntry iEntry = factory.interfaceEntry ();
+ //iEntry.name ("Current");
+ //iEntry.module ("org/omg/CORBA");
+ //iEntry.container (corba);
+ //symbolTable.put ("org/omg/CORBA/Current", iEntry);
+ //symbolTable.put ("CORBA/Current", iEntry);
+ //overrideNames.put ("CORBA/Current", "org/omg/CORBA/Current");
+ //overrideNames.put ("org/omg/CORBA/Current", "CORBA/Current");
+
+ overrideNames.put ("TRUE", "true");
+ overrideNames.put ("FALSE", "false");
+ //overrideNames.put ("any", "org/omg/CORBA/Any");
+
+ // Add CORBA module to symbol table
+ symbolTable.put ("CORBA", corba); // 55699
+ overrideNames.put ("CORBA", "org/omg/CORBA"); // <d55699>
+ overrideNames.put ("org/omg/CORBA", "CORBA"); // <d55699>
+ } // preParse
+
+
+ protected void preEmit (Enumeration emitList)
+ {
+ typedefInfo = SymtabEntry.getVariableKey ();
+ Hashtable tempST = (Hashtable)symbolTable.clone ();
+
+ for (Enumeration e = tempST.elements (); e.hasMoreElements ();)
+ {
+ SymtabEntry element = (SymtabEntry)e.nextElement ();
+
+ // Any other symbolTable processing?
+ preEmitSTElement (element);
+ }
+
+ // Do this processing AFTER any other processing to get the
+ // correct names.
+ Enumeration elements = symbolTable.elements ();
+ while (elements.hasMoreElements ())
+ {
+ // Find all TypedefEntry's and fill in the SymtabEntry.info
+ // field with it's real type , including [][]... with const
+ // exprs.
+ SymtabEntry element = (SymtabEntry)elements.nextElement ();
+ if (element instanceof TypedefEntry || element instanceof SequenceEntry)
+ Util.fillInfo (element);
+
+ // <d59437> Members of constructed types may now be value boxes, and value
+ // boxes may contain types that are directly defined rather than typedef-ed
+ // (e.g., "valuetype vb sequence <long, 5>;"). If member resolves to a value
+ // box, then check and fillInfo() for value box and its content type BEFORE
+ // doing fillInfo() on member; otherwise, could get an exception. There's
+ // code in fillInfo() that performs this check, so it does not appear here.
+
+ else if (element instanceof StructEntry)
+ {
+ Enumeration members = ((StructEntry)element).members ().elements ();
+ while (members.hasMoreElements ())
+ Util.fillInfo ((SymtabEntry)members.nextElement ());
+ }
+ else if (element instanceof InterfaceEntry && ((InterfaceEntry)element).state () != null)
+ {
+ Enumeration members = ((InterfaceEntry)element).state ().elements ();
+ while (members.hasMoreElements ())
+ Util.fillInfo (((InterfaceState)members.nextElement ()).entry);
+ }
+ else if (element instanceof UnionEntry)
+ {
+ Enumeration branches = ((UnionEntry)element).branches ().elements ();
+ while (branches.hasMoreElements ())
+ Util.fillInfo (((UnionBranch)branches.nextElement ()).typedef);
+ }
+
+ // For each type that is at the top level that is NOT a module
+ // or IncludeEntry, add it to the imports list. If there are
+ // types within modules which refer to these, their types must
+ // be explicitly stated in an import statement.
+ if (element.module ().equals ("") && !(element instanceof ModuleEntry || element instanceof IncludeEntry || element instanceof PrimitiveEntry))
+ importTypes.addElement (element);
+ }
+
+ while (emitList.hasMoreElements ())
+ {
+ SymtabEntry entry = (SymtabEntry)emitList.nextElement ();
+
+ // Any other emitList processing:
+ preEmitELElement (entry);
+ }
+ } // preEmit
+
+ /**
+ * This method is called by preEmit once for each symbol table entry.
+ * It can be called by extenders.
+ **/
+ protected void preEmitSTElement (SymtabEntry entry)
+ {
+ // If the -package argument was used, search the packages list
+ // for the given type name and prepend the package to it.
+ Hashtable packages = ((Arguments)arguments).packages;
+ if (packages.size () > 0)
+ {
+ String substr = (String)packages.get (entry.fullName ());
+ if (substr != null)
+ {
+ String pkg = null;
+ ModuleEntry mod = null;
+ ModuleEntry prev = null;
+ while (substr != null)
+ {
+ int dot = substr.indexOf ('.');
+ if (dot < 0)
+ {
+ pkg = substr;
+ substr = null;
+ }
+ else
+ {
+ pkg = substr.substring (0, dot);
+ substr = substr.substring (dot + 1);
+ }
+
+ String fullName = prev == null ? pkg : prev.fullName () + '/' + pkg;
+ mod = (ModuleEntry)symbolTable.get (fullName);
+ if (mod == null)
+ {
+ mod = factory.moduleEntry ();
+ mod.name (pkg);
+ mod.container (prev);
+ if (prev != null) mod.module (prev.fullName ());
+ symbolTable.put (pkg, mod);
+ }
+ prev = mod;
+ }
+ entry.module (mod.fullName ());
+ entry.container (mod);
+ }
+ }
+ } // preEmitSTElement
+
+ /**
+ * This method is called by preEmit once for each emitList entry.
+ * It can be called by extenders.
+ **/
+ protected void preEmitELElement (SymtabEntry entry)
+ {
+ } // preEmitELElement
+
+ public Vector importTypes = new Vector ();
+ public SymtabFactory factory;
+ public static int typedefInfo;
+ public Hashtable list = new Hashtable ();
+ public static Compile compiler = null; // <d58591>
+} // class Compile
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ConstGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ConstGen.java
new file mode 100644
index 0000000..b6a3808
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ConstGen.java
@@ -0,0 +1,197 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.ConstEntry;
+import com.sun.tools.corba.se.idl.ModuleEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+
+/**
+ *
+ **/
+public class ConstGen implements com.sun.tools.corba.se.idl.ConstGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public ConstGen ()
+ {
+ } // ctor
+
+ /**
+ * Generate Java code for an IDL constant. A constant is written to
+ * a new class only when it is not a member of an interface; otherwise
+ * it written to the interface class in which it resides.
+ **/
+ public void generate (Hashtable symbolTable, ConstEntry c, PrintWriter s)
+ {
+ this.symbolTable = symbolTable;
+ this.c = c;
+ this.stream = s;
+ init ();
+
+ if (c.container () instanceof ModuleEntry)
+ generateConst ();
+ else if (stream != null)
+ writeConstExpr ();
+ } // generate
+
+ /**
+ * Initialize members unique to this generator.
+ **/
+ protected void init ()
+ {
+ } // init
+
+ /**
+ * Generate the class defining the constant.
+ **/
+ protected void generateConst ()
+ {
+ openStream ();
+ if (stream == null)
+ return;
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ } // generateConst
+
+ /**
+ * Open a new print stream only if the constant is not a member
+ * of an interface.
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (c, ".java");
+ } // openStream
+
+ /**
+ * Write the heading for the class defining the constant.
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, c);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+ stream.println ("public interface " + c.name ());
+ // should not be done according to the mapping
+ // + " extends org.omg.CORBA.portable.IDLEntity");
+ stream.println ("{");
+ } // writeHeading
+
+ /**
+ * Write the constant expression and any comment, if present.
+ **/
+ protected void writeBody ()
+ {
+ writeConstExpr ();
+ } // writeBody
+
+ /**
+ * Write the entire constant expression and any comment, if present.
+ **/
+ protected void writeConstExpr ()
+ {
+ if (c.comment () != null)
+ c.comment ().generate (" ", stream);
+ if (c.container () instanceof ModuleEntry) {
+
+ stream.print (" public static final " + Util.javaName (c.type ()) + " value = ");
+ } else {
+ stream.print (" public static final " + Util.javaName (c.type ()) + ' ' + c.name () + " = ");
+ }
+ writeConstValue (c.type ());
+ } // writeConstExpr
+
+ /**
+ * Write the constant's value according to its type.
+ **/
+ private void writeConstValue (SymtabEntry type)
+ {
+ if (type instanceof PrimitiveEntry)
+ stream.println ('(' + Util.javaName (type) + ")(" + Util.parseExpression (c.value ()) + ");");
+ else if (type instanceof StringEntry)
+ stream.println (Util.parseExpression (c.value ()) + ';');
+ else if (type instanceof TypedefEntry)
+ {
+ while (type instanceof TypedefEntry)
+ type = type.type ();
+ writeConstValue (type);
+ }
+ else
+ stream.println (Util.parseExpression (c.value ()) + ';');
+ } // writeValue
+
+ /**
+ * Generate any last words and close the class.
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ("}");
+ } // writeClosing
+
+ /**
+ * Close the print stream, causing the file to be written.
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ protected java.util.Hashtable symbolTable = null;
+ protected ConstEntry c = null;
+ protected PrintWriter stream = null;
+} // class ConstGen
+
+
+/*=======================================================================================
+ DATE-AUTHOR ACTION
+ ---------------------------------------------------------------------------------------
+ 11sep1997daz Return when print stream is null and container is NOT a module. Fixes
+ -keep option, which causes null print stream to be sent to ConstGen.
+ 31jul1997daz Write source comment immediately preceding constant declaration.
+ =======================================================================================*/
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/DefaultFactory.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/DefaultFactory.java
new file mode 100644
index 0000000..ee1dd29
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/DefaultFactory.java
@@ -0,0 +1,200 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D62023 klr new class
+
+import java.io.PrintWriter;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+
+/**
+ *
+ **/
+public class DefaultFactory implements AuxGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public DefaultFactory ()
+ {
+ } // ctor
+
+ /**
+ * Generate the default value factory class. Provides general algorithm for
+ * auxiliary binding generation:
+ * 1.) Initialize symbol table and symbol table entry members,
+ * common to all generators.
+ * 2.) Initialize members unique to this generator.
+ * 3.) Open print stream
+ * 4.) Write class heading (package, prologue, source comment, class
+ * statement, open curly
+ * 5.) Write class body (member data and methods)
+ * 6.) Write class closing (close curly)
+ * 7.) Close the print stream
+ **/
+ public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry)
+ {
+ this.symbolTable = symbolTable;
+ this.entry = entry;
+ init ();
+ openStream ();
+ if (stream == null)
+ return;
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ } // generate
+
+ /**
+ * Initialize variables unique to this generator.
+ **/
+ protected void init ()
+ {
+ factoryClass = entry.name () + "DefaultFactory";
+ factoryInterface = entry.name () + "ValueFactory";
+ factoryType = Util.javaName (entry);
+ implType = entry.name () + "Impl"; // default implementation class
+ } // init
+
+ /**
+ * @return true if entry has any factory methods declared
+ **/
+ protected boolean hasFactoryMethods ()
+ {
+ Vector init = ((ValueEntry)entry).initializers ();
+ if (init != null && init.size () > 0)
+ return true;
+ else
+ return false;
+ } // hasFactoryMethods
+
+ /**
+ * Open the print stream for subsequent output.
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (entry, "DefaultFactory.java");
+ } // openStream
+
+ /**
+ * Generate the heading, including the package, imports,
+ * source comment, class statement, and left curly.
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, entry, Util.TypeFile); // REVISIT - same as interface?
+ Util.writeProlog (stream, stream.name ());
+ if (entry.comment () != null)
+ entry.comment ().generate ("", stream);
+ stream.print ("public class " + factoryClass + " implements ");
+ if (hasFactoryMethods ())
+ stream.print (factoryInterface);
+ else
+ stream.print ("org.omg.CORBA.portable.ValueFactory");
+ stream.println (" {");
+ } // writeHeading
+
+ /**
+ * Generate the contents of this class
+ **/
+ protected void writeBody ()
+ {
+ writeFactoryMethods ();
+ stream.println ();
+ writeReadValue ();
+ } // writeBody
+
+ /**
+ * Generate members of this class.
+ **/
+ protected void writeFactoryMethods ()
+ {
+ Vector init = ((ValueEntry)entry).initializers ();
+ if (init != null)
+ {
+ for (int i = 0; i < init.size (); i++)
+ {
+ MethodEntry element = (MethodEntry) init.elementAt (i);
+ element.valueMethod (true); //tag value method if not tagged previously
+ ((MethodGen24) element.generator ()).defaultFactoryMethod (symbolTable, element, stream);
+ }
+ }
+ } // writeFactoryMethods
+
+ /**
+ * Generate default read_value
+ **/
+ protected void writeReadValue ()
+ {
+ stream.println (" public java.io.Serializable read_value (org.omg.CORBA_2_3.portable.InputStream is)");
+ stream.println (" {");
+ stream.println (" return is.read_value(new " + implType + " ());");
+ stream.println (" }");
+ } // writeReadValue
+
+ /**
+ * Generate the closing statements.
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ('}');
+ } // writeClosing
+
+ /**
+ * Write the stream to file by closing the print stream.
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ protected java.util.Hashtable symbolTable;
+ protected com.sun.tools.corba.se.idl.SymtabEntry entry;
+ protected GenFileStream stream;
+
+ // Unique to this generator
+ protected String factoryClass;
+ protected String factoryInterface;
+ protected String factoryType;
+ protected String implType;
+} // class Holder
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/EnumGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/EnumGen.java
new file mode 100644
index 0000000..de07257
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/EnumGen.java
@@ -0,0 +1,279 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D61056 <klr> Use Util.helperName
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.EnumEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+
+/**
+ *
+ **/
+public class EnumGen implements com.sun.tools.corba.se.idl.EnumGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public EnumGen ()
+ {
+ } // ctor
+
+ /**
+ * Generate the Java code for an IDL enumeration.
+ **/
+ public void generate (Hashtable symbolTable, EnumEntry e, PrintWriter s)
+ {
+ this.symbolTable = symbolTable;
+ this.e = e;
+ init ();
+
+ openStream ();
+ if (stream == null) return;
+ generateHolder ();
+ generateHelper ();
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ } // generate
+
+ /**
+ * Initialize members unique to this generator.
+ **/
+ protected void init ()
+ {
+ className = e.name ();
+ fullClassName = Util.javaName (e);
+ }
+
+ /**
+ * Open the print stream to which to write the enumeration class.
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (e, ".java");
+ }
+
+ /**
+ * Generate the holder class for this enumeration.
+ **/
+ protected void generateHolder ()
+ {
+ ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, e);
+ }
+
+ /**
+ * Generate the helper class for this enumeration.
+ **/
+ protected void generateHelper ()
+ {
+ ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, e);
+ }
+
+ /**
+ * Write the heading of the enumeration class, including the package,
+ * imports, class statement, and open curly.
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, e);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+ if (e.comment () != null)
+ e.comment ().generate ("", stream);
+ stream.println ("public class " + className + " implements org.omg.CORBA.portable.IDLEntity");
+ stream.println ("{");
+ }
+
+ /**
+ * Write the members of enumeration class.
+ **/
+ protected void writeBody ()
+ {
+ stream.println (" private int __value;");
+ stream.println (" private static int __size = " + (e.elements ().size ()) + ';');
+ stream.println (" private static " + fullClassName + "[] __array = new " + fullClassName + " [__size];");
+ stream.println ();
+ for (int i = 0; i < e.elements ().size (); ++i)
+ {
+ String label = (String)e.elements ().elementAt (i);
+ stream.println (" public static final int _" + label + " = " + i + ';');
+ stream.println (" public static final " + fullClassName + ' ' + label + " = new " + fullClassName + "(_" + label + ");");
+ }
+ stream.println ();
+ writeValue ();
+ writeFromInt ();
+ writeCtors ();
+ }
+
+ /**
+ * Write the value method for the enumeration class.
+ **/
+ protected void writeValue ()
+ {
+ stream.println (" public int value ()");
+ stream.println (" {");
+ stream.println (" return __value;");
+ stream.println (" }");
+ stream.println ();
+ } // writeValue
+
+ /**
+ * Write the from_int method for the enumeration class.
+ **/
+ protected void writeFromInt ()
+ {
+ stream.println (" public static " + fullClassName + " from_int (int value)");
+ stream.println (" {");
+ stream.println (" if (value >= 0 && value < __size)");
+ stream.println (" return __array[value];");
+ stream.println (" else");
+ stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
+ stream.println (" }");
+ stream.println ();
+ }
+
+ /**
+ * Write the protected constructor for the enumeration class.
+ **/
+ protected void writeCtors ()
+ {
+ stream.println (" protected " + className + " (int value)");
+ stream.println (" {");
+ stream.println (" __value = value;");
+ stream.println (" __array[__value] = this;");
+ stream.println (" }");
+ }
+
+ /**
+ * Close the enumeration class.
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ("} // class " + className);
+ }
+
+ /**
+ * Close the print stream, which writes the stream to file.
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ }
+
+ ///////////////
+ // From JavaGenerator
+
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ tcoffsets.set (entry);
+ EnumEntry enumEntry = (EnumEntry)entry;
+ StringBuffer emit = new StringBuffer ("new String[] { ");
+ Enumeration e = enumEntry.elements ().elements ();
+ boolean firstTime = true;
+ while (e.hasMoreElements ())
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ emit.append (", ");
+ emit.append ('"' + Util.stripLeadingUnderscores ((String)e.nextElement ()) + '"');
+ }
+ emit.append ("} ");
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_enum_tc ("
+ + Util.helperName (enumEntry, true) + ".id (), \"" // <54697> // <d61056>
+// + "_id, \"" <54697>
+ + Util.stripLeadingUnderscores (entry.name ()) + "\", "
+ + new String (emit) + ");");
+ return index + 1;
+
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
+ stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
+ return index;
+ } // type
+
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (" return " + Util.javaQualifiedName (entry) + ".from_int (istream.read_long ());");
+ } // helperRead
+
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (" ostream.write_long (value.value ());");
+ } // helperWrite
+
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (indent + name + " = " + Util.javaQualifiedName (entry) + ".from_int (istream.read_long ());");
+ return index;
+ } // read
+
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (indent + "ostream.write_long (" + name + ".value ());");
+ return index;
+ } // write
+
+ // From JavaGenerator
+ ///////////////
+
+ protected Hashtable symbolTable = null;
+ protected EnumEntry e = null;
+ protected PrintWriter stream = null;
+
+ // Member data unique to this generator
+ String className = null;
+ String fullClassName = null;
+} // class EnumGen
+
+
+/*============================================================================
+ DATE<AUTHOR> ACTION
+ ----------------------------------------------------------------------------
+ 31jul1997<daz> Modified to write comment immediately preceding class defining
+ enumeration declaration.
+ 12dec1998<klr> D55971 - omg 98-11-03 Java 2.4 RTF - make subclassable
+ ===========================================================================*/
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ExceptionGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ExceptionGen.java
new file mode 100644
index 0000000..2ad0908
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ExceptionGen.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.ExceptionEntry;
+
+/**
+ *
+ **/
+public class ExceptionGen extends StructGen implements com.sun.tools.corba.se.idl.ExceptionGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public ExceptionGen ()
+ {
+ super (true);
+ } // ctor
+
+ /**
+ *
+ **/
+ public void generate (Hashtable symbolTable, ExceptionEntry entry, PrintWriter stream)
+ {
+ super.generate (symbolTable, entry, stream);
+ } // generate
+} // class ExceptionGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Factories.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Factories.java
new file mode 100644
index 0000000..a8fa3e8
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Factories.java
@@ -0,0 +1,141 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D62023<klr> Add corbaLevel=2.4
+
+/**
+ *
+ **/
+public class Factories extends com.sun.tools.corba.se.idl.Factories
+{
+ public com.sun.tools.corba.se.idl.GenFactory genFactory ()
+ {
+ return new GenFactory ();
+ } // genFactory
+
+ public com.sun.tools.corba.se.idl.Arguments arguments ()
+ {
+ return new Arguments ();
+ } // arguments
+
+ public String[] languageKeywords ()
+ {
+ // These are Java keywords that are not also IDL keywords.
+ return keywords;
+ } // languageKeywords
+
+ static String[] keywords =
+ {"abstract", "break", "byte",
+ "catch", "class", "continue",
+ "do", "else", "extends",
+ "false", "final", "finally",
+ "for", "goto", "if",
+ "implements", "import", "instanceof",
+ "int", "interface", "native",
+ "new", "null", "operator",
+ "outer", "package", "private",
+ "protected", "public", "return",
+ "static", "super", "synchronized",
+ "this", "throw", "throws",
+ "transient", "true", "try",
+ "volatile", "while",
+// Special reserved suffixes:
+ "+Helper", "+Holder", "+Package",
+// These following are not strictly keywords. They
+// are methods on java.lang.Object and, as such, must
+// not have conflicts with methods defined on IDL
+// interfaces. Treat them the same as keywords.
+ "clone", "equals", "finalize",
+ "getClass", "hashCode", "notify",
+ "notifyAll", "toString", "wait"};
+
+ ///////////////
+ // toJava-specific factory methods
+
+ private Helper _helper = null; // <62023>
+ public Helper helper ()
+ {
+ if (_helper == null)
+ if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
+ _helper = new Helper24 (); // <d60023>
+ else
+ _helper = new Helper ();
+ return _helper;
+ } // helper
+
+ private ValueFactory _valueFactory = null; // <62023>
+ public ValueFactory valueFactory ()
+ {
+ if (_valueFactory == null)
+ if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
+ _valueFactory = new ValueFactory (); // <d60023>
+ // else return null since shouldn't be used
+ return _valueFactory;
+ } // valueFactory
+
+ private DefaultFactory _defaultFactory = null; // <62023>
+ public DefaultFactory defaultFactory ()
+ {
+ if (_defaultFactory == null)
+ if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
+ _defaultFactory = new DefaultFactory (); // <d60023>
+ // else return null since shouldn't be used
+ return _defaultFactory;
+ } // defaultFactory
+
+ private Holder _holder = new Holder ();
+ public Holder holder ()
+ {
+ return _holder;
+ } // holder
+
+ private Skeleton _skeleton = new Skeleton ();
+ public Skeleton skeleton ()
+ {
+ return _skeleton;
+ } // skeleton
+
+ private Stub _stub = new Stub ();
+ public Stub stub ()
+ {
+ return _stub;
+ } // stub
+
+ // toJava-specific factory methods
+ ///////////////
+} // class Factories
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ForwardValueGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ForwardValueGen.java
new file mode 100644
index 0000000..a849848
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ForwardValueGen.java
@@ -0,0 +1,206 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D61056 <klr> Use Util.helperName
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.ForwardValueEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.MethodEntry;
+
+/**
+ *
+ **/
+public class ForwardValueGen implements com.sun.tools.corba.se.idl.ForwardValueGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public ForwardValueGen ()
+ {
+ } // ctor
+
+ /**
+ *
+ **/
+ public void generate (Hashtable symbolTable, ForwardValueEntry v, PrintWriter str)
+ {
+ this.symbolTable = symbolTable;
+ this.v = v;
+
+ openStream ();
+ if (stream == null)
+ return;
+ generateHelper ();
+ generateHolder ();
+ generateStub ();
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ } // generate
+
+ /**
+ *
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (v, ".java");
+ } // openStream
+
+ /**
+ *
+ **/
+ protected void generateHelper ()
+ {
+ ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, v);
+ } // generateHelper
+
+ /**
+ *
+ **/
+ protected void generateHolder ()
+ {
+ ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, v);
+ } // generateHolder
+
+ /**
+ *
+ **/
+ protected void generateStub ()
+ {
+ } // generateStub
+
+ /**
+ *
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, v);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+
+ if (v.comment () != null)
+ v.comment ().generate ("", stream);
+
+ stream.print ("public class " + v.name () + " implements org.omg.CORBA.portable.IDLEntity");
+ // There should ALWAYS be at least one: ValueBase
+
+ stream.println ("{");
+ } // writeHeading
+
+ /**
+ *
+ **/
+ protected void writeBody ()
+ {
+ } // writeBody
+
+ /**
+ *
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ("} // class " + v.name ());
+ } // writeClosing
+
+ /**
+ *
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ ///////////////
+ // From JavaGenerator
+
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ return index;
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
+ stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
+ return index;
+ } // type
+
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (" " + entryName + " value = new " + entryName + " ();");
+ read (0, " ", "value", entry, stream);
+ stream.println (" return value;");
+ } // helperRead
+
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ return index;
+ } // read
+
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ write (0, " ", "value", entry, stream);
+ } // helperWrite
+
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ return index;
+ } // write
+
+ // From JavaGenerator
+ ///////////////
+
+ /**
+ *
+ **/
+ protected void writeAbstract ()
+ {
+ } // writeAbstract
+
+ protected Hashtable symbolTable = null;
+ protected ForwardValueEntry v = null;
+ protected PrintWriter stream = null;
+} // class ForwardValueGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/GenFactory.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/GenFactory.java
new file mode 100644
index 0000000..d7b1132
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/GenFactory.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+/**
+ *
+ **/
+public class GenFactory implements com.sun.tools.corba.se.idl.GenFactory
+{
+
+ public com.sun.tools.corba.se.idl.AttributeGen createAttributeGen ()
+ {
+ if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
+ return new AttributeGen24 ();
+ else
+ return new AttributeGen ();
+ } // createAttributeGen
+
+ public com.sun.tools.corba.se.idl.ConstGen createConstGen ()
+ {
+ return new ConstGen ();
+ } // createConstGen
+
+ public com.sun.tools.corba.se.idl.NativeGen createNativeGen ()
+ {
+ return new NativeGen ();
+ } // createNativeGen
+
+ public com.sun.tools.corba.se.idl.EnumGen createEnumGen ()
+ {
+ return new EnumGen ();
+ } // createEnumGen
+
+ public com.sun.tools.corba.se.idl.ExceptionGen createExceptionGen ()
+ {
+ return new ExceptionGen ();
+ } // createExceptionGen
+
+ public com.sun.tools.corba.se.idl.ForwardGen createForwardGen ()
+ {
+ return null;
+ } // createForwardGen
+
+ public com.sun.tools.corba.se.idl.ForwardValueGen createForwardValueGen ()
+ {
+ return null;
+ } // createForwardValueGen
+
+ public com.sun.tools.corba.se.idl.IncludeGen createIncludeGen ()
+ {
+ return null;
+ } // createIncludeGen
+
+ public com.sun.tools.corba.se.idl.InterfaceGen createInterfaceGen ()
+ {
+ return new InterfaceGen ();
+ } // createInterfaceGen
+
+ public com.sun.tools.corba.se.idl.ValueGen createValueGen ()
+ {
+ if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
+ return new ValueGen24 ();
+ else
+ return new ValueGen ();
+ } // createValueGen
+
+ public com.sun.tools.corba.se.idl.ValueBoxGen createValueBoxGen ()
+ {
+ if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
+ return new ValueBoxGen24 ();
+ else
+ return new ValueBoxGen ();
+ } // createValueBoxGen
+
+ public com.sun.tools.corba.se.idl.MethodGen createMethodGen ()
+ {
+ if (Util.corbaLevel (2.4f, 99.0f)) // <d60023>
+ return new MethodGen24 ();
+ else
+ return new MethodGen ();
+ } // createMethodGen
+
+ public com.sun.tools.corba.se.idl.ModuleGen createModuleGen ()
+ {
+ return new ModuleGen ();
+ } // createModuleGen
+
+ public com.sun.tools.corba.se.idl.ParameterGen createParameterGen ()
+ {
+ return null;
+ } // createParameterGen
+
+ public com.sun.tools.corba.se.idl.PragmaGen createPragmaGen ()
+ {
+ return null;
+ } // createPragmaGen
+
+ public com.sun.tools.corba.se.idl.PrimitiveGen createPrimitiveGen ()
+ {
+ return new PrimitiveGen ();
+ } // createPrimitiveGen
+
+ public com.sun.tools.corba.se.idl.SequenceGen createSequenceGen ()
+ {
+ return new SequenceGen ();
+ } // createSequenceGen
+
+ public com.sun.tools.corba.se.idl.StringGen createStringGen ()
+ {
+ return new StringGen ();
+ } // createSequenceGen
+
+ public com.sun.tools.corba.se.idl.StructGen createStructGen ()
+ {
+ return new StructGen ();
+ } // createStructGen
+
+ public com.sun.tools.corba.se.idl.TypedefGen createTypedefGen ()
+ {
+ return new TypedefGen ();
+ } // createTypedefGen
+
+ public com.sun.tools.corba.se.idl.UnionGen createUnionGen ()
+ {
+ return new UnionGen ();
+ } // createUnionGen
+} // class GenFactory
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper.java
new file mode 100644
index 0000000..664fba9
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper.java
@@ -0,0 +1,699 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -F46082.51<daz> Remove -stateful feature.
+// -D57118 <klr> Fix "narrow" in helper for abstract interface
+// -D58889 <klr> re-Fix "narrow" in helper for abstract interface
+// -D59383 <klr> 'get_class' in value helper returns value class, not helper.
+// -D59413 <klr> Remove Helper interface references for non-value types.
+// -D59435 <klr> Remove read_Object, write_Object completely.
+// -D59418 <klr> Move read_Value, write_Value to generator's helperRead.
+
+import java.io.PrintWriter;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.ParameterEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.StructEntry;
+
+/**
+ *
+ **/
+public class Helper implements AuxGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public Helper ()
+ {
+ } // ctor
+
+ /**
+ * Generate the helper class. Provides general algorithm
+ * for auxiliary binding generation:
+ *
+ * 1.) Initialize symbol table and symbol table entry members,
+ * common to all generators.
+ * 2.) Initialize members unique to this generator.
+ * 3.) Open print stream
+ * 4.) Write class heading: package, prologue, class statement, open curly
+ * 5.) Write class body: member data and methods
+ * 6.) Write class closing: close curly
+ * 7.) Close the print stream
+ **/
+ public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry)
+ {
+ this.symbolTable = symbolTable;
+ this.entry = entry;
+ init ();
+
+ openStream ();
+ if (stream == null)
+ return;
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ } // generate
+
+ /**
+ * Initialize variables unique to this generator.
+ **/
+ protected void init ()
+ {
+ helperClass = entry.name () + "Helper";
+ if (entry instanceof ValueBoxEntry)
+ {
+ ValueBoxEntry v = (ValueBoxEntry) entry;
+ TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+
+ if (mType instanceof PrimitiveEntry)
+ helperType = Util.javaName (entry);
+ else
+ helperType = Util.javaName (mType);
+ }
+ else
+ helperType = Util.javaName (entry);
+ } // init
+
+ /**
+ * Open the print stream for subsequent output.
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (entry, "Helper.java");
+ } // openStream
+
+ /**
+ * Generate the heading, including package, imports, class statements,
+ * and open curly.
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, entry, Util.HelperFile);
+ Util.writeProlog (stream, stream.name ());
+
+ // Transfer comment to target <30jul1997daz>.
+ if (entry.comment () != null)
+ entry.comment ().generate ("", stream);
+
+ stream.print ("public final class " + helperClass);
+ if (entry instanceof ValueEntry)
+ stream.println (" implements org.omg.CORBA.portable.ValueHelper");
+ else
+ stream.println ();
+ stream.println ('{');
+ }
+
+ /**
+ * Generate members of this class.
+ **/
+ protected void writeBody ()
+ {
+ writeInstVars ();
+ writeCtors ();
+ writeInsert ();
+ writeExtract ();
+ writeType ();
+ writeID ();
+ writeRead ();
+ writeWrite ();
+ if (entry instanceof InterfaceEntry && !(entry instanceof ValueEntry)) {
+ writeNarrow ();
+ writeUncheckedNarrow ();
+ }
+ writeHelperInterface ();
+ if (entry instanceof ValueEntry)
+ writeValueHelperInterface ();
+ } // writeBody
+
+ /**
+ * Generate members of the Helper interface.
+ **/
+ protected void writeHelperInterface ()
+ {
+ } // writeHelperInterface
+
+ /**
+ * Generate members of the ValueHelper interface.
+ **/
+ protected void writeValueHelperInterface ()
+ {
+ writeGetID (); // moved for <d59413>
+ writeGetType (); // moved for <d59413>
+ writeGetInstance (); // not in ValueHelper interface
+ writeGetClass ();
+ writeGetSafeBaseIds ();
+ } // writeHelperInterface
+
+ /**
+ * Generate the closing statements.
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ('}');
+ }
+
+ /**
+ * Write the stream to file by closing the print stream.
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ }
+
+ /**
+ * Generate the instance variables.
+ **/
+ protected void writeInstVars ()
+ {
+ stream.println (" private static String _id = \"" + Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()) + "\";");
+ if (entry instanceof ValueEntry)
+ {
+ stream.println ();
+ stream.println (" private static " + helperClass + " helper = new " + helperClass + " ();");
+ stream.println ();
+ stream.println (" private static String[] _truncatable_ids = {");
+ stream.print (" _id");
+
+ // Any safe ValueEntry must have a concete value parent.
+ // The topmost parent cannot be safe since it doesn't have
+ // a concrete parent.
+ ValueEntry child = (ValueEntry) entry;
+ while (child.isSafe ())
+ {
+ stream.println(",");
+ ValueEntry parent = (ValueEntry)child.derivedFrom ().elementAt (0);
+ stream.print(" \"" + Util.stripLeadingUnderscoresFromID (parent.repositoryID ().ID ()) + "\"");
+ child = parent;
+ }
+ stream.println(" };");
+ }
+ stream.println ();
+ } // writeInstVars
+
+ /**
+ * Generate the constructors.
+ **/
+ protected void writeCtors ()
+ {
+ stream.println (" public " + helperClass + "()");
+ stream.println (" {");
+ stream.println (" }");
+ stream.println ();
+ } // writeCtors
+
+ /**
+ * Generate the insert method.
+ **/
+ protected void writeInsert ()
+ {
+ stream.println (" public static void insert (org.omg.CORBA.Any a, " + helperType + " that)");
+ stream.println (" {");
+ stream.println (" org.omg.CORBA.portable.OutputStream out = a.create_output_stream ();");
+ stream.println (" a.type (type ());");
+ stream.println (" write (out, that);");
+ stream.println (" a.read_value (out.create_input_stream (), type ());");
+ stream.println (" }");
+ stream.println ();
+ } // writeInsert
+
+ /**
+ * Generate the extract method.
+ **/
+ protected void writeExtract ()
+ {
+ stream.println (" public static " + helperType + " extract (org.omg.CORBA.Any a)");
+ stream.println (" {");
+ stream.println (" return read (a.create_input_stream ());");
+ stream.println (" }");
+ stream.println ();
+ } // writeExtract
+
+ /**
+ * Generate the typecode variable and type method.
+ **/
+ protected void writeType ()
+ {
+ boolean canRecurse = entry instanceof ValueEntry
+ || entry instanceof ValueBoxEntry
+ || entry instanceof StructEntry;
+ stream.println (" private static org.omg.CORBA.TypeCode __typeCode = null;");
+ if (canRecurse)
+ stream.println (" private static boolean __active = false;");
+ stream.println (" synchronized public static org.omg.CORBA.TypeCode type ()");
+ stream.println (" {");
+ stream.println (" if (__typeCode == null)");
+ stream.println (" {");
+ if (canRecurse) {
+ stream.println (" synchronized (org.omg.CORBA.TypeCode.class)");
+ stream.println (" {");
+ stream.println (" if (__typeCode == null)");
+ stream.println (" {");
+ stream.println (" if (__active)");
+ stream.println (" {");
+ stream.println (" return org.omg.CORBA.ORB.init().create_recursive_tc ( _id );");
+ stream.println (" }");
+ stream.println (" __active = true;");
+ ((JavaGenerator)entry.generator ()).helperType (0, " ", new TCOffsets (), "__typeCode", entry, stream);
+ }
+ else
+ ((JavaGenerator)entry.generator ()).helperType (0, " ", new TCOffsets (), "__typeCode", entry, stream);
+
+ // Generate body of type() method
+
+ if (canRecurse) {
+ stream.println (" __active = false;");
+ stream.println (" }");
+ stream.println (" }");
+ }
+ stream.println (" }");
+ stream.println (" return __typeCode;");
+ stream.println (" }");
+ stream.println ();
+ } // writeType
+
+ /**
+ * Generate the ID method.
+ **/
+ protected void writeID ()
+ {
+ stream.println (" public static String id ()");
+ stream.println (" {");
+ stream.println (" return _id;");
+ stream.println (" }");
+ stream.println ();
+ } // writeID
+
+ /**
+ * Generate the read method.
+ **/
+ protected void writeRead ()
+ {
+
+ boolean isLocalInterface = false;
+
+ if (entry instanceof InterfaceEntry) {
+ InterfaceEntry ie = (InterfaceEntry) entry;
+
+ // for #pragma sun_local or sun_localservant, or actual local
+ // local interface, set the flag by checking on both
+ isLocalInterface = ie.isLocal() | ie.isLocalServant();
+ }
+
+ stream.println (" public static " + helperType + " read (org.omg.CORBA.portable.InputStream istream)");
+ stream.println (" {");
+ if ( !isLocalInterface ) { // nonLocal Interface and other types
+ ((JavaGenerator)entry.generator ()).helperRead (helperType, entry, stream);
+ } else { //Local interface should throw exception
+ stream.println (" throw new org.omg.CORBA.MARSHAL ();");
+ }
+ stream.println (" }");
+ stream.println ();
+ } // writeRead
+
+ /**
+ * Generate the write method.
+ **/
+ protected void writeWrite ()
+ {
+
+ boolean isLocalInterface = false;
+
+ if (entry instanceof InterfaceEntry) {
+ InterfaceEntry ie = (InterfaceEntry) entry;
+
+ // for #pragma sun_local or sun_localservant, or actual local
+ // local interface, set the flag by checking on both
+ isLocalInterface = ie.isLocal() | ie.isLocalServant();
+ }
+
+ stream.println (" public static void write (org.omg.CORBA.portable.OutputStream ostream, " + helperType + " value)");
+ stream.println (" {");
+ if ( !isLocalInterface ) { // nonLocal Interface and other types
+ ((JavaGenerator)entry.generator ()).helperWrite (entry, stream);
+ } else { //Local interface should throw exception
+ stream.println (" throw new org.omg.CORBA.MARSHAL ();");
+ }
+ stream.println (" }");
+ stream.println ();
+ } // writeWrite
+
+
+ /**
+ * Generate the narrow method.
+ **/
+ protected void writeNarrow ()
+ {
+ writeRemoteNarrow ();
+ stream.println ();
+ }
+
+ /**
+ * Write the narrow() method for a remotable object.
+ **/
+ protected void writeRemoteNarrow ()
+ {
+ InterfaceEntry ie = (InterfaceEntry) entry;
+
+ // narrow for LocalObject interface
+ if (ie.isLocal ()) {
+ writeRemoteNarrowForLocal (false);
+ return;
+ }
+
+ // narrow for Abstract interface
+ if (ie.isAbstract ()) {
+ writeRemoteNarrowForAbstract (false);
+ return;
+ } else {
+ // Determine if the non-abstract interface has any abstract parents
+ for (int i = 0; i < ie.derivedFrom ().size (); i++) {
+ SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
+ if (((InterfaceEntry) parent).isAbstract ()) {
+ writeRemoteNarrowForAbstract (true);
+ break;
+ }
+ }
+ }
+
+ stream.println (" public static " + helperType + " narrow (org.omg.CORBA.Object obj)");
+ stream.println (" {");
+ stream.println (" if (obj == null)");
+ stream.println (" return null;");
+ stream.println (" else if (obj instanceof " + helperType + ')');
+ stream.println (" return (" + helperType + ")obj;");
+ stream.println (" else if (!obj._is_a (id ()))");
+ stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
+ stream.println (" else");
+ stream.println (" {");
+ stream.println (" org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
+ String stubNameofEntry = stubName ((InterfaceEntry)entry);
+ stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
+ stream.println (" stub._set_delegate(delegate);");
+ stream.println (" return stub;");
+ stream.println (" }");
+ stream.println (" }");
+ } // writeRemoteNarrow
+
+ /**
+ * Write the narrow() method for local interface.
+ **/
+ private void writeRemoteNarrowForLocal (boolean hasAbstractParent)
+ {
+ stream.println (" public static " + helperType + " narrow (org.omg.CORBA.Object obj)");
+ stream.println (" {");
+ stream.println (" if (obj == null)");
+ stream.println (" return null;");
+ stream.println (" else if (obj instanceof " + helperType + ')');
+ stream.println (" return (" + helperType + ")obj;");
+ stream.println (" else");
+ stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
+ stream.println (" }");
+ } // writeRemoteNarrowForLocal
+
+ /**
+ * Write the narrow() method for abstract interface.
+ **/
+ private void writeRemoteNarrowForAbstract (boolean hasAbstractParent)
+ {
+ stream.print (" public static " + helperType + " narrow (java.lang.Object obj)");
+ stream.println (" {");
+ stream.println (" if (obj == null)");
+ stream.println (" return null;");
+ if (hasAbstractParent)
+ {
+ stream.println (" else if (obj instanceof org.omg.CORBA.Object)");
+ stream.println (" return narrow ((org.omg.CORBA.Object) obj);");
+ }
+ else
+ {
+ stream.println (" else if (obj instanceof " + helperType + ')');
+ stream.println (" return (" + helperType + ")obj;");
+ }
+
+ // If hasAbstractParent is false, then THIS entry must be abstract.
+ // This method is also called in case THIS entry is not abstract, but
+ // there is an abstract parent. If this entry is not abstract,
+ // it can never narrow to a CORBA object reference.
+ if (!hasAbstractParent) { // <d58889>
+ String stubNameofEntry = stubName ((InterfaceEntry)entry);
+
+ stream.println (" else if ((obj instanceof org.omg.CORBA.portable.ObjectImpl) &&");
+ stream.println (" (((org.omg.CORBA.Object)obj)._is_a (id ()))) {");
+ stream.println (" org.omg.CORBA.portable.ObjectImpl impl = (org.omg.CORBA.portable.ObjectImpl)obj ;" ) ;
+ stream.println (" org.omg.CORBA.portable.Delegate delegate = impl._get_delegate() ;" ) ;
+ stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
+ stream.println (" stub._set_delegate(delegate);");
+ stream.println (" return stub;" ) ;
+ stream.println (" }" ) ;
+ };
+ // end <d57118 - check for remotable - klr>
+
+ stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
+ stream.println (" }");
+ stream.println ();
+ } // writeRemoteNarrowForAbstract
+
+
+ /**
+ * Generate the unchecked narrow method.
+ **/
+ protected void writeUncheckedNarrow ()
+ {
+ writeUncheckedRemoteNarrow ();
+ stream.println ();
+ }
+
+ /**
+ * Write the unchecked narrow() method for a remotable object.
+ **/
+ protected void writeUncheckedRemoteNarrow ()
+ {
+ InterfaceEntry ie = (InterfaceEntry) entry;
+
+ // unchecked narrow for LocalObject interface
+ if (ie.isLocal ()) {
+ writeRemoteUncheckedNarrowForLocal (false);
+ return;
+ }
+
+ // unchecked narrow for Abstract interface
+ if (ie.isAbstract ()) {
+ writeRemoteUncheckedNarrowForAbstract (false);
+ return;
+ } else {
+ // Determine if the non-abstract interface has any abstract parents
+ for (int i = 0; i < ie.derivedFrom ().size (); i++) {
+ SymtabEntry parent = (SymtabEntry) ie.derivedFrom ().elementAt (i);
+ if (((InterfaceEntry) parent).isAbstract ()) {
+ writeRemoteUncheckedNarrowForAbstract (true);
+ break;
+ }
+ }
+ }
+
+ stream.println (" public static " + helperType + " unchecked_narrow (org.omg.CORBA.Object obj)");
+ stream.println (" {");
+ stream.println (" if (obj == null)");
+ stream.println (" return null;");
+ stream.println (" else if (obj instanceof " + helperType + ')');
+ stream.println (" return (" + helperType + ")obj;");
+ stream.println (" else");
+ stream.println (" {");
+ stream.println (" org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate ();");
+ String stubNameofEntry = stubName ((InterfaceEntry)entry);
+ stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
+ stream.println (" stub._set_delegate(delegate);");
+ stream.println (" return stub;");
+ stream.println (" }");
+ stream.println (" }");
+ } // writeUncheckedRemoteNarrow
+
+ /**
+ * Write the unchecked narrow() method for local interface.
+ **/
+ private void writeRemoteUncheckedNarrowForLocal (boolean hasAbstractParent)
+ {
+ stream.println (" public static " + helperType + " unchecked_narrow (org.omg.CORBA.Object obj)");
+ stream.println (" {");
+ stream.println (" if (obj == null)");
+ stream.println (" return null;");
+ stream.println (" else if (obj instanceof " + helperType + ')');
+ stream.println (" return (" + helperType + ")obj;");
+ stream.println (" else");
+ stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
+ stream.println (" }");
+ } // writeRemoteUncheckedNarrowForLocal
+
+ /**
+ * Write the unchecked narrow() method for abstract interface.
+ **/
+ private void writeRemoteUncheckedNarrowForAbstract (boolean hasAbstractParent)
+ {
+ stream.print (" public static " + helperType + " unchecked_narrow (java.lang.Object obj)");
+ stream.println (" {");
+ stream.println (" if (obj == null)");
+ stream.println (" return null;");
+ if (hasAbstractParent)
+ {
+ stream.println (" else if (obj instanceof org.omg.CORBA.Object)");
+ stream.println (" return unchecked_narrow ((org.omg.CORBA.Object) obj);");
+ }
+ else
+ {
+ stream.println (" else if (obj instanceof " + helperType + ')');
+ stream.println (" return (" + helperType + ")obj;");
+ }
+
+ if (!hasAbstractParent) {
+ String stubNameofEntry = stubName ((InterfaceEntry)entry);
+
+ stream.println (" else if (obj instanceof org.omg.CORBA.portable.ObjectImpl) {");
+ stream.println (" org.omg.CORBA.portable.ObjectImpl impl = (org.omg.CORBA.portable.ObjectImpl)obj ;" ) ;
+ stream.println (" org.omg.CORBA.portable.Delegate delegate = impl._get_delegate() ;" ) ;
+ stream.println (" " + stubNameofEntry + " stub = new " + stubNameofEntry + " ();");
+ stream.println (" stub._set_delegate(delegate);");
+ stream.println (" return stub;" ) ;
+ stream.println (" }" ) ;
+ };
+
+ stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
+ stream.println (" }");
+ stream.println ();
+ } // writeRemoteUncheckedNarrowForAbstract
+
+
+ /**
+ * Generate the GetID method.
+ **/
+ protected void writeGetID ()
+ {
+ if ( !Util.IDLEntity (entry))
+ return;
+ stream.println (" public String get_id ()");
+ stream.println (" {");
+ stream.println (" return _id;");
+ stream.println (" }");
+ stream.println ();
+ } // writeGetID
+
+ /**
+ * Generate the GetType method.
+ **/
+ protected void writeGetType ()
+ {
+ if ( !Util.IDLEntity (entry))
+ return;
+ stream.println (" public org.omg.CORBA.TypeCode get_type ()");
+ stream.println (" {");
+ stream.println (" return type ();");
+ stream.println (" }");
+ stream.println ();
+ } // writeGetID
+
+ /**
+ * Generate the get_class method.
+ **/
+ protected void writeGetClass ()
+ {
+ stream.println (" public Class get_class ()");
+ stream.println (" {");
+ stream.println (" return " + helperType + ".class;"); //<d59383>
+ stream.println (" }");
+ stream.println ();
+ } // writeGetClass
+
+ /**
+ * Generate the get_instance method.
+ **/
+ protected void writeGetInstance ()
+ {
+ stream.println (" public static org.omg.CORBA.portable.ValueHelper get_instance ()");
+ stream.println (" {");
+ stream.println (" return helper;");
+ stream.println (" }");
+ stream.println ();
+ } // writeGetInstance
+
+ /**
+ * Generate the GetSafeBaseIds method.
+ **/
+ protected void writeGetSafeBaseIds ()
+ {
+ stream.println (" public String[] get_truncatable_base_ids ()");
+ stream.println (" {");
+ stream.println (" return _truncatable_ids;");
+ stream.println (" }");
+ stream.println ();
+ } // writeGetSafeBaseIds
+
+ /**
+ * Return the stub name for the interface entry.
+ **/
+ protected String stubName (InterfaceEntry entry)
+ {
+ String name;
+ if (entry.container ().name ().equals (""))
+ name = '_' + entry.name () + "Stub";
+ else
+ {
+ name = Util.containerFullName (entry.container ()) + "._" + entry.name () + "Stub";
+ }
+ return name.replace ('/', '.');
+ } // stubName
+
+ protected java.util.Hashtable symbolTable;
+ protected com.sun.tools.corba.se.idl.SymtabEntry entry;
+ protected GenFileStream stream;
+
+ // Unique to this generator
+ protected String helperClass;
+ protected String helperType;
+} // class Helper
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper24.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper24.java
new file mode 100644
index 0000000..0079b14
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Helper24.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D62023 <klr> New file to implement CORBA 2.4 RTF
+
+import java.io.PrintWriter;
+
+import java.util.Enumeration;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.ParameterEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.StructEntry;
+
+/**
+ *
+ **/
+public class Helper24 extends Helper
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public Helper24 ()
+ {
+ } // ctor
+
+ /**
+ * Generate the heading, including package, imports, class statements,
+ * and open curly.
+ * d62023 - don't implement ValueHelper, make non-boxed helpers abstract
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, entry, Util.HelperFile);
+ Util.writeProlog (stream, stream.name ());
+
+ // Transfer comment to target <30jul1997daz>.
+ if (entry.comment () != null)
+ entry.comment ().generate ("", stream);
+
+ if (entry instanceof ValueBoxEntry) {
+ stream.print ("public final class " + helperClass);
+ stream.println (" implements org.omg.CORBA.portable.BoxedValueHelper");
+ }
+ else
+ stream.println ("abstract public class " + helperClass);
+ stream.println ('{');
+ }
+
+ /**
+ * Generate the instance variables.
+ * <pre>
+ * d62023 - no helper instance except for boxed valuetypes;
+ * - move truncatable_ids to mapped class.
+ * </pre>
+ **/
+ protected void writeInstVars ()
+ {
+ stream.println (" private static String _id = \"" + Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ()) + "\";");
+ if (entry instanceof ValueEntry)
+ {
+ stream.println ();
+ if (entry instanceof ValueBoxEntry) {
+ stream.println (" private static " + helperClass + " _instance = new " + helperClass + " ();");
+ stream.println ();
+ }
+ }
+ stream.println ();
+ } // writeInstVars
+
+ /**
+ * d62023 - generate members of BoxedValueHelper interface if boxed
+ *
+ * d62023 - hook in here to write factory methods for non-boxed ValueTypes
+ * into Helper.
+ **/
+ protected void writeValueHelperInterface ()
+ {
+ if (entry instanceof ValueBoxEntry) {
+ writeGetID ();
+ } else if (entry instanceof ValueEntry) {
+ writeHelperFactories ();
+ }
+ } // writeValueHelperInterface
+
+ /**
+ *
+ **/
+ protected void writeHelperFactories ()
+ {
+ Vector init = ((ValueEntry)entry).initializers ();
+ if (init != null)
+ {
+ stream.println ();
+ for (int i = 0; i < init.size (); i++)
+ {
+ MethodEntry element = (MethodEntry) init.elementAt (i);
+ element.valueMethod (true); //tag value method if not tagged previously
+ ((MethodGen24) element.generator ()). helperFactoryMethod (symbolTable, element, entry, stream);
+ }
+ }
+ } // writeHelperFactories
+
+ /**
+ * d62023 - generate constructors only for boxed valuetype helpers.
+ * All other helpers are abstract.
+ **/
+ protected void writeCtors ()
+ {
+ if (entry instanceof ValueBoxEntry) {
+ stream.println (" public " + helperClass + "()");
+ stream.println (" {");
+ stream.println (" }");
+ stream.println ();
+ }
+ } // writeCtors
+}
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Holder.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Holder.java
new file mode 100644
index 0000000..d356705
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Holder.java
@@ -0,0 +1,255 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D61056 <klr> Use Util.helperName
+
+import java.io.PrintWriter;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+
+/**
+ *
+ **/
+public class Holder implements AuxGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public Holder ()
+ {
+ } // ctor
+
+ /**
+ * Generate the holder class. Provides general algorithm for
+ * auxiliary binding generation:
+ * 1.) Initialize symbol table and symbol table entry members,
+ * common to all generators.
+ * 2.) Initialize members unique to this generator.
+ * 3.) Open print stream
+ * 4.) Write class heading (package, prologue, source comment, class
+ * statement, open curly
+ * 5.) Write class body (member data and methods)
+ * 6.) Write class closing (close curly)
+ * 7.) Close the print stream
+ **/
+ public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry)
+ {
+ this.symbolTable = symbolTable;
+ this.entry = entry;
+ init ();
+
+ openStream ();
+ if (stream == null)
+ return;
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ } // generate
+
+ /**
+ * Initialize variables unique to this generator.
+ **/
+ protected void init ()
+ {
+ holderClass = entry.name () + "Holder";
+ helperClass = Util.helperName (entry, true); // <d61056>
+ if (entry instanceof ValueBoxEntry)
+ {
+ ValueBoxEntry v = (ValueBoxEntry) entry;
+ TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+ holderType = Util.javaName (mType);
+ }
+ else
+ holderType = Util.javaName (entry);
+ } // init
+
+ /**
+ * Open the print stream for subsequent output.
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (entry, "Holder.java");
+ } // openStream
+
+ /**
+ * Generate the heading, including the package, imports,
+ * source comment, class statement, and left curly.
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, entry, Util.HolderFile);
+ Util.writeProlog (stream, stream.name ());
+ if (entry.comment () != null)
+ entry.comment ().generate ("", stream);
+ stream.println ("public final class " + holderClass + " implements org.omg.CORBA.portable.Streamable");
+ stream.println ('{');
+ } // writeHeading
+
+ /**
+ * Generate members of this class.
+ **/
+ protected void writeBody ()
+ {
+ if (entry instanceof ValueBoxEntry)
+ stream.println (" public " + holderType + " value;");
+ else
+ Util.writeInitializer (" public ", "value", "", entry, stream);
+ stream.println ();
+ writeCtors ();
+ writeRead ();
+ writeWrite ();
+ writeType ();
+ } // writeBody
+
+ /**
+ * Generate the closing statements.
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ('}');
+ } // writeClosing
+
+ /**
+ * Write the stream to file by closing the print stream.
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ /**
+ * Generate the constructors.
+ **/
+ protected void writeCtors ()
+ {
+ stream.println (" public " + holderClass + " ()");
+ stream.println (" {");
+ stream.println (" }");
+ stream.println ();
+ stream.println (" public " + holderClass + " (" + holderType + " initialValue)");
+ stream.println (" {");
+ stream.println (" value = initialValue;");
+ stream.println (" }");
+ stream.println ();
+ } // writeCtors
+
+ /**
+ * Generate the _read method.
+ **/
+ protected void writeRead ()
+ {
+ stream.println (" public void _read (org.omg.CORBA.portable.InputStream i)");
+ stream.println (" {");
+ if (entry instanceof ValueBoxEntry)
+ {
+ TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+ if (mType instanceof StringEntry)
+ stream.println (" value = i.read_string ();");
+
+ else if (mType instanceof PrimitiveEntry)
+ stream.println (" value = " + helperClass + ".read (i).value;");
+
+ else
+ stream.println (" value = " + helperClass + ".read (i);");
+ }
+ else
+ stream.println (" value = " + helperClass + ".read (i);");
+ stream.println (" }");
+ stream.println ();
+ } // writeRead
+
+ /**
+ * Generate the _write method.
+ **/
+ protected void writeWrite ()
+ {
+ stream.println (" public void _write (org.omg.CORBA.portable.OutputStream o)");
+ stream.println (" {");
+ if (entry instanceof ValueBoxEntry)
+ {
+ TypedefEntry member = ((InterfaceState) ((ValueBoxEntry) entry).state ().elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+ if (mType instanceof StringEntry)
+ stream.println (" o.write_string (value);");
+
+ else if (mType instanceof PrimitiveEntry)
+ {
+ String name = entry.name ();
+ stream.println (" " + name + " vb = new " + name + " (value);");
+ stream.println (" " + helperClass + ".write (o, vb);");
+ }
+
+ else
+ stream.println (" " + helperClass + ".write (o, value);");
+ }
+ else
+ stream.println (" " + helperClass + ".write (o, value);");
+ stream.println (" }");
+ stream.println ();
+ } // writeWrite
+
+ /**
+ * Generate the _type method.
+ **/
+ protected void writeType ()
+ {
+ stream.println (" public org.omg.CORBA.TypeCode _type ()");
+ stream.println (" {");
+ stream.println (" return " + helperClass + ".type ();");
+ stream.println (" }");
+ stream.println ();
+ } // writeType
+
+ protected java.util.Hashtable symbolTable;
+ protected com.sun.tools.corba.se.idl.SymtabEntry entry;
+ protected GenFileStream stream;
+
+ // Unique to this generator
+ protected String holderClass;
+ protected String helperClass;
+ protected String holderType;
+} // class Holder
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/InterfaceGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/InterfaceGen.java
new file mode 100644
index 0000000..2667b9e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/InterfaceGen.java
@@ -0,0 +1,864 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -The ctor should really throw an exception, but then it must have a
+// throws clause. How much of a ripple effect is this?
+// -F46082.51<daz> Remove -stateful feature.
+// -D60929 <klr> Update for RTF2.4 changes
+// -D61056 <klr> Use Util.helperName
+// -D62014 <klr> Move const definitions from signature to operations interf.
+// -D62310 <klr> Fix declaration of interfaces extending abstract intf.
+// -D62023 <klr> Move const definitions back from operations to signature.
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.ConstEntry;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+
+/**
+ *
+ **/
+public class InterfaceGen implements com.sun.tools.corba.se.idl.InterfaceGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public InterfaceGen ()
+ {
+ //emit = ((Arguments)Compile.compiler.arguments).emit;
+ //factories = (Factories)Compile.compiler.factories ();
+ } // ctor
+
+ /**
+ * Generate the interface and all the files associated with it.
+ * Provides general algorithm for binding generation:
+ * 1.) Initialize symbol table and symbol table entry members, common to all generators.
+ * 2.) Generate the skeleton if required by calling generateSkeletn ()
+ * 3.) Generate the holder by calling generateHolder ()
+ * 4.) Generate the helper by calling generateHelper ()
+ * 5.) Generate the stub if required by calling generateStub ()
+ * 6.) Generate the interface by calling generateInterface ()
+ **/
+ public void generate (Hashtable symbolTable, InterfaceEntry i, PrintWriter stream)
+ {
+ if (!isPseudo(i))
+ {
+ this.symbolTable = symbolTable;
+ this.i = i;
+ init ();
+
+ // for sun_local pragma, just generate the signature and operations interfaces
+ // for sun_localservant pragma, generate the Local Stubs, and Skel, should not
+ // have _invoke defined.
+ // for local (is_local()) case, generate only Helpers and Holder, where they
+ // have been modified to throw appropriate exceptions for read and write, and
+ // narrow is modified to not invoke _is_a
+
+ if (! (i.isLocalSignature())) {
+ // generate the stubs and skeletons for non-local interfaces
+ if (! (i.isLocal())) {
+ // for local servant case just generate the skeleton, but
+ // for others generate the stubs also
+ generateSkeleton ();
+
+ // _REVISIT_, Whenever there is time restructure the code to
+ // encapsulate stub and skeleton generation.
+
+ // If the option is -fallTie then generate the Tie class first
+ // and then generate the ImplBase class to make the generation
+ // complete for the Hierarchy.
+ Arguments theArguments = (Arguments)Compile.compiler.arguments;
+ if( (theArguments.TIEServer == true )
+ &&(theArguments.emit == theArguments.All ) )
+ {
+ theArguments.TIEServer = false;
+ // Generate the ImplBase class
+ generateSkeleton ();
+ // Revert in case file contains multiple interfaces
+ theArguments.TIEServer = true;
+ }
+ generateStub ();
+ }
+ generateHolder ();
+ generateHelper ();
+ }
+ intfType = SIGNATURE;
+ generateInterface ();
+ intfType = OPERATIONS;
+ generateInterface ();
+ intfType = 0;
+ }
+ } // generate
+
+ /**
+ * Initialize members unique to this generator.
+ **/
+ protected void init ()
+ {
+ emit = ((Arguments)Compile.compiler.arguments).emit;
+ factories = (Factories)Compile.compiler.factories ();
+ } // init
+
+ /**
+ * Generate a Skeleton when the user does not want just the client-side code.
+ **/
+ protected void generateSkeleton ()
+ {
+ // <f46082.51> Remove -stateful feature.
+ // The Skeleton is generated only when the user doesn't want
+ // JUST the client code OR when the interface is stateful
+ //if (emit != Arguments.Client || i.state () != null)
+ // factories.skeleton ().generate (symbolTable, i);
+ if (emit != Arguments.Client)
+ factories.skeleton ().generate (symbolTable, i);
+ } // generateSkeleton
+
+ /**
+ * Generate a Stub when the user does not want just the server-side code.
+ **/
+ protected void generateStub ()
+ {
+ // <klr> According to Simon on 10/28/98, we should generate stubs for
+ // abstract interfaces too.
+ if (emit != Arguments.Server /* && !i.isAbstract () */)
+ factories.stub ().generate (symbolTable, i);
+ } // generateStub
+
+ /**
+ * Generate a Helper when the user does not want just the server-side code.
+ **/
+ protected void generateHelper ()
+ {
+ if (emit != Arguments.Server)
+ factories.helper ().generate (symbolTable, i);
+ } // generateHelper
+
+ /**
+ * Generate a Holder when the user does not want just the server-side code.
+ **/
+ protected void generateHolder ()
+ {
+ if (emit != Arguments.Server)
+ factories.holder ().generate (symbolTable, i);
+ } // generateHolder
+
+ /**
+ * Generate the interface. Provides general algorithm for binding generation:
+ * <ol>
+ * <li> Initialize members unique to this generator - init()</li>
+ * <li> Open print stream - openStream()</li>
+ * <li> Write class heading (package, prologue, class statement, open curly - writeHeading()</li>
+ * <li> Write class body (member data and methods) - write*Body()</li>
+ * <li> Write class closing (close curly) - writeClosing()</li>
+ * <li> Close the print stream - closeStream ()</li>
+ * </ol>
+ *
+ * For CORBA 2.3, interfaces are mapped to Operations and Signature
+ * interfaces. The Operations interface contains the method definitions.
+ * The Signature interface extends the Operations interface and adds
+ * CORBA::Object. (klr)
+ **/
+ protected void generateInterface ()
+ {
+ init ();
+ openStream ();
+ if (stream == null)
+ return;
+ writeHeading ();
+ if (intfType == OPERATIONS)
+ writeOperationsBody ();
+ if (intfType == SIGNATURE)
+ writeSignatureBody ();
+ writeClosing ();
+ closeStream ();
+ } // generateInterface
+
+ /**
+ *
+ **/
+ protected void openStream ()
+ {
+ if (i.isAbstract () || intfType == SIGNATURE)
+ stream = Util.stream (i, ".java");
+ else if (intfType == OPERATIONS)
+ stream = Util.stream (i, "Operations.java");
+ } // openStream
+
+ /**
+ *
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, i, Util.TypeFile);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+
+ // Transfer interface comment to target <31jul1997>.
+ if (i.comment () != null)
+ i.comment ().generate ("", stream);
+
+ String className = i.name ();
+// if (((Arguments)Compile.compiler.arguments).TIEServer)
+// {
+// // For the delegate model, don't make interface a subclass of CORBA.Object
+// stream.print ("public interface " + className);
+// boolean firstTime = true;
+// for (int ii = 0; ii < i.derivedFrom ().size (); ++ii)
+// {
+// SymtabEntry parent = (SymtabEntry)i.derivedFrom ().elementAt (ii);
+// if (!parent.fullName ().equals ("org/omg/CORBA/Object"))
+// {
+// if (firstTime)
+// {
+// firstTime = false;
+// stream.print (" extends ");
+// }
+// else
+// stream.print (", ");
+// stream.print (Util.javaName (parent));
+// }
+// }
+// if (i.derivedFrom ().size () > 0)
+// stream.print (", ");
+// stream.print ("org.omg.CORBA.portable.IDLEntity ");
+// }
+//
+// else
+// {
+ if (intfType == SIGNATURE)
+ writeSignatureHeading ();
+ else if (intfType == OPERATIONS)
+ writeOperationsHeading ();
+// }
+
+ stream.println ();
+ stream.println ('{');
+ } // writeHeading
+
+ /**
+ *
+ **/
+ protected void writeSignatureHeading ()
+ {
+ String className = i.name ();
+ stream.print ("public interface " + className + " extends " + className + "Operations, ");
+ boolean firstTime = true;
+ boolean hasNonAbstractParent = false; // <d62310-klr>
+ for (int k = 0; k < i.derivedFrom ().size (); ++k)
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ stream.print (", ");
+ InterfaceEntry parent = (InterfaceEntry)i.derivedFrom ().elementAt (k);
+ stream.print (Util.javaName (parent));
+ if (! parent.isAbstract ()) // <d62310-klr>
+ hasNonAbstractParent = true; // <d62310-klr>
+ }
+ // <d62310-klr> - begin
+ // If this interface extends only abstract interfaces,
+ // it should extend both org.omg.CORBA.Object and IDLEntity.
+ if (!hasNonAbstractParent) {
+ stream.print (", org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity ");
+ }
+ else {
+ // <d62310-klr> - end
+ // extends IDLEntity if there's only one default parent - CORBA.Object
+ if (i.derivedFrom ().size () == 1)
+ stream.print (", org.omg.CORBA.portable.IDLEntity ");
+ }
+ } // writeSignatureHeading
+
+ /**
+ *
+ **/
+ protected void writeOperationsHeading ()
+ {
+ stream.print ("public interface " + i.name ());
+ if ( !i.isAbstract ())
+ stream.print ("Operations ");
+ else {
+ // <d60929> - base abstract interfaces extend AbstractBase
+ // changed to IDLEntity by SCN per latest spec...
+ if (i.derivedFrom ().size () == 0)
+ stream.print (" extends org.omg.CORBA.portable.IDLEntity");
+ }
+
+ boolean firstTime = true;
+ for (int k = 0; k < i.derivedFrom ().size (); ++k)
+ {
+ InterfaceEntry parent = (InterfaceEntry) i.derivedFrom ().elementAt (k);
+ String parentName = Util.javaName (parent);
+
+ // ignore the default parent - CORBA.Object
+ if (parentName.equals ("org.omg.CORBA.Object"))
+ continue;
+
+ if (firstTime)
+ {
+ firstTime = false;
+ stream.print (" extends ");
+ }
+ else
+ stream.print (", ");
+
+ // Don't append suffix Operations to the parents of abstract interface
+ // or to the abstract parents of regular interface
+ if (parent.isAbstract () || i.isAbstract ())
+ stream.print (parentName);
+ else
+ stream.print (parentName + "Operations");
+ }
+ } // writeOperationsHeading
+
+
+ /**
+ *
+ **/
+ protected void writeOperationsBody ()
+ {
+ // Generate everything but constants
+ Enumeration e = i.contained ().elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry contained = (SymtabEntry)e.nextElement ();
+ if (contained instanceof MethodEntry)
+ {
+ MethodEntry element = (MethodEntry)contained;
+ ((MethodGen)element.generator ()).interfaceMethod (symbolTable, element, stream);
+ }
+ else
+ if ( !(contained instanceof ConstEntry))
+ contained.generate (symbolTable, stream);
+ }
+ } // writeOperationsBody
+
+ /**
+ *
+ **/
+ protected void writeSignatureBody ()
+ {
+ // Generate only constants
+ Enumeration e = i.contained ().elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry contained = (SymtabEntry)e.nextElement ();
+ if (contained instanceof ConstEntry)
+ contained.generate (symbolTable, stream);
+ }
+ } // writeSignatureBody
+
+ /**
+ *
+ **/
+ protected void writeClosing ()
+ {
+ String intfName = i.name ();
+ if ( !i.isAbstract () && intfType == OPERATIONS)
+ intfName = intfName + "Operations";
+ stream.println ("} // interface " + intfName);
+ } // writeClosing
+
+ /**
+ *
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ ///////////////
+ // From JavaGenerator
+
+ // <f46082.51> Remove -stateful feature.
+ /*
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ InterfaceEntry i = (InterfaceEntry)entry;
+ if (i.state () != null && i.state ().size () > 0)
+ index = structHelperType (index, indent, tcoffsets, name, entry, stream);
+ else
+ {
+ tcoffsets.set (entry);
+ if (entry.fullName ().equals ("org/omg/CORBA/Object"))
+ stream.println (indent + name
+ + " = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_objref);");
+ else
+ stream.println (indent + name
+ // <54697>
+ //+ " = org.omg.CORBA.ORB.init ().create_interface_tc (_id, "
+ + " = org.omg.CORBA.ORB.init ().create_interface_tc (" + Util.helperName (i, true) + ".id (), " // <d61056>
+ + '\"' + Util.stripLeadingUnderscores (entry.name ()) + "\");");
+ }
+ return index;
+ } // helperType
+ */
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ InterfaceEntry i = (InterfaceEntry)entry;
+ tcoffsets.set (entry);
+ if (entry.fullName ().equals ("org/omg/CORBA/Object"))
+ stream.println (indent + name
+ + " = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_objref);");
+ else
+ stream.println (indent + name
+ // <54697>
+ //+ " = org.omg.CORBA.ORB.init ().create_interface_tc (_id, "
+ + " = org.omg.CORBA.ORB.init ().create_interface_tc (" + Util.helperName (i, true) + ".id (), " // <d61056>
+ + '\"' + Util.stripLeadingUnderscores (entry.name ()) + "\");");
+ return index;
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
+ stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
+ return index;
+ } // type
+
+ // <f46082.51> Remove -stateful feature.
+ /*
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ InterfaceEntry i = (InterfaceEntry)entry;
+ if (i.state () != null)
+ structHelperRead (entryName, i, stream);
+ else
+ {
+ if (i.isAbstract ())
+ stream.println (" return narrow (((org.omg.CORBA_2_3.portable.InputStream)istream).read_abstract_interface (_" + i.name () + "Stub.class));"); // <d60929>
+ else
+ stream.println (" return narrow (istream.read_Object (_" + i.name () + "Stub.class));");
+ }
+ } // helperRead
+
+ */
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ InterfaceEntry i = (InterfaceEntry)entry;
+ if (i.isAbstract ())
+ stream.println (" return narrow (((org.omg.CORBA_2_3.portable.InputStream)istream).read_abstract_interface (_" + i.name () + "Stub.class));"); // <d60929>
+ else
+ stream.println (" return narrow (istream.read_Object (_" + i.name () + "Stub.class));");
+ } // helperRead
+
+ // <f46082.51> Remove -stateful feature.
+ /*
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ InterfaceEntry i = (InterfaceEntry)entry;
+ if (i.state () != null)
+ structHelperWrite (entry, stream);
+ else
+ write (0, " ", "value", entry, stream);
+ } // helperWrite
+ */
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ write (0, " ", "value", entry, stream);
+ } // helperWrite
+
+ // <f46082.51> Remove -stateful feature.
+ /*
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ InterfaceEntry i = (InterfaceEntry)entry;
+ if (i.state () != null)
+ index = structRead (index, indent, name, i, stream);
+ else
+ {
+ if (entry.fullName ().equals ("org/omg/CORBA/Object"))
+ stream.println (indent + name + " = istream.read_Object (_" + i.name () + "Stub.class);");
+ else
+ stream.println (indent + name + " = " + Util.helperName (entry, false) + ".narrow (istream.read_Object (_" + i.name () + "Stub.class));"); // <d61056>
+ }
+ return index;
+ } // read
+ */
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ InterfaceEntry i = (InterfaceEntry)entry;
+ if (entry.fullName ().equals ("org/omg/CORBA/Object"))
+ stream.println (indent + name + " = istream.read_Object (_" + i.name () + "Stub.class);");
+ else
+ stream.println (indent + name + " = " + Util.helperName (entry, false) + ".narrow (istream.read_Object (_" + i.name () + "Stub.class));"); // <d61056>
+ return index;
+ } // read
+
+ // <f46082.51> Remove -stateful feature.
+ /*
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ InterfaceEntry i = (InterfaceEntry)entry;
+ if (i.state () != null)
+ index = structWrite (index, indent, name, entry, stream);
+ else
+ {
+ if (i.isAbstract ())
+ stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_abstract_interface ((java.lang.Object) " + name + ");"); // <d60929>
+ else
+ stream.println (indent + "ostream.write_Object ((org.omg.CORBA.Object) " + name + ");");
+ }
+ return index;
+ } // write
+ */
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ InterfaceEntry i = (InterfaceEntry)entry;
+ if (i.isAbstract ())
+ stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_abstract_interface ((java.lang.Object) " + name + ");"); // <d60929>
+ else
+ stream.println (indent + "ostream.write_Object ((org.omg.CORBA.Object) " + name + ");");
+ return index;
+ } // write
+
+ // <f46082.51> Remove -stateful feature.
+ /*
+ // These methods are cobbled from StructGen. Stateful interfaces
+ // are sent across the wire as if they were structs, with the first
+ // element being a string - the Java name of the class.
+
+ public int structHelperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ TCOffsets innerOffsets = new TCOffsets ();
+ innerOffsets.set (entry);
+ int offsetForStruct = innerOffsets.currentOffset ();
+ InterfaceEntry i = (InterfaceEntry)entry;
+ String membersName = "_members" + index++;
+ Vector state = i.state ();
+ stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + (state.size () + 1) + "];");
+ String tcOfMembers = "_tcOf" + membersName;
+ stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + ';');
+
+ // The name string is the first element of the struct
+ String memberName = "_name";
+ StringEntry stringEntry = Compile.compiler.factory.stringEntry ();
+ index = ((JavaGenerator)stringEntry.generator ()).helperType (index, indent, innerOffsets, tcOfMembers, stringEntry, stream);
+ stream.println (indent + membersName + "[0] = new org.omg.CORBA.StructMember (");
+ stream.println (indent + " \"" + memberName + "\",");
+ stream.println (indent + " " + tcOfMembers + ',');
+ stream.println (indent + " null);");
+ int offsetSoFar = innerOffsets.currentOffset ();
+ innerOffsets = new TCOffsets ();
+ innerOffsets.set (entry);
+ innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);
+
+ for (int idx = 0; idx < state.size (); ++idx)
+ {
+ TypedefEntry member = ((InterfaceState)state.elementAt (idx)).entry;
+ memberName = member.name ();
+ index = ((JavaGenerator)member.generator ()).helperType (index, indent, innerOffsets, tcOfMembers, member, stream);
+ stream.println (indent + membersName + '[' + (idx + 1) + "] = new org.omg.CORBA.StructMember (");
+ stream.println (indent + " \"" + memberName + "\",");
+ stream.println (indent + " " + tcOfMembers + ',');
+ stream.println (indent + " null);");
+ offsetSoFar = innerOffsets.currentOffset ();
+ innerOffsets = new TCOffsets ();
+ innerOffsets.set (entry);
+ innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);
+ }
+ tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + entry.name () + "\", " + membersName + ");");
+ return index;
+ } // structHelperType
+
+ public void structHelperRead (String entryName, InterfaceEntry entry, PrintWriter stream)
+ {
+ String impl = implName ((InterfaceEntry)entry);
+ stream.println (" " + Util.javaStatefulName (entry) + " value = null;");
+ structRead (0, " ", "value", entry, stream);
+ stream.println (" return value;");
+ } // structHelperRead
+
+ private String implName (InterfaceEntry entry)
+ {
+ String name;
+ if (entry.container ().name ().equals (""))
+ name = '_' + entry.name () + "Impl";
+ else
+ name = Util.containerFullName (entry.container ()) + "._" + entry.name () + "Impl";
+ return name.replace ('/', '.');
+ } // implName
+
+ public int structRead (int index, String indent, String name, InterfaceEntry entry, PrintWriter stream)
+ {
+ // The first element will be the name of the Java implementation class.
+ String stringName = "_name" + index++;
+ stream.println (indent + "String " + stringName + " = istream.read_string ();");
+ stream.println (indent + "try");
+ stream.println (indent + "{");
+ stream.println (indent + " " + name + " = (" + Util.javaStatefulName (entry) + ")com.sun.CORBA.iiop.ORB.getImpl (" + stringName + ".replace ('/', '.'));");
+ stream.println (indent + "}");
+ stream.println (indent + "catch (Exception e)");
+ stream.println (indent + "{");
+ stream.println (indent + " " + name + " = null;");
+ stream.println (indent + "}");
+ stream.println (indent + "if (" + name + " == null)");
+ stream.println (indent + " throw new org.omg.CORBA.NO_IMPLEMENT (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
+ stream.println ();
+
+ stream.println (indent + "if (!" + stringName + ".equals (\"" + entry.fullName () + "\"))");
+ stream.println (indent + '{');
+ stream.println (indent + " Class _cls = " + name + ".getClass ();");
+ stream.println (indent + " boolean _found = false;");
+ stream.println (indent + " while (!_found && _cls != null)");
+ stream.println (indent + " {");
+ stream.println (indent + " Class[] interfaces = _cls.getInterfaces ();");
+ stream.println (indent + " for (int i = 0; i < interfaces.length; ++i)");
+ stream.println (indent + " if (interfaces[i].getName ().indexOf (\"State\") > 0)");
+ stream.println (indent + " {");
+ stream.println (indent + " _cls = interfaces[i];");
+ stream.println (indent + " _found = true;");
+ stream.println (indent + " break;");
+ stream.println (indent + " }");
+ stream.println (indent + " if (!_found)");
+ stream.println (indent + " _cls = _cls.getSuperclass ();");
+ stream.println (indent + " }");
+ stream.println (indent + " if (_cls == null)");
+ stream.println (indent + " throw new org.omg.CORBA.NO_IMPLEMENT (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
+ stream.println ();
+ stream.println (indent + " String _className = _cls.getName ();");
+ stream.println (indent + " int _index = _className.lastIndexOf ('.');");
+ stream.println (indent + " String _helperName = _className.substring (0, _index + 1) + _className.substring (_index + 2, _className.length () - 5) + \"Helper\"; // 5 == \"State\".length");
+ stream.println (indent + " try");
+ stream.println (indent + " {");
+ stream.println (indent + " Class _helperClass = Class.forName (_helperName);");
+ stream.println (indent + " Class[] _formalParms = new Class [1];");
+ stream.println (indent + " _formalParms[0] = Class.forName (\"org.omg.CORBA.portable.InputStream\");");
+ stream.println (indent + " java.lang.reflect.Method _read = _helperClass.getMethod (\"read\", _formalParms);");
+ stream.println (indent + " Object[] _actualParms = new Object [1];");
+ stream.println (indent + " _actualParms[0] = istream;");
+ stream.println (indent + " " + name + " = (" + Util.javaStatefulName (entry) + ")_read.invoke (null, _actualParms);");
+ stream.println (indent + " }");
+ stream.println (indent + " catch (Exception e)");
+ stream.println (indent + " {");
+ stream.println (indent + " throw new org.omg.CORBA.NO_IMPLEMENT (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
+ stream.println (indent + " }");
+ stream.println (indent + '}');
+
+ // instantiate an implementation
+ stream.println (indent + "else");
+ stream.println (indent + '{');
+
+ // Load the state
+ readState (index, indent, name, (InterfaceEntry)entry, stream);
+
+ stream.println (indent + '}');
+ return index;
+ } // structRead
+
+ private void readState (int index, String indent, String name, InterfaceEntry entry, PrintWriter stream)
+ {
+ // First write the state from all parents
+ Enumeration e = entry.derivedFrom ().elements ();
+ while (e.hasMoreElements ())
+ {
+ InterfaceEntry parent = (InterfaceEntry)e.nextElement ();
+ if (parent.state () != null)
+ {
+ if (parent.state ().size () > 0)
+ readState (index, indent, name, parent, stream);
+ break;
+ }
+ }
+
+ // Now write the state for the local entry
+ e = entry.state ().elements ();
+ while (e.hasMoreElements ())
+ {
+ TypedefEntry member = ((InterfaceState)e.nextElement ()).entry;
+ String tmpName = '_' + member.name () + "Tmp";
+ Util.writeInitializer (indent + " ", tmpName, "", member, stream);
+ if (!member.arrayInfo ().isEmpty () || member.type () instanceof SequenceEntry || member.type () instanceof PrimitiveEntry || member.type () instanceof StringEntry)
+ index = ((JavaGenerator)member.generator ()).read (index, indent + " ", tmpName, member, stream);
+ else
+ stream.println (indent + " " + tmpName + " = " + Util.helperName (member.type (), true) + ".read (istream);"); // <d61056>
+ stream.println (indent + " " + name + '.' + member.name () + " (" + tmpName + ");");
+ }
+ } // readState
+
+ public void structHelperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ structWrite (0, " ", "value", entry, stream);
+ } // structHelperWrite
+
+ public int structWrite (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ // The first element of the struct must be the name of the real interface.
+ stream.println (indent + "Class _cls = " + name + ".getClass ();");
+ stream.println (indent + "boolean _found = false;");
+ stream.println (indent + "while (!_found && _cls != null)");
+ stream.println (indent + "{");
+ stream.println (indent + " Class[] interfaces = _cls.getInterfaces ();");
+ stream.println (indent + " for (int i = 0; i < interfaces.length; ++i)");
+ stream.println (indent + " if (interfaces[i].getName ().indexOf (\"State\") > 0)");
+ stream.println (indent + " {");
+ stream.println (indent + " _cls = interfaces[i];");
+ stream.println (indent + " _found = true;");
+ stream.println (indent + " break;");
+ stream.println (indent + " }");
+ stream.println (indent + " if (!_found)");
+ stream.println (indent + " _cls = _cls.getSuperclass ();");
+ stream.println (indent + '}');
+ stream.println ();
+ stream.println (indent + "if (_cls == null)");
+ stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
+ stream.println ();
+ stream.println (indent + "String _className = _cls.getName ();");
+ stream.println (indent + "int _index = _className.lastIndexOf ('.');");
+ stream.println (indent + "String _interfaceName = _className.substring (0, _index + 1) + _className.substring (_index + 2, _className.length () - 5); // 5 == \"State\".length");
+ stream.println (indent + "ostream.write_string (_interfaceName.replace ('.', '/'));");
+
+ // If _className != Util.javaName (entry), then call that class's helper class.
+ stream.println ();
+ stream.println (indent + "if (!_interfaceName.equals (\"" + Util.javaName (entry) + "\"))");
+ stream.println (indent + '{');
+ stream.println (indent + " try");
+ stream.println (indent + " {");
+ stream.println (indent + " Class _helperClass = Class.forName (_interfaceName + \"Helper\");");
+ stream.println (indent + " Class[] _formalParms = new Class [2];");
+ stream.println (indent + " _formalParms[0] = Class.forName (\"org.omg.CORBA.portable.OutputStream\");");
+ stream.println (indent + " _formalParms[1] = _cls;");
+ stream.println (indent + " java.lang.reflect.Method _write = _helperClass.getMethod (\"write\", _formalParms);");
+ stream.println (indent + " Object[] _actualParms = new Object [2];");
+ stream.println (indent + " _actualParms[0] = ostream;");
+ stream.println (indent + " _actualParms[1] = " + name + ';');
+ stream.println (indent + " _write.invoke (null, _actualParms);");
+ stream.println (indent + " }");
+ stream.println (indent + " catch (Exception e)");
+ stream.println (indent + " {");
+ stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
+ stream.println (indent + " }");
+ stream.println (indent + '}');
+
+ stream.println (indent + "else");
+ stream.println (indent + '{');
+
+ writeState (index, indent, name, (InterfaceEntry)entry, stream);
+
+ stream.println (indent + '}');
+ return index;
+ } // structWrite
+
+ private void writeState (int index, String indent, String name, InterfaceEntry entry, PrintWriter stream)
+ {
+ // First write the state from all parents
+ Enumeration e = entry.derivedFrom ().elements ();
+ while (e.hasMoreElements ())
+ {
+ InterfaceEntry parent = (InterfaceEntry)e.nextElement ();
+ if (parent.state () != null)
+ {
+ if (parent.state ().size () > 0)
+ writeState (index, indent, name, parent, stream);
+ break;
+ }
+ }
+
+ // Now write the state for the local entry
+ Vector members = entry.state ();
+ for (int i = 0; i < members.size (); ++i)
+ {
+ TypedefEntry member = ((InterfaceState)members.elementAt (i)).entry;
+ if (!member.arrayInfo ().isEmpty () || member.type () instanceof SequenceEntry || member.type () instanceof PrimitiveEntry || member.type () instanceof StringEntry)
+ index = ((JavaGenerator)member.generator ()).write (index, indent + " ", name + '.' + member.name () + "()", member, stream);
+ else
+ stream.println (indent + " " + Util.helperName (member.type (), true) + ".write (ostream, " + name + '.' + member.name () + " ());"); // <d61056>
+ }
+ } // writeState
+ */
+
+ /**
+ * @return true if the entry is for a CORBA pseudo-object.
+ **/
+ private boolean isPseudo(InterfaceEntry i) {
+ java.lang.String fullname = i.fullName();
+ if (fullname.equalsIgnoreCase("CORBA/TypeCode"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/Principal"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/ORB"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/Any"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/Context"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/ContextList"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/DynamicImplementation"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/Environment"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/ExceptionList"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/NVList"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/NamedValue"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/Request"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/ServerRequest"))
+ return true;
+ if (fullname.equalsIgnoreCase("CORBA/UserException"))
+ return true;
+ return false;
+ }
+
+ // From JavaGenerator
+ ///////////////
+
+ protected int emit = 0;
+ protected Factories factories = null;
+
+ protected Hashtable symbolTable = null;
+ protected InterfaceEntry i = null;
+ protected PrintWriter stream = null;
+
+ // <f46082.03, f46838.1/.2/.3> Modify access to protected.
+ protected static final int SIGNATURE = 1;
+ protected static final int OPERATIONS = 2;
+ protected int intfType = 0;
+} // class InterfaceGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/JavaGenerator.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/JavaGenerator.java
new file mode 100644
index 0000000..69a2f6e
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/JavaGenerator.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+import java.io.PrintWriter;
+
+import com.sun.tools.corba.se.idl.SymtabEntry;
+
+/**
+ *
+ **/
+public interface JavaGenerator
+{
+ // The helper methods print the specific helper method.
+ // The helper read/write methods call the read/write methods.
+
+ int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream);
+
+ void helperRead (String entryName, SymtabEntry entry, PrintWriter stream);
+
+ void helperWrite (SymtabEntry entry, PrintWriter stream);
+
+ // The read/write methods print the streaming of the type.
+ // This printed code is found in the helper method but it is only
+ // that code that is concerned with streaming itself.
+
+ int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream);
+
+ int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream);
+
+ int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream);
+
+} // interface JavaGenerator
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen.java
new file mode 100644
index 0000000..155d27c
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen.java
@@ -0,0 +1,1091 @@
+/*
+ * Copyright (c) 1999, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -After demarshalling an IOR, think about how to deal with the exceptions.
+// -catching Exception throws a string which should be in a properties file.
+// -30jul1997<daz> Modified to write comment immediately preceding method signature.
+// -07May1998<ktp> Modified to support RMI Portable Stub
+// -26Aug1998<klr> Modified to pass helper instance to read_Value.
+// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
+// -D56554 <klr> Port bounded string checks from toJava to toJavaPortable
+// -D58549 <klr> bounded string checks on in/inout parms throw BAD_PARAM
+// -D57112<daz> Valuetype initializers map to ctor, regardless of name, and
+// "void _init(...)" methods now mapped correctly.
+// -D59297 <klr> pass context parm when Remarshalling
+// -D59560 <klr> call read/write_Context
+// -D60929 <klr> Update for RTF2.4 changes
+// -D61056 <klr> Use Util.helperName
+// -D61650<daz> Remove '\n' from generated strings; use println()'s.
+
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.EnumEntry;
+import com.sun.tools.corba.se.idl.ExceptionEntry;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.ParameterEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.AttributeEntry;
+
+import com.sun.tools.corba.se.idl.constExpr.Expression;
+
+/**
+ *
+ **/
+public class MethodGen implements com.sun.tools.corba.se.idl.MethodGen
+{
+ private static final String ONE_INDENT = " ";
+ private static final String TWO_INDENT = " ";
+ private static final String THREE_INDENT = " ";
+ private static final String FOUR_INDENT = " ";
+ private static final String FIVE_INDENT = " ";
+ // This is the length of _get_ and _set_
+ private static final int ATTRIBUTE_METHOD_PREFIX_LENGTH = 5;
+ /**
+ * Public zero-argument constructor.
+ **/
+ public MethodGen ()
+ {
+ } // ctor
+
+ /**
+ * Method generate() is not used in MethodGen. They are replaced by the
+ * more granular interfaceMethod, stub, skeleton, dispatchSkeleton.
+ **/
+ public void generate (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
+ {
+ } // generate
+
+ /**
+ *
+ **/
+ protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
+ {
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ if (m.comment () != null)
+ m.comment ().generate ("", stream);
+ stream.print (" ");
+ SymtabEntry container = (SymtabEntry)m.container ();
+ boolean isAbstract = false;
+ boolean valueContainer = false;
+ if (container instanceof ValueEntry)
+ {
+ isAbstract = ((ValueEntry)container).isAbstract ();
+ valueContainer = true;
+ }
+ if (valueContainer && !isAbstract)
+ stream.print ("public ");
+ writeMethodSignature ();
+ if (valueContainer && !isAbstract)
+ {
+ stream.println ();
+ stream.println (" {");
+ stream.println (" }");
+ stream.println ();
+ }
+ else
+ stream.println (";");
+ } // interfaceMethod
+
+ /**
+ *
+ **/
+ protected void stub (String className, boolean isAbstract,
+ Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
+ {
+ localOptimization =
+ ((Arguments)Compile.compiler.arguments).LocalOptimization;
+ this.isAbstract = isAbstract;
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ this.methodIndex = index;
+ if (m.comment () != null)
+ m.comment ().generate (" ", stream);
+ stream.print (" public ");
+ writeMethodSignature ();
+ stream.println ();
+ stream.println (" {");
+ writeStubBody ( className );
+ stream.println (" } // " + m.name ());
+ stream.println ();
+ } // stub
+
+ /**
+ *
+ **/
+ protected void localstub (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index, InterfaceEntry i)
+ {
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ this.methodIndex = index;
+ if (m.comment () != null)
+ m.comment ().generate (" ", stream);
+ stream.print (" public ");
+ writeMethodSignature ();
+ stream.println ();
+ stream.println (" {");
+ writeLocalStubBody (i);
+ stream.println (" } // " + m.name ());
+ stream.println ();
+ } // stub
+ /**
+ *
+ **/
+ protected void skeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
+ {
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ this.methodIndex = index;
+ if (m.comment () != null)
+ m.comment ().generate (" ", stream);
+ stream.print (" public ");
+ writeMethodSignature ();
+ stream.println ();
+ stream.println (" {");
+ writeSkeletonBody ();
+ stream.println (" } // " + m.name ());
+ } // skeleton
+
+ /**
+ *
+ **/
+ protected void dispatchSkeleton (Hashtable symbolTable, MethodEntry m, PrintWriter stream, int index)
+ {
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ this.methodIndex = index;
+ if (m.comment () != null)
+ m.comment ().generate (" ", stream);
+ writeDispatchCall ();
+ } // dispatchSkeleton
+
+ // <d57112>
+ /**
+ * Determine whether method entry m is a valuetype initializer.
+ * @return true if is m is valuetype initializer, false otherwise.
+ **/
+ protected boolean isValueInitializer ()
+ {
+ MethodEntry currentInit = null;
+ if ((m.container () instanceof ValueEntry))
+ {
+ Enumeration e = ((ValueEntry)m.container ()).initializers ().elements ();
+ while (currentInit != m && e.hasMoreElements ())
+ currentInit = (MethodEntry)e.nextElement ();
+ }
+ return (currentInit == m) && (null != m); // True ==> yes, false ==> no.
+ } // isValueInitializer
+
+ /**
+ *
+ **/
+ protected void writeMethodSignature ()
+ {
+ boolean isValueInitializer = isValueInitializer (); // <d57112>
+
+ // Step 0. Print the return type and name.
+ // A return type of null indicates the "void" return type. If m is a
+ // Valuetype intitializer, it has name "init" and a null return type,
+ // but it maps to a ctor.
+ // <d57112>
+ //if (m.type () == null)
+ //{
+ // if (m.name ().compareTo ("init") != 0)
+ // stream.print ("void");
+ //}
+ if (m.type () == null)
+ {
+ if (!isValueInitializer)
+ stream.print ("void");
+ }
+ else
+ {
+ // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
+ //stream.print (Util.javaStatefulName (m.type ()));
+ stream.print (Util.javaName (m.type ()));
+ }
+ // <d57112> Value initializers map to constructors.
+ // If the value has an 'init' method with a return type, handle
+ // the method like other regular methods
+ //if (m.valueMethod () && m.name ().compareTo ("init") == 0 &&
+ // m.type () == null)
+ if (isValueInitializer)
+ stream.print (' ' + m.container ().name () + " (");
+ else
+ stream.print (' ' + m.name () + " (");
+
+ // Step 1. Print the parameter list.
+ boolean firstTime = true;
+ Enumeration e = m.parameters ().elements ();
+ while (e.hasMoreElements ())
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ stream.print (", ");
+ ParameterEntry parm = (ParameterEntry)e.nextElement ();
+
+ writeParmType (parm.type (), parm.passType ());
+
+ // Print parm name
+ stream.print (' ' + parm.name ());
+ }
+
+ // Step 2. Add the context parameter if necessary.
+ if (m.contexts ().size () > 0)
+ {
+ if (!firstTime)
+ stream.print (", ");
+ stream.print ("org.omg.CORBA.Context $context");
+ }
+
+ // Step 3. Print the throws clause (if necessary).
+ if (m.exceptions ().size () > 0)
+ {
+ stream.print (") throws ");
+ e = m.exceptions ().elements ();
+ firstTime = true;
+ while (e.hasMoreElements ())
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ stream.print (", ");
+ stream.print (Util.javaName ((SymtabEntry)e.nextElement ()));
+ }
+ }
+ else
+ stream.print (')');
+ } // writeMethodSignature
+
+ /**
+ *
+ **/
+ protected void writeParmType (SymtabEntry parm, int passType)
+ {
+ if (passType != ParameterEntry.In)
+ {
+ parm = Util.typeOf (parm);
+ stream.print (Util.holderName (parm));
+ }
+ else // passType is `in'
+ // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
+ //stream.print (Util.javaStatefulName (parm));
+ stream.print (Util.javaName (parm));
+ } // writeParmType
+
+ /**
+ *
+ **/
+ protected void writeDispatchCall ()
+ {
+ String indent = " ";
+ String fullMethodName = m.fullName ();
+ if (m instanceof AttributeEntry)
+ {
+ // determine the index at which the attribute name starts in the full name
+ int index = fullMethodName.lastIndexOf ('/') + 1;
+ if (m.type () == null) // if it's a modifier
+ fullMethodName = fullMethodName.substring (0, index) + "_set_" + m.name ();
+ else
+ fullMethodName = fullMethodName.substring (0, index) + "_get_" + m.name ();
+ }
+ stream.println (indent + "case " + methodIndex + ": // " + fullMethodName);
+ stream.println (indent + "{");
+ indent = indent + " ";
+ if (m.exceptions ().size () > 0)
+ {
+ stream.println (indent + "try {");
+ indent = indent + " ";
+ }
+
+ // Step 1 Read arguments from the input stream
+ SymtabEntry mtype = Util.typeOf (m.type ());
+ Enumeration parms = m.parameters ().elements ();
+ parms = m.parameters ().elements ();
+ while (parms.hasMoreElements ())
+ {
+ ParameterEntry parm = (ParameterEntry) parms.nextElement ();
+ String name = parm.name ();
+ String anyName = '_' + name;
+ SymtabEntry type = parm.type ();
+ int passType = parm.passType ();
+
+ if (passType == ParameterEntry.In)
+ Util.writeInitializer (indent, name, "", type, writeInputStreamRead ("in", type), stream);
+
+ else // the parm is a holder
+ {
+ String holderName = Util.holderName (type);
+ stream.println (indent + holderName + ' ' + name + " = new " + holderName + " ();");
+ if (passType == ParameterEntry.Inout)
+ {
+ if (type instanceof ValueBoxEntry)
+ {
+ ValueBoxEntry v = (ValueBoxEntry) type;
+ TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+ if (mType instanceof PrimitiveEntry)
+ stream.println (indent + name + ".value = (" + writeInputStreamRead ("in", parm.type ()) + ").value;");
+ else
+ stream.println (indent + name + ".value = " + writeInputStreamRead ("in", parm.type ()) + ";");
+ }
+ else
+ stream.println (indent + name + ".value = " + writeInputStreamRead ("in", parm.type ()) + ";");
+ }
+ }
+ }
+
+ // Step 1a. Read the context parameter if necessary. <d59560>
+ if (m.contexts ().size () > 0)
+ {
+ stream.println (indent + "org.omg.CORBA.Context $context = in.read_Context ();");
+ }
+
+ // Step 2 Load return if necessary
+ if (mtype != null)
+ Util.writeInitializer (indent, "$result", "", mtype, stream);
+
+ // Step 3 Call the method with the list of parameters
+ writeMethodCall (indent);
+
+ parms = m.parameters ().elements ();
+ boolean firstTime = true;
+ while (parms.hasMoreElements ())
+ {
+ ParameterEntry parm = (ParameterEntry)parms.nextElement ();
+ if (firstTime)
+ firstTime = false;
+ else
+ stream.print (", ");
+ stream.print (parm.name ());
+ }
+
+ // Step 3a. Add the context parameter if necessary. <d59560>
+ if (m.contexts ().size () > 0)
+ {
+ if (!firstTime)
+ stream.print (", ");
+ stream.print ("$context");
+ }
+
+ stream.println (");");
+
+ //Step 3b. Create reply;
+ writeCreateReply (indent);
+
+ // Step 4 Write method's result to the output stream
+ if (mtype != null)
+ {
+ writeOutputStreamWrite (indent, "out", "$result", mtype, stream);
+ }
+
+ // Step 5 Write inout/out value to the output stream
+ parms = m.parameters ().elements ();
+ while (parms.hasMoreElements ())
+ {
+ ParameterEntry parm = (ParameterEntry)parms.nextElement ();
+ int passType = parm.passType ();
+ if (passType != ParameterEntry.In)
+ {
+ writeOutputStreamWrite (indent, "out", parm.name () + ".value", parm.type (), stream);
+ }
+ }
+
+ // Step 6 Handle exception
+ if (m.exceptions ().size () > 0)
+ {
+ Enumeration exceptions = m.exceptions ().elements ();
+ while (exceptions.hasMoreElements ())
+ {
+ indent = " ";
+ ExceptionEntry exc = (ExceptionEntry) exceptions.nextElement ();
+ String fullName = Util.javaQualifiedName (exc);
+ stream.println (indent + "} catch (" + fullName + " $ex) {");
+ indent = indent + " ";
+ stream.println (indent + "out = $rh.createExceptionReply ();");
+ stream.println (indent + Util.helperName (exc, true) + ".write (out, $ex);"); // <d61056>
+ }
+
+ indent = " ";
+ stream.println (indent + "}");
+ }
+
+ stream.println (" break;");
+ stream.println (" }");
+ stream.println ();
+ } // writeDispatchCall
+
+ /**
+ *
+ **/
+ protected void writeStubBody ( String className )
+ {
+ // Step 1 Create a request
+ String methodName = Util.stripLeadingUnderscores (m.name ());
+ if (m instanceof AttributeEntry)
+ {
+ if (m.type () == null) // if it's a modifier
+ methodName = "_set_" + methodName;
+ else
+ methodName = "_get_" + methodName;
+ }
+ if( localOptimization && !isAbstract ) {
+ stream.println (ONE_INDENT + "while(true) {" );
+ stream.println(TWO_INDENT + "if(!this._is_local()) {" );
+ }
+ stream.println(THREE_INDENT +
+ "org.omg.CORBA.portable.InputStream $in = null;");
+ stream.println(THREE_INDENT + "try {");
+ stream.println(FOUR_INDENT + "org.omg.CORBA.portable.OutputStream $out =" +
+ " _request (\"" + methodName + "\", " + !m.oneway() + ");");
+
+ // Step 1.b. Check string bounds <d56554 - klr>
+ // begin <d56554> in/inout string bounds check
+ Enumeration parms = m.parameters ().elements ();
+ while (parms.hasMoreElements ())
+ {
+ ParameterEntry parm = (ParameterEntry)parms.nextElement ();
+ SymtabEntry parmType = Util.typeOf (parm.type ());
+ if (parmType instanceof StringEntry)
+ if ((parm.passType () == ParameterEntry.In) ||
+ (parm.passType () == ParameterEntry.Inout))
+ {
+ StringEntry string = (StringEntry)parmType;
+ if (string.maxSize () != null)
+ {
+ stream.print (THREE_INDENT + "if (" + parm.name ());
+ if (parm.passType () == ParameterEntry.Inout)
+ stream.print (".value"); // get from holder
+ stream.print (" == null || " + parm.name ());
+ if (parm.passType () == ParameterEntry.Inout)
+ stream.print (".value"); // get from holder
+ stream.println (".length () > (" +
+ Util.parseExpression (string.maxSize ()) + "))");
+ stream.println (THREE_INDENT +
+ "throw new org.omg.CORBA.BAD_PARAM (0," +
+ " org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
+ }
+ }
+ }
+ // end <d56554> in/inout string bounds check
+
+ // Step 2 Load the parameters into the outputStream
+ parms = m.parameters ().elements ();
+ while (parms.hasMoreElements ())
+ {
+ ParameterEntry parm = (ParameterEntry)parms.nextElement ();
+ if (parm.passType () == ParameterEntry.In)
+ writeOutputStreamWrite(FOUR_INDENT, "$out", parm.name (), parm.type (),
+ stream);
+ else if (parm.passType () == ParameterEntry.Inout)
+ writeOutputStreamWrite(FOUR_INDENT, "$out", parm.name () + ".value",
+ parm.type (), stream);
+ }
+
+ // Step 2a. Write the context parameter if necessary. <d59560>
+ if (m.contexts ().size () > 0)
+ {
+ stream.println(FOUR_INDENT + "org.omg.CORBA.ContextList $contextList =" +
+ "_orb ().create_context_list ();");
+
+ for (int cnt = 0; cnt < m.contexts ().size (); cnt++)
+ {
+ stream.println(FOUR_INDENT +
+ "$contextList.add (\"" + m.contexts (). elementAt (cnt) + "\");");
+ }
+ stream.println(FOUR_INDENT +
+ "$out.write_Context ($context, $contextList);");
+ }
+
+ // Step 3 Invoke the method with the output stream
+ stream.println (FOUR_INDENT + "$in = _invoke ($out);");
+
+ SymtabEntry mtype = m.type ();
+ if (mtype != null)
+ Util.writeInitializer (FOUR_INDENT, "$result", "", mtype,
+ writeInputStreamRead ("$in", mtype), stream);
+
+ // Step 4 Read the inout/out values
+ parms = m.parameters ().elements ();
+ while (parms.hasMoreElements ())
+ {
+ ParameterEntry parm = (ParameterEntry)parms.nextElement ();
+ if (parm.passType () != ParameterEntry.In)
+ {
+ if (parm.type () instanceof ValueBoxEntry)
+ {
+ ValueBoxEntry v = (ValueBoxEntry) parm.type ();
+ TypedefEntry member =
+ ((InterfaceState) v.state ().elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+ if (mType instanceof PrimitiveEntry)
+ stream.println(FOUR_INDENT + parm.name () +
+ ".value = (" + writeInputStreamRead ("$in", parm.type ()) +
+ ").value;");
+ else
+ stream.println(FOUR_INDENT + parm.name () +
+ ".value = " + writeInputStreamRead ("$in", parm.type ()) +";");
+ }
+ else
+ stream.println (FOUR_INDENT + parm.name () + ".value = " +
+ writeInputStreamRead ("$in", parm.type ()) + ";");
+ }
+ }
+ // Step 4.b. Check string bounds <d56554 - klr>
+ // begin <d56554> out/inout/return string bounds check
+ parms = m.parameters ().elements ();
+ while (parms.hasMoreElements ())
+ {
+ ParameterEntry parm = (ParameterEntry)parms.nextElement ();
+ SymtabEntry parmType = Util.typeOf (parm.type ());
+ if (parmType instanceof StringEntry)
+ if ((parm.passType () == ParameterEntry.Out) ||
+ (parm.passType () == ParameterEntry.Inout))
+ {
+ StringEntry string = (StringEntry)parmType;
+ if (string.maxSize () != null)
+ {
+ stream.print (FOUR_INDENT + "if (" + parm.name () +
+ ".value.length ()");
+ stream.println (" > (" +
+ Util.parseExpression (string.maxSize ()) + "))");
+ stream.println (FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL(0,"+
+ "org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
+ }
+ }
+ }
+ if (mtype instanceof StringEntry)
+ {
+ StringEntry string = (StringEntry)mtype;
+ if (string.maxSize () != null)
+ {
+ stream.println(FOUR_INDENT + "if ($result.length () > (" +
+ Util.parseExpression (string.maxSize ()) + "))");
+ stream.println (FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL (0," +
+ " org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
+ }
+ }
+ // end <d56554> out/inout/return string bounds check
+
+ // Step 5 Handle return if necessary
+ if (mtype != null) {
+ stream.println(FOUR_INDENT + "return $result;");
+ } else {
+ stream.println(FOUR_INDENT + "return;");
+ }
+
+ // Step 6 Handle exceptions
+ stream.println(THREE_INDENT +
+ "} catch (org.omg.CORBA.portable.ApplicationException " + "$ex) {");
+ stream.println(FOUR_INDENT + "$in = $ex.getInputStream ();");
+ stream.println(FOUR_INDENT + "String _id = $ex.getId ();");
+
+ if (m.exceptions ().size () > 0)
+ {
+ Enumeration exceptions = m.exceptions ().elements ();
+ boolean firstExc = true;
+ while (exceptions.hasMoreElements ())
+ {
+ ExceptionEntry exc = (ExceptionEntry)exceptions.nextElement ();
+ if (firstExc)
+ {
+ stream.print(FOUR_INDENT + "if ");
+ firstExc = false;
+ }
+ else
+ stream.print(FOUR_INDENT + "else if ");
+
+ stream.println( "(_id.equals (\"" + exc.repositoryID ().ID () + "\"))");
+ stream.println (FIVE_INDENT + "throw " +
+ Util.helperName ((SymtabEntry)exc, false) + ".read ($in);");
+ }
+ stream.println(FOUR_INDENT + "else");
+ stream.println(FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL (_id);");
+ }
+ else
+ stream.println(FOUR_INDENT + "throw new org.omg.CORBA.MARSHAL (_id);");
+
+ stream.println(THREE_INDENT +
+ "} catch (org.omg.CORBA.portable.RemarshalException $rm) {");
+ stream.print( FOUR_INDENT );
+ if (m.type () != null) // not a void method
+ stream.print ("return ");
+ stream.print (m.name () + " (");
+ {
+ // write parm names
+ boolean firstTime = true;
+ Enumeration e = m.parameters ().elements ();
+ while (e.hasMoreElements ())
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ stream.print (", ");
+ ParameterEntry parm = (ParameterEntry)e.nextElement ();
+ stream.print (parm.name ());
+ }
+ // Step 2. Add the context parameter if necessary. <d59297>
+ if (m.contexts ().size () > 0)
+ {
+ if (!firstTime)
+ stream.print (", ");
+ stream.print ("$context");
+ }
+ }
+ stream.println (TWO_INDENT + ");");
+ stream.println (THREE_INDENT + "} finally {");
+ stream.println (FOUR_INDENT + "_releaseReply ($in);");
+ stream.println (THREE_INDENT + "}");
+ if( localOptimization && !isAbstract ) {
+ stream.println (TWO_INDENT + "}");
+ writeStubBodyForLocalInvocation( className, methodName );
+ }
+
+ } // writeStubBody
+
+
+ /**
+ * This method writes the else part of the stub method invocation to
+ * enable local invocation in case of collocation.
+ * NOTE: This will only be invoked from writeStubBody.
+ */
+ private void writeStubBodyForLocalInvocation( String className,
+ String methodName )
+ {
+ stream.println (TWO_INDENT + "else {" );
+ stream.println (THREE_INDENT +
+ "org.omg.CORBA.portable.ServantObject _so =");
+ stream.println (FOUR_INDENT + "_servant_preinvoke(\"" + methodName +
+ "\", _opsClass);" );
+ stream.println(THREE_INDENT + "if (_so == null ) {");
+ stream.println(FOUR_INDENT + "continue;" );
+ stream.println(THREE_INDENT + "}");
+ stream.println(THREE_INDENT + className + "Operations _self =" );
+ stream.println(FOUR_INDENT + "(" + className + "Operations) _so.servant;");
+ stream.println(THREE_INDENT + "try {" );
+ Enumeration parms = m.parameters ().elements ();
+ if (m instanceof AttributeEntry)
+ {
+ // Local Method Name should drop _get_ or _set_ prefix for attribute
+ // entry
+ methodName = methodName.substring( ATTRIBUTE_METHOD_PREFIX_LENGTH );
+ }
+ boolean voidReturnType = (this.m.type() == null);
+ if ( !voidReturnType ) {
+ stream.println (FOUR_INDENT + Util.javaName (this.m.type ()) +
+ " $result;");
+ }
+ if( !isValueInitializer() ) {
+ if ( voidReturnType ) {
+ stream.print(FOUR_INDENT + "_self." + methodName + "( " );
+ } else {
+ stream.print(FOUR_INDENT + "$result = _self." +
+ methodName + "( " );
+ }
+ while (parms.hasMoreElements ()) {
+ ParameterEntry param = (ParameterEntry)parms.nextElement ();
+ if( parms.hasMoreElements( ) ) {
+ stream.print( " " + param.name() + "," );
+ } else {
+ stream.print( " " + param.name() );
+ }
+ }
+ stream.print( ");" );
+ stream.println( " " );
+ if( voidReturnType ) {
+ stream.println(FOUR_INDENT + "return;" );
+ } else {
+ stream.println(FOUR_INDENT + "return $result;" );
+ }
+ }
+ stream.println(" ");
+ stream.println (THREE_INDENT + "}" );
+ stream.println (THREE_INDENT + "finally {" );
+ stream.println (FOUR_INDENT + "_servant_postinvoke(_so);" );
+ stream.println (THREE_INDENT + "}" );
+ stream.println (TWO_INDENT + "}" );
+ stream.println (ONE_INDENT + "}" );
+ }
+
+
+ protected void writeLocalStubBody (InterfaceEntry i)
+ {
+ // Step 1 Create a request
+ String methodName = Util.stripLeadingUnderscores (m.name ());
+ if (m instanceof AttributeEntry)
+ {
+ if (m.type () == null) // if it's a modifier
+ methodName = "_set_" + methodName;
+ else
+ methodName = "_get_" + methodName;
+ }
+ //stream.println (" while(true) {");
+ stream.println (" org.omg.CORBA.portable.ServantObject $so = " +
+ "_servant_preinvoke (\"" + methodName + "\", " + "_opsClass);");
+ //stream.println (" if ($so == null) {");
+ //stream.println (" continue;");
+ //stream.println (" }");
+ String opsName = i.name() + "Operations";
+ stream.println (" " + opsName + " $self = " + "(" + opsName + ") " + "$so.servant;");
+ stream.println ();
+ stream.println (" try {");
+ stream.print (" ");
+ if (m.type () != null) // not a void method
+ stream.print ("return ");
+ stream.print ("$self." + m.name () + " (");
+ {
+ // write parm names
+ boolean firstTime = true;
+ Enumeration e = m.parameters ().elements ();
+ while (e.hasMoreElements ())
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ stream.print (", ");
+ ParameterEntry parm = (ParameterEntry)e.nextElement ();
+ stream.print (parm.name ());
+ }
+ // Step 2. Add the context parameter if necessary. <d59297>
+ if (m.contexts ().size () > 0)
+ {
+ if (!firstTime)
+ stream.print (", ");
+ stream.print ("$context");
+ }
+ }
+ stream.println (");");
+ //stream.println (" } catch (org.omg.CORBA.portable.RemarshalException $rm) {");
+ //stream.println (" continue; ");
+ stream.println (" } finally {");
+ stream.println (" _servant_postinvoke ($so);");
+ stream.println (" }");
+ //stream.println (" }");
+
+ } // writeLocalStubBody
+
+
+
+ /**
+ *
+ **/
+ private void writeInsert (String indent, String target, String source, SymtabEntry type, PrintWriter stream)
+ {
+ String typeName = type.name ();
+ if (type instanceof PrimitiveEntry)
+ {
+ // RJB does something have to be done with TC offsets?
+ if (typeName.equals ("long long"))
+ stream.println (indent + source + ".insert_longlong (" + target + ");");
+ else if (typeName.equals ("unsigned short"))
+ stream.println (indent + source + ".insert_ushort (" + target + ");");
+ else if (typeName.equals ("unsigned long"))
+ stream.println (indent + source + ".insert_ulong (" + target + ");");
+ else if (typeName.equals ("unsigned long long"))
+ stream.println (indent + source + ".insert_ulonglong (" + target + ");");
+ else
+ stream.println (indent + source + ".insert_" + typeName + " (" + target + ");");
+ }
+ else if (type instanceof StringEntry)
+ stream.println (indent + source + ".insert_" + typeName + " (" + target + ");");
+ else
+ stream.println (indent + Util.helperName (type, true) + ".insert (" + source + ", " + target + ");"); // <d61056>
+ } // writeInsert
+
+ /**
+ *
+ **/
+ private void writeType (String indent, String name, SymtabEntry type, PrintWriter stream)
+ {
+ if (type instanceof PrimitiveEntry)
+ {
+ // RJB does something have to be done with TC offsets?
+ if (type.name ().equals ("long long"))
+ stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_longlong));");
+ else if (type.name ().equals ("unsigned short"))
+ stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ushort));");
+ else if (type.name ().equals ("unsigned long"))
+ stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulong));");
+ else if (type.name ().equals ("unsigned long long"))
+ stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_ulonglong));");
+ else
+ stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));");
+ }
+ else if (type instanceof StringEntry)
+ {
+ StringEntry s = (StringEntry)type;
+ Expression e = s.maxSize ();
+ if (e == null)
+ stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));");
+ else
+ stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));");
+ }
+ else
+ stream.println (indent + name + '(' + Util.helperName (type, true) + ".type ());"); // <d61056>
+ } // writeType
+
+ /**
+ *
+ **/
+ private void writeExtract (String indent, String target, String source, SymtabEntry type, PrintWriter stream)
+ {
+ if (type instanceof PrimitiveEntry)
+ {
+ if (type.name ().equals ("long long"))
+ stream.println (indent + target + " = " + source + ".extract_longlong ();");
+ else if (type.name ().equals ("unsigned short"))
+ stream.println (indent + target + " = " + source + ".extract_ushort ();");
+ else if (type.name ().equals ("unsigned long"))
+ stream.println (indent + target + " = " + source + ".extract_ulong ();");
+ else if (type.name ().equals ("unsigned long long"))
+ stream.println (indent + target + " = " + source + ".extract_ulonglong ();");
+ else
+ stream.println (indent + target + " = " + source + ".extract_" + type.name () + " ();");
+ }
+ else if (type instanceof StringEntry)
+ stream.println (indent + target + " = " + source + ".extract_" + type.name () + " ();");
+ else
+ stream.println (indent + target + " = " + Util.helperName (type, true) + ".extract (" + source + ");"); // <d61056>
+ } // writeExtract
+
+ /**
+ *
+ **/
+ private String writeExtract (String source, SymtabEntry type)
+ {
+ String extract;
+ if (type instanceof PrimitiveEntry)
+ {
+ if (type.name ().equals ("long long"))
+ extract = source + ".extract_longlong ()";
+ else if (type.name ().equals ("unsigned short"))
+ extract = source + ".extract_ushort ()";
+ else if (type.name ().equals ("unsigned long"))
+ extract = source + ".extract_ulong ()";
+ else if (type.name ().equals ("unsigned long long"))
+ extract = source + ".extract_ulonglong ()";
+ else
+ extract = source + ".extract_" + type.name () + " ()";
+ }
+ else if (type instanceof StringEntry)
+ extract = source + ".extract_" + type.name () + " ()";
+ else
+ extract = Util.helperName (type, true) + ".extract (" + source + ')'; // <d61056>
+ return extract;
+ } // writeExtract
+
+ /**
+ *
+ **/
+ private void writeSkeletonBody ()
+ {
+ SymtabEntry mtype = Util.typeOf (m.type ());
+
+ // If there is a return value, increment the appropriate counter
+ stream.print (" ");
+ if (mtype != null)
+ stream.print ("return ");
+ stream.print ("_impl." + m.name () + '(');
+
+ // Load the parameters
+ Enumeration parms = m.parameters ().elements ();
+ boolean first = true;
+ while (parms.hasMoreElements ())
+ {
+ ParameterEntry parm = (ParameterEntry)parms.nextElement ();
+ if (first)
+ first = false;
+ else
+ stream.print (", ");
+ stream.print (parm.name ());
+ }
+ if (m.contexts ().size () != 0)
+ {
+ if (!first)
+ stream.print (", ");
+ stream.print ("$context");
+ }
+
+ stream.println (");");
+ } // writeSkeletonBody
+
+ /**
+ *
+ **/
+ protected String passType (int passType)
+ {
+ String type;
+ switch (passType)
+ {
+ case ParameterEntry.Inout:
+ type = "org.omg.CORBA.ARG_INOUT.value";
+ break;
+ case ParameterEntry.Out:
+ type = "org.omg.CORBA.ARG_OUT.value";
+ break;
+ case ParameterEntry.In:
+ default:
+ type = "org.omg.CORBA.ARG_IN.value";
+ break;
+ }
+ return type;
+ } // passType
+
+ /**
+ * This is only used by AttributeGen. The java mapping says
+ * the names should be getXXX and setXXX, but CORBA says they
+ * should be _get_XXX and _set_XXX. this.name () will be
+ * getXXX. realName is set by AttributeGen to _get_XXX.
+ **/
+ protected void serverMethodName (String name)
+ {
+ realName = (name == null) ? "" : name;
+ } // serverMethodName
+
+ /**
+ *
+ **/
+ private void writeOutputStreamWrite (String indent, String oStream, String name, SymtabEntry type, PrintWriter stream)
+ {
+ String typeName = type.name ();
+ stream.print (indent);
+ if (type instanceof PrimitiveEntry)
+ {
+ if (typeName.equals ("long long"))
+ stream.println (oStream + ".write_longlong (" + name +");");
+ else if (typeName.equals ("unsigned short"))
+ stream.println (oStream + ".write_ushort (" + name + ");");
+ else if (typeName.equals ("unsigned long"))
+ stream.println (oStream + ".write_ulong (" + name + ");");
+ else if (typeName.equals ("unsigned long long"))
+ stream.println (oStream + ".write_ulonglong (" + name + ");");
+ else
+ stream.println (oStream + ".write_" + typeName + " (" + name + ");");
+ }
+ else if (type instanceof StringEntry)
+ stream.println (oStream + ".write_" + typeName + " (" + name + ");");
+ else if (type instanceof SequenceEntry)
+ stream.println (oStream + ".write_" + type.type().name() + " (" + name + ");");
+ else if (type instanceof ValueBoxEntry)
+ {
+ ValueBoxEntry v = (ValueBoxEntry) type;
+ TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+
+ // if write value to the boxed holder indicated by the name ending with ".value"
+ if (mType instanceof PrimitiveEntry && name.endsWith (".value"))
+ stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " // <d61056>
+ + " new " + Util.javaQualifiedName (type) + " (" + name + "));"); //<d60929>
+ else
+ stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " + name + ");"); //<d60929> // <d61056>
+ }
+ else if (type instanceof ValueEntry)
+ stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " + name + ");"); //<d60929> // <d61056>
+ else
+ stream.println (Util.helperName (type, true) + ".write (" + oStream + ", " + name + ");"); // <d61056>
+ } // writeOutputStreamWrite
+
+ /**
+ *
+ **/
+ private String writeInputStreamRead (String source, SymtabEntry type)
+ {
+ String read = "";
+ if (type instanceof PrimitiveEntry)
+ {
+ if (type.name ().equals ("long long"))
+ read = source + ".read_longlong ()";
+ else if (type.name ().equals ("unsigned short"))
+ read = source + ".read_ushort ()";
+ else if (type.name ().equals ("unsigned long"))
+ read = source + ".read_ulong ()";
+ else if (type.name ().equals ("unsigned long long"))
+ read = source + ".read_ulonglong ()";
+ else
+ read = source + ".read_" + type.name () + " ()";
+ }
+ else if (type instanceof StringEntry)
+ read = source + ".read_" + type.name () + " ()";
+ else
+ read = Util.helperName (type, true) + ".read (" + source + ')'; // <d61056>
+ return read;
+ } // writeInputStreamRead
+
+ /**
+ *
+ **/
+ protected void writeMethodCall (String indent)
+ {
+ SymtabEntry mtype = Util.typeOf (m.type ());
+ if (mtype == null)
+ stream.print (indent + "this." + m.name () + " (");
+ else
+ stream.print (indent + "$result = this." + m.name () + " (");
+ } // writeMethodCall
+
+ /**
+ *
+ **/
+ protected void writeCreateReply(String indent){
+ stream.println(indent + "out = $rh.createReply();");
+ }
+
+ protected int methodIndex = 0;
+ protected String realName = "";
+ protected Hashtable symbolTable = null;
+ protected MethodEntry m = null;
+ protected PrintWriter stream = null;
+ protected boolean localOptimization = false;
+ protected boolean isAbstract = false;
+} // class MethodGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen24.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen24.java
new file mode 100644
index 0000000..ba84c9f
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGen24.java
@@ -0,0 +1,258 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D62023 <klr> New file to implement CORBA 2.4 RTF
+// -D62794 <klr> Fix problem with no-arg create functions
+
+import java.io.PrintWriter;
+
+import java.util.Enumeration;
+import java.util.Vector;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.ParameterEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.StructEntry;
+
+/**
+ *
+ **/
+public class MethodGen24 extends MethodGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public MethodGen24 ()
+ {
+ } // ctor
+
+ /**
+ * Print the parameter list for the factory method.
+ * @param m The method to list parameters for
+ * @param listTypes If try, declare the parms, otherwise just list them
+ * @param stream The PrintWriter to print on
+ */
+ protected void writeParmList (MethodEntry m, boolean listTypes, PrintWriter stream) {
+ boolean firstTime = true;
+ Enumeration e = m.parameters ().elements ();
+ while (e.hasMoreElements ())
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ stream.print (", ");
+ ParameterEntry parm = (ParameterEntry)e.nextElement ();
+ if (listTypes) {
+ writeParmType (parm.type (), parm.passType ());
+ stream.print (' ');
+ }
+ // Print parm name
+ stream.print (parm.name ());
+ // end of parameter list
+ }
+ }
+
+ /**
+ * d62023 - write the methodEntry for a valuetype factory method into
+ * the Value Helper class. Contents from email from Simon,
+ * 4/25/99.
+ **/
+ protected void helperFactoryMethod (Hashtable symbolTable, MethodEntry m, SymtabEntry t, PrintWriter stream)
+ {
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ String initializerName = m.name ();
+ String typeName = Util.javaName (t);
+ String factoryName = typeName + "ValueFactory";
+
+ // Step 1. Print factory method decl up to parms.
+ stream.print (" public static " + typeName + " " + initializerName +
+ " (org.omg.CORBA.ORB $orb");
+ if (!m.parameters ().isEmpty ())
+ stream.print (", "); // <d62794>
+
+ // Step 2. Print the declaration parameter list.
+ writeParmList (m, true, stream);
+
+ // Step 3. Print the body of the factory method
+ stream.println (")");
+ stream.println (" {");
+ stream.println (" try {");
+ stream.println (" " + factoryName + " $factory = (" + factoryName + ")");
+ stream.println (" ((org.omg.CORBA_2_3.ORB) $orb).lookup_value_factory(id());");
+ stream.print (" return $factory." + initializerName + " (");
+ writeParmList (m, false, stream);
+ stream.println (");");
+ stream.println (" } catch (ClassCastException $ex) {");
+ stream.println (" throw new org.omg.CORBA.BAD_PARAM ();");
+ stream.println (" }");
+ stream.println (" }");
+ stream.println ();
+ } // helperFactoryMethod
+
+ /**
+ * d62023 - write an abstract method definition
+ **/
+ protected void abstractMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
+ {
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ if (m.comment () != null)
+ m.comment ().generate (" ", stream);
+ stream.print (" ");
+ stream.print ("public abstract ");
+ writeMethodSignature ();
+ stream.println (";");
+ stream.println ();
+ } // abstractMethod
+
+ /**
+ * d62023 - write a default factory method implementation for the
+ * {@code <value>DefaultFactory}. m is a methodEntry for a factory
+ * method contained in a non-abstract ValueEntry.
+ **/
+ protected void defaultFactoryMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
+ {
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ String typeName = m.container (). name ();
+ stream.println ();
+ if (m.comment () != null)
+ m.comment ().generate (" ", stream);
+ stream.print (" public " + typeName + " " + m.name () + " (");
+ writeParmList (m, true, stream);
+ stream.println (")");
+ stream.println (" {");
+ stream.print (" return new " + typeName + "Impl (");
+ writeParmList (m, false, stream);
+ stream.println (");");
+ stream.println (" }");
+ } // defaultFactoryMethod
+
+ /**
+ * d62023 - remove all valueInitializer junk
+ **/
+ protected void writeMethodSignature ()
+ {
+ // Step 0. Print the return type and name.
+ // A return type of null indicates the "void" return type. If m is a
+ // Valuetype factory method, it has a null return type,
+ if (m.type () == null)
+ {
+ // if factory method, result type is container
+ if (isValueInitializer ())
+ stream.print (m.container ().name ());
+ else
+ stream.print ("void");
+ }
+ else
+ {
+ stream.print (Util.javaName (m.type ()));
+ }
+ stream.print (' ' + m.name () + " (");
+
+ // Step 1. Print the parameter list.
+ boolean firstTime = true;
+ Enumeration e = m.parameters ().elements ();
+ while (e.hasMoreElements ())
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ stream.print (", ");
+ ParameterEntry parm = (ParameterEntry)e.nextElement ();
+
+ writeParmType (parm.type (), parm.passType ());
+
+ // Print parm name
+ stream.print (' ' + parm.name ());
+ }
+
+ // Step 2. Add the context parameter if necessary.
+ if (m.contexts ().size () > 0)
+ {
+ if (!firstTime)
+ stream.print (", ");
+ stream.print ("org.omg.CORBA.Context $context");
+ }
+
+ // Step 3. Print the throws clause (if necessary).
+ if (m.exceptions ().size () > 0)
+ {
+ stream.print (") throws ");
+ e = m.exceptions ().elements ();
+ firstTime = true;
+ while (e.hasMoreElements ())
+ {
+ if (firstTime)
+ firstTime = false;
+ else
+ stream.print (", ");
+ stream.print (Util.javaName ((SymtabEntry)e.nextElement ()));
+ }
+ }
+ else
+ stream.print (')');
+ } // writeMethodSignature
+
+ /**
+ * d62023 - delete method templates for valuetypes
+ **/
+ protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
+ {
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ if (m.comment () != null)
+ m.comment ().generate (" ", stream);
+ stream.print (" ");
+ writeMethodSignature ();
+ stream.println (";");
+ } // interfaceMethod
+}
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGenClone24.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGenClone24.java
new file mode 100644
index 0000000..5c2e959
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/MethodGenClone24.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D62023 <klr> New file to implement CORBA 2.4 RTF
+// NOTE: The methods in this class should be exact copies of the
+// correspoind methods in MethodGen24. The purpose of this class is
+// to inject the changes made in MethodGen24 between AttributeGen
+// and AttributeGen24. When the AttributeGen24 changes are merged, this
+// class should be deleted.
+
+import java.io.PrintWriter;
+
+import java.util.Enumeration;
+import java.util.Vector;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.ParameterEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.StructEntry;
+
+/**
+ *
+ **/
+public class MethodGenClone24 extends AttributeGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public MethodGenClone24 ()
+ {
+ } // ctor
+
+ /**
+ * d62023 - write an abstract method definition
+ **/
+ protected void abstractMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
+ {
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ if (m.comment () != null)
+ m.comment ().generate (" ", stream);
+ stream.print (" ");
+ stream.print ("public abstract ");
+ writeMethodSignature ();
+ stream.println (";");
+ stream.println ();
+ } // abstractMethod
+
+ /**
+ * d62023 - delete method templates for valuetypes
+ **/
+ protected void interfaceMethod (Hashtable symbolTable, MethodEntry m, PrintWriter stream)
+ {
+ this.symbolTable = symbolTable;
+ this.m = m;
+ this.stream = stream;
+ if (m.comment () != null)
+ m.comment ().generate (" ", stream);
+ stream.print (" ");
+ writeMethodSignature ();
+ stream.println (";");
+ } // interfaceMethod
+}
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ModuleGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ModuleGen.java
new file mode 100644
index 0000000..ceae4b1
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ModuleGen.java
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.ModuleEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+
+/**
+ *
+ **/
+public class ModuleGen implements com.sun.tools.corba.se.idl.ModuleGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public ModuleGen ()
+ {
+ } // ctor
+
+ /**
+ * Generate Java code for all members of an IDL module.
+ **/
+ public void generate (Hashtable symbolTable, ModuleEntry entry, PrintWriter stream)
+ {
+ // Generate the package directory
+ String name = Util.containerFullName( entry ) ;
+ Util.mkdir (name);
+
+ // Generate all of the contained types
+ Enumeration e = entry.contained ().elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry element = (SymtabEntry)e.nextElement ();
+ if (element.emit ())
+ element.generate (symbolTable, stream);
+ }
+ } // generate
+} // class ModuleGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifier.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifier.java
new file mode 100644
index 0000000..a69d507
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifier.java
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable ;
+
+public interface NameModifier {
+ /** Create a modified name from the base name.
+ */
+ String makeName( String base ) ;
+} ;
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifierImpl.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifierImpl.java
new file mode 100644
index 0000000..afbd2ea
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NameModifierImpl.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable ;
+
+import com.sun.tools.corba.se.idl.toJavaPortable.NameModifier ;
+
+public class NameModifierImpl implements NameModifier {
+ private String prefix ;
+ private String suffix ;
+
+ public NameModifierImpl( )
+ {
+ this.prefix = null ;
+ this.suffix = null ;
+ }
+
+ public NameModifierImpl( String prefix, String suffix )
+ {
+ this.prefix = prefix ;
+ this.suffix = suffix ;
+ }
+
+ /** Construct a NameModifier from a pattern of the form xxx%xxx.
+ * The pattern must consist of characters chosen from the
+ * set [A-Za-z0-9%$_]. In addition, the pattern must contain
+ * exactly one % character. Finally, if % is not the first char in
+ * the pattern, the pattern must not start with a number.
+ * <p>
+ * The semantics of makeName are very simply: just replace the
+ * % character with the base in the pattern and return the result.
+ */
+ public NameModifierImpl( String pattern )
+ {
+ int first = pattern.indexOf( '%' ) ;
+ int last = pattern.lastIndexOf( '%' ) ;
+
+ if (first != last)
+ throw new IllegalArgumentException(
+ Util.getMessage( "NameModifier.TooManyPercent" ) ) ;
+
+ if (first == -1)
+ throw new IllegalArgumentException(
+ Util.getMessage( "NameModifier.NoPercent" ) ) ;
+
+ for (int ctr = 0; ctr<pattern.length(); ctr++) {
+ char ch = pattern.charAt( ctr ) ;
+ if (invalidChar( ch, ctr==0 )) {
+ char[] chars = new char[] { ch } ;
+ throw new IllegalArgumentException(
+ Util.getMessage( "NameModifier.InvalidChar",
+ new String( chars )) ) ;
+ }
+ }
+
+ // at this point, 0 <= first && first < pattern.length()
+ prefix = pattern.substring( 0, first ) ;
+ suffix = pattern.substring( first+1 ) ;
+ }
+
+ /** Return true if ch is invalid as a character in an
+ * identifier. If ch is a number, it is invalid only if
+ * isFirst is true.
+ */
+ private boolean invalidChar( char ch, boolean isFirst )
+ {
+ if (('A'<=ch) && (ch<='Z'))
+ return false ;
+ else if (('a'<=ch) && (ch<='z'))
+ return false ;
+ else if (('0'<=ch) && (ch<='9'))
+ return isFirst ;
+ else if (ch=='%')
+ return false ;
+ else if (ch=='$')
+ return false ;
+ else if (ch=='_')
+ return false ;
+ else
+ return true ;
+ }
+
+ public String makeName( String base )
+ {
+ StringBuffer sb = new StringBuffer() ;
+
+ if (prefix != null)
+ sb.append( prefix ) ;
+
+ sb.append( base ) ;
+
+ if (suffix != null)
+ sb.append( suffix ) ;
+
+ return sb.toString() ;
+ }
+}
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NativeGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NativeGen.java
new file mode 100644
index 0000000..c29ec74
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/NativeGen.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.NativeEntry;
+import com.sun.tools.corba.se.idl.ModuleEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+
+/**
+ *
+ **/
+public class NativeGen implements com.sun.tools.corba.se.idl.NativeGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public NativeGen ()
+ {
+ } // ctor
+
+ /**
+ * Generate Java code for an IDL constant. A constant is written to
+ * a new class only when it is not a member of an interface; otherwise
+ * it written to the interface class in which it resides.
+ **/
+ public void generate (Hashtable symbolTable, NativeEntry c, PrintWriter s)
+ {
+ // noop, do not generate anything
+ } // generate
+
+} // class NativeGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/PrimitiveGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/PrimitiveGen.java
new file mode 100644
index 0000000..95365bc
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/PrimitiveGen.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+
+/**
+ *
+ **/
+public class PrimitiveGen implements com.sun.tools.corba.se.idl.PrimitiveGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public PrimitiveGen ()
+ {
+ } // ctor
+
+ /**
+ * This method should never be called; this class exists for
+ * the JavaGenerator interface.
+ **/
+ public void generate (Hashtable symbolTable, PrimitiveEntry e, PrintWriter stream)
+ {
+ } // generate
+
+ ///////////////
+ // From JavaGenerator
+
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ return type (index, indent, tcoffsets, name, entry, stream);
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
+ tcoffsets.set (entry);
+ String emit = "tk_null";
+ if (entry.name ().equals ("null"))
+ emit = "tk_null";
+ else if (entry.name ().equals ("void"))
+ emit = "tk_void";
+ else if (entry.name ().equals ("short"))
+ emit = "tk_short";
+ else if (entry.name ().equals ("long"))
+ emit = "tk_long";
+ else if (entry.name ().equals ("long long"))
+ emit = "tk_longlong";
+ else if (entry.name ().equals ("unsigned short"))
+ emit = "tk_ushort";
+ else if (entry.name ().equals ("unsigned long"))
+ emit = "tk_ulong";
+ else if (entry.name ().equals ("unsigned long long"))
+ emit = "tk_ulonglong";
+ else if (entry.name ().equals ("float"))
+ emit = "tk_float";
+ else if (entry.name ().equals ("double"))
+ emit = "tk_double";
+ else if (entry.name ().equals ("boolean"))
+ emit = "tk_boolean";
+ else if (entry.name ().equals ("char"))
+ emit = "tk_char";
+ else if (entry.name ().equals ("octet"))
+ emit = "tk_octet";
+ else if (entry.name ().equals ("any"))
+ emit = "tk_any";
+ else if (entry.name ().equals ("TypeCode"))
+ emit = "tk_TypeCode";
+ else if (entry.name ().equals ("wchar"))
+ emit = "tk_wchar";
+ else if (entry.name ().equals ("Principal")) // <d61961>
+ emit = "tk_Principal";
+ else if (entry.name ().equals ("wchar"))
+ emit = "tk_wchar";
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind." + emit + ");");
+ return index;
+ } // type
+
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ } // helperRead
+
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ } // helperWrite
+
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (indent + name + " = " + "istream.read_" + Util.collapseName (entry.name ()) + " ();");
+ return index;
+ } // read
+
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (indent + "ostream.write_" + Util.collapseName (entry.name ()) + " (" + name + ");");
+ return index;
+ } // write
+
+ // From JavaGenerator
+ ///////////////
+} // class PrimitiveGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/SequenceGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/SequenceGen.java
new file mode 100644
index 0000000..e21c469
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/SequenceGen.java
@@ -0,0 +1,271 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
+// -D61056 <klr> Use Util.helperName
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+
+import com.sun.tools.corba.se.idl.constExpr.Expression;
+
+/**
+ *
+ **/
+public class SequenceGen implements com.sun.tools.corba.se.idl.SequenceGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public SequenceGen ()
+ {
+ } // ctor
+
+ /**
+ *
+ **/
+ public void generate (Hashtable symbolTable, SequenceEntry s, PrintWriter stream)
+ {
+ } // generator
+
+ ///////////////
+ // From JavaGenerator
+
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ int offsetOfType = tcoffsets.offset (entry.type ().fullName ());
+ if (offsetOfType >= 0)
+ {
+ // This code uses the deprecated create_recursive_sequence_tc()
+ // It should be eliminated when the API is removed from the ORB class
+ // Regardles, this code will not be emitted since updated emitters invoke
+ // method type() below instead of helperType() when handling sequences
+
+ // This is a recursive sequence
+ tcoffsets.set (null);
+ Expression maxSize = ((SequenceEntry)entry).maxSize ();
+ if (maxSize == null)
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_sequence_tc (0, " + (offsetOfType - tcoffsets.currentOffset ()) + ");");
+ else
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_sequence_tc (" + Util.parseExpression (maxSize) + ", " + (offsetOfType - tcoffsets.currentOffset ()) + ");");
+ tcoffsets.bumpCurrentOffset (4); // add indirection field
+ }
+ else
+ {
+ // This is a normal sequence
+ tcoffsets.set (entry);
+ index = ((JavaGenerator)entry.type ().generator ()).helperType (index + 1, indent, tcoffsets, name, entry.type (), stream);
+ Expression maxSize = ((SequenceEntry)entry).maxSize ();
+ if (maxSize == null)
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");");
+ else
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");");
+ }
+ tcoffsets.bumpCurrentOffset (4); // add on the seq max size
+ return index;
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
+ int offsetOfType = tcoffsets.offset (entry.type ().fullName ());
+ if (offsetOfType >= 0)
+ {
+ // This is a recursive sequence
+ tcoffsets.set (null);
+
+ // Need to fix later: how to get repositoryId of IDL type containing this sequence?
+ // entry.repositoryID().ID() returns empty string and
+ // Util.javaQualifiedName(entry) returns internal name which is not valid repId
+
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_recursive_tc (" + "\"\"" + ");");
+ tcoffsets.bumpCurrentOffset (4); // add indirection field
+ }
+ else
+ {
+ // This is a normal sequence
+ tcoffsets.set (entry);
+ index = ((JavaGenerator)entry.type ().generator ()).type (index + 1, indent, tcoffsets, name, entry.type (), stream);
+ Expression maxSize = ((SequenceEntry)entry).maxSize ();
+ if (maxSize == null)
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (0, " + name + ");");
+ else
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_sequence_tc (" + Util.parseExpression (maxSize) + ", " + name + ");");
+ }
+ //stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
+ return index;
+ } // type
+
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ } // helperRead
+
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ } // helperWrite
+
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ SequenceEntry seq = (SequenceEntry)entry;
+ String length = "_len" + index++;
+ stream.println (indent + "int " + length + " = istream.read_long ();");
+ if (seq.maxSize () != null)
+ {
+ stream.println (indent + "if (" + length + " > (" + Util.parseExpression (seq.maxSize ()) + "))");
+ stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
+ }
+ String seqOfName;
+ try
+ {
+ seqOfName = Util.sansArrayInfo ((String)seq.dynamicVariable (Compile.typedefInfo));
+ }
+ catch (NoSuchFieldException e)
+ {
+ seqOfName = seq.name ();
+ }
+ int startArray = seqOfName.indexOf ('[');
+ String arrayDcl = seqOfName.substring (startArray);
+ seqOfName = seqOfName.substring (0, startArray);
+
+ // For interfaces having state, e.g., valuetypes.
+ SymtabEntry seqOfEntry = (SymtabEntry)Util.symbolTable.get (seqOfName.replace ('.', '/'));
+ if (seqOfEntry != null && seqOfEntry instanceof InterfaceEntry && ((InterfaceEntry)seqOfEntry).state () != null)
+ // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
+ //seqOfName = Util.javaStatefulName ((InterfaceEntry)seqOfEntry);
+ seqOfName = Util.javaName ((InterfaceEntry)seqOfEntry);
+
+ arrayDcl = arrayDcl.substring (2);
+ stream.println (indent + name + " = new " + seqOfName + '[' + length + ']' + arrayDcl + ';');
+ if (seq.type () instanceof PrimitiveEntry)
+ // <d61961> Check for CORBA::Principal, too
+ //if (seq.type ().name ().equals ("any") || seq.type ().name ().equals ("TypeCode"))
+ if (seq.type ().name ().equals ("any") ||
+ seq.type ().name ().equals ("TypeCode") ||
+ seq.type ().name ().equals ("Principal"))
+ {
+ String loopIndex = "_o" + index;
+ stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
+ stream.println (indent + " " + name + '[' + loopIndex + "] = istream.read_" + seq.type ().name () + " ();");
+ }
+ else
+ { // special case for ValueBox: if name is "xxx tmp", drop xxx
+ String varName = name;
+ int nameIndex = varName.indexOf (' ');
+ if ( nameIndex != -1 )
+ varName = varName.substring( nameIndex + 1 );
+ stream.println (indent + "istream.read_" + Util.collapseName (entry.type ().name ()) + "_array (" + varName + ", 0, " + length + ");");
+ }
+ else if (entry.type () instanceof StringEntry)
+ {
+ String loopIndex = "_o" + index;
+ stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
+ stream.println (indent + " " + name + '[' + loopIndex + "] = istream.read_" + seq.type ().name () + " ();");
+ }
+ else if (entry.type () instanceof SequenceEntry)
+ {
+ String loopIndex = "_o" + index;
+ stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
+ stream.println (indent + '{');
+ index = ((JavaGenerator)seq.type ().generator ()).read (index, indent + " ", name + '[' + loopIndex + ']', seq.type (), stream);
+ stream.println (indent + '}');
+ }
+ else
+ { // special case for ValueBox: if name is "xxx tmp", drop xxx
+ String varName = name;
+ int nameIndex = varName.indexOf (' ');
+ if ( nameIndex != -1 )
+ varName = varName.substring( nameIndex + 1 );
+ String loopIndex = "_o" + index;
+ stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + varName + ".length; ++" + loopIndex + ')');
+ stream.println (indent + " " + varName + '[' + loopIndex + "] = " + Util.helperName (seq.type (), true) + ".read (istream);"); // <d61056>
+ }
+ return index;
+ } // read
+
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ SequenceEntry seq = (SequenceEntry)entry;
+ if (seq.maxSize () != null)
+ {
+ stream.println (indent + "if (" + name + ".length > (" + Util.parseExpression (seq.maxSize ()) + "))");
+ stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
+ }
+ stream.println (indent + "ostream.write_long (" + name + ".length);");
+ if (entry.type () instanceof PrimitiveEntry)
+ // <d61961> Check for CORBA::Principal, too.
+ //if (entry.type ().name ().equals ("any") || entry.type ().name ().equals ("TypeCode"))
+ if (entry.type ().name ().equals ("any") ||
+ entry.type ().name ().equals ("TypeCode") ||
+ entry.type ().name ().equals ("Principal"))
+ {
+ String loopIndex = "_i" + index++;
+ stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
+ stream.println (indent + " ostream.write_" + seq.type ().name () + " (" + name + '[' + loopIndex + "]);");
+ }
+ else
+ stream.println (indent + "ostream.write_" + Util.collapseName (entry.type ().name ()) + "_array (" + name + ", 0, " + name + ".length);");
+ else if (entry.type () instanceof StringEntry)
+ {
+ String loopIndex = "_i" + index++;
+ stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
+ stream.println (indent + " ostream.write_" + seq.type ().name () + " (" + name + '[' + loopIndex + "]);");
+ }
+ else if (entry.type () instanceof SequenceEntry)
+ {
+ String loopIndex = "_i" + index++;
+ stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
+ stream.println (indent + '{');
+ index = ((JavaGenerator)seq.type ().generator ()).write (index, indent + " ", name + '[' + loopIndex + ']', seq.type (), stream);
+ stream.println (indent + '}');
+ }
+ else
+ {
+ String loopIndex = "_i" + index++;
+ stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < " + name + ".length; ++" + loopIndex + ')');
+ stream.println (indent + " " + Util.helperName (seq.type (), true) + ".write (ostream, " + name + '[' + loopIndex + "]);"); // <d61056>
+ }
+ return index;
+ } // write
+
+ // From JavaGenerator
+ ///////////////
+} // class SequenceGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Skeleton.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Skeleton.java
new file mode 100644
index 0000000..3707048
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Skeleton.java
@@ -0,0 +1,568 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
+// -D57147 <klr> Make _Tie implement org.omg.CORBA.portable.InvokeHandler
+// -D58037 <klr> Make _Tie delegate to Operations interface
+// -D62739 <klr> no TIE for values that support abstract interfaces, etc.
+
+import java.io.File;
+import java.io.PrintWriter;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.AttributeEntry;
+import com.sun.tools.corba.se.idl.GenFileStream;
+
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+
+/**
+ *
+ **/
+public class Skeleton implements AuxGen
+{
+ private NameModifier skeletonNameModifier ;
+ private NameModifier tieNameModifier ;
+
+ public Skeleton ()
+ {
+ }
+
+ public void generate (Hashtable symbolTable, SymtabEntry entry)
+ {
+ // <d62739-begin>
+ // Per Simon, 5-12-99, don't generate TIE or Skeleton for
+ //
+ // 1) valuetypes supporting abstract interfaces
+ // 2) valuetypes with no supports.
+ // 3) abstract interfaces
+ //
+ if (entry instanceof ValueEntry)
+ {
+ ValueEntry v = (ValueEntry) entry;
+ if ((v.supports ().size () == 0) ||
+ ((InterfaceEntry) v.supports ().elementAt (0)).isAbstract ()) {
+ return;
+ }
+ }
+ if (((InterfaceEntry) entry).isAbstract ()) {
+ return;
+ }
+ // <d62739-end>
+
+ this.symbolTable = symbolTable;
+
+ this.i = (InterfaceEntry)entry;
+ init ();
+ openStream ();
+ if (stream == null)
+ return;
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ } // generate
+
+ /**
+ * Initialize members unique to this generator.
+ **/
+ protected void init ()
+ {
+ tie = ((Arguments)Compile.compiler.arguments).TIEServer ;
+ poa = ((Arguments)Compile.compiler.arguments).POAServer ;
+
+ skeletonNameModifier =
+ ((Arguments)Compile.compiler.arguments).skeletonNameModifier ;
+ tieNameModifier =
+ ((Arguments)Compile.compiler.arguments).tieNameModifier ;
+
+ tieClassName = tieNameModifier.makeName( i.name() ) ;
+ skeletonClassName = skeletonNameModifier.makeName( i.name() ) ;
+
+ intfName = Util.javaName (i);
+ // for valuetype, get the name of the interface the valuetype supports
+ if (i instanceof ValueEntry)
+ {
+ ValueEntry v = (ValueEntry) i;
+ InterfaceEntry intf = (InterfaceEntry) v.supports ().elementAt (0);
+ intfName = Util.javaName (intf);
+ }
+ } // init
+
+ protected void openStream ()
+ {
+ if (tie)
+ stream = Util.stream( i, tieNameModifier, ".java" ) ;
+ else
+ stream = Util.stream( i, skeletonNameModifier, ".java" ) ;
+ } // openStream
+
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, i, Util.StubFile);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+ if (i.comment () != null)
+ i.comment ().generate ("", stream);
+ writeClassDeclaration ();
+ stream.println ('{');
+ stream.println ();
+ } // writeHeading
+
+ protected void writeClassDeclaration ()
+ {
+ if (tie){
+ stream.println ("public class " + tieClassName +
+ " extends " + skeletonClassName ) ;
+ } else {
+ if (poa) {
+ stream.println ("public abstract class " + skeletonClassName +
+ " extends org.omg.PortableServer.Servant");
+ stream.print (" implements " + intfName + "Operations, ");
+ stream.println ("org.omg.CORBA.portable.InvokeHandler");
+ } else {
+ stream.println ("public abstract class " + skeletonClassName +
+ " extends org.omg.CORBA.portable.ObjectImpl");
+ stream.print (" implements " + intfName + ", ");
+ stream.println ("org.omg.CORBA.portable.InvokeHandler");
+ }
+ }
+ } // writeClassDeclaration
+
+ /**
+ *
+ **/
+ protected void writeBody ()
+ {
+ // <f46082.51> Remove -stateful feature. ?????
+ //if (i.state () != null)
+ // writeState ();
+ writeCtors ();
+ if (i instanceof ValueEntry)
+ {
+ // use the interface the valuetype supports to generate the
+ // tie class instead of using the valuetype itself
+ ValueEntry v = (ValueEntry) i;
+ this.i = (InterfaceEntry) v.supports ().elementAt (0);
+ }
+ buildMethodList ();
+ //DispatchMethod and MethodTable
+ if (tie){ //Concrete class implementing the remote interface
+ //The logic is here for future use
+ if (poa) {
+ writeMethods ();
+ stream.println (" private " + intfName + "Operations _impl;");
+ stream.println (" private org.omg.PortableServer.POA _poa;");
+ } else {
+ writeMethods ();
+ stream.println (" private " + intfName + "Operations _impl;");
+ }
+ } else { //Both POA and ImplBase are abstract InvokeHandler
+ //The logic is here for future use
+ if (poa) {
+ writeMethodTable ();
+ writeDispatchMethod ();
+ writeCORBAOperations ();
+ } else {
+ writeMethodTable ();
+ writeDispatchMethod ();
+ writeCORBAOperations ();
+ }
+ }
+ //legacy !!
+ writeOperations ();
+ } // writeBody
+
+ /**
+ * Close the skeleton class. The singleton ORB member is
+ * necessary only for portable skeletons.
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ();
+ if (tie){
+ stream.println ("} // class " + tieClassName);
+ } else {
+ stream.println ("} // class " + skeletonClassName);
+ }
+ } // writeClosing
+
+ /**
+ * Close the print stream, which flushes the stream to file.
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ protected void writeCtors ()
+ {
+ stream.println (" // Constructors");
+ // Empty argument constructors
+ if (!poa) {
+ if (tie){
+ stream.println (" public " + tieClassName + " ()");
+ stream.println (" {");
+ stream.println (" }");
+ } else {
+ stream.println (" public " + skeletonClassName + " ()");
+ stream.println (" {");
+ stream.println (" }");
+ }
+ }
+ stream.println ();
+ // Argumented constructors
+ if (tie){
+ if (poa) {
+ //Write constructors
+ writePOATieCtors();
+ //Write state setters and getters
+ writePOATieFieldAccessMethods();
+ } else {
+ stream.println (" public " + tieClassName +
+ " (" + intfName + "Operations impl)");
+ stream.println (" {");
+ // Does it derive from a interface having state, e.g., valuetype?
+ if (((InterfaceEntry)i.derivedFrom ().firstElement ()).state () != null)
+ stream.println (" super (impl);");
+ else
+ stream.println (" super ();");
+ stream.println (" _impl = impl;");
+ stream.println (" }");
+ stream.println ();
+ }
+ } else { //Skeleton is not Tie so it has no constructors.
+ if (poa) {
+ } else {
+ }
+ }
+
+ } // writeCtors
+
+
+ private void writePOATieCtors(){
+ //First constructor
+ stream.println (" public " + tieClassName + " ( " + intfName + "Operations delegate ) {");
+ stream.println (" this._impl = delegate;");
+ stream.println (" }");
+ //Second constructor specifying default poa.
+ stream.println (" public " + tieClassName + " ( " + intfName +
+ "Operations delegate , org.omg.PortableServer.POA poa ) {");
+ stream.println (" this._impl = delegate;");
+ stream.println (" this._poa = poa;");
+ stream.println (" }");
+ }
+
+ private void writePOATieFieldAccessMethods(){
+ //Getting delegate
+ stream.println (" public " + intfName+ "Operations _delegate() {");
+ stream.println (" return this._impl;");
+ stream.println (" }");
+ //Setting delegate
+ stream.println (" public void _delegate (" + intfName + "Operations delegate ) {");
+ stream.println (" this._impl = delegate;");
+ stream.println (" }");
+ //Overriding default poa
+ stream.println (" public org.omg.PortableServer.POA _default_POA() {");
+ stream.println (" if(_poa != null) {");
+ stream.println (" return _poa;");
+ stream.println (" }");
+ stream.println (" else {");
+ stream.println (" return super._default_POA();");
+ stream.println (" }");
+ stream.println (" }");
+ }
+
+ /**
+ * Build a list of all of the methods, keeping out duplicates.
+ **/
+ protected void buildMethodList ()
+ {
+ // Start from scratch
+ methodList = new Vector ();
+
+ buildMethodList (i);
+ } // buildMethodList
+
+ /**
+ *
+ **/
+ private void buildMethodList (InterfaceEntry entry)
+ {
+ // Add the local methods
+ Enumeration locals = entry.methods ().elements ();
+ while (locals.hasMoreElements ())
+ addMethod ((MethodEntry)locals.nextElement ());
+
+ // Add the inherited methods
+ Enumeration parents = entry.derivedFrom ().elements ();
+ while (parents.hasMoreElements ())
+ {
+ InterfaceEntry parent = (InterfaceEntry)parents.nextElement ();
+ if (!parent.name ().equals ("Object"))
+ buildMethodList (parent);
+ }
+ } // buildMethodList
+
+ /**
+ *
+ **/
+ private void addMethod (MethodEntry method)
+ {
+ if (!methodList.contains (method))
+ methodList.addElement (method);
+ } // addMethod
+
+ /**
+ *
+ **/
+ protected void writeDispatchMethod ()
+ {
+ String indent = " ";
+ stream.println (" public org.omg.CORBA.portable.OutputStream _invoke (String $method,");
+ stream.println (indent + "org.omg.CORBA.portable.InputStream in,");
+ stream.println (indent + "org.omg.CORBA.portable.ResponseHandler $rh)");
+ stream.println (" {");
+
+ // this is a special case code generation for cases servantLocator and
+ // servantActivator, where OMG is taking too long to define them
+ // as local objects
+
+ boolean isLocalInterface = false;
+ if (i instanceof InterfaceEntry) {
+ isLocalInterface = i.isLocalServant();
+ }
+
+ if (!isLocalInterface) {
+ // Per Simon 8/26/98, create and return reply stream for all methods - KLR
+ stream.println (" org.omg.CORBA.portable.OutputStream out = null;");
+ stream.println (" java.lang.Integer __method = (java.lang.Integer)_methods.get ($method);");
+ stream.println (" if (__method == null)");
+ stream.println (" throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
+ stream.println ();
+ if (methodList.size () > 0)
+ {
+ stream.println (" switch (__method.intValue ())");
+ stream.println (" {");
+
+ // Write the method case statements
+ int realI = 0;
+ for (int i = 0; i < methodList.size (); ++i)
+ {
+ MethodEntry method = (MethodEntry)methodList.elementAt (i);
+ ((MethodGen)method.generator ()).dispatchSkeleton (symbolTable, method, stream, realI);
+ if (method instanceof AttributeEntry && !((AttributeEntry)method).readOnly ())
+ realI += 2;
+ else
+ ++realI;
+ }
+
+ indent = " ";
+ stream.println (indent + "default:");
+ stream.println (indent + " throw new org.omg.CORBA.BAD_OPERATION (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
+ stream.println (" }");
+ stream.println ();
+ }
+ stream.println (" return out;");
+ } else {
+ stream.println(" throw new org.omg.CORBA.BAD_OPERATION();");
+ }
+ stream.println (" } // _invoke");
+ stream.println ();
+ } // writeDispatchMethod
+
+ /**
+ *
+ **/
+ protected void writeMethodTable ()
+ {
+ // Write the methods hashtable
+ stream.println (" private static java.util.Hashtable _methods = new java.util.Hashtable ();");
+ stream.println (" static");
+ stream.println (" {");
+
+ int count = -1;
+ Enumeration e = methodList.elements ();
+ while (e.hasMoreElements ())
+ {
+ MethodEntry method = (MethodEntry)e.nextElement ();
+ if (method instanceof AttributeEntry)
+ {
+ stream.println (" _methods.put (\"_get_" + Util.stripLeadingUnderscores (method.name ()) + "\", new java.lang.Integer (" + (++count) + "));");
+ if (!((AttributeEntry)method).readOnly ())
+ stream.println (" _methods.put (\"_set_" + Util.stripLeadingUnderscores (method.name ()) + "\", new java.lang.Integer (" + (++count) + "));");
+ }
+ else
+ stream.println (" _methods.put (\"" + Util.stripLeadingUnderscores (method.name ()) + "\", new java.lang.Integer (" + (++count) + "));");
+ }
+ stream.println (" }");
+ stream.println ();
+ } // writeMethodTable
+
+ /**
+ *
+ **/
+ protected void writeMethods ()
+ {
+ int realI = 0;
+ for (int i = 0; i < methodList.size (); ++i)
+ {
+ MethodEntry method = (MethodEntry)methodList.elementAt (i);
+ ((MethodGen)method.generator ()).skeleton
+ (symbolTable, method, stream, realI);
+ if (method instanceof AttributeEntry &&
+ !((AttributeEntry)method).readOnly ())
+ realI += 2;
+ else
+ ++realI;
+ stream.println ();
+ }
+ } // writeMethods
+
+ /**
+ *
+ **/
+ private void writeIDs ()
+ {
+ Vector list = new Vector ();
+ buildIDList (i, list);
+ Enumeration e = list.elements ();
+ boolean first = true;
+ while (e.hasMoreElements ())
+ {
+ if (first)
+ first = false;
+ else
+ stream.println (", ");
+ stream.print (" \"" + (String)e.nextElement () + '"');
+ }
+ } // writeIDs
+
+ /**
+ *
+ **/
+ private void buildIDList (InterfaceEntry entry, Vector list)
+ {
+ if (!entry.fullName ().equals ("org/omg/CORBA/Object"))
+ {
+ String id = Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ());
+ if (!list.contains (id))
+ list.addElement (id);
+ Enumeration e = entry.derivedFrom ().elements ();
+ while (e.hasMoreElements ())
+ buildIDList ((InterfaceEntry)e.nextElement (), list);
+ }
+ } // buildIDList
+
+ /**
+ *
+ **/
+ protected void writeCORBAOperations ()
+ {
+ stream.println (" // Type-specific CORBA::Object operations");
+
+ stream.println (" private static String[] __ids = {");
+ writeIDs ();
+ stream.println ("};");
+ stream.println ();
+ if (poa)
+ writePOACORBAOperations();
+ else
+ writeNonPOACORBAOperations();
+
+ } // writeCORBAOperations
+
+ protected void writePOACORBAOperations(){
+ stream.println (" public String[] _all_interfaces (org.omg.PortableServer.POA poa, byte[] objectId)");
+ //Right now, with our POA implementation, the same
+ //implementation of _ids() type methods seem to work for both non-POA
+ //as well as POA servers. We need to REVISIT since the equivalent
+ //POA interface, i.e. _all_interfaces, has parameters which are not being
+ //used in the _ids() implementation.
+ stream.println (" {");
+ stream.println (" return (String[])__ids.clone ();");
+ stream.println (" }");
+ stream.println ();
+ //_this()
+ stream.println (" public "+ i.name() +" _this() ");
+ stream.println (" {");
+ stream.println (" return "+ i.name() +"Helper.narrow(" );
+ stream.println (" super._this_object());");
+ stream.println (" }");
+ stream.println ();
+ //_this(org.omg.CORBA.ORB orb)
+ stream.println (" public "+ i.name() +" _this(org.omg.CORBA.ORB orb) ");
+ stream.println (" {");
+ stream.println (" return "+ i.name() +"Helper.narrow(" );
+ stream.println (" super._this_object(orb));");
+ stream.println (" }");
+ stream.println ();
+ }
+ protected void writeNonPOACORBAOperations(){
+ stream.println (" public String[] _ids ()");
+ stream.println (" {");
+ stream.println (" return (String[])__ids.clone ();");
+ stream.println (" }");
+ stream.println ();
+ }
+ /**
+ *
+ **/
+ protected void writeOperations ()
+ {
+ // _get_ids removed at Simon's request 8/26/98 - KLR
+ } // writeOperations
+
+ protected Hashtable symbolTable = null;
+ protected InterfaceEntry i = null;
+ protected PrintWriter stream = null;
+
+ // Unique to this generator
+ protected String tieClassName = null;
+ protected String skeletonClassName = null;
+ protected boolean tie = false;
+ protected boolean poa = false;
+ protected Vector methodList = null;
+ protected String intfName = "";
+} // class Skeleton
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StringGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StringGen.java
new file mode 100644
index 0000000..ce92610
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StringGen.java
@@ -0,0 +1,139 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D61056 <klr> Use Util.helperName
+
+import java.io.PrintWriter;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+
+/**
+ * Handles generation of CORBA strings as well as wstrings. Be careful
+ * not to forget the wstrings.
+ **/
+public class StringGen implements com.sun.tools.corba.se.idl.StringGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public StringGen ()
+ {
+ } // ctor
+
+ /**
+ * This should never be called. This class exists for the
+ * JavaGenerator interface.
+ **/
+ public void generate (Hashtable symbolTable, StringEntry e, PrintWriter stream)
+ {
+ } // generate
+
+ ///////////////
+ // From JavaGenerator
+
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ return type(index, indent, tcoffsets, name, entry, stream);
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
+ tcoffsets.set (entry);
+ StringEntry stringEntry = (StringEntry)entry;
+ String bound;
+ if (stringEntry.maxSize () == null)
+ bound = "0";
+ else
+ bound = Util.parseExpression (stringEntry.maxSize ());
+
+ // entry.name() is necessary to determine whether it is a
+ // string or wstring
+
+ stream.println (indent
+ + name
+ + " = org.omg.CORBA.ORB.init ().create_"
+ + entry.name()
+ + "_tc ("
+ + bound + ");");
+ return index;
+ } // type
+
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ } // helperRead
+
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ } // helperWrite
+
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ StringEntry string = (StringEntry)entry;
+ String entryName = entry.name ();
+ if (entryName.equals ("string"))
+ stream.println (indent + name + " = istream.read_string ();");
+ else if (entryName.equals ("wstring"))
+ stream.println (indent + name + " = istream.read_wstring ();");
+ if (string.maxSize () != null)
+ {
+ stream.println (indent + "if (" + name + ".length () > (" + Util.parseExpression (string.maxSize ()) + "))");
+ stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
+ }
+ return index;
+ } // read
+
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ StringEntry string = (StringEntry)entry;
+ if (string.maxSize () != null)
+ {
+ stream.print (indent + "if (" + name + ".length () > (" + Util.parseExpression (string.maxSize ()) + "))");
+ stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
+ }
+ String entryName = entry.name ();
+ if (entryName.equals ("string"))
+ stream.println (indent + "ostream.write_string (" + name + ");");
+ else if (entryName.equals ("wstring"))
+ stream.println (indent + "ostream.write_wstring (" + name + ");");
+ return index;
+ } // write
+
+ // From JavaGenerator
+ ///////////////
+} // class StringGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StructGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StructGen.java
new file mode 100644
index 0000000..610efad
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/StructGen.java
@@ -0,0 +1,455 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// - Think about arrays (and sequences?) as members
+// - A sequence must be converted to an array, but a memory of the
+// max size must be retained.
+// - After demarshalling an IOR, think about how to deal with the exceptions.
+// - The demarshall method should be throwing a ClientException,
+// but should it, really?
+// -D60929 <klr> Update for RTF2.4 changes
+// -D61056 <klr> Use Util.helperName
+// -D62023 <klr> Use corbaLevel in read/write generation
+// -D59437 <daz> Modify read() to enit qualified name of value box helper.
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.EnumEntry;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.StructEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+
+/**
+ *
+ **/
+public class StructGen implements com.sun.tools.corba.se.idl.StructGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public StructGen ()
+ {
+ } // ctor
+
+ /**
+ * Constructor for ExceptionGen.
+ **/
+ protected StructGen (boolean exception)
+ {
+ thisIsReallyAnException = exception;
+ } // ctor
+
+ /**
+ *
+ **/
+ public void generate (Hashtable symbolTable, StructEntry s, PrintWriter str)
+ {
+ this.symbolTable = symbolTable;
+ this.s = s;
+ //init ();
+
+ openStream ();
+ if (stream == null)
+ return;
+ generateHelper ();
+ generateHolder ();
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ generateContainedTypes ();
+ } // generate
+
+ /**
+ * Initialize members unique to this generator.
+ **/
+ protected void init ()
+ {
+ } // init
+
+ /**
+ *
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (s, ".java");
+ } // openStream
+
+ /**
+ *
+ **/
+ protected void generateHelper ()
+ {
+ ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, s);
+ } // generateHelper
+
+ /**
+ *
+ **/
+ protected void generateHolder ()
+ {
+ ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, s);
+ } // generateHolder
+
+ /**
+ *
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, s);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+
+ if (s.comment () != null)
+ s.comment ().generate ("", stream);
+
+ stream.print ("public final class " + s.name ());
+ if (thisIsReallyAnException)
+ stream.print (" extends org.omg.CORBA.UserException");
+ else
+ stream.print(" implements org.omg.CORBA.portable.IDLEntity");
+ stream.println ();
+ stream.println ("{");
+ } // writeHeading
+
+ /**
+ *
+ **/
+ protected void writeBody ()
+ {
+ writeMembers ();
+ writeCtors ();
+ } // writeBody
+
+ /**
+ *
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ("} // class " + s.name ());
+ } // writeClosing
+
+ /**
+ *
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ /**
+ *
+ **/
+ protected void generateContainedTypes ()
+ {
+ // Generate all of the contained types
+ Enumeration e = s.contained ().elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry entry = (SymtabEntry)e.nextElement ();
+
+ // Don't generate contained entries if they are sequences.
+ // Sequences are unnamed and since they translate to arrays,
+ // no classes are generated for them, not even holders in this
+ // case since they cannot be accessed outside of this struct.
+
+ if (!(entry instanceof SequenceEntry))
+ entry.generate (symbolTable, stream);
+ }
+ } // generateContainedTypes
+
+ /**
+ *
+ **/
+ protected void writeMembers ()
+ {
+ // Write members and populate quality arrays
+ int size = s.members ().size ();
+ memberIsPrimitive = new boolean [size];
+ memberIsInterface = new boolean [size];
+ memberIsTypedef = new boolean [size];
+ for (int i = 0; i < s.members ().size (); ++i)
+ {
+ SymtabEntry member = (SymtabEntry)s.members ().elementAt (i);
+ memberIsPrimitive[i] = member.type () instanceof PrimitiveEntry;
+ memberIsInterface[i] = member.type () instanceof InterfaceEntry;
+ memberIsTypedef[i] = member.type () instanceof TypedefEntry;
+ Util.fillInfo (member);
+ // Transfer member comment to target <31jul1997>.
+ if (member.comment () != null)
+ member.comment ().generate (" ", stream);
+ Util.writeInitializer (" public ", member.name (), "", member, stream);
+ }
+ } // writeMembers
+
+ /**
+ *
+ **/
+ protected void writeCtors ()
+ {
+ // Write default ctor
+ stream.println ();
+ stream.println (" public " + s.name () + " ()");
+ stream.println (" {");
+ // fixed mapping for exceptions
+ if (thisIsReallyAnException)
+ stream.println (" super(" + s.name() + "Helper.id());");
+ stream.println (" } // ctor");
+ writeInitializationCtor(true);
+ if (thisIsReallyAnException) {
+ // for exception according to mapping we should always
+ // have a full constructor
+ writeInitializationCtor(false);
+ }
+ }
+
+ private void writeInitializationCtor(boolean init)
+ {
+ // Write initialization ctor
+ if (!init || (s.members ().size () > 0))
+ {
+ stream.println ();
+ stream.print (" public " + s.name () + " (");
+ boolean firstTime = true;
+ if (!init) {
+ stream.print ("String $reason");
+ firstTime = false;
+ }
+
+ for (int i = 0; i < s.members ().size (); ++i)
+ {
+ SymtabEntry member = (SymtabEntry)s.members ().elementAt (i);
+ if (firstTime)
+ firstTime = false;
+ else
+ stream.print (", ");
+ stream.print (Util.javaName (member) + " _" + member.name ());
+ }
+ stream.println (")");
+ stream.println (" {");
+ // fixed mapping for exceptions
+ if (thisIsReallyAnException) {
+ if (init)
+ stream.println (" super(" + s.name() + "Helper.id());");
+ else
+ stream.println (" super(" + s.name() + "Helper.id() + \" \" + $reason);");
+ }
+ for (int i = 0; i < s.members ().size (); ++i)
+ {
+ SymtabEntry member = (SymtabEntry)s.members ().elementAt (i);
+ stream.println (" " + member.name () + " = _" + member.name () + ";");
+ }
+ stream.println (" } // ctor");
+ }
+ stream.println ();
+ } // writeInitializationCtor
+
+ ///////////////
+ // From JavaGenerator
+
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ TCOffsets innerOffsets = new TCOffsets ();
+ innerOffsets.set (entry);
+ int offsetForStruct = innerOffsets.currentOffset ();
+ StructEntry s = (StructEntry)entry;
+ String membersName = "_members" + index++;
+ stream.println (indent + "org.omg.CORBA.StructMember[] " + membersName + " = new org.omg.CORBA.StructMember [" + s.members ().size () + "];");
+ String tcOfMembers = "_tcOf" + membersName;
+ stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;");
+ for (int i = 0; i < s.members ().size (); ++i)
+ {
+ TypedefEntry member = (TypedefEntry)s.members ().elementAt (i);
+ String memberName = member.name ();
+ // Generate and assign member TypeCode to tcofMembers
+ index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
+ stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.StructMember (");
+ stream.println (indent + " \"" + Util.stripLeadingUnderscores (memberName) + "\",");
+ stream.println (indent + " " + tcOfMembers + ',');
+ stream.println (indent + " null);");
+ int offsetSoFar = innerOffsets.currentOffset ();
+ innerOffsets = new TCOffsets ();
+ innerOffsets.set (entry);
+ innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForStruct);
+
+ }
+ tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
+ // <54697>
+ //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_struct_tc (id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");");
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_" + (thisIsReallyAnException ? "exception" : "struct") + "_tc (" + Util.helperName (s, true) + ".id (), \"" + Util.stripLeadingUnderscores (entry.name ()) + "\", " + membersName + ");"); // <d61056>
+ return index;
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
+ stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
+ return index;
+ } // type
+
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (" " + entryName + " value = new " + entryName + " ();");
+ read (0, " ", "value", entry, stream);
+ stream.println (" return value;");
+ } // helperRead
+
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ if (thisIsReallyAnException)
+ {
+ stream.println (indent + "// read and discard the repository ID");
+ stream.println (indent + "istream.read_string ();");
+ }
+
+ Enumeration e = ((StructEntry)entry).members ().elements ();
+ while (e.hasMoreElements ())
+ {
+ TypedefEntry member = (TypedefEntry)e.nextElement ();
+ SymtabEntry mType = member.type ();
+
+ if (!member.arrayInfo ().isEmpty () || mType instanceof SequenceEntry ||
+ mType instanceof PrimitiveEntry || mType instanceof StringEntry ||
+ mType instanceof TypedefEntry)
+ index = ((JavaGenerator)member.generator ()).read (index, indent, name + '.' + member.name (), member, stream);
+ else if (mType instanceof ValueBoxEntry)
+ {
+ // call read_value instead of Helper.read for the value
+ Vector st = ((ValueBoxEntry) mType).state ();
+ TypedefEntry vbMember = ((InterfaceState) st.elementAt (0)).entry;
+ SymtabEntry vbType = vbMember.type ();
+
+ String jName = null;
+ String jHelper = null;
+
+ if (vbType instanceof SequenceEntry || vbType instanceof StringEntry ||
+ !vbMember.arrayInfo ().isEmpty ())
+ {
+ jName = Util.javaName (vbType); // name of mapped Java type
+ // <d59437> REVISIT. Typename info. now correct for value boxes, so
+ // these two cases may be obsolete. See UnionGen.read().
+ //jHelper = Util.helperName (vbType, false); // <d61056>
+ jHelper = Util.helperName (mType, true);
+ }
+ else
+ {
+ jName = Util.javaName (mType); // name of mapped Java class
+ // <d59437>
+ //jHelper = Util.helperName (mType, false); // <d61056>
+ jHelper = Util.helperName (mType, true);
+ }
+ // <d62023> Call xHelper.read() for valueboxes for RTF2.4
+ if (Util.corbaLevel (2.4f, 99.0f))
+ stream.println (indent + name + '.' + member.name () + " = (" + jName + ") " + jHelper + ".read (istream);");
+ else
+ stream.println (indent + name + '.' + member.name () + " = (" + jName + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + jHelper + ".get_instance ());"); // <d60929> <d61056>
+ }
+ // <d62023-klr> for corbaLevel 2.4 and up, use Helper.read like
+ // everything else
+ else if ((mType instanceof ValueEntry) &&
+ !Util.corbaLevel (2.4f, 99.0f)) // <d62023>
+ {
+ // call read_value instead of Helper.read for the value
+ stream.println (indent + name + '.' + member.name () + " = (" + Util.javaName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, false) + ".get_instance ());"); // <d60929> // <d61056>
+ }
+ else
+ stream.println (indent + name + '.' + member.name () + " = " + Util.helperName (member.type (), true) + ".read (istream);"); // <d61056>
+ }
+ return index;
+ } // read
+
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ write (0, " ", "value", entry, stream);
+ } // helperWrite
+
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ if (thisIsReallyAnException)
+ {
+ stream.println (indent + "// write the repository ID");
+ stream.println (indent + "ostream.write_string (id ());");
+ }
+
+ Vector members = ((StructEntry)entry).members ();
+ for (int i = 0; i < members.size (); ++i)
+ {
+ TypedefEntry member = (TypedefEntry)members.elementAt (i);
+ SymtabEntry mType = member.type ();
+
+ if (!member.arrayInfo ().isEmpty () || mType instanceof SequenceEntry ||
+ mType instanceof TypedefEntry || mType instanceof PrimitiveEntry ||
+ mType instanceof StringEntry)
+ index = ((JavaGenerator)member.generator ()).write (index, " ", name + '.' + member.name (), member, stream);
+
+ // <d62023-klr> for corbaLevel 2.4 and up, use Helper.write like
+ // everything else
+ else if ((mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
+ && !Util.corbaLevel (2.4f, 99.0f)) { // <d62023>
+ stream.println (indent + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) " // <d60929>
+ + name + '.' + member.name () + ", "
+ + Util.helperName (member.type (), true) // <d61056>
+ + ".get_instance ());"); // <d61056>
+ }
+ else
+ stream.println (indent + Util.helperName (member.type (), true) + ".write (ostream, " + name + '.' + member.name () + ");"); // <d61056>
+ }
+ return index;
+ } // write
+
+ // From JavaGenerator
+ ///////////////
+
+ protected Hashtable symbolTable = null;
+ protected StructEntry s = null;
+ protected PrintWriter stream = null;
+
+ protected boolean thisIsReallyAnException = false;
+ private boolean[] memberIsPrimitive;
+ private boolean[] memberIsInterface;
+ private boolean[] memberIsTypedef;
+} // class StructGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java
new file mode 100644
index 0000000..c305ada
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Stub.java
@@ -0,0 +1,380 @@
+/*
+ * Copyright (c) 1999, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.AttributeEntry;
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+
+/**
+ *
+ **/
+public class Stub implements AuxGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public Stub ()
+ {
+ } // ctor
+
+ /**
+ *
+ **/
+ public void generate (Hashtable symbolTable, SymtabEntry entry)
+ {
+ this.symbolTable = symbolTable;
+ this.i = (InterfaceEntry)entry;
+ this.localStub = i.isLocalServant();
+ this.isAbstract = i.isAbstract( );
+ init ();
+
+ openStream ();
+ if (stream == null)
+ return;
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ } // generate
+
+ /**
+ * Initialize unique members of this generator.
+ **/
+ protected void init ()
+ {
+ classSuffix = "Stub";
+ } // init
+
+ /**
+ *
+ **/
+ protected void openStream ()
+ {
+ String name = '_' + i.name () + classSuffix;
+ String pkg = Util.containerFullName (i.container ());
+ if (pkg != null && !pkg.equals (""))
+ {
+ Util.mkdir (pkg);
+ name = pkg + '/' + name;
+ }
+ stream = Util.getStream (name.replace ('/', File.separatorChar) + ".java", i);
+ } // openStream
+
+ /**
+ *
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, i, Util.StubFile);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+
+ // Transfer interface comment to target <31jul1997>.
+ if (i.comment () != null)
+ i.comment ().generate ("", stream);
+
+ writeClassDeclaration ();
+ stream.println ('{');
+ } // writeHeading
+
+ /**
+ *
+ **/
+ protected void writeClassDeclaration ()
+ {
+ stream.print ("public class _" + i.name () + classSuffix + " extends org.omg.CORBA.portable.ObjectImpl");
+ stream.println (" implements " + Util.javaName (i));
+ } // writeClassDeclaration
+
+ /**
+ * Steps done within writeBody include:
+ * 1.) makeCtors ();
+ * 2.) buildMethodList ();
+ * 3.) makeMethods ();
+ * 4.) makeCORBAObjectMethods ()
+ **/
+ protected void writeBody ()
+ {
+ writeCtors ();
+ buildMethodList ();
+ writeMethods ();
+ writeCORBAObjectMethods ();
+ writeSerializationMethods ();
+ } // writeBody
+
+ /**
+ *
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ("} // class _" + i.name () + classSuffix);
+ } // writeClosing
+
+ /**
+ *
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ /**
+ *
+ **/
+ protected void writeCtors ()
+ {
+ String name = i.name ();
+
+ /*** the constructors are not generated as per ptc/00-01-08.pdf
+ * since these are non-standard APIs, and same can be accomplished
+ * programatically, we need to comment this out, in order to
+ * be able to generate standard stubs
+ */
+
+ /*************
+ stream.println (" // Constructors");
+ stream.println (" // NOTE: If the default constructor is used, the");
+ stream.println (" // object is useless until _set_delegate (...)");
+ stream.println (" // is called.");
+ stream.println (" public _" + name + classSuffix + " ()");
+ stream.println (" {");
+ stream.println (" super ();");
+ stream.println (" }");
+ stream.println ();
+ stream.println (" public _" + name + classSuffix + " (org.omg.CORBA.portable.Delegate delegate)");
+ stream.println (" {");
+ stream.println (" super ();");
+ stream.println (" _set_delegate (delegate);");
+ stream.println (" }");
+ ***************/
+ // This is confusing since we have localOptimization flag as well.
+ // We have left this code because JCK team filed a P1 bug for changing
+ // _opsClass to $opsClass. Will clean it up in Tiger
+ // _REVISIT_ (Hemanth 03/05/2002)
+ if (localStub) {
+ stream.println (" final public static java.lang.Class _opsClass = " +
+ name + "Operations.class;");
+ stream.println ();
+ }
+ stream.println ();
+ } // writeCtors
+
+ /**
+ * Build a list of all of the methods, keeping out duplicates.
+ **/
+ protected void buildMethodList ()
+ {
+ // Start from scratch
+ methodList = new Vector ();
+
+ buildMethodList (i);
+ } // buildMethodList
+
+ /**
+ *
+ **/
+ private void buildMethodList (InterfaceEntry entry)
+ {
+ // Add the local methods
+ Enumeration locals = entry.methods ().elements ();
+ while (locals.hasMoreElements ())
+ addMethod ((MethodEntry)locals.nextElement ());
+
+ // Add the inherited methods
+ Enumeration parents = entry.derivedFrom ().elements ();
+ while (parents.hasMoreElements ())
+ {
+ InterfaceEntry parent = (InterfaceEntry)parents.nextElement ();
+ if (!parent.name ().equals ("Object"))
+ buildMethodList (parent);
+ }
+ } // buildMethodList
+
+ /**
+ *
+ **/
+ private void addMethod (MethodEntry method)
+ {
+ if (!methodList.contains (method))
+ methodList.addElement (method);
+ } // addMethod
+
+ /**
+ *
+ **/
+ protected void writeMethods ()
+ {
+ // Count the methods, attributes which are not readonly are
+ // counted as 2 methods.
+ int count = methodList.size ();
+ Enumeration e = methodList.elements ();
+ while (e.hasMoreElements ())
+ {
+ Object method = e.nextElement ();
+ if (method instanceof AttributeEntry && !((AttributeEntry)method).readOnly ())
+ ++count;
+ }
+
+ if( (((Arguments)Compile.compiler.arguments).LocalOptimization )
+ && !isAbstract )
+ {
+ stream.println( " final public static java.lang.Class _opsClass =" );
+ stream.println( " " + this.i.name() + "Operations.class;" );
+ }
+
+ // Write the methods
+ int realI = 0;
+ for (int i = 0; i < methodList.size (); ++i)
+ {
+ MethodEntry method = (MethodEntry)methodList.elementAt (i);
+ if (!localStub) {
+ ((MethodGen)method.generator ()).stub (this.i.name(), isAbstract, symbolTable, method, stream, realI);
+ } else {
+ ((MethodGen)method.generator ()).localstub (symbolTable, method, stream, realI, this.i);
+ }
+ if (method instanceof AttributeEntry && !((AttributeEntry)method).readOnly ())
+ realI += 2;
+ else
+ ++realI;
+ }
+ } // writeMethods
+
+ /**
+ *
+ **/
+ private void buildIDList (InterfaceEntry entry, Vector list)
+ {
+ if (!entry.fullName ().equals ("org/omg/CORBA/Object"))
+ {
+ String id = Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ());
+ if (!list.contains (id))
+ list.addElement (id);
+ Enumeration e = entry.derivedFrom ().elements ();
+ while (e.hasMoreElements ())
+ buildIDList ((InterfaceEntry)e.nextElement (), list);
+ }
+ } // buildIDList
+
+ /**
+ *
+ **/
+ private void writeIDs ()
+ {
+ Vector list = new Vector ();
+ buildIDList (i, list);
+ Enumeration e = list.elements ();
+ boolean first = true;
+ while (e.hasMoreElements ())
+ {
+ if (first)
+ first = false;
+ else
+ stream.println (", ");
+ stream.print (" \"" + (String)e.nextElement () + '"');
+ }
+ } // writeIDs
+
+ /**
+ *
+ **/
+ protected void writeCORBAObjectMethods ()
+ {
+ stream.println (" // Type-specific CORBA::Object operations");
+ stream.println (" private static String[] __ids = {");
+ writeIDs ();
+ stream.println ("};");
+ stream.println ();
+ stream.println (" public String[] _ids ()");
+ stream.println (" {");
+ stream.println (" return (String[])__ids.clone ();");
+ stream.println (" }");
+ stream.println ();
+ } // writeCORBAObjectMethods
+
+ /**
+ *
+ **/
+ protected void writeSerializationMethods ()
+ {
+ stream.println (" private void readObject (java.io.ObjectInputStream s) throws java.io.IOException");
+ stream.println (" {");
+ stream.println (" String str = s.readUTF ();");
+ stream.println (" String[] args = null;");
+ stream.println (" java.util.Properties props = null;");
+ stream.println (" org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);");
+ stream.println (" try {");
+ stream.println (" org.omg.CORBA.Object obj = orb.string_to_object (str);");
+ stream.println (" org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();");
+ stream.println (" _set_delegate (delegate);");
+ stream.println (" } finally {");
+ stream.println (" orb.destroy() ;");
+ stream.println (" }");
+ stream.println (" }");
+ stream.println ();
+ stream.println (" private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException");
+ stream.println (" {");
+ stream.println (" String[] args = null;");
+ stream.println (" java.util.Properties props = null;");
+ stream.println (" org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init (args, props);");
+ stream.println (" try {");
+ stream.println (" String str = orb.object_to_string (this);");
+ stream.println (" s.writeUTF (str);");
+ stream.println (" } finally {");
+ stream.println (" orb.destroy() ;");
+ stream.println (" }");
+ stream.println (" }");
+ }
+
+ protected Hashtable symbolTable = null;
+ protected InterfaceEntry i = null;
+ protected PrintWriter stream = null;
+
+ // Unique to this generator
+ protected Vector methodList = null;
+ protected String classSuffix = "";
+ protected boolean localStub = false;
+ private boolean isAbstract = false;
+} // class Stub
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TCOffsets.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TCOffsets.java
new file mode 100644
index 0000000..5cf903d
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TCOffsets.java
@@ -0,0 +1,145 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.*;
+
+// This class is passed through the JavaGenerator.HelperType methods.
+// It is ONLY used when a recursive sequence is detected. ie.
+//
+// struct S1
+// {
+// sequence <S1> others;
+// };
+
+/**
+ *
+ **/
+public class TCOffsets
+{
+ /**
+ * Return -1 if the given name is not in the list of types.
+ **/
+ public int offset (String name)
+ {
+ Integer value = (Integer)tcs.get (name);
+ return value == null ? -1 : value.intValue ();
+ } // offset
+
+ /**
+ *
+ **/
+ public void set (SymtabEntry entry)
+ {
+ if (entry == null)
+ offset += 8;
+ else
+ {
+ tcs.put (entry.fullName (), new Integer (offset));
+ offset += 4;
+ String repID = Util.stripLeadingUnderscoresFromID (entry.repositoryID ().ID ());
+ if (entry instanceof InterfaceEntry)
+ offset += alignStrLen (repID) + alignStrLen (entry.name ());
+ else if (entry instanceof StructEntry)
+ offset += alignStrLen (repID) + alignStrLen (entry.name ()) + 4;
+ else if (entry instanceof UnionEntry)
+ offset += alignStrLen (repID) + alignStrLen (entry.name ()) + 12;
+ else if (entry instanceof EnumEntry)
+ {
+ offset += alignStrLen (repID) + alignStrLen (entry.name ()) + 4;
+ Enumeration e = ((EnumEntry)entry).elements ().elements ();
+ while (e.hasMoreElements ())
+ offset += alignStrLen ((String)e.nextElement ());
+ }
+ else if (entry instanceof StringEntry)
+ offset += 4;
+ else if (entry instanceof TypedefEntry)
+ {
+ offset += alignStrLen (repID) + alignStrLen (entry.name ());
+ if (((TypedefEntry)entry).arrayInfo ().size () != 0)
+ offset += 8;
+ }
+ }
+ } // set
+
+ /**
+ * Return the full length of the string type: 4 byte length, x bytes for
+ * string + 1 for the null terminator, align it so it ends on a 4-byte
+ * boundary. This method assumes the string starts at a 4-byte boundary
+ * since it doesn't do any leading alignment.
+ **/
+ public int alignStrLen (String string)
+ {
+ int len = string.length () + 1;
+ int align = 4 - (len % 4);
+ if (align == 4) align = 0;
+ return len + align + 4;
+ } // alignStrLen
+
+ /**
+ *
+ **/
+ public void setMember (SymtabEntry entry)
+ {
+ offset += alignStrLen (entry.name ());
+ if (((TypedefEntry)entry).arrayInfo ().size () != 0)
+ offset += 4;
+ } // setMember
+
+ /**
+ *
+ **/
+ public int currentOffset ()
+ {
+ return offset;
+ } // currentOffset
+
+ /**
+ *
+ **/
+ public void bumpCurrentOffset (int value)
+ {
+ offset += value;
+ } // bumpCurrentOffset
+
+ private Hashtable tcs = new Hashtable ();
+ private int offset = 0;
+} // class TCOffsets
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TypedefGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TypedefGen.java
new file mode 100644
index 0000000..775a493
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/TypedefGen.java
@@ -0,0 +1,326 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -11aug1997<daz> No modification: comments for type_defs will appear in
+// helper, holder classes as a result of modifications to routines
+// makeHelper(), makeHolder() in class com.sun.tools.corba.se.idl.toJava.Util.
+// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
+// -D61056 <klr> Use Util.helperName
+
+import java.io.PrintWriter;
+
+import java.util.Enumeration;
+import java.util.Hashtable;
+
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.StructEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.UnionEntry;
+
+import com.sun.tools.corba.se.idl.constExpr.Expression;
+
+// Notes:
+
+/**
+ *
+ **/
+public class TypedefGen implements com.sun.tools.corba.se.idl.TypedefGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public TypedefGen ()
+ {
+ } // ctor
+
+ /**
+ *
+ **/
+ public void generate (Hashtable symbolTable, TypedefEntry t, PrintWriter stream)
+ {
+ this.symbolTable = symbolTable;
+ this.t = t;
+
+ if (t.arrayInfo ().size () > 0 || t.type () instanceof SequenceEntry)
+ generateHolder ();
+ generateHelper ();
+ } // generator
+
+ /**
+ *
+ **/
+ protected void generateHolder ()
+ {
+ ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, t);
+ }
+
+ /**
+ *
+ **/
+ protected void generateHelper ()
+ {
+ ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, t);
+ }
+
+ ///////////////
+ // From JavaGenerator
+
+ private boolean inStruct (TypedefEntry entry)
+ {
+ boolean inStruct = false;
+ if (entry.container () instanceof StructEntry || entry.container () instanceof UnionEntry)
+ inStruct = true;
+ else if (entry.container () instanceof InterfaceEntry)
+ {
+ InterfaceEntry i = (InterfaceEntry)entry.container ();
+ if (i.state () != null)
+ {
+ Enumeration e = i.state ().elements ();
+ while (e.hasMoreElements ())
+ if (((InterfaceState)e.nextElement ()).entry == entry)
+ {
+ inStruct = true;
+ break;
+ }
+ }
+ }
+ return inStruct;
+ } // inStruct
+
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ TypedefEntry td = (TypedefEntry)entry;
+ boolean inStruct = inStruct (td);
+ if (inStruct)
+ tcoffsets.setMember (entry);
+ else
+ tcoffsets.set (entry);
+
+ // Print the base types typecode
+ index = ((JavaGenerator)td.type ().generator ()).type (index, indent, tcoffsets, name, td.type (), stream);
+
+ if (inStruct && td.arrayInfo ().size () != 0)
+ tcoffsets.bumpCurrentOffset (4); // for array length field
+
+ // Print the array typecodes (if there are any)
+ int dimensions = td.arrayInfo ().size ();
+ for (int i = 0; i < dimensions; ++i)
+ {
+ String size = Util.parseExpression ((Expression)td.arrayInfo ().elementAt (i));
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_array_tc (" + size + ", " + name + " );");
+ }
+
+ // If this typedef describes a struct/union member, don't put it
+ // in an alias typedef; otherwise that's where it belongs.
+ if (!inStruct)
+ // <54697>
+ //stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_alias_tc (id (), \"" + Util.stripLeadingUnderscores (td.name ()) + "\", " + name + ");");
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_alias_tc (" + Util.helperName (td, true) + ".id (), \"" + Util.stripLeadingUnderscores (td.name ()) + "\", " + name + ");"); // <d61056>
+
+ return index;
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ // The type() method is invoked from other emitters instead of when an IDL
+ // typedef statement is being processed. Code generated is identical minus the
+ // generation of a create_alias_tc() which is required for IDL typedef's but not
+ // needed when typedef is being processed as a member of struct/union/valuetype.
+
+ return helperType( index, indent, tcoffsets, name, entry, stream);
+ } // type
+
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ Util.writeInitializer (" ", "value", "", entry, stream);
+ read (0, " ", "value", entry, stream);
+ stream.println (" return value;");
+ } // helperRead
+
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ write (0, " ", "value", entry, stream);
+ } // helperWrite
+
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ TypedefEntry td = (TypedefEntry)entry;
+ String modifier = Util.arrayInfo (td.arrayInfo ());
+ if (!modifier.equals (""))
+ {
+ // arrayInfo is a vector of Expressions which indicate the
+ // number of array dimensions for this typedef. But what if
+ // this is a typedef of a sequence?
+ // The `new' statement being generated must know the full
+ // number of brackets. That can be found in td.info.
+ // For instance:
+ // typedef sequence<short> A[10][10];
+ // void proc (out A a);
+ // typeModifier = "[10][10]"
+ // td.info = "short[][][]";
+ // The first new statement generated is:
+ // a.value = new short[10][][];
+ // Note that the 3 sets of brackets come from td.info, not
+ // arrayInfo;
+ // The second new statement generated is:
+ // a.value[_i1] = new short[10][];
+ // ------------ ---- ------
+ // \ \ \
+ // name baseName arrayDcl
+ int closingBrackets = 0;
+ String loopIndex = "";
+ String baseName;
+ try
+ {
+ baseName = (String)td.dynamicVariable (Compile.typedefInfo);
+ }
+ catch (NoSuchFieldException e)
+ {
+ baseName = td.name ();
+ }
+ int startArray = baseName.indexOf ('[');
+ String arrayDcl = Util.sansArrayInfo (baseName.substring (startArray)) + "[]"; // Add an extra set because the first gets stripped off in the loop.
+ baseName = baseName.substring (0, startArray);
+
+ // For interfaces having state, e.g., valuetypes.
+ SymtabEntry baseEntry = (SymtabEntry)Util.symbolTable.get (baseName.replace ('.', '/'));
+ if (baseEntry instanceof InterfaceEntry && ((InterfaceEntry)baseEntry).state () != null)
+ // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
+ //baseName = Util.javaStatefulName ((InterfaceEntry)baseEntry);
+ baseName = Util.javaName ((InterfaceEntry)baseEntry);
+
+ int end1stArray;
+ while (!modifier.equals (""))
+ {
+ int rbracket = modifier.indexOf (']');
+ String size = modifier.substring (1, rbracket);
+ end1stArray = arrayDcl.indexOf (']');
+ arrayDcl = '[' + size + arrayDcl.substring (end1stArray + 2);
+ stream.println (indent + name + " = new " + baseName + arrayDcl + ';');
+ loopIndex = "_o" + index++;
+ stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
+ stream.println (indent + '{');
+ ++closingBrackets;
+ modifier = modifier.substring (rbracket + 1);
+ indent = indent + " ";
+ name = name + '[' + loopIndex + ']';
+ }
+ end1stArray = arrayDcl.indexOf (']');
+ if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
+ index = ((JavaGenerator)td.type ().generator ()).read (index, indent, name, td.type (), stream);
+ else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
+ stream.println (indent + name + " = istream.read_Object ();");
+ else
+ stream.println (indent + name + " = " + Util.helperName (td.type (), true) + ".read (istream);"); // <d61056>
+ for (int i = 0; i < closingBrackets; ++i)
+ {
+ indent = indent.substring (2);
+ stream.println (indent + '}');
+ }
+ }
+ else
+ {
+ SymtabEntry tdtype = Util.typeOf (td.type ());
+ if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
+ index = ((JavaGenerator)tdtype.generator ()).read (index, indent, name, tdtype, stream);
+ else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
+ stream.println (indent + name + " = istream.read_Object ();");
+ else
+ stream.println (indent + name + " = " + Util.helperName (tdtype, true) + ".read (istream);"); // <d61056>
+ }
+ return index;
+ } // read
+
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ TypedefEntry td = (TypedefEntry)entry;
+ String modifier = Util.arrayInfo (td.arrayInfo ());
+ if (!modifier.equals (""))
+ {
+ int closingBrackets = 0;
+ String loopIndex = "";
+ while (!modifier.equals (""))
+ {
+ int rbracket = modifier.indexOf (']');
+ String size = modifier.substring (1, rbracket);
+ stream.println (indent + "if (" + name + ".length != (" + size + "))");
+ stream.println (indent + " throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
+ loopIndex = "_i" + index++;
+ stream.println (indent + "for (int " + loopIndex + " = 0;" + loopIndex + " < (" + size + "); ++" + loopIndex + ')');
+ stream.println (indent + '{');
+ ++closingBrackets;
+ modifier = modifier.substring (rbracket + 1);
+ indent = indent + " ";
+ name = name + '[' + loopIndex + ']';
+ }
+ if (td.type () instanceof SequenceEntry || td.type () instanceof PrimitiveEntry || td.type () instanceof StringEntry)
+ index = ((JavaGenerator)td.type ().generator ()).write (index, indent, name, td.type (), stream);
+ else if (td.type () instanceof InterfaceEntry && td.type ().fullName ().equals ("org/omg/CORBA/Object"))
+ stream.println (indent + "ostream.write_Object (" + name + ");");
+ else
+ stream.println (indent + Util.helperName (td.type (), true) + ".write (ostream, " + name + ");"); // <d61056>
+ for (int i = 0; i < closingBrackets; ++i)
+ {
+ indent = indent.substring (2);
+ stream.println (indent + '}');
+ }
+ }
+ else
+ {
+ SymtabEntry tdtype = Util.typeOf (td.type ());
+ if (tdtype instanceof SequenceEntry || tdtype instanceof PrimitiveEntry || tdtype instanceof StringEntry)
+ index = ((JavaGenerator)tdtype.generator ()).write (index, indent, name, tdtype, stream);
+ else if (tdtype instanceof InterfaceEntry && tdtype.fullName ().equals ("org/omg/CORBA/Object"))
+ stream.println (indent + "ostream.write_Object (" + name + ");");
+ else
+ stream.println (indent + Util.helperName (tdtype, true) + ".write (ostream, " + name + ");"); // <d61056>
+ }
+ return index;
+ } // write
+
+ // From JavaGenerator
+ ////////////////
+
+ protected Hashtable symbolTable = null;
+ protected TypedefEntry t = null;
+} // class TypedefGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java
new file mode 100644
index 0000000..89367e6
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/UnionGen.java
@@ -0,0 +1,1074 @@
+/*
+ * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -cast() does not support longlong types yet.
+// -Deal with typedef changes.
+// -Scoped names for the discriminator are ignored at the moment.
+// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
+// -D61056 <klr> Use Util.helperName
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.ConstEntry;
+import com.sun.tools.corba.se.idl.EnumEntry;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.UnionBranch;
+import com.sun.tools.corba.se.idl.UnionEntry;
+
+import com.sun.tools.corba.se.idl.constExpr.Expression;
+import com.sun.tools.corba.se.idl.constExpr.EvaluationException;
+
+/**
+ *
+ **/
+public class UnionGen implements com.sun.tools.corba.se.idl.UnionGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public UnionGen ()
+ {
+ } // ctor
+
+ /**
+ *
+ **/
+ public void generate (Hashtable symbolTable, UnionEntry u, PrintWriter s)
+ {
+ this.symbolTable = symbolTable;
+ this.u = u;
+ init ();
+
+ openStream ();
+ if (stream == null)
+ return;
+ generateHelper ();
+ generateHolder ();
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ generateContainedTypes ();
+ } // generate
+
+ /**
+ * Initialize members unique to this generator.
+ **/
+ protected void init ()
+ {
+ utype = Util.typeOf (u.type ());
+ unionIsEnum = utype instanceof EnumEntry;
+ } // init
+
+ /**
+ *
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (u, ".java");
+ } // openStream
+
+ /**
+ *
+ **/
+ protected void generateHelper ()
+ {
+ ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, u);
+ } // generateHelper
+
+ /**
+ *
+ **/
+ protected void generateHolder ()
+ {
+ ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, u);
+ } // generateHolder
+
+ /**
+ *
+ **/
+ protected void writeHeading ()
+ {
+ // If the discriminator is an enum, assign the typePackage string.
+ if (unionIsEnum)
+ typePackage = Util.javaQualifiedName (utype) + '.';
+ else
+ typePackage = "";
+
+ Util.writePackage (stream, u);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+
+ String className = u.name ();
+ stream.println ("public final class " + u.name () + " implements org.omg.CORBA.portable.IDLEntity");
+ stream.println ("{");
+ } // writeHeading
+
+ /**
+ *
+ **/
+ protected void writeBody ()
+ {
+ // Write branches and populate quality arrays
+ int size = u.branches ().size () + 1;
+ Enumeration e = u.branches ().elements ();
+ int i = 0;
+ while (e.hasMoreElements ())
+ {
+ UnionBranch branch = (UnionBranch)e.nextElement ();
+ Util.fillInfo (branch.typedef);
+ // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
+ //stream.println (" private " + Util.javaStatefulName (branch.typedef) + " ___" + branch.typedef.name () + ";");
+ stream.println (" private " + Util.javaName (branch.typedef) + " ___" + branch.typedef.name () + ";");
+ ++i;
+ }
+ stream.println (" private " + Util.javaName (utype) + " __discriminator;");
+ stream.println (" private boolean __uninitialized = true;");
+
+ // Write ctor
+ stream.println ();
+ stream.println (" public " + u.name () + " ()");
+ stream.println (" {");
+ stream.println (" }");
+
+ // Write discriminator
+ stream.println ();
+ stream.println (" public " + Util.javaName (utype) + " " + safeName (u, "discriminator") + " ()");
+ stream.println (" {");
+ stream.println (" if (__uninitialized)");
+ stream.println (" throw new org.omg.CORBA.BAD_OPERATION ();");
+ stream.println (" return __discriminator;");
+ stream.println (" }");
+
+ // Write for each branch:
+ // - setter
+ // - getter
+ // - private verifyXXX
+ e = u.branches ().elements ();
+ i = 0;
+ while (e.hasMoreElements ())
+ {
+ UnionBranch branch = (UnionBranch)e.nextElement ();
+ writeBranchMethods (stream, u, branch, i++);
+ }
+ if (u.defaultBranch () == null && !coversAll (u))
+ {
+ stream.println ();
+ stream.println (" public void _default ()");
+ stream.println (" {");
+ stream.println (" __discriminator = " + defaultDiscriminator (u) + ';');
+ stream.println (" __uninitialized = false;");
+ stream.println (" }");
+
+ stream.println ();
+ stream.println (" public void _default (" + Util.javaName(utype) +
+ " discriminator)");
+ stream.println (" {");
+ stream.println (" verifyDefault( discriminator ) ;" );
+ stream.println (" __discriminator = discriminator ;");
+ stream.println (" __uninitialized = false;");
+ stream.println (" }");
+
+ writeVerifyDefault() ;
+ }
+ stream.println ();
+ } // writeBody
+
+ /**
+ *
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ("} // class " + u.name ());
+ } // writeClosing
+
+ /**
+ *
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ /**
+ *
+ **/
+ protected void generateContainedTypes ()
+ {
+ Enumeration e = u.contained ().elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry entry = (SymtabEntry)e.nextElement ();
+
+ // Don't generate contained entries if they are sequences.
+ // Sequences are unnamed and since they translate to arrays,
+ // no classes are generated for them, not even holders in this
+ // case since they cannot be accessed outside of this union.
+ if (!(entry instanceof SequenceEntry))
+ entry.generate (symbolTable, stream);
+ }
+ } // generateContainedTypes
+
+ private void writeVerifyDefault()
+ {
+ Vector labels = vectorizeLabels (u.branches (), true);
+
+ if (Util.javaName(utype).equals ("boolean")) {
+ stream.println( "" ) ;
+ stream.println( " private void verifyDefault (boolean discriminator)" ) ;
+ stream.println( " {" ) ;
+ if (labels.contains ("true"))
+ stream.println (" if ( discriminator )");
+ else
+ stream.println (" if ( !discriminator )");
+ stream.println( " throw new org.omg.CORBA.BAD_OPERATION();" ) ;
+ stream.println( " }" ) ;
+ return;
+ }
+
+ stream.println( "" ) ;
+ stream.println( " private void verifyDefault( " + Util.javaName(utype) +
+ " value )" ) ;
+ stream.println( " {" ) ;
+
+ if (unionIsEnum)
+ stream.println( " switch (value.value()) {" ) ;
+ else
+ stream.println( " switch (value) {" ) ;
+
+ Enumeration e = labels.elements() ;
+ while (e.hasMoreElements()) {
+ String str = (String)(e.nextElement()) ;
+ stream.println( " case " + str + ":" ) ;
+ }
+
+ stream.println( " throw new org.omg.CORBA.BAD_OPERATION() ;" ) ;
+ stream.println( "" ) ;
+ stream.println( " default:" ) ;
+ stream.println( " return;" ) ;
+ stream.println( " }" ) ;
+ stream.println( " }" ) ;
+ }
+
+ private String defaultDiscriminator (UnionEntry u)
+ {
+ Vector labels = vectorizeLabels (u.branches (), false );
+ String ret = null;
+ SymtabEntry utype = Util.typeOf (u.type ());
+ if (utype instanceof PrimitiveEntry && utype.name ().equals ("boolean")) {
+ // If it got this far, then:
+ // - there is only one branch;
+ // - that branch has only one label.
+ if (labels.contains ("true"))
+ ret = "false";
+ else
+ ret = "true";
+ } else if (utype.name ().equals ("char")) {
+ // This doesn't handle '\u0030' == '0'. Unions are so
+ // seldom used. I don't have time to make this perfect.
+ int def = 0;
+ String string = "'\\u0000'";
+ while (def != 0xFFFF && labels.contains (string))
+ if (++def / 0x10 == 0)
+ string = "'\\u000" + def + "'";
+ else if (def / 0x100 == 0)
+ string = "\\u00" + def + "'";
+ else if (def / 0x1000 == 0)
+ string = "\\u0" + def + "'";
+ else
+ string = "\\u" + def + "'";
+ ret = string;
+ } else if (utype instanceof EnumEntry) {
+ Enumeration e = labels.elements ();
+ EnumEntry enumEntry = (EnumEntry)utype;
+ Vector enumList = (Vector)enumEntry.elements ().clone ();
+ // cull out those elements in the enumeration list that are
+ // in the cases of this union
+ while (e.hasMoreElements ())
+ enumList.removeElement (e.nextElement ());
+ // If all of the enum elements are covered in this union and
+ // there is a default statement, just pick one of the
+ // elements for the default. If there are enum elements
+ // which are NOT covered by the cases, pick one as the
+ // default.
+ if (enumList.size () == 0)
+ ret = typePackage + (String)enumEntry.elements ().lastElement ();
+ else
+ ret = typePackage + (String)enumList.firstElement ();
+ } else if (utype.name ().equals ("octet")) {
+ short def = Byte.MIN_VALUE;
+ while (def != Byte.MAX_VALUE && labels.contains (Integer.toString (def)))
+ ++def;
+ ret = Integer.toString (def);
+ } else if (utype.name ().equals ("short")) {
+ short def = Short.MIN_VALUE;
+ while (def != Short.MAX_VALUE && labels.contains (Integer.toString (def)))
+ ++def;
+ ret = Integer.toString (def);
+ } else if (utype.name ().equals ("long")) {
+ int def = Integer.MIN_VALUE;
+ while (def != Integer.MAX_VALUE && labels.contains (Integer.toString (def)))
+ ++def;
+ ret = Integer.toString (def);
+ } else if (utype.name ().equals ("long long")) {
+ long def = Long.MIN_VALUE;
+ while (def != Long.MAX_VALUE && labels.contains (Long.toString (def)))
+ ++def;
+ ret = Long.toString (def);
+ } else if (utype.name ().equals ("unsigned short")) {
+ short def = 0;
+ while (def != Short.MAX_VALUE && labels.contains (Integer.toString (def)))
+ ++def;
+ ret = Integer.toString (def);
+ } else if (utype.name ().equals ("unsigned long")) {
+ int def = 0;
+ while (def != Integer.MAX_VALUE && labels.contains (Integer.toString (def)))
+ ++def;
+ ret = Integer.toString (def);
+ } else if (utype.name ().equals ("unsigned long long")) {
+ long def = 0;
+ while (def != Long.MAX_VALUE && labels.contains (Long.toString (def)))
+ ++def;
+ ret = Long.toString (def);
+ }
+
+ return ret;
+ } // defaultDiscriminator
+
+ /**
+ *
+ **/
+ private Vector vectorizeLabels (Vector branchVector, boolean useIntsForEnums )
+ {
+ Vector mergedLabels = new Vector ();
+ Enumeration branches = branchVector.elements ();
+ while (branches.hasMoreElements ())
+ {
+ UnionBranch branch = (UnionBranch)branches.nextElement ();
+ Enumeration labels = branch.labels.elements ();
+ while (labels.hasMoreElements ())
+ {
+ Expression expr = (Expression)labels.nextElement ();
+ String str ;
+
+ if (unionIsEnum)
+ if (useIntsForEnums)
+ str = typePackage + "_" + Util.parseExpression( expr ) ;
+ else
+ str = typePackage + Util.parseExpression( expr ) ;
+ else
+ str = Util.parseExpression( expr ) ;
+
+ mergedLabels.addElement (str);
+ }
+ }
+ return mergedLabels;
+ } // vectorizeLabels
+
+ /**
+ *
+ **/
+ private String safeName (UnionEntry u, String name)
+ {
+ Enumeration e = u.branches ().elements ();
+ while (e.hasMoreElements ())
+ if (((UnionBranch)e.nextElement ()).typedef.name ().equals (name))
+ {
+ name = '_' + name;
+ break;
+ }
+ return name;
+ } // safeName
+
+ /**
+ *
+ **/
+ private boolean coversAll (UnionEntry u)
+ {
+ // This assumes that it is not possible to cover types other than
+ // boolean and enums. This is not quite correct, but since octet
+ // is not a valid discriminator type, it's not too bad in practice.
+ // It may also be possible to cover a char type, but we won't worry
+ // about that either.
+ SymtabEntry utype = Util.typeOf (u.type ());
+
+ boolean coversAll = false;
+ if (utype.name ().equals ("boolean")) {
+ if (u.branches ().size () == 2)
+ coversAll = true;
+ } else if (utype instanceof EnumEntry) {
+ Vector labels = vectorizeLabels (u.branches (), true);
+ if (labels.size () == ((EnumEntry)utype).elements ().size ())
+ coversAll = true;
+ }
+
+ return coversAll;
+ } // coversAll
+
+ /**
+ *
+ **/
+ private void writeBranchMethods (PrintWriter stream, UnionEntry u, UnionBranch branch, int i)
+ {
+ // Write getter
+ stream.println ();
+ // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
+ //stream.println (" public " + Util.javaStatefulName (branch.typedef) + " " + branch.typedef.name () + " ()");
+ stream.println (" public " + Util.javaName (branch.typedef) + " " + branch.typedef.name () + " ()");
+ stream.println (" {");
+ stream.println (" if (__uninitialized)");
+ stream.println (" throw new org.omg.CORBA.BAD_OPERATION ();");
+ stream.println (" verify" + branch.typedef.name () + " (__discriminator);");
+ stream.println (" return ___" + branch.typedef.name () + ";");
+ stream.println (" }");
+
+ // Write setter(s)
+ stream.println ();
+ // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
+ //stream.println (" public void " + branch.typedef.name () + " (" + Util.javaStatefulName (branch.typedef) + " value)");
+ stream.println (" public void " + branch.typedef.name () + " (" + Util.javaName (branch.typedef) + " value)");
+ stream.println (" {");
+ if (branch.labels.size () == 0)
+ {
+ // This is a default branch
+ stream.println (" __discriminator = " + defaultDiscriminator (u) + ";");
+ }
+ else
+ {
+ // This is a non-default branch
+ if (unionIsEnum)
+ stream.println (" __discriminator = " + typePackage + Util.parseExpression ((Expression)branch.labels.firstElement ()) + ";");
+ else
+ stream.println (" __discriminator = " + cast ((Expression)branch.labels.firstElement (), u.type ()) + ";");
+ }
+ stream.println (" ___" + branch.typedef.name () + " = value;");
+ stream.println (" __uninitialized = false;");
+ stream.println (" }");
+
+ SymtabEntry utype = Util.typeOf (u.type ());
+
+ // If there are multiple labels for one branch, write the
+ // setter that takes a discriminator.
+ if (branch.labels.size () > 0 || branch.isDefault)
+ {
+ stream.println ();
+ // <f46082.51> Remove -stateful feature; javaStatefulName() obsolete.
+ //stream.println (" public void " + branch.typedef.name () + " (" + Util.javaName (utype) + " discriminator, " + Util.javaStatefulName (branch.typedef) + " value)");
+ stream.println (" public void " + branch.typedef.name () + " (" + Util.javaName (utype) + " discriminator, " + Util.javaName (branch.typedef) + " value)");
+ stream.println (" {");
+ stream.println (" verify" + branch.typedef.name () + " (discriminator);");
+ stream.println (" __discriminator = discriminator;");
+ stream.println (" ___" + branch.typedef.name () + " = value;");
+ stream.println (" __uninitialized = false;");
+ stream.println (" }");
+ }
+
+ // Write verifyXXX
+ stream.println ();
+ stream.println (" private void verify" + branch.typedef.name () + " (" + Util.javaName (utype) + " discriminator)");
+ stream.println (" {");
+
+ boolean onlyOne = true;
+
+ if (branch.isDefault && u.branches ().size () == 1)
+ ;// If all that is in this union is a default branch,
+ // all discriminators are legal. Don't print any
+ // body to this method in that case.
+ else
+ {
+ // Otherwise this code is executed and a body is printed.
+ stream.print (" if (");
+ if (branch.isDefault)
+ {
+ Enumeration eBranches = u.branches ().elements ();
+ while (eBranches.hasMoreElements ())
+ {
+ UnionBranch b = (UnionBranch)eBranches.nextElement ();
+ if (b != branch)
+ {
+ Enumeration eLabels = b.labels.elements ();
+ while (eLabels.hasMoreElements ())
+ {
+ Expression label = (Expression)eLabels.nextElement ();
+ if (!onlyOne)
+ stream.print (" || ");
+ if (unionIsEnum)
+ stream.print ("discriminator == " + typePackage + Util.parseExpression (label));
+ else
+ stream.print ("discriminator == " + Util.parseExpression (label));
+ onlyOne = false;
+ }
+ }
+ }
+ }
+ else
+ {
+ Enumeration e = branch.labels.elements ();
+ while (e.hasMoreElements ())
+ {
+ Expression label = (Expression)e.nextElement ();
+ if (!onlyOne)
+ stream.print (" && ");
+ if (unionIsEnum)
+ stream.print ("discriminator != " + typePackage + Util.parseExpression (label));
+ else
+ stream.print ("discriminator != " + Util.parseExpression (label));
+ onlyOne = false;
+ }
+ }
+ stream.println (")");
+ stream.println (" throw new org.omg.CORBA.BAD_OPERATION ();");
+ }
+ stream.println (" }");
+ } // writeBranchMethods
+
+ ///////////////
+ // From JavaGenerator
+
+ /**
+ *
+ **/
+
+ // Computes the total number of labels in the union, which is the sum
+ // of the number of labels in each branch of the union. Note that the
+ // label for the default branch has size 0, but still counts in the total
+ // size.
+ private int unionLabelSize( UnionEntry un )
+ {
+ int size = 0 ;
+ Vector branches = un.branches() ;
+ for (int i = 0; i < branches.size (); ++i) {
+ UnionBranch branch = (UnionBranch)(branches.get(i)) ;
+ int branchSize = branch.labels.size() ;
+ size += ((branchSize == 0) ? 1 : branchSize) ;
+ }
+ return size ;
+ }
+
+ public int helperType (int index, String indent, TCOffsets tcoffsets,
+ String name, SymtabEntry entry, PrintWriter stream)
+ {
+ TCOffsets innerOffsets = new TCOffsets ();
+ UnionEntry u = (UnionEntry)entry;
+ String discTypeCode = "_disTypeCode" + index;
+ String membersName = "_members" + index;
+
+ // Build discriminator tc
+ stream.println (indent + "org.omg.CORBA.TypeCode " + discTypeCode + ';');
+ index = ((JavaGenerator)u.type ().generator ()).type (index + 1, indent,
+ innerOffsets, discTypeCode, u.type (), stream);
+ tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
+
+ stream.println (indent + "org.omg.CORBA.UnionMember[] " + membersName +
+ " = new org.omg.CORBA.UnionMember [" + unionLabelSize(u) + "];");
+ String tcOfMembers = "_tcOf" + membersName;
+ String anyOfMembers = "_anyOf" + membersName;
+ stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + ';');
+ stream.println (indent + "org.omg.CORBA.Any " + anyOfMembers + ';');
+
+ innerOffsets = new TCOffsets ();
+ innerOffsets.set (entry);
+ int offsetForUnion = innerOffsets.currentOffset ();
+ for (int i = 0; i < u.branches ().size (); ++i) {
+ UnionBranch branch = (UnionBranch)u.branches ().elementAt (i);
+ TypedefEntry member = branch.typedef;
+ Vector labels = branch.labels;
+ String memberName = Util.stripLeadingUnderscores (member.name ());
+
+ if (labels.size() == 0) {
+ stream.println ();
+ stream.println (indent + "// Branch for " + memberName +
+ " (Default case)" );
+ SymtabEntry utype = Util.typeOf (u.type ());
+ stream.println (indent + anyOfMembers + " = org.omg.CORBA.ORB.init ().create_any ();");
+ // For default member, label is the zero octet (per CORBA spec.)
+ stream.println (indent + anyOfMembers + ".insert_octet ((byte)0); // default member label");
+
+ // Build typecode
+ innerOffsets.bumpCurrentOffset (4); // label value
+ index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
+ int offsetSoFar = innerOffsets.currentOffset ();
+ innerOffsets = new TCOffsets ();
+ innerOffsets.set (entry);
+ innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForUnion);
+
+ // Build union member
+ stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.UnionMember (");
+ stream.println (indent + " \"" + memberName + "\",");
+ stream.println (indent + " " + anyOfMembers + ',');
+ stream.println (indent + " " + tcOfMembers + ',');
+ stream.println (indent + " null);");
+ } else {
+ Enumeration enumeration = labels.elements() ;
+ while (enumeration.hasMoreElements()) {
+ Expression expr = (Expression)(enumeration.nextElement()) ;
+ String elem = Util.parseExpression( expr ) ;
+
+ stream.println ();
+ stream.println (indent + "// Branch for " + memberName +
+ " (case label " + elem + ")" );
+
+ SymtabEntry utype = Util.typeOf (u.type ());
+
+ // Build any
+ stream.println (indent + anyOfMembers + " = org.omg.CORBA.ORB.init ().create_any ();");
+
+ if (utype instanceof PrimitiveEntry)
+ stream.println (indent + anyOfMembers + ".insert_" +
+ Util.collapseName (utype.name ()) + " ((" + Util.javaName (utype) +
+ ')' + elem + ");");
+ else { // it must be enum
+ String enumClass = Util.javaName (utype);
+ stream.println (indent + Util.helperName (utype, false) + ".insert (" +
+ anyOfMembers + ", " + enumClass + '.' + elem + ");"); // <d61056>
+ }
+
+ // Build typecode
+ innerOffsets.bumpCurrentOffset (4); // label value
+ index = ((JavaGenerator)member.generator ()).type (index, indent, innerOffsets, tcOfMembers, member, stream);
+ int offsetSoFar = innerOffsets.currentOffset ();
+ innerOffsets = new TCOffsets ();
+ innerOffsets.set (entry);
+ innerOffsets.bumpCurrentOffset (offsetSoFar - offsetForUnion);
+
+ // Build union member
+ stream.println (indent + membersName + '[' + i + "] = new org.omg.CORBA.UnionMember (");
+ stream.println (indent + " \"" + memberName + "\",");
+ stream.println (indent + " " + anyOfMembers + ',');
+ stream.println (indent + " " + tcOfMembers + ',');
+ stream.println (indent + " null);");
+ }
+ }
+ }
+
+ tcoffsets.bumpCurrentOffset (innerOffsets.currentOffset ());
+
+ // Build create_union_tc
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_union_tc (" +
+ Util.helperName (u, true) + ".id (), \"" + entry.name () + "\", " +
+ discTypeCode + ", " + membersName + ");");
+ return index;
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name,
+ SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();");
+ return index;
+ }
+
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (" " + entryName + " value = new " + entryName + " ();");
+ read (0, " ", "value", entry, stream);
+ stream.println (" return value;");
+ }
+
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ write (0, " ", "value", entry, stream);
+ }
+
+ public int read (int index, String indent, String name,
+ SymtabEntry entry, PrintWriter stream)
+ {
+ UnionEntry u = (UnionEntry)entry;
+ String disName = "_dis" + index++;
+ SymtabEntry utype = Util.typeOf (u.type ());
+ Util.writeInitializer (indent, disName, "", utype, stream);
+
+ if (utype instanceof PrimitiveEntry)
+ index = ((JavaGenerator)utype.generator ()).read (index, indent, disName, utype, stream);
+ else
+ stream.println (indent + disName + " = " + Util.helperName (utype, true) + ".read (istream);");
+
+ if (utype.name ().equals ("boolean"))
+ index = readBoolean (disName, index, indent, name, u, stream);
+ else
+ index = readNonBoolean (disName, index, indent, name, u, stream);
+
+ return index;
+ }
+
+ private int readBoolean (String disName, int index, String indent,
+ String name, UnionEntry u, PrintWriter stream)
+ {
+ UnionBranch firstBranch = (UnionBranch)u.branches ().firstElement ();
+ UnionBranch secondBranch;
+
+ if (u.branches ().size () == 2)
+ secondBranch = (UnionBranch)u.branches ().lastElement ();
+ else
+ secondBranch = null;
+
+ boolean firstBranchIsTrue = false;
+ boolean noCases = false;
+ try {
+ if (u.branches ().size () == 1 &&
+ (u.defaultBranch () != null || firstBranch.labels.size () == 2)) {
+ noCases = true;
+ } else {
+ Expression expr = (Expression)(firstBranch.labels.firstElement()) ;
+ Boolean bool = (Boolean)(expr.evaluate()) ;
+ firstBranchIsTrue = bool.booleanValue ();
+ }
+ } catch (EvaluationException ex) {
+ // no action
+ }
+
+ if (noCases) {
+ // There is only a default label. Since there are no cases,
+ // there is no need for if...else branches.
+ index = readBranch (index, indent, firstBranch.typedef.name (), "", firstBranch.typedef, stream);
+ } else {
+ // If first branch is false, swap branches
+ if (!firstBranchIsTrue) {
+ UnionBranch tmp = firstBranch;
+ firstBranch = secondBranch;
+ secondBranch = tmp;
+ }
+
+ stream.println (indent + "if (" + disName + ')');
+
+ if (firstBranch == null)
+ stream.println (indent + " value._default(" + disName + ");");
+ else {
+ stream.println (indent + '{');
+ index = readBranch (index, indent + " ", firstBranch.typedef.name (),
+ disName, firstBranch.typedef, stream);
+ stream.println (indent + '}');
+ }
+
+ stream.println (indent + "else");
+
+ if (secondBranch == null)
+ stream.println (indent + " value._default(" + disName + ");");
+ else {
+ stream.println (indent + '{');
+ index = readBranch (index, indent + " ", secondBranch.typedef.name (),
+ disName, secondBranch.typedef, stream);
+ stream.println (indent + '}');
+ }
+ }
+
+ return index;
+ }
+
+ private int readNonBoolean (String disName, int index, String indent,
+ String name, UnionEntry u, PrintWriter stream)
+ {
+ SymtabEntry utype = Util.typeOf (u.type ());
+
+ if (utype instanceof EnumEntry)
+ stream.println (indent + "switch (" + disName + ".value ())");
+ else
+ stream.println (indent + "switch (" + disName + ')');
+
+ stream.println (indent + '{');
+ String typePackage = Util.javaQualifiedName (utype) + '.';
+
+ Enumeration e = u.branches ().elements ();
+ while (e.hasMoreElements ()) {
+ UnionBranch branch = (UnionBranch)e.nextElement ();
+ Enumeration labels = branch.labels.elements ();
+
+ while (labels.hasMoreElements ()) {
+ Expression label = (Expression)labels.nextElement ();
+
+ if (utype instanceof EnumEntry) {
+ String key = Util.parseExpression (label);
+ stream.println (indent + " case " + typePackage + '_' + key + ':');
+ } else
+ stream.println (indent + " case " + cast (label, utype) + ':');
+ }
+
+ if (!branch.typedef.equals (u.defaultBranch ())) {
+ index = readBranch (index, indent + " ", branch.typedef.name (),
+ branch.labels.size() > 1 ? disName : "" ,
+ branch.typedef, stream);
+ stream.println (indent + " break;");
+ }
+ }
+
+ // We need a default branch unless all of the case of the discriminator type
+ // are listed in the case branches.
+ if (!coversAll(u)) {
+ stream.println( indent + " default:") ;
+
+ if (u.defaultBranch () == null) {
+ // If the union does not have a default branch, we still need to initialize
+ // the discriminator.
+ stream.println( indent + " value._default( " + disName + " ) ;" ) ;
+ } else {
+ index = readBranch (index, indent + " ", u.defaultBranch ().name (), disName,
+ u.defaultBranch (), stream);
+ }
+
+ stream.println (indent + " break;");
+ }
+
+ stream.println (indent + '}');
+
+ return index;
+ }
+
+ private int readBranch (int index, String indent, String name, String disName, TypedefEntry entry, PrintWriter stream)
+ {
+ SymtabEntry type = entry.type ();
+ Util.writeInitializer (indent, '_' + name, "", entry, stream);
+
+ if (!entry.arrayInfo ().isEmpty () ||
+ type instanceof SequenceEntry ||
+ type instanceof PrimitiveEntry ||
+ type instanceof StringEntry) {
+ index = ((JavaGenerator)entry.generator ()).read (index, indent, '_' + name, entry, stream);
+ } else {
+ stream.println (indent + '_' + name + " = " + Util.helperName (type, true) + ".read (istream);");
+ }
+
+ stream.print (indent + "value." + name + " (");
+ if( disName == "" )
+ stream.println("_" + name + ");");
+ else
+ stream.println(disName + ", " + "_" + name + ");");
+
+ return index;
+ }
+
+ /**
+ *
+ **/
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ UnionEntry u = (UnionEntry)entry;
+ SymtabEntry utype = Util.typeOf (u.type ());
+ if (utype instanceof PrimitiveEntry)
+ index = ((JavaGenerator)utype.generator ()).write (index, indent, name + ".discriminator ()", utype, stream);
+ else
+ stream.println (indent + Util.helperName (utype, true) + ".write (ostream, " + name + ".discriminator ());"); // <d61056>
+ if (utype.name ().equals ("boolean"))
+ index = writeBoolean (name + ".discriminator ()", index, indent, name, u, stream);
+ else
+ index = writeNonBoolean (name + ".discriminator ()", index, indent, name, u, stream);
+ return index;
+ } // write
+
+ /**
+ *
+ **/
+ private int writeBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
+ {
+ SymtabEntry utype = Util.typeOf (u.type ());
+ UnionBranch firstBranch = (UnionBranch)u.branches ().firstElement ();
+ UnionBranch secondBranch;
+ if (u.branches ().size () == 2)
+ secondBranch = (UnionBranch)u.branches ().lastElement ();
+ else
+ secondBranch = null;
+ boolean firstBranchIsTrue = false;
+ boolean noCases = false;
+ try
+ {
+ if (u.branches ().size () == 1 && (u.defaultBranch () != null || firstBranch.labels.size () == 2))
+ noCases = true;
+ else
+ firstBranchIsTrue = ((Boolean)((Expression)firstBranch.labels.firstElement ()).evaluate ()).booleanValue ();
+ }
+ catch (EvaluationException ex)
+ {}
+
+ if (noCases)
+ {
+ // There is only a default label. Since there are no cases,
+ // there is no need for if...else branches.
+ index = writeBranch (index, indent, name, firstBranch.typedef, stream);
+ }
+ else
+ {
+ // If first branch is false, swap branches
+ if (!firstBranchIsTrue)
+ {
+ UnionBranch tmp = firstBranch;
+ firstBranch = secondBranch;
+ secondBranch = tmp;
+ }
+ if (firstBranch != null && secondBranch != null) {
+ stream.println (indent + "if (" + disName + ')');
+ stream.println (indent + '{');
+ index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream);
+ stream.println (indent + '}');
+ stream.println (indent + "else");
+ stream.println (indent + '{');
+ index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream);
+ stream.println (indent + '}');
+ } else if (firstBranch != null) {
+ stream.println (indent + "if (" + disName + ')');
+ stream.println (indent + '{');
+ index = writeBranch (index, indent + " ", name, firstBranch.typedef, stream);
+ stream.println (indent + '}');
+ } else {
+ stream.println (indent + "if (!" + disName + ')');
+ stream.println (indent + '{');
+ index = writeBranch (index, indent + " ", name, secondBranch.typedef, stream);
+ stream.println (indent + '}');
+ }
+ }
+ return index;
+ } // writeBoolean
+
+ /**
+ *
+ **/
+ private int writeNonBoolean (String disName, int index, String indent, String name, UnionEntry u, PrintWriter stream)
+ {
+ SymtabEntry utype = Util.typeOf (u.type ());
+ if (utype instanceof EnumEntry)
+ stream.println (indent + "switch (" + name + ".discriminator ().value ())");
+ else
+ stream.println (indent + "switch (" + name + ".discriminator ())");
+ stream.println (indent + "{");
+ String typePackage = Util.javaQualifiedName (utype) + '.';
+ Enumeration e = u.branches ().elements ();
+ while (e.hasMoreElements ())
+ {
+ UnionBranch branch = (UnionBranch)e.nextElement ();
+ Enumeration labels = branch.labels.elements ();
+ while (labels.hasMoreElements ())
+ {
+ Expression label = (Expression)labels.nextElement ();
+ if (utype instanceof EnumEntry)
+ {
+ String key = Util.parseExpression (label);
+ stream.println (indent + " case " + typePackage + '_' + key + ":");
+ }
+ else
+ stream.println (indent + " case " + cast (label, utype) + ':');
+ }
+ if (!branch.typedef.equals (u.defaultBranch ()))
+ {
+ index = writeBranch (index, indent + " ", name, branch.typedef, stream);
+ stream.println (indent + " break;");
+ }
+ }
+ if (u.defaultBranch () != null) {
+ stream.println (indent + " default:");
+ index = writeBranch (index, indent + " ", name, u.defaultBranch (), stream);
+ stream.println (indent + " break;");
+ }
+ stream.println (indent + "}");
+ return index;
+ } // writeNonBoolean
+
+ /**
+ *
+ **/
+ private int writeBranch (int index, String indent, String name, TypedefEntry entry, PrintWriter stream)
+ {
+ SymtabEntry type = entry.type ();
+ if (!entry.arrayInfo ().isEmpty () || type instanceof SequenceEntry || type instanceof PrimitiveEntry || type instanceof StringEntry)
+ index = ((JavaGenerator)entry.generator ()).write (index, indent, name + '.' + entry.name () + " ()", entry, stream);
+ else
+ stream.println (indent + Util.helperName (type, true) + ".write (ostream, " + name + '.' + entry.name () + " ());"); // <d61056>
+ return index;
+ } // writeBranch
+
+ // From JavaGenerator
+ ///////////////
+
+ /**
+ *
+ **/
+ private String cast (Expression expr, SymtabEntry type)
+ {
+ String ret = Util.parseExpression (expr);
+ if (type.name ().indexOf ("short") >= 0)
+ {
+ if (expr.value () instanceof Long)
+ {
+ long value = ((Long)expr.value ()).longValue ();
+ if (value > Short.MAX_VALUE)
+ ret = "(short)(" + ret + ')';
+ }
+ else if (expr.value () instanceof Integer)
+ {
+ int value = ((Integer)expr.value ()).intValue ();
+ if (value > Short.MAX_VALUE)
+ ret = "(short)(" + ret + ')';
+ }
+ }
+ else if (type.name ().indexOf ("long") >= 0)
+ {
+ if (expr.value () instanceof Long)
+ {
+ long value = ((Long)expr.value ()).longValue ();
+ // value == Integer.MIN_VALUE because if the number is
+ // Integer.MIN_VALUE, then it will have the 'L' suffix and
+ // the cast will be necessary.
+ if (value > Integer.MAX_VALUE || value == Integer.MIN_VALUE)
+ ret = "(int)(" + ret + ')';
+ }
+ else if (expr.value () instanceof Integer)
+ {
+ int value = ((Integer)expr.value ()).intValue ();
+ // value == Integer.MIN_VALUE because if the number is
+ // Integer.MIN_VALUE, then it will have the 'L' suffix and
+ // the cast will be necessary.
+ if (value > Integer.MAX_VALUE || value == Integer.MIN_VALUE)
+ ret = "(int)(" + ret + ')';
+ }
+ }
+ return ret;
+ } // cast
+
+ protected Hashtable symbolTable = null;
+ protected UnionEntry u = null;
+ protected PrintWriter stream = null;
+ protected SymtabEntry utype = null;
+ protected boolean unionIsEnum;
+ protected String typePackage = "";
+} // class UnionGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java
new file mode 100644
index 0000000..7397619
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/Util.java
@@ -0,0 +1,1429 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// Notes:
+// -F46838.4<klr> Ported -td option from toJava.
+// -10/17/98 KLR Ported fix for d48911 from toJava
+// -10/18/98 KLR Ported fix from toJava for "unsigned long" constants
+// -F46082.51<daz> Removed code to collect makefile list generation inforamtion
+// from getStream(); see f46830.
+// -F46082.51<daz> Removed -stateful feature: methods javaStatefulName(String)
+// and javaStatefulName(SymtabEntry) are obsolete, supplanted by javaName().
+// -D54640<daz> Represent unsigned long long expressions with their computed
+// value rather than their actual representation (see notes in method
+// parseTerminal(), parseBinary(), and parseUnary().)
+// -D58319<daz> Add getVersion() method.
+// -D48034<daz> Import Helper classes for typedef struct members when generating
+// helper. See method addImportLines().
+// -D59851<daz> Modify to enable QuickTest build. (pending)
+// -D42256<daz> Determine import lines for template types, which may specify any
+// positive int., constant expression for a boundary. Such expression containing
+// non-literal contansts previously caused problems when appearing in constructs
+// structs, unions, exceptions, typedefs, operation types and parameters,
+// attributes; and of course, sequences, strings.
+// -D59063<daz> Add helper for global exception to stub import list.
+// -D58951<daz> Publicise members for QuickTest.
+// -D59421<klr> Change ValueBaseHolder to SerializableHolder
+// -D59596<klr> Prevent accesses to elements of empty Vectors.
+// -D59771<daz> Add import stmt for Helper of global type in stubs.
+// -D59355<daz> Remove target dir. from filename when writing to prolog.
+// -D59437<daz> Fill typename information for value boxes.
+// -D62023<klr> Don't import ValueBase*
+// -D62023<klr> Add corbaLevel
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.math.BigInteger;
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Locale;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.ConstEntry;
+import com.sun.tools.corba.se.idl.EnumEntry;
+import com.sun.tools.corba.se.idl.ExceptionEntry;
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.NativeEntry;
+import com.sun.tools.corba.se.idl.ParameterEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.StructEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.UnionBranch;
+import com.sun.tools.corba.se.idl.UnionEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+
+import com.sun.tools.corba.se.idl.constExpr.*;
+
+/**
+ * Class Util is a repository of static members available for general
+ * use by the IDL parser framework and any generator extensions.
+ **/
+public class Util extends com.sun.tools.corba.se.idl.Util
+{
+ // <d58319>
+ /**
+ * Fetch the version number of this build of the IDL-to-Java (portable)
+ * compiler from the appropriate properties file.
+ * @return the version number of this compiler build.
+ **/
+ public static String getVersion ()
+ {
+ return com.sun.tools.corba.se.idl.Util.getVersion ("com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp");
+ } // getVersion
+
+ /**
+ * This method is called by Setup.preEmit, so
+ * symbolTable is available for all Util methods.
+ **/
+ static void setSymbolTable (Hashtable symtab)
+ {
+ symbolTable = symtab;
+ } // setSymbolTable
+
+ public static void setPackageTranslation( Hashtable pkgtrans )
+ {
+ packageTranslation = pkgtrans ;
+ }
+
+ public static boolean isInterface (String name)
+ {
+ return isInterface (name, symbolTable);
+ } // isInterface
+
+ static String arrayInfo (Vector arrayInfo)
+ {
+ int arrays = arrayInfo.size ();
+ String info = "";
+ Enumeration e = arrayInfo.elements ();
+ while (e.hasMoreElements ())
+ info = info + '[' + parseExpression ((Expression)e.nextElement ()) + ']';
+ return info;
+ } // arrayInfo
+
+ // <d58951> static String sansArrayInfo (Vector arrayInfo)
+ public static String sansArrayInfo (Vector arrayInfo)
+ {
+ int arrays = arrayInfo.size ();
+ String brackets = "";
+ for (int i = 0; i < arrays; ++i)
+ brackets = brackets + "[]";
+ return brackets;
+ } // sansArrayInfo
+
+ // <d58951> static String sansArrayInfo (String name)
+ static public String sansArrayInfo (String name)
+ {
+ int index = name.indexOf ('[');
+ if (index >= 0)
+ {
+ String array = name.substring (index);
+ name = name.substring (0, index);
+ while (!array.equals (""))
+ {
+ name = name + "[]";
+ array = array.substring (array.indexOf (']') + 1);
+ }
+ }
+ return name;
+ } // sansArrayInfo
+
+ /**
+ * Given a symbol table entry, return the name of
+ * the file which should be created.
+ **/
+ public static String fileName (SymtabEntry entry, String extension )
+ {
+ NameModifier nm = new NameModifierImpl() ;
+ return fileName( entry, nm, extension ) ;
+ } // fileName
+
+ public static String fileName (SymtabEntry entry, NameModifier modifier, String extension )
+ {
+ // This may not be the most appropriate place for
+ // the mkdir calls, but it's common to everything:
+ String pkg = containerFullName (entry.container ());
+ if (pkg != null && !pkg.equals (""))
+ mkdir (pkg);
+
+ String name = entry.name ();
+ name = modifier.makeName( name ) + extension ;
+ if (pkg != null && !pkg.equals (""))
+ name = pkg + '/' + name;
+
+ return name.replace ('/', File.separatorChar);
+ } // fileName
+
+ public static GenFileStream stream (SymtabEntry entry, String extension)
+ {
+ NameModifier nm = new NameModifierImpl() ;
+ return stream(entry, nm, extension);
+ } // stream
+
+ public static GenFileStream stream (SymtabEntry entry, NameModifier modifier, String extension )
+ {
+ return getStream ( fileName (entry,modifier,extension), entry ) ;
+ }
+
+ public static GenFileStream getStream (String name, SymtabEntry entry)
+ {
+ // <f46838.4>
+ String absPathName = ((Arguments)Compile.compiler.arguments).targetDir + name;
+ if (Compile.compiler.arguments.keepOldFiles && new File (absPathName).exists ())
+ return null;
+ else
+ // Write the data to the file stream
+ return new GenFileStream (absPathName);
+ } // getStream
+
+ public static String containerFullName( SymtabEntry container)
+ {
+ String name = doContainerFullName( container ) ;
+ if (packageTranslation.size() > 0)
+ name = translate( name ) ;
+ return name ;
+ }
+
+ public static String translate( String name )
+ {
+ String head = name ;
+ String tail = "" ;
+ int index ;
+ String trname ;
+
+ // Check for package name translations, starting with the
+ // most specific match.
+ do {
+ trname = (String)(packageTranslation.get( head )) ;
+ if (trname != null)
+ return trname + tail ;
+
+ index = head.lastIndexOf( '/' ) ;
+ if (index >= 0) {
+ tail = head.substring( index ) + tail ;
+ head = head.substring( 0, index ) ;
+ }
+ } while (index >= 0) ;
+
+ return name ;
+ }
+
+ private static String doContainerFullName (SymtabEntry container)
+ {
+ String name = "";
+
+ if (container == null)
+ name = "";
+ else
+ {
+ if (container instanceof InterfaceEntry ||
+ container instanceof StructEntry ||
+ container instanceof UnionEntry)
+ name = container.name () + "Package";
+ else
+ name = container.name ();
+
+ if (container.container () != null &&
+ !container.container ().name ().equals (""))
+ name = doContainerFullName (container.container ()) + '/' + name;
+ }
+
+ return name;
+ } // doContainerFullName
+
+ /**
+ * Given a SymtabEntry, return the string which should be used
+ * for this entry. Enums are converted to ints, typedefs and
+ * sequences are converted to their info types. javaQualifiedName
+ * does not do any of these conversions.
+ **/
+ public static String javaName (SymtabEntry entry)
+ {
+ // First get the real name of this type
+ String name = "";
+ if (entry instanceof TypedefEntry || entry instanceof SequenceEntry)
+ try
+ {
+ name = sansArrayInfo ((String)entry.dynamicVariable (Compile.typedefInfo));
+ }
+ catch (NoSuchFieldException e)
+ {
+ name = entry.name ();
+ }
+ else if (entry instanceof PrimitiveEntry)
+ name = javaPrimName (entry.name ());
+ else if (entry instanceof StringEntry)
+ name = "String";
+ else if (entry instanceof NativeEntry)
+ name = javaNativeName (entry.name());
+ else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase"))
+ name = "java.io.Serializable";
+ else if (entry instanceof ValueBoxEntry)
+ {
+ ValueBoxEntry v = (ValueBoxEntry) entry;
+ TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+ if (mType instanceof PrimitiveEntry)
+ {
+ name = containerFullName (entry.container ());
+ if (!name.equals (""))
+ name = name + '.';
+ name = name + entry.name ();
+ }
+ else
+ name = javaName (mType);
+ }
+ else
+ {
+ name = containerFullName (entry.container ());
+ if (name.equals (""))
+ name = entry.name ();
+ else
+ name = name + '.' + entry.name ();
+ }
+
+ // Make it a fully package-qualified name
+ return name.replace ('/', '.');
+ } // javaName
+
+ public static String javaPrimName (String name)
+ {
+ if (name.equals ("long") || name.equals ("unsigned long"))
+ name = "int";
+ else if (name.equals ("octet"))
+ name = "byte";
+ // "unisigned long long" exceeds Java long.
+ else if (name.equals ("long long") || name.equals ("unsigned long long"))
+ name = "long";
+ else if (name.equals ("wchar"))
+ name = "char";
+ else if (name.equals ("unsigned short"))
+ name = "short";
+ else if (name.equals ("any"))
+ name = "org.omg.CORBA.Any";
+ else if (name.equals ("TypeCode"))
+ name = "org.omg.CORBA.TypeCode";
+ else if (name.equals ("Principal")) // <d61961>
+ name = "org.omg.CORBA.Principal";
+ return name;
+ } // javaPrimName
+
+ public static String javaNativeName (String name)
+ {
+
+ // translations for Native declarations according to CORBA 2.3 spec
+
+ if (name.equals ("AbstractBase") || name.equals ("Cookie"))
+ name = "java.lang.Object";
+ else if (name.equals ("Servant"))
+ name = "org.omg.PortableServer.Servant";
+ else if (name.equals ("ValueFactory"))
+ name = "org.omg.CORBA.portable.ValueFactory";
+ return name;
+ }
+
+
+ /**
+ * Given a symtabEntry, return the name of this entry. This
+ * method does not do any conversions like javaName does.
+ **/
+ public static String javaQualifiedName (SymtabEntry entry)
+ {
+ String name = "";
+ if (entry instanceof PrimitiveEntry)
+ name = javaPrimName (entry.name ());
+ else if (entry instanceof StringEntry)
+ name = "String";
+ else if (entry instanceof ValueEntry && entry.name ().equals ("ValueBase"))
+ name = "java.io.Serializable";
+ else
+ {
+ SymtabEntry container = entry.container ();
+ if (container != null)
+ name = container.name ();
+ if (name.equals (""))
+ name = entry.name ();
+ else
+ name = containerFullName (entry.container ()) + '.' + entry.name ();
+ }
+ return name.replace ('/', '.');
+ } // javaQualifiedName
+
+ // <f46082.03> Publicize for extensions.
+ //static String collapseName (String name)
+
+ /**
+ * Collapse primitive type names.
+ **/
+ public static String collapseName (String name)
+ {
+ if (name.equals ("unsigned short"))
+ name = "ushort";
+ else if (name.equals ("unsigned long"))
+ name = "ulong";
+ else if (name.equals ("unsigned long long"))
+ name = "ulonglong";
+ else if (name.equals ("long long"))
+ name = "longlong";
+ return name;
+ } // collapseName
+
+ /**
+ *
+ **/
+ public static SymtabEntry typeOf (SymtabEntry entry)
+ {
+ while (entry instanceof TypedefEntry && ((TypedefEntry)entry).arrayInfo ().isEmpty () && !(entry.type () instanceof SequenceEntry))
+ entry = entry.type ();
+ return entry;
+ } // typeOf
+
+ /**
+ * Fill the info field with the full name (with array info) of the type.
+ **/
+ static void fillInfo (SymtabEntry infoEntry)
+ {
+ String arrayInfo = "";
+ SymtabEntry entry = infoEntry;
+ boolean alreadyHave = false;
+
+ do
+ {
+ try
+ {
+ alreadyHave = entry.dynamicVariable (Compile.typedefInfo) != null;
+ }
+ catch (NoSuchFieldException e)
+ {}
+ // If this entry's info has already been processed
+ // don't bother processing it again, just take it.
+ if (!alreadyHave)
+ {
+ if (entry instanceof TypedefEntry)
+ arrayInfo = arrayInfo + arrayInfo (((TypedefEntry)entry).arrayInfo ());
+ else if (entry instanceof SequenceEntry)
+ {
+ Expression maxSize = ((SequenceEntry)entry).maxSize ();
+ if (maxSize == null)
+ arrayInfo = arrayInfo + "[]";
+ else
+ arrayInfo = arrayInfo + '[' + parseExpression (maxSize) + ']';
+ }
+ if (entry.type () == null)
+ {
+ // <d59437> Suppress this message. It tells the developer nothing, and
+ // this path does not cause the algorithm to fail. Value boxes may
+ // contain anonymous types, like a struct or enum.
+ //System.err.println (getMessage ("PreEmit.indeterminateTypeInfo", entry.typeName ()));
+ }
+ else
+ entry = entry.type ();
+ }
+ } while (!alreadyHave && entry != null &&
+ (entry instanceof TypedefEntry || entry instanceof SequenceEntry));
+ // <d59437> Value boxes may contain types lacking typename info., which
+ // causes the 2nd case, below, to fail with exception when retrieving the
+ // javaName().
+ if (entry instanceof ValueBoxEntry)
+ fillValueBoxInfo ((ValueBoxEntry)entry);
+ try
+ {
+ if (alreadyHave)
+ infoEntry.dynamicVariable (Compile.typedefInfo, (String)entry.dynamicVariable (Compile.typedefInfo) + arrayInfo);
+ else
+ infoEntry.dynamicVariable (Compile.typedefInfo, javaName (entry) + arrayInfo);
+ }
+ catch (NoSuchFieldException e)
+ {}
+ } // fillInfo
+
+ // <d59437>
+ /**
+ *
+ **/
+ static void fillValueBoxInfo (ValueBoxEntry vb)
+ {
+ SymtabEntry stateMember = (((InterfaceState) vb.state ().elementAt (0)).entry);
+ if (stateMember.type() != null)
+ Util.fillInfo (stateMember.type ());
+ Util.fillInfo (stateMember);
+ } // fillValueBoxInfo
+
+ /**
+ *
+ **/
+ public static String holderName (SymtabEntry entry)
+ {
+ String name;
+ if (entry instanceof PrimitiveEntry)
+ if (entry.name ().equals ("any"))
+ name = "org.omg.CORBA.AnyHolder";
+ else if (entry.name ().equals ("TypeCode"))
+ name = "org.omg.CORBA.TypeCodeHolder";
+ else if (entry.name ().equals ("Principal")) // <d61961>
+ name = "org.omg.CORBA.PrincipalHolder";
+ else
+ name = "org.omg.CORBA." + capitalize (javaQualifiedName (entry)) + "Holder";
+ else if (entry instanceof TypedefEntry)
+ {
+ TypedefEntry td = (TypedefEntry)entry;
+ if (!td.arrayInfo ().isEmpty () || td.type () instanceof SequenceEntry)
+ name = javaQualifiedName (entry) + "Holder";
+ else
+ name = holderName (entry.type ());
+ }
+ else if (entry instanceof StringEntry)
+ name = "org.omg.CORBA.StringHolder";
+ else if (entry instanceof ValueEntry)
+ {
+ if (entry.name ().equals ("ValueBase"))
+ name = "org.omg.CORBA.ValueBaseHolder"; // <d59421>, <d60929>
+ else
+ name = javaName (entry) + "Holder";
+ } else if (entry instanceof NativeEntry) {
+ // do not attach holder to the translation for Native Entries, e.g.
+ // for Cookie it should be CookieHolder instead of java.lang.ObjectHolder
+ // returns the complete name for the package, etc.
+ name = javaQualifiedName(entry) + "Holder";
+ }
+ else
+ name = javaName (entry) + "Holder";
+ return name;
+ } // holderName
+
+ /**
+ * d61056
+ **/
+ public static String helperName (SymtabEntry entry, boolean qualifiedName)
+ {
+ if (entry instanceof ValueEntry)
+ if (entry.name ().equals ("ValueBase"))
+ return "org.omg.CORBA.ValueBaseHelper";
+
+ if (qualifiedName)
+ return javaQualifiedName (entry) + "Helper";
+ else
+ return javaName (entry) + "Helper";
+ } // helperName
+
+ public static final short
+ TypeFile = 0,
+ StubFile = 1,
+ HelperFile = 2,
+ HolderFile = 3,
+ StateFile = 4;
+
+ /**
+ *
+ **/
+ public static void writePackage (PrintWriter stream, SymtabEntry entry)
+ {
+ writePackage (stream, entry, TypeFile);
+ } // writePackage
+
+ /**
+ *
+ **/
+ public static void writePackage (PrintWriter stream, SymtabEntry entry, String name, short type)
+ {
+ if (name != null && !name.equals (""))
+ {
+ stream.println ("package " + name.replace ('/', '.') + ';');
+
+ // This type is in a module. Just in case it refers to types
+ // in the unnamed module, add an import statement for each of
+ // those types.
+ if (!Compile.compiler.importTypes.isEmpty ())
+ {
+ stream.println ();
+ Vector v = addImportLines (entry, Compile.compiler.importTypes, type);
+ printImports (v, stream);
+ }
+ }
+ } // writePackage
+
+ /**
+ *
+ **/
+ public static void writePackage (PrintWriter stream, SymtabEntry entry, short type)
+ {
+ String fullName = containerFullName (entry.container ());
+ if (fullName != null && !fullName.equals (""))
+ {
+ stream.println ("package " + fullName.replace ('/', '.') + ';');
+ // This type is in a module. Just in case it refers to types
+ // in the unnamed module, add an import statement for each of
+ // those types.
+ if ((type != HolderFile || entry instanceof TypedefEntry) && !Compile.compiler.importTypes.isEmpty ())
+ {
+ stream.println ();
+ Vector v = addImportLines (entry, Compile.compiler.importTypes, type);
+ printImports (v, stream);
+ }
+ /*
+ Enumeration e = Compile.compiler.importTypes.elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry i = (SymtabEntry)e.nextElement ();
+ // Write import for type
+ if (!(i instanceof TypedefEntry))
+ stream.println ("import " + i.name () + ';');
+
+ // Write import for Helper
+ if (!(i instanceof ConstEntry))
+ stream.println ("import " + i.name () + "Helper;");
+
+ // Write import for Holder
+ if (!(i instanceof ConstEntry))
+ if (!(i instanceof TypedefEntry) || (i.type () instanceof SequenceEntry || !((TypedefEntry)i).arrayInfo ().isEmpty ()))
+ stream.println ("import " + i.name () + "Holder;");
+ }
+ */
+ }
+ } // writePackage
+
+ /**
+ *
+ **/
+ static private void printImports (Vector importList, PrintWriter stream)
+ {
+ Enumeration e = importList.elements ();
+ while (e.hasMoreElements ())
+ stream.println ("import " + (String)e.nextElement () + ';');
+ } // printImport
+
+ /**
+ *
+ **/
+ static private void addTo (Vector importList, String name)
+ {
+ // REVISIT - <d62023-klr> was also importing ValueBaseHolder and Helper
+ if (name.startsWith ("ValueBase")) // don't import ValueBase*
+ if ((name.compareTo ("ValueBase") == 0) ||
+ (name.compareTo ("ValueBaseHolder") == 0) ||
+ (name.compareTo ("ValueBaseHelper") == 0))
+ return;
+ if (!importList.contains (name))
+ importList.addElement (name);
+ } // addTo
+
+ /**
+ *
+ **/
+ static private Vector addImportLines (SymtabEntry entry, Vector importTypes, short type)
+ {
+ Vector importList = new Vector ();
+ if (entry instanceof ConstEntry)
+ {
+ ConstEntry c = (ConstEntry)entry;
+ Object cvalue = c.value ().value ();
+ if (cvalue instanceof ConstEntry && importTypes.contains (cvalue))
+ addTo (importList, ((ConstEntry)cvalue).name ());
+ }
+ else if (entry instanceof ValueEntry && type == HelperFile) // <d59512>
+ {
+ // This code inspired by ValueGen.getConcreteBaseTypeCode(). Helper method
+ // type() could be invoked against a global valuetype.
+ if (((ValueEntry)entry).derivedFrom ().size () > 0) // <59596> KLR HACK
+ {
+ ValueEntry base = (ValueEntry)((ValueEntry)entry).derivedFrom ().elementAt (0);
+ String baseName = base.name ();
+ if (!"ValueBase".equals (baseName))
+ if (importTypes.contains (base))
+ addTo (importList, baseName + "Helper");
+ }
+ }
+ else if (entry instanceof InterfaceEntry && (type == TypeFile || type == StubFile))
+ {
+ InterfaceEntry i = (InterfaceEntry)entry;
+
+ if (i instanceof ValueEntry) // <d59512>
+ {
+ // Examine interface parents in supports vector.
+ Enumeration e = ((ValueEntry)i).supports ().elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry parent = (SymtabEntry)e.nextElement ();
+ if (importTypes.contains (parent))
+ {
+ addTo (importList, parent.name () + "Operations");
+ }
+ // If this is a stub, then recurse to the parents
+ if (type == StubFile)
+ {
+ if (importTypes.contains (parent))
+ addTo (importList, parent.name ());
+ Vector subImportList = addImportLines (parent, importTypes, StubFile);
+ Enumeration en = subImportList.elements ();
+ while (en.hasMoreElements ())
+ {
+ addTo (importList, (String)en.nextElement ());
+ }
+ }
+ }
+ }
+ // Interface or valuetype -- Examine interface and valuetype parents,
+ // Look through derivedFrom vector
+ Enumeration e = i.derivedFrom ().elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry parent = (SymtabEntry)e.nextElement ();
+ if (importTypes.contains (parent))
+ {
+ addTo (importList, parent.name ());
+ // <d59512> Always add both imports, even though superfluous. Cannot
+ // tell when writing Operations or Signature interface!
+ if (!(parent instanceof ValueEntry)) // && parent.name ().equals ("ValueBase")))
+ addTo (importList, parent.name () + "Operations");
+ }
+ // If this is a stub, then recurse to the parents
+ if (type == StubFile)
+ {
+ Vector subImportList = addImportLines (parent, importTypes, StubFile);
+ Enumeration en = subImportList.elements ();
+ while (en.hasMoreElements ())
+ {
+ addTo (importList, (String)en.nextElement ());
+ }
+ }
+ }
+ // Look through methods vector
+ e = i.methods ().elements ();
+ while (e.hasMoreElements ())
+ {
+ MethodEntry m = (MethodEntry)e.nextElement ();
+
+ // Look at method type
+ SymtabEntry mtype = typeOf (m.type ());
+ if (mtype != null && importTypes.contains (mtype))
+ if (type == TypeFile || type == StubFile)
+ {
+ addTo (importList, mtype.name ());
+ addTo (importList, mtype.name () + "Holder");
+ if (type == StubFile)
+ addTo (importList, mtype.name () + "Helper");
+ }
+ checkForArrays (mtype, importTypes, importList);
+ // <d42256> Print import lines for globals constants and constants
+ // within global interfaces.
+ if (type == StubFile)
+ checkForBounds (mtype, importTypes, importList);
+
+ // Look through exceptions
+ Enumeration exEnum = m.exceptions ().elements ();
+ while (exEnum.hasMoreElements ())
+ {
+ ExceptionEntry ex = (ExceptionEntry)exEnum.nextElement ();
+ if (importTypes.contains (ex))
+ {
+ addTo (importList, ex.name ());
+ addTo (importList, ex.name () + "Helper"); // <d59063>
+ }
+ }
+
+ // Look through parameters
+ Enumeration parms = m.parameters ().elements ();
+ while (parms.hasMoreElements ())
+ {
+ ParameterEntry parm = (ParameterEntry)parms.nextElement ();
+ SymtabEntry parmType = typeOf (parm.type ());
+ if (importTypes.contains (parmType))
+ {
+ // <d59771> Helper needed in stubs.
+ if (type == StubFile)
+ addTo (importList, parmType.name () + "Helper");
+ if (parm.passType () == ParameterEntry.In)
+ addTo (importList, parmType.name ());
+ else
+ addTo (importList, parmType.name () + "Holder");
+ }
+ checkForArrays (parmType, importTypes, importList);
+ // <d42256>
+ if (type == StubFile)
+ checkForBounds (parmType, importTypes, importList);
+ }
+ }
+ }
+ else if (entry instanceof StructEntry)
+ {
+ StructEntry s = (StructEntry)entry;
+
+ // Look through the members
+ Enumeration members = s.members ().elements ();
+ while (members.hasMoreElements ())
+ {
+ SymtabEntry member = (TypedefEntry)members.nextElement ();
+ // <d48034> Need to add helper name for typedef members. This name
+ // is referenced at typecode generation in Helper class.
+ SymtabEntry memberType = member.type ();
+ member = typeOf (member);
+ if (importTypes.contains (member))
+ {
+ // If this IS a typedef, then there are only Helper/Holder classes.
+ //if (!(member instanceof TypedefEntry))
+ // <d59437> Valueboxes
+ if (!(member instanceof TypedefEntry) && !(member instanceof ValueBoxEntry))
+ addTo (importList, member.name ());
+ // <d48034> Add helper name of alias, too, if member is a typedef.
+ //if (type == HelperFile)
+ // addTo (importList, member.name () + "Helper");
+ if (type == HelperFile)
+ {
+ addTo (importList, member.name () + "Helper");
+ if (memberType instanceof TypedefEntry)
+ addTo (importList, memberType.name () + "Helper");
+ }
+ }
+ checkForArrays (member, importTypes, importList);
+ checkForBounds (member, importTypes, importList);
+ }
+ }
+ else if (entry instanceof TypedefEntry)
+ {
+ TypedefEntry t = (TypedefEntry)entry;
+ String arrays = checkForArrayBase (t, importTypes, importList);
+ if (type == HelperFile)
+ {
+ checkForArrayDimensions (arrays, importTypes, importList);
+ try
+ {
+ String name = (String)t.dynamicVariable (Compile.typedefInfo);
+ int index = name.indexOf ('[');
+ if (index >= 0)
+ name = name.substring (0, index);
+ // See if the base type should be added to the list.
+ SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
+ if (typeEntry != null && importTypes.contains (typeEntry))
+ addTo (importList, typeEntry.name () + "Helper");
+ }
+ catch (NoSuchFieldException e)
+ {}
+
+ // <d42256> Typedefs for global bounded strings need import
+ // statement when bound expression contains non-literal constants.
+ checkForBounds (typeOf (t), importTypes, importList);
+ }
+ Vector subImportList = addImportLines (t.type (), importTypes, type);
+ Enumeration e = subImportList.elements ();
+ while (e.hasMoreElements ())
+ addTo (importList, (String)e.nextElement ());
+ }
+ else if (entry instanceof UnionEntry)
+ {
+ UnionEntry u = (UnionEntry)entry;
+
+ // Look at the discriminant type
+ SymtabEntry utype = typeOf (u.type ());
+ if (utype instanceof EnumEntry && importTypes.contains (utype))
+ addTo (importList, utype.name ());
+
+ // Look through the branches
+ Enumeration branches = u.branches ().elements ();
+ while (branches.hasMoreElements ())
+ {
+ UnionBranch branch = (UnionBranch)branches.nextElement ();
+ SymtabEntry branchEntry = typeOf (branch.typedef);
+ if (importTypes.contains (branchEntry))
+ {
+ addTo (importList, branchEntry.name ());
+ if (type == HelperFile)
+ addTo (importList, branchEntry.name () + "Helper");
+ }
+ checkForArrays (branchEntry, importTypes, importList);
+ // <d42256>
+ checkForBounds (branchEntry, importTypes, importList);
+ }
+ }
+
+ // If a typedef is not a sequence or an array, only holders and
+ // helpers are generated for it. Remove references to such
+ // class names.
+ Enumeration en = importList.elements ();
+ while (en.hasMoreElements ())
+ {
+ String name = (String)en.nextElement ();
+ SymtabEntry e = (SymtabEntry)symbolTable.get (name);
+ if (e != null && e instanceof TypedefEntry)
+ {
+ TypedefEntry t = (TypedefEntry)e;
+ if (t.arrayInfo ().size () == 0 || !(t.type () instanceof SequenceEntry))
+ importList.removeElement (name);
+ }
+ }
+ return importList;
+ } // addImportLines
+
+ /**
+ *
+ **/
+ static private void checkForArrays (SymtabEntry entry, Vector importTypes, Vector importList)
+ {
+ if (entry instanceof TypedefEntry)
+ {
+ TypedefEntry t = (TypedefEntry)entry;
+ String arrays = checkForArrayBase (t, importTypes, importList);
+ checkForArrayDimensions (arrays, importTypes, importList);
+ }
+ } // checkForArrays
+
+ /**
+ *
+ **/
+ static private String checkForArrayBase (TypedefEntry t, Vector importTypes, Vector importList)
+ {
+ String arrays = "";
+ try
+ {
+ String name = (String)t.dynamicVariable (Compile.typedefInfo);
+ int index = name.indexOf ('[');
+ if (index >= 0)
+ {
+ arrays = name.substring (index);
+ name = name.substring (0, index);
+ }
+
+ // See if the base type should be added to the list.
+ SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (name);
+ if (typeEntry != null && importTypes.contains (typeEntry))
+ addTo (importList, typeEntry.name ());
+ }
+ catch (NoSuchFieldException e)
+ {}
+ return arrays;
+ } // checkForArrayBase
+
+ /**
+ *
+ **/
+ static private void checkForArrayDimensions (String arrays, Vector importTypes, Vector importList)
+ {
+ // See if any of the arrays contain a constentry.
+ // If so, see if it should be added to the list.
+ while (!arrays.equals (""))
+ {
+ int index = arrays.indexOf (']');
+ String dim = arrays.substring (1, index);
+ arrays = arrays.substring (index + 1);
+ SymtabEntry constant = (SymtabEntry)symbolTable.get (dim);
+ if (constant == null)
+ {
+ // A constant expr could be of the form <const> OR
+ // <interface>.<const>. This if branch checks for that case.
+ int i = dim.lastIndexOf ('.');
+ if (i >= 0)
+ constant = (SymtabEntry)symbolTable.get (dim.substring (0, i));
+ }
+ if (constant != null && importTypes.contains (constant))
+ addTo (importList, constant.name ());
+ }
+ } // checkForArrayDimensions
+
+ // <d42256> Call the following method when its necessary to determine the
+ // the import types for IDL constructs containing arbitrary positive int.
+ // expressions, which may specify non-literal constants.
+
+ /**
+ * Determine the import lines for template types.
+ **/
+ static private void checkForBounds (SymtabEntry entry, Vector importTypes, Vector importList)
+ {
+ // Obtain actual type, just to be complete.
+ SymtabEntry entryType = entry;
+ while (entryType instanceof TypedefEntry)
+ entryType = entryType.type ();
+
+ if (entryType instanceof StringEntry && ((StringEntry)entryType).maxSize () != null)
+ checkForGlobalConstants (((StringEntry)entryType).maxSize ().rep (), importTypes, importList);
+ else
+ if (entryType instanceof SequenceEntry && ((SequenceEntry)entryType).maxSize () != null)
+ checkForGlobalConstants (((SequenceEntry)entryType).maxSize ().rep (), importTypes, importList);
+ } // checkForBounds
+
+ /**
+ * Extract the global constants from the supplied integer expression
+ * representation (string) and add them to the supplied import list.
+ **/
+ static private void checkForGlobalConstants (String exprRep, Vector importTypes, Vector importList)
+ {
+ // NOTE: Do not use '/' as a delimiter. Symbol table names use '/' as a
+ // delimiter and would not be otherwise properly collected. Blanks and
+ // arithmetic symbols do not appear in tokens, except for '/'.
+ java.util.StringTokenizer st = new java.util.StringTokenizer (exprRep, " +-*()~&|^%<>");
+ while (st.hasMoreTokens ())
+ {
+ String token = st.nextToken ();
+ // When token contains '/', it represents the division symbol or
+ // a nested type (e.g., I/x). Ignore the division symbol, and don't
+ // forget constants declared within global interfaces!
+ if (!token.equals ("/"))
+ {
+ SymtabEntry typeEntry = (SymtabEntry)symbolTable.get (token);
+ if (typeEntry instanceof ConstEntry)
+ {
+ int slashIdx = token.indexOf ('/');
+ if (slashIdx < 0) // Possible global constant
+ {
+ if (importTypes.contains (typeEntry))
+ addTo (importList, typeEntry.name ());
+ }
+ else // Possible constant in global interface
+ {
+ SymtabEntry constContainer = (SymtabEntry)symbolTable.get (token.substring (0, slashIdx));
+ if (constContainer instanceof InterfaceEntry && importTypes.contains (constContainer))
+ addTo (importList, constContainer.name ());
+ }
+ }
+ }
+ }
+ } // checkForGlobalConstants
+
+ /**
+ *
+ **/
+ public static void writeInitializer (String indent, String name, String arrayDcl, SymtabEntry entry, PrintWriter stream)
+ {
+ if (entry instanceof TypedefEntry)
+ {
+ TypedefEntry td = (TypedefEntry)entry;
+ writeInitializer (indent, name, arrayDcl + sansArrayInfo (td.arrayInfo ()), td.type (), stream);
+ }
+ else if (entry instanceof SequenceEntry)
+ writeInitializer (indent, name, arrayDcl + "[]", entry.type (), stream);
+ else if (entry instanceof EnumEntry)
+ if (arrayDcl.length () > 0)
+ stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = null;");
+ else
+ stream.println (indent + javaName (entry) + ' ' + name + " = null;");
+ else if (entry instanceof PrimitiveEntry)
+ {
+ boolean array = arrayDcl.length () > 0;
+ String tname = javaPrimName (entry.name ());
+ if (tname.equals ("boolean"))
+ stream.println (indent + "boolean " + name + arrayDcl + " = " + (array ? "null;" : "false;"));
+ else if (tname.equals ("org.omg.CORBA.TypeCode"))
+ stream.println (indent + "org.omg.CORBA.TypeCode " + name + arrayDcl + " = null;");
+ else if (tname.equals ("org.omg.CORBA.Any"))
+ stream.println (indent + "org.omg.CORBA.Any " + name + arrayDcl + " = null;");
+ else if (tname.equals ("org.omg.CORBA.Principal")) // <d61961>
+ stream.println (indent + "org.omg.CORBA.Principal " + name + arrayDcl + " = null;");
+ else
+ stream.println (indent + tname + ' ' + name + arrayDcl + " = " + (array ? "null;" : '(' + tname + ")0;"));
+ }
+ // <f46082.51> Remove -stateful feature. This case is identical to next one
+ // because javaName() supplants javaStatefulName().
+ //else if (entry instanceof InterfaceEntry && ((InterfaceEntry)entry).state () != null)
+ // stream.println (indent + javaStatefulName ((InterfaceEntry)entry) + ' ' + name + arrayDcl + " = null;");
+ else
+ stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = null;");
+ } // writeInitializer
+
+ /**
+ *
+ **/
+ public static void writeInitializer (String indent, String name, String arrayDcl, SymtabEntry entry, String initializer, PrintWriter stream)
+ {
+ if (entry instanceof TypedefEntry)
+ {
+ TypedefEntry td = (TypedefEntry)entry;
+ writeInitializer (indent, name, arrayDcl + sansArrayInfo (td.arrayInfo ()), td.type (), initializer, stream);
+ }
+ else if (entry instanceof SequenceEntry)
+ writeInitializer (indent, name, arrayDcl + "[]", entry.type (), initializer, stream);
+ else if (entry instanceof EnumEntry)
+ if (arrayDcl.length () > 0)
+ stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
+ else
+ stream.println (indent + javaName (entry) + ' ' + name + " = " + initializer + ';');
+ else if (entry instanceof PrimitiveEntry)
+ {
+ boolean array = arrayDcl.length () > 0;
+ String tname = javaPrimName (entry.name ());
+ if (tname.equals ("boolean"))
+ stream.println (indent + "boolean " + name + arrayDcl + " = " + initializer + ';');
+ else if (tname.equals ("org.omg.CORBA.TypeCode"))
+ stream.println (indent + "org.omg.CORBA.TypeCode " + name + arrayDcl + " = " + initializer + ';');
+ else if (tname.equals ("org.omg.CORBA.Any"))
+ stream.println (indent + "org.omg.CORBA.Any " + name + arrayDcl + " = " + initializer + ';');
+ else if (tname.equals ("org.omg.CORBA.Principal")) // <d61961>
+ stream.println (indent + "org.omg.CORBA.Principal " + name + arrayDcl + " = " + initializer + ';');
+ else
+ stream.println (indent + tname + ' ' + name + arrayDcl + " = " + initializer + ';');
+ }
+ // <f46082.51> Remove -stateful feature. This case is identical to next one
+ // because javaName() supplants javaStatefulName().
+ //else if (entry instanceof InterfaceEntry && ((InterfaceEntry)entry).state () != null)
+ // stream.println (indent + javaStatefulName ((InterfaceEntry)entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
+ else
+ stream.println (indent + javaName (entry) + ' ' + name + arrayDcl + " = " + initializer + ';');
+ } // writeInitializer
+
+ /**
+ *
+ **/
+ public static void mkdir (String name)
+ {
+ String targetDir = ((Arguments)Compile.compiler.arguments).targetDir; // F46838.4
+ name = (targetDir + name).replace ('/', File.separatorChar); // F46838.4
+ File pkg = new File (name);
+ if (!pkg.exists ())
+ if (!pkg.mkdirs ())
+ System.err.println (getMessage ("Util.cantCreatePkg", name));
+ } // mkdir
+
+ /**
+ *
+ **/
+ public static void writeProlog (PrintWriter stream, String filename)
+ {
+ // <d59355> Remove target directory
+ String targetDir = ((Arguments)Compile.compiler.arguments).targetDir;
+ if (targetDir != null)
+ filename = filename.substring (targetDir.length ());
+ stream.println ();
+ stream.println ("/**");
+ stream.println ("* " + filename.replace (File.separatorChar, '/') +
+ " .");
+ stream.println ("* " + Util.getMessage ("toJavaProlog1",
+ Util.getMessage ("Version.product", Util.getMessage ("Version.number"))));
+ // <d48911> Do not introduce invalid escape characters into comment! <daz>
+ //stream.println ("* " + Util.getMessage ("toJavaProlog2", Compile.compiler.arguments.file));
+ stream.println ("* " + Util.getMessage ("toJavaProlog2", Compile.compiler.arguments.file.replace (File.separatorChar, '/')));
+
+ ///////////////
+ // This SHOULD work, but there's a bug in the JDK.
+ // stream.println ("* " + DateFormat.getDateTimeInstance (DateFormat.FULL, DateFormat.FULL, Locale.getDefault ()).format (new Date ()));
+ // This gets around the bug:
+
+ DateFormat formatter = DateFormat.getDateTimeInstance (DateFormat.FULL, DateFormat.FULL, Locale.getDefault ());
+
+ // Japanese-specific workaround. JDK bug 4069784 being repaired by JavaSoft.
+ // Keep this transient solution until bug fix is reported.cd .
+
+ if (Locale.getDefault () == Locale.JAPAN)
+ formatter.setTimeZone (java.util.TimeZone.getTimeZone ("JST"));
+ else
+ formatter.setTimeZone (java.util.TimeZone.getDefault ());
+
+ stream.println ("* " + formatter.format (new Date ()));
+
+ // <daz>
+ ///////////////
+
+ stream.println ("*/");
+ stream.println ();
+ } // writeProlog
+
+ // keywords ending in Holder or Helper or Package have '_' prepended.
+ // These prepended underscores must not be part of anything sent
+ // across the wire, so these two methods are provided to strip them
+ // off.
+
+ /**
+ *
+ **/
+ public static String stripLeadingUnderscores (String string)
+ {
+ while (string.startsWith ("_"))
+ string = string.substring (1);
+ return string;
+ } // stripLeadingUnderscores
+
+ /**
+ *
+ **/
+ public static String stripLeadingUnderscoresFromID (String string)
+ {
+ String stringPrefix = "";
+ int slashIndex = string.indexOf (':');
+ if (slashIndex >= 0)
+ do
+ {
+ stringPrefix = stringPrefix + string.substring (0, slashIndex + 1);
+ string = string.substring (slashIndex + 1);
+ while (string.startsWith ("_"))
+ string = string.substring (1);
+ slashIndex = string.indexOf ('/');
+ } while (slashIndex >= 0);
+ return stringPrefix + string;
+ } // stripLeadingUnderscoresFromID
+
+ /**
+ *
+ **/
+ public static String parseExpression (Expression e)
+ {
+ if (e instanceof Terminal)
+ return parseTerminal ((Terminal)e);
+ else if (e instanceof BinaryExpr)
+ return parseBinary ((BinaryExpr)e);
+ else if (e instanceof UnaryExpr)
+ return parseUnary ((UnaryExpr)e);
+ else
+ return "(UNKNOWN_VALUE)"; // This shouldn't happen unless someone slips
+ // in another type of expression.
+ } // parseExpression
+
+ /**
+ *
+ **/
+ static String parseTerminal (Terminal e)
+ {
+ if (e.value () instanceof ConstEntry)
+ {
+ ConstEntry c = (ConstEntry)e.value ();
+ if (c.container () instanceof InterfaceEntry)
+ return javaQualifiedName (c.container ()) + '.' + c.name ();
+ else
+ return javaQualifiedName (c) + ".value";
+ }
+ else if (e.value () instanceof Expression)
+ return '(' + parseExpression ((Expression)e.value ()) + ')';
+ else if (e.value () instanceof Character)
+ {
+ if (((Character)e.value ()).charValue () == '\013')
+ // e.rep is \v. \v for vertical tab is meaningless in Java.
+ return "'\\013'";
+ else if (((Character)e.value ()).charValue () == '\007')
+ // e.rep is \a. \a for alert is meaningless in Java.
+ return "'\\007'";
+ else if (e.rep ().startsWith ("'\\x"))
+ return hexToOctal (e.rep ());
+ else if (e.rep ().equals ("'\\?'"))
+ return "'?'";
+ else
+ return e.rep ();
+ }
+ else if (e.value () instanceof Boolean)
+ return e.value ().toString ();
+
+ // <d54640> If value is type "unsigned long long" (ull) and its magnitude
+ // is greater than the maximal Java long (i.e., IDL long long) value, then
+ // return its signed representation rather than its actual representation.
+ /*
+ // Support long long
+ //else if (e.value () instanceof Long)
+ else if (e.value () instanceof BigInteger &&
+ (e.type ().indexOf ("long long") >= 0 || e.type ().equals ("unsigned long"))) // <klr>
+ {
+ String rep = e.rep ();
+ int index = rep.indexOf (')');
+ if (index < 0)
+ return rep + 'L';
+ else
+ return rep.substring (0, index) + 'L' + rep.substring (index);
+ }
+ */
+ else if (e.value () instanceof BigInteger)
+ {
+ // Get the correct primitive type. Since integer types (octet, short,
+ // long, long long, unsigned short, unsigned long, unsigned long long)
+ // could be aliased (typedef'ed) to any arbitrary levels, the code
+ // below walks up the alias chain to get to the primitive type.
+
+ // Get the symbol table entry corresponding to the 'type'.
+ SymtabEntry typeEntry = (SymtabEntry) symbolTable.get(e.type());
+
+ // Get to the primitive type.
+ while (typeEntry.type() != null) {
+ typeEntry = typeEntry.type();
+ }
+ String type = typeEntry.name();
+
+ if (type.equals("unsigned long long") &&
+ ((BigInteger)e.value ()).compareTo (Expression.llMax) > 0) // value > long long Max?
+ {
+ // Convert to signed value, which will always be negative.
+ BigInteger v = (BigInteger)e.value ();
+ v = v.subtract (Expression.twoPow64);
+ int index = e.rep ().indexOf (')');
+ if (index < 0)
+ return v.toString () + 'L';
+ else
+ return '(' + v.toString () + 'L' + ')';
+ }
+ else if ( type.indexOf("long long") >= 0 || type.equals("unsigned long") )
+ {
+ String rep = e.rep ();
+ int index = rep.indexOf (')');
+ if (index < 0)
+ return rep + 'L';
+ else
+ return rep.substring (0, index) + 'L' + rep.substring (index);
+ }
+ else
+ return e.rep ();
+ } // end <d54640>
+ else
+ return e.rep ();
+ } // parseTerminal
+
+ /**
+ *
+ **/
+ static String hexToOctal (String hex)
+ {
+ // The format of hex is '/xXX' where XX is one or two hex digits.
+ // This statement pulls off XX.
+ hex = hex.substring (3, hex.length () - 1);
+ return "'\\" + Integer.toString (Integer.parseInt (hex, 16), 8) + "'";
+ } // hexToOctal
+
+ /**
+ *
+ **/
+ static String parseBinary (BinaryExpr e)
+ {
+ String castString = "";
+ if (e.value () instanceof Float || e.value () instanceof Double)
+ {
+ castString = "(double)";
+ if (!(e instanceof Plus || e instanceof Minus ||
+ e instanceof Times || e instanceof Divide))
+ System.err.println ("Operator " + e.op () + " is invalid on floating point numbers");
+ }
+ else if (e.value () instanceof Number)
+ {
+ if (e.type (). indexOf ("long long") >= 0)
+ castString = "(long)";
+ else
+ castString = "(int)";
+ }
+ else
+ {
+ castString = "";
+ System.err.println ("Unknown type in constant expression");
+ }
+
+ // <d54640> Must emit value rather than representation when type "unsigned
+ // long long" (ull) because emitted binary arithmetic expressions containing
+ // ull's converted to long (i.e., IDL long long) do not always compute to
+ // the correct result.
+
+ //return castString + '(' + parseExpression (e.left ()) + ' ' + e.op () + ' ' + parseExpression (e.right ()) + ')';
+ if (e.type ().equals ("unsigned long long"))
+ {
+ BigInteger value = (BigInteger)e.value ();
+ if (value.compareTo (Expression.llMax) > 0) // value > long long max?
+ value = value.subtract (Expression.twoPow64); // Convert to Java long (signed)
+ return castString + '(' + value.toString () + 'L' + ')';
+ }
+ else
+ return castString + '(' + parseExpression (e.left ()) + ' ' + e.op () + ' ' + parseExpression (e.right ()) + ')';
+ // <d54640> end
+ } // parseBinary
+
+ /**
+ *
+ **/
+ static String parseUnary (UnaryExpr e)
+ {
+ if (!(e.value () instanceof Number))
+ return "(UNKNOWN_VALUE)"; // This shouldn't happen if the parser checked the expression types correctly.
+ else if ((e.value () instanceof Float || e.value () instanceof Double) && e instanceof Not)
+ return "(UNKNOWN_VALUE)"; // This shouldn't happen if the parser checked the expression types correctly.
+ else
+ {
+ String castString = "";
+ if (e.operand ().value () instanceof Float ||
+ e.operand ().value () instanceof Double)
+ castString = "(double)";
+ // Support long long.
+ //else
+ // castString = "(long)";
+ else if (e.type (). indexOf ("long long") >= 0)
+ castString = "(long)";
+ else
+ castString = "(int)";
+
+ // <d54640> Must emit value rather than representation when type is
+ // "unsigned long long" (ull) because emitted unary arithmetic expressions
+ // containing a ull converted to long (i.e., IDL long long) do not always
+ // compute to the correct result.
+
+ //return castString + e.op () + parseExpression (e.operand ());
+ if (e.type ().equals ("unsigned long long"))
+ {
+ BigInteger value = (BigInteger)e.value ();
+ if (value.compareTo (Expression.llMax) > 0) // value > long long max?
+ value = value.subtract (Expression.twoPow64); // Convert to Java long (signed)
+ return castString + '(' + value.toString () + 'L' + ')';
+ }
+ else
+ return castString + e.op () + parseExpression (e.operand ());
+ // end <d54640>
+ }
+ } // parseUnary
+
+ /**
+ *
+ **/
+ public static boolean IDLEntity (SymtabEntry entry)
+ {
+ boolean rc = true;
+ if (entry instanceof PrimitiveEntry || entry instanceof StringEntry)
+ rc = false;
+ else if (entry instanceof TypedefEntry)
+ rc = IDLEntity (entry.type ());
+ return rc;
+ } // IDLEntity
+
+ // <d62023>
+ /**
+ * @return true if the current setting of corbaLevel is within delta of
+ * the range {@code min <= corbaLevel <= max}
+ **/
+ public static boolean corbaLevel (float min, float max)
+ {
+ float level = Compile.compiler.arguments.corbaLevel;
+ float delta = 0.001f;
+ if ((level - min + delta >= 0.0f) && (max - level + delta >= 0.0f))
+ return true;
+ else
+ return false;
+ } // corbaLevel
+
+ static Hashtable symbolTable = new Hashtable ();
+ static Hashtable packageTranslation = new Hashtable() ;
+} // class Util
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen.java
new file mode 100644
index 0000000..d8efe32
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen.java
@@ -0,0 +1,349 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D60929 <klr> Update for RTF2.4 changes
+// -D61056 <klr> Use Util.helperName
+// -D62023 <klr> Fix generation botch in helper.read for boxed bounded strings
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+
+/**
+ *
+ **/
+public class ValueBoxGen implements com.sun.tools.corba.se.idl.ValueBoxGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public ValueBoxGen ()
+ {
+ } // ctor
+
+ /**
+ *
+ **/
+ public void generate (Hashtable symbolTable, ValueBoxEntry v, PrintWriter str)
+ {
+ this.symbolTable = symbolTable;
+ this.v = v;
+
+ TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+ // if it's primitive type, generate a java class
+ if (mType instanceof PrimitiveEntry)
+ {
+ openStream ();
+ if (stream == null)
+ return;
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ }
+ else
+ {
+ // If a constructed type is nested in the value box,
+ // value v struct s {...};
+ // the bindings for the nested type must be handled here
+ Enumeration e = v.contained ().elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry contained = (SymtabEntry) e.nextElement ();
+
+ // in case of value box w/ nested enum, ex: value v enum e {e0, e1,...};
+ // the SymtabEntry for the enum and labels are contained in the vector.
+ // Must check the type to ignore the SymtabEntry for labels.
+ if (contained.type () != null)
+ contained.type ().generate (symbolTable, stream);
+ }
+ }
+ generateHelper ();
+ generateHolder ();
+ } // generate
+
+ /**
+ *
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (v, ".java");
+ } // openStream
+
+ /**
+ *
+ **/
+ protected void generateHelper ()
+ {
+ ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, v);
+ } // generateHelper
+
+ /**
+ *
+ **/
+ protected void generateHolder ()
+ {
+ ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, v);
+ } // generateHolder
+
+ /**
+ *
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, v);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+ if (v.comment () != null)
+ v.comment ().generate ("", stream);
+// stream.println ("public class " + v.name () + " implements org.omg.CORBA.portable.ValueBase, org.omg.CORBA.portable.Streamable");
+ stream.println ("public class " + v.name () + " implements org.omg.CORBA.portable.ValueBase"); // <d60929>
+ stream.println ("{");
+ } // writeHeading
+
+ /**
+ *
+ **/
+ protected void writeBody ()
+ {
+ InterfaceState member = (InterfaceState) v.state ().elementAt (0);
+ SymtabEntry entry = (SymtabEntry) member.entry;
+ Util.fillInfo (entry);
+ if (entry.comment () != null)
+ entry.comment ().generate (" ", stream);
+ stream.println (" public " + Util.javaName (entry) + " value;");
+ stream.println (" public " + v.name () + " (" + Util.javaName (entry) + " initial)");
+ stream.println (" {");
+ stream.println (" value = initial;");
+ stream.println (" }");
+ stream.println ();
+ writeTruncatable (); // <d60929>
+// writeStreamableMethods ();
+ } // writeBody
+
+ /**
+ *
+ **/
+ protected void writeTruncatable () // <d60929>
+ {
+ // Per Simon, 4/6/98, emit _truncatable_ids()
+ stream.println (" public String[] _truncatable_ids() {");
+ stream.println (" return " + Util.helperName(v, true) + ".get_instance().get_truncatable_base_ids();"); // <d61056>
+ stream.println (" }");
+ stream.println ();
+ } // writeTruncatable
+
+ /**
+ *
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ("} // class " + v.name ());
+ } // writeClosing
+
+ /**
+ *
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ /**
+ *
+ **/
+ protected void writeStreamableMethods ()
+ {
+ stream.println (" public void _read (org.omg.CORBA.portable.InputStream istream)");
+ stream.println (" {");
+ streamableRead ("this", v, stream);
+ stream.println (" }");
+ stream.println ();
+ stream.println (" public void _write (org.omg.CORBA.portable.OutputStream ostream)");
+ stream.println (" {");
+ write (0, " ", "this", v, stream);
+ stream.println (" }");
+ stream.println ();
+ stream.println (" public org.omg.CORBA.TypeCode _type ()");
+ stream.println (" {");
+ stream.println (" return " + Util.helperName (v, false) + ".type ();"); // <d61056>
+ stream.println (" }");
+ } // writeStreamableMethods
+
+ ///////////////
+ // From JavaGenerator
+
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ ValueEntry vt = (ValueEntry) entry;
+ TypedefEntry member = (TypedefEntry) ((InterfaceState) (vt.state ()).elementAt (0)).entry;
+ SymtabEntry mType = Util.typeOf (member);
+ index = ((JavaGenerator)mType.generator ()).type (index, indent, tcoffsets, name, mType, stream);
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_value_box_tc ("
+ + "_id, "
+ + '"' + entry.name () + "\", "
+ + name
+ + ");");
+ return index;
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
+ stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
+ return index;
+ } // type
+
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ return index;
+ } // read
+
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ // <d59418 - KLR> per Simon, make "static" read call istream.read_value.
+ // put real marshalling code in read_value.
+ stream.println (" return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (get_instance());"); // <d60929>
+ stream.println (" }");
+ stream.println ();
+
+ // done with "read", now do "read_value with real marshalling code.
+
+ stream.println (" public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
+ stream.println (" {");
+ // end of <d59418> changes
+
+ String indent = " ";
+ Vector vMembers = ((ValueBoxEntry) entry).state ();
+ TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+ if (mType instanceof PrimitiveEntry ||
+ mType instanceof SequenceEntry ||
+ mType instanceof TypedefEntry ||
+ mType instanceof StringEntry ||
+ !member.arrayInfo ().isEmpty ()) {
+ stream.println (indent + Util.javaName (mType) + " tmp;"); // <d62023>
+ ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream);
+ }
+ else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
+ stream.println (indent + Util.javaQualifiedName (mType) + " tmp = (" +
+ Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, true) + ".get_instance ());"); // <d60929> // <d61056>
+ else
+ stream.println (indent + Util.javaName (mType) + " tmp = " +
+ Util.helperName ( mType, true ) + ".read (istream);"); // <d61056>
+ if (mType instanceof PrimitiveEntry)
+ stream.println (indent + "return new " + entryName + " (tmp);");
+ else
+ stream.println (indent + "return tmp;");
+ } // helperRead
+
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ // <d59418 - KLR> per Simon, make "static" write call istream.write_value.
+ // put real marshalling code in write_value.
+ stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, get_instance());"); // <d60929>
+ stream.println (" }");
+ stream.println ();
+
+ // done with "write", now do "write_value with real marshalling code.
+
+ stream.println (" public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable obj)"); // <d60929>
+ stream.println (" {");
+
+ String entryName = Util.javaName(entry);
+ stream.println (" " + entryName + " value = (" + entryName + ") obj;");
+ write (0, " ", "value", entry, stream);
+ } // helperWrite
+
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ Vector vMembers = ( (ValueEntry) entry ).state ();
+ TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+
+ if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
+ index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
+ else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
+ index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
+ else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
+ stream.println (indent
+ + "((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value ((java.io.Serializable) value, " // <d60929>
+ + Util.helperName (mType, true) // <d61056>
+ + ".get_instance ());"); // <d61056>
+ else
+ stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
+ return index;
+ } // write
+
+ protected void writeAbstract ()
+ {
+ } // writeAbstract
+
+ protected void streamableRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ Vector vMembers = ( (ValueBoxEntry) entry ).state ();
+ TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+ if (mType instanceof PrimitiveEntry || mType instanceof SequenceEntry || mType instanceof TypedefEntry ||
+ mType instanceof StringEntry || !member.arrayInfo ().isEmpty ())
+ {
+ SymtabEntry mEntry = (SymtabEntry) ((InterfaceState) vMembers.elementAt (0)).entry;
+ ((JavaGenerator)member.generator ()).read (0, " ", entryName + ".value", member, stream);
+ }
+ else if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
+ stream.println (" " + entryName + ".value = (" + Util.javaQualifiedName (mType) + ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName(mType, true) + ".get_instance ());"); // <d60929> // <d61056>
+ else
+ stream.println (" " + entryName + ".value = " + Util.helperName (mType, true) + ".read (istream);"); // <d61056>
+ } // streamableRead
+
+ protected Hashtable symbolTable = null;
+ protected ValueBoxEntry v = null;
+ protected PrintWriter stream = null;
+} // class ValueBoxGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen24.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen24.java
new file mode 100644
index 0000000..dbb1ced
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueBoxGen24.java
@@ -0,0 +1,163 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D62023 <klr> Update for Java 2.4 RTF
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+
+/**
+ *
+ **/
+public class ValueBoxGen24 extends ValueBoxGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public ValueBoxGen24 ()
+ {
+ } // ctor
+
+ /**
+ * d62023 - Move from helper to mapped class
+ **/
+ protected void writeTruncatable () // <d60929>
+ {
+ stream.print (" private static String[] _truncatable_ids = {");
+ stream.println (Util.helperName(v, true) + ".id ()};");
+ stream.println ();
+ stream.println (" public String[] _truncatable_ids() {");
+ stream.println (" return _truncatable_ids;");
+ stream.println (" }");
+ stream.println ();
+ } // writeTruncatable
+
+
+ /**
+ * d62023
+ **/
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (" if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {");
+ stream.println (" throw new org.omg.CORBA.BAD_PARAM(); }");
+ stream.println (" return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);");
+ stream.println (" }");
+ stream.println ();
+
+ // done with "read", now do "read_value with real marshalling code.
+
+ stream.println (" public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
+ stream.println (" {");
+
+ String indent = " ";
+ Vector vMembers = ((ValueBoxEntry) entry).state ();
+ TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+ if (mType instanceof PrimitiveEntry ||
+ mType instanceof SequenceEntry ||
+ mType instanceof TypedefEntry ||
+ mType instanceof StringEntry ||
+ !member.arrayInfo ().isEmpty ()) {
+ stream.println (indent + Util.javaName (mType) + " tmp;");
+ ((JavaGenerator)member.generator ()).read (0, indent, "tmp", member, stream);
+ }
+ else
+ stream.println (indent + Util.javaName (mType) + " tmp = " +
+ Util.helperName ( mType, true ) + ".read (istream);");
+ if (mType instanceof PrimitiveEntry)
+ stream.println (indent + "return new " + entryName + " (tmp);");
+ else
+ stream.println (indent + "return (java.io.Serializable) tmp;");
+ } // helperRead
+
+ /**
+ * d62023
+ **/
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ stream.println (" if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {");
+ stream.println (" throw new org.omg.CORBA.BAD_PARAM(); }");
+ stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance);");
+ stream.println (" }");
+ stream.println ();
+
+ // done with "write", now do "write_value with real marshalling code.
+
+ stream.println (" public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)");
+ stream.println (" {");
+
+ String entryName = Util.javaName(entry);
+ stream.println (" if (!(value instanceof " + entryName + ")) {");
+ stream.println (" throw new org.omg.CORBA.MARSHAL(); }");
+ stream.println (" " + entryName + " valueType = (" + entryName + ") value;");
+ write (0, " ", "valueType", entry, stream);
+ } // helperWrite
+
+ /**
+ * d62023
+ **/
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ Vector vMembers = ( (ValueEntry) entry ).state ();
+ TypedefEntry member = ((InterfaceState) vMembers.elementAt (0)).entry;
+ SymtabEntry mType = member.type ();
+
+ if (mType instanceof PrimitiveEntry || !member.arrayInfo ().isEmpty ())
+ index = ((JavaGenerator)member.generator ()).write (index, indent, name + ".value", member, stream);
+ else if (mType instanceof SequenceEntry || mType instanceof StringEntry || mType instanceof TypedefEntry || !member.arrayInfo ().isEmpty ())
+ index = ((JavaGenerator)member.generator ()).write (index, indent, name, member, stream);
+ else
+ stream.println (indent + Util.helperName (mType, true) + ".write (ostream, " + name + ");"); // <d61056>
+ return index;
+ } // write
+}
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueFactory.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueFactory.java
new file mode 100644
index 0000000..b0d6e94
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueFactory.java
@@ -0,0 +1,173 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D62023 klr new class
+
+import java.io.PrintWriter;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+
+/**
+ *
+ **/
+public class ValueFactory implements AuxGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public ValueFactory ()
+ {
+ } // ctor
+
+ /**
+ * Generate the default value factory class. Provides general algorithm for
+ * auxiliary binding generation:
+ * 1.) Initialize symbol table and symbol table entry members,
+ * common to all generators.
+ * 2.) Initialize members unique to this generator.
+ * 3.) Open print stream
+ * 4.) Write class heading (package, prologue, source comment, class
+ * statement, open curly
+ * 5.) Write class body (member data and methods)
+ * 6.) Write class closing (close curly)
+ * 7.) Close the print stream
+ **/
+ public void generate (java.util.Hashtable symbolTable, com.sun.tools.corba.se.idl.SymtabEntry entry)
+ {
+ this.symbolTable = symbolTable;
+ this.entry = entry;
+ init ();
+ if (hasFactoryMethods ()) {
+ openStream ();
+ if (stream == null)
+ return;
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ }
+ } // generate
+
+ /**
+ * Initialize variables unique to this generator.
+ **/
+ protected void init ()
+ {
+ factoryClass = entry.name () + "ValueFactory";
+ factoryType = Util.javaName (entry);
+ } // init
+
+ /**
+ * @return true if entry has any factory methods declared
+ **/
+ protected boolean hasFactoryMethods ()
+ {
+ Vector init = ((ValueEntry)entry).initializers ();
+ if (init != null && init.size () > 0)
+ return true;
+ else
+ return false;
+ } // hasFactoryMethods
+
+ /**
+ * Open the print stream for subsequent output.
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (entry, "ValueFactory.java");
+ } // openStream
+
+ /**
+ * Generate the heading, including the package, imports,
+ * source comment, class statement, and left curly.
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, entry, Util.TypeFile); // REVISIT - same as interface?
+ Util.writeProlog (stream, stream.name ());
+ if (entry.comment () != null)
+ entry.comment ().generate ("", stream);
+ stream.println ("public interface " + factoryClass + " extends org.omg.CORBA.portable.ValueFactory");
+ stream.println ('{');
+ } // writeHeading
+
+ /**
+ * Generate members of this class.
+ **/
+ protected void writeBody ()
+ {
+ Vector init = ((ValueEntry)entry).initializers ();
+ if (init != null)
+ {
+ for (int i = 0; i < init.size (); i++)
+ {
+ MethodEntry element = (MethodEntry) init.elementAt (i);
+ element.valueMethod (true); //tag value method if not tagged previously
+ ((MethodGen) element.generator ()). interfaceMethod (symbolTable, element, stream);
+ }
+ }
+ } // writeBody
+
+ /**
+ * Generate the closing statements.
+ **/
+ protected void writeClosing ()
+ {
+ stream.println ('}');
+ } // writeClosing
+
+ /**
+ * Write the stream to file by closing the print stream.
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ protected java.util.Hashtable symbolTable;
+ protected com.sun.tools.corba.se.idl.SymtabEntry entry;
+ protected GenFileStream stream;
+
+ // Unique to this generator
+ protected String factoryClass;
+ protected String factoryType;
+} // class Holder
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen.java
new file mode 100644
index 0000000..26e6fb0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen.java
@@ -0,0 +1,767 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -F46082.51<daz> Remove -stateful feature; javaStatefulName() obsolete.
+// -D57067 <klr> suppress default init if an emit init explicitly specified.
+// -D59071 <daz> Clone method entries when their content needs modification.
+// -D59092 <klr> Valuetype supporting interfaces should implement interface.
+// -D59418 <klr> Custom values implement org.omg.CORBA.CustomMarshal
+// -D59418 <klr> Invert read/read_Value, write/write_Value for Simon
+// -D60929 <klr> Update for RTF2.4 changes
+// -D62018 <klr> write_value for value with value field x calls xHelper.write.
+// -D62062 <klr> Add _write to value Helper to marshal state.
+// write_value for value subclass calls parent._write
+// -D61650<daz> Remove '\n' from generated strings; use println()'s.
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.StructEntry;
+
+/**
+ *
+ **/
+public class ValueGen implements com.sun.tools.corba.se.idl.ValueGen, JavaGenerator
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public ValueGen ()
+ {
+ } // ctor
+
+ /**
+ *
+ **/
+ public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str)
+ {
+ this.symbolTable = symbolTable;
+ this.v = v;
+ init ();
+
+ openStream ();
+ if (stream == null)
+ return;
+ generateTie ();
+ generateHelper ();
+ generateHolder ();
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ } // generate
+
+ /**
+ * Initialize members unique to this generator.
+ **/
+ protected void init ()
+ {
+ emit = ((Arguments)Compile.compiler.arguments).emit;
+ factories = (Factories)Compile.compiler.factories ();
+ } // init
+
+ /**
+ *
+ **/
+ protected void openStream ()
+ {
+ stream = Util.stream (v, ".java");
+ } // openStream
+
+ /**
+ * Generate a Tie class only when the user specifies the TIE option
+ * and the valuetype does support an interface.
+ **/
+ protected void generateTie ()
+ {
+ boolean tie = ((Arguments)Compile.compiler.arguments).TIEServer;
+ if (v.supports ().size () > 0 && tie)
+ {
+ Factories factories = (Factories)Compile.compiler.factories ();
+ factories.skeleton ().generate (symbolTable, v);
+ }
+ } // generateTie
+
+ /**
+ *
+ **/
+ protected void generateHelper ()
+ {
+ ((Factories)Compile.compiler.factories ()).helper ().generate (symbolTable, v);
+ } // generateHelper
+
+ /**
+ *
+ **/
+ protected void generateHolder ()
+ {
+ ((Factories)Compile.compiler.factories ()).holder ().generate (symbolTable, v);
+ } // generateHolder
+
+ /**
+ *
+ **/
+ protected void writeHeading ()
+ {
+ Util.writePackage (stream, v);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+
+ if (v.comment () != null)
+ v.comment ().generate ("", stream);
+
+ if (v.isAbstract ())
+ {
+ writeAbstract ();
+ return;
+ }
+ else
+ stream.print ("public class " + v.name ());
+
+ // There should always be at least one parent: ValueBase
+ SymtabEntry parent = (SymtabEntry) v.derivedFrom ().elementAt (0);
+
+ // If parent is ValueBase, it's mapped to java.io.Serializable
+ String parentName = Util.javaName (parent);
+ boolean impl = false;
+
+ if (parentName.equals ("java.io.Serializable"))
+ {
+// stream.print (" implements org.omg.CORBA.portable.ValueBase, org.omg.CORBA.portable.Streamable");
+ stream.print (" implements org.omg.CORBA.portable.ValueBase"); // <d60929>
+ impl = true;
+ }
+ else if ( !((ValueEntry)parent).isAbstract ())
+ stream.print (" extends " + parentName);
+
+ // if inheriting from abstract values
+ for (int i = 0; i < v.derivedFrom ().size (); i++) {
+ parent = (SymtabEntry) v.derivedFrom ().elementAt (i);
+ if ( ((ValueEntry)parent).isAbstract ())
+ {
+ if (!impl)
+ {
+ stream.print (" implements ");
+ impl = true;
+ }
+ else
+ stream.print (", ");
+ stream.print (Util.javaName (parent));
+ }
+ }
+// <d59092-klr> Valuetype supporting interface implement Operations interface
+// for supported IDL interface
+ if (((ValueEntry)v).supports ().size () > 0) {
+ if (!impl)
+ {
+ stream.print (" implements ");
+ impl = true;
+ }
+ else
+ stream.print (", ");
+
+ InterfaceEntry s =(InterfaceEntry)((ValueEntry)v).supports().elementAt(0);
+ // abstract supported classes don't have "Operations"
+ if (s.isAbstract ())
+ stream.print (Util.javaName (s));
+ else
+ stream.print (Util.javaName (s) + "Operations");
+ }
+
+// <d59418> Custom valuetypes implement org.omg.CORBA.CustomMarshal.
+ if ( ((ValueEntry)v).isCustom ()) {
+ if (!impl)
+ {
+ stream.print (" implements ");
+ impl = true;
+ }
+ else
+ stream.print (", ");
+
+ stream.print ("org.omg.CORBA.CustomMarshal ");
+ }
+
+ stream.println ();
+ stream.println ("{");
+ } // writeHeading
+
+ /**
+ *
+ **/
+ protected void writeBody ()
+ {
+ writeMembers ();
+ writeInitializers ();
+ writeConstructor (); // <d57067>
+ writeTruncatable (); // <d60929>
+ writeMethods ();
+ } // writeBody
+
+ /**
+ *
+ **/
+ protected void writeClosing ()
+ {
+ if (v.isAbstract ())
+ stream.println ("} // interface " + v.name ());
+ else
+ stream.println ("} // class " + v.name ());
+ } // writeClosing
+
+ /**
+ *
+ **/
+ protected void closeStream ()
+ {
+ stream.close ();
+ } // closeStream
+
+ /**
+ *
+ **/
+ protected void writeConstructor ()
+ {
+ // Per Simon, 9/3/98, emit a protected default constructor
+ if (!v.isAbstract () && !explicitDefaultInit) { // <d57067 - klr>
+ stream.println (" protected " + v.name () + " () {}");
+ stream.println ();
+ }
+ } // writeConstructor
+
+ /**
+ *
+ **/
+ protected void writeTruncatable () // <d60929>
+ {
+ // Per Simon, 4/6/98, emit _truncatable_ids()
+ if (!v.isAbstract ()) {
+ stream.println (" public String[] _truncatable_ids() {");
+ stream.println (" return " + Util.helperName(v, true) + ".get_instance().get_truncatable_base_ids();"); // <d61056>
+ stream.println (" }");
+ stream.println ();
+ }
+ } // writeTruncatable
+
+ /**
+ *
+ **/
+ protected void writeMembers ()
+ {
+ // if the value type contains no data members, a null return is expected
+ if (v.state () == null)
+ return;
+
+ for (int i = 0; i < v.state ().size (); i ++)
+ {
+ InterfaceState member = (InterfaceState) v.state ().elementAt (i);
+ SymtabEntry entry = (SymtabEntry) member.entry;
+ Util.fillInfo (entry);
+
+ if (entry.comment () != null)
+ entry.comment ().generate (" ", stream);
+
+ String modifier = " ";
+ if (member.modifier == InterfaceState.Public)
+ modifier = " public ";
+ Util.writeInitializer (modifier, entry.name (), "", entry, stream);
+ }
+ } // writeMembers
+
+ /**
+ *
+ **/
+ protected void writeInitializers ()
+ {
+ Vector init = v.initializers ();
+ if (init != null)
+ {
+ stream.println ();
+ for (int i = 0; i < init.size (); i++)
+ {
+ MethodEntry element = (MethodEntry) init.elementAt (i);
+ element.valueMethod (true);
+ ((MethodGen) element.generator ()). interfaceMethod (symbolTable, element, stream);
+ if (element.parameters ().isEmpty ()) // <d57067-klr>
+ explicitDefaultInit = true;
+ }
+ }
+ } // writeInitializers
+
+ /**
+ *
+ **/
+ protected void writeMethods ()
+ {
+ // contained vector contains methods, attributes, const, enums, exceptions,
+ // structs, unions, or typedefs that are declared inside the value object.
+ // State members of the nested types are also included in this vector.
+ // Thus, if the declaration of a constructed type is nested in the decl.
+ // of a state member, e.g struct x {boolean b;} memberx;
+ // the generation of the nested type must be handled here.
+ Enumeration e = v.contained ().elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry contained = (SymtabEntry)e.nextElement ();
+ if (contained instanceof MethodEntry)
+ {
+ MethodEntry element = (MethodEntry)contained;
+ ((MethodGen)element.generator ()).interfaceMethod (symbolTable, element, stream);
+ }
+ else
+ {
+ // Generate the type referenced by the typedef.
+ if (contained instanceof TypedefEntry)
+ contained.type ().generate (symbolTable, stream);
+
+ // Note that we also need to generate the typedef itself if
+ // contained is a typedef.
+ contained.generate (symbolTable, stream);
+ }
+ }
+
+ // Abstract values are mapped to interfaces. There is no need to generate
+ // the bindings for inheriting methods in case of inheritance from other
+ // abstract values or supporting interface
+ if (v.isAbstract ())
+ return;
+
+ // workaround: if the value type doesnot support any interfaces, a null
+ // return is expected instead of an empty vector
+
+ // if supporting an interfaces, generate bindings for inheriting methods
+ if (v.supports ().size () > 0)
+ {
+ InterfaceEntry intf = (InterfaceEntry) v.supports ().elementAt (0);
+ Enumeration el = intf.allMethods ().elements ();
+ while (el.hasMoreElements ())
+ {
+ MethodEntry m = (MethodEntry) el.nextElement ();
+ // <d59071> Don't alter the symbol table/emit list elements!
+ //m.container (v);
+ //((MethodGen)m.generator ()).interfaceMethod (symbolTable, m, stream);
+ MethodEntry mClone = (MethodEntry)m.clone ();
+ mClone.container (v);
+ ((MethodGen)mClone.generator ()).interfaceMethod (symbolTable, mClone, stream);
+ }
+ }
+
+ // if inheriting from abstract values, generating bindings for all
+ // inheriting methods
+ for (int i = 0; i < v.derivedFrom ().size (); i++) {
+ ValueEntry parentValue = (ValueEntry) v.derivedFrom ().elementAt (i);
+ if (parentValue.isAbstract ())
+ {
+ Enumeration el = parentValue.allMethods ().elements ();
+ while (el.hasMoreElements ())
+ {
+ MethodEntry m = (MethodEntry) el.nextElement ();
+ // <d59071> Don't alter the symbol table/emit list elements!
+ //m.container (v);
+ //((MethodGen)m.generator ()).interfaceMethod (symbolTable, m, stream);
+ MethodEntry mClone = (MethodEntry)m.clone ();
+ mClone.container (v);
+ ((MethodGen)mClone.generator ()).interfaceMethod (symbolTable, mClone, stream);
+ }
+ }
+ }
+
+ //writeStreamableMethods ();
+ } // writeMethods
+
+ /**
+ *
+ **/
+ protected void writeStreamableMethods ()
+ {
+ stream.println (" public void _read (org.omg.CORBA.portable.InputStream istream)");
+ stream.println (" {");
+ read (0, " ", "this", v, stream);
+ stream.println (" }");
+ stream.println ();
+ stream.println (" public void _write (org.omg.CORBA.portable.OutputStream ostream)");
+ stream.println (" {");
+ write (0, " ", "this", v, stream);
+ stream.println (" }");
+ stream.println ();
+ stream.println (" public org.omg.CORBA.TypeCode _type ()");
+ stream.println (" {");
+ stream.println (" return " + Util.helperName (v, false) + ".type ();"); // <d61056>
+ stream.println (" }");
+ } // writeStreamableMethods
+
+ ///////////////
+ // From JavaGenerator
+
+ public int helperType (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ ValueEntry vt = (ValueEntry) entry;
+ Vector state = vt.state ();
+ int noOfMembers = state == null ? 0 : state.size ();
+ String members = "_members" + index++;
+ String tcOfMembers = "_tcOf" + members;
+
+ stream.println (indent + "org.omg.CORBA.ValueMember[] "
+ + members + " = new org.omg.CORBA.ValueMember["
+ + noOfMembers
+ + "];");
+ stream.println (indent + "org.omg.CORBA.TypeCode " + tcOfMembers + " = null;");
+ //stream.println (""); // <d61650>
+
+ String definedInrepId = "_id";
+ String repId, version;
+
+ for (int k=0; k<noOfMembers; k++)
+ {
+ InterfaceState valueMember = (InterfaceState)state.elementAt (k);
+ TypedefEntry member = (TypedefEntry)valueMember.entry;
+ SymtabEntry mType = Util.typeOf (member);
+ if (hasRepId (member))
+ {
+ repId = Util.helperName (mType, true) + ".id ()"; // <d61056>
+ if (mType instanceof ValueEntry || mType instanceof ValueBoxEntry)
+ // OBV spec is silent on defining VersionSpec for valuetype RepIds
+ version = "\"\"";
+ else
+ {
+ String id = mType.repositoryID ().ID ();
+ version = '"' + id.substring (id.lastIndexOf (':')+1) + '"';
+ }
+ }
+ else
+ {
+ repId = "\"\"";
+ version = "\"\"";
+ }
+
+ // Get TypeCode for valuetype member and store it var. name given by tcOfMembers
+ stream.println (indent + "// ValueMember instance for " + member.name ());
+ index = ((JavaGenerator)member.generator ()).type (index, indent, tcoffsets, tcOfMembers, member, stream);
+ stream.println (indent + members + "[" + k + "] = new org.omg.CORBA.ValueMember (" // <d61650>
+ + '"' + member.name () + "\", "); // name
+ stream.println (indent + " " + repId + ", "); // id
+ stream.println (indent + " " + definedInrepId + ", "); // defined_in
+ stream.println (indent + " " + version + ", "); // version
+ stream.println (indent + " " + tcOfMembers + ", "); // type
+ stream.println (indent + " " + "null, "); // type_def
+ stream.println (indent + " " + "org.omg.CORBA." +
+ (valueMember.modifier == InterfaceState.Public ?
+ "PUBLIC_MEMBER" : "PRIVATE_MEMBER") + ".value" + ");"); // access
+ } // end for
+
+ stream.println (indent + name + " = org.omg.CORBA.ORB.init ().create_value_tc ("
+ + "_id, "
+ + '"' + entry.name () + "\", "
+ + getValueModifier (vt) + ", "
+ + getConcreteBaseTypeCode (vt) + ", "
+ + members
+ + ");");
+
+ return index;
+ } // helperType
+
+ public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
+ stream.println (indent + name + " = " + Util.helperName (entry, true) + ".type ();"); // <d61056>
+ return index;
+ } // type
+
+ // Check for types which don't have a Repository ID: primitive,
+ // string, arrays and sequences.
+
+ private static boolean hasRepId (SymtabEntry member)
+ {
+ SymtabEntry mType = Util.typeOf (member);
+ return !( mType instanceof PrimitiveEntry ||
+ mType instanceof StringEntry ||
+ ( mType instanceof TypedefEntry &&
+ !(((TypedefEntry)mType).arrayInfo ().isEmpty ()) ) ||
+ ( mType instanceof TypedefEntry && member.type () instanceof SequenceEntry) );
+ } // hasRepId
+
+ private static String getValueModifier (ValueEntry vt)
+ {
+ String mod = "NONE";
+ if (vt.isCustom ())
+ mod = "CUSTOM";
+ else if (vt.isAbstract ())
+ mod = "ABSTRACT";
+ else if (vt.isSafe ())
+ mod = "TRUNCATABLE";
+ return "org.omg.CORBA.VM_" + mod + ".value";
+ } // getValueModifier
+
+ private static String getConcreteBaseTypeCode (ValueEntry vt)
+ {
+ Vector v = vt.derivedFrom ();
+ if (!vt.isAbstract ())
+ {
+ SymtabEntry base = (SymtabEntry)vt.derivedFrom ().elementAt (0);
+ if (!"ValueBase".equals (base.name ()))
+ return Util.helperName (base, true) + ".type ()"; // <d61056>
+ }
+ return "null";
+ } // getConcreteBaseTypeCode
+
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ // <d59418 - KLR> per Simon, make "static" read call istream.read_value.
+ // put real marshalling code in read_value.
+
+ if (((ValueEntry)entry).isAbstract ())
+ {
+ stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"abstract value cannot be instantiated\");");
+ }
+ else
+ {
+ stream.println (" return (" + entryName +") ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (get_instance());"); // <d60929>
+ }
+ stream.println (" }");
+ stream.println ();
+
+ // done with "read", now do "read_value with real marshalling code.
+
+ stream.println (" public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)"); // <d60929>
+ stream.println (" {");
+
+ // per Simon, 3/3/99, read_value for custom values throws an exception
+ if (((ValueEntry)entry).isAbstract ())
+ {
+ stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"abstract value cannot be instantiated\");");
+ }
+ else
+ if (((ValueEntry)entry).isCustom ())
+ {
+ stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"custom values should use unmarshal()\");");
+ }
+ else
+ {
+ stream.println (" " + entryName + " value = new " + entryName + " ();");
+ read (0, " ", "value", entry, stream);
+ stream.println (" return value;");
+ }
+ stream.println (" }");
+ stream.println ();
+ // End of normal read method
+
+ // Per Simon, 8/26/98 - Value helpers get an additional overloaded
+ // read method where the value is passed in instead of "new'd" up. This is
+ // used for reading parent value state.
+
+ // Per Simon, 3/3/99 - Don't change this "read" for custom marshalling
+ stream.println (" public static void read (org.omg.CORBA.portable.InputStream istream, " + entryName + " value)");
+ stream.println (" {");
+ read (0, " ", "value", entry, stream);
+ } // helperRead
+
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ // First do the state members from concrete parent hierarchy
+ Vector vParents = ((ValueEntry) entry).derivedFrom ();
+ if (vParents != null && vParents.size() != 0)
+ {
+ ValueEntry parent = (ValueEntry) vParents.elementAt (0);
+ if (parent == null)
+ return index;
+ // Per Simon, 4/6/99 - call parent read. <d60929>
+ if (! Util.javaQualifiedName(parent).equals ("java.io.Serializable")) // <d60929>
+ stream.println(indent + Util.helperName (parent, true) + ".read (istream, value);"); // <d60929> // <d61056>
+ }
+
+ Vector vMembers = ((ValueEntry) entry).state ();
+ int noOfMembers = vMembers == null ? 0 : vMembers.size ();
+
+ for (int k = 0; k < noOfMembers; k++)
+ {
+ TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
+ String memberName = member.name ();
+ SymtabEntry mType = member.type ();
+
+ if (mType instanceof PrimitiveEntry ||
+ mType instanceof TypedefEntry ||
+ mType instanceof SequenceEntry ||
+ mType instanceof StringEntry ||
+ !member.arrayInfo ().isEmpty ())
+ index = ((JavaGenerator)member.generator ()).read (index, indent, name + '.' + memberName, member, stream);
+ else if (mType instanceof ValueEntry)
+ {
+ String returnType = Util.javaQualifiedName (mType);
+ if (mType instanceof ValueBoxEntry)
+ // <f46082.51> Remove -stateful.
+ //returnType = Util.javaStatefulName (mType);
+ returnType = Util.javaName (mType);
+ stream.println (" " + name + '.' + memberName + " = (" + returnType +
+ ") ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value (" + Util.helperName (mType, true) + // <d61056>
+ ".get_instance ());"); // <d61056>
+ }
+ else
+ stream.println (indent + name + '.' + memberName + " = " +
+ Util.helperName (mType, true) + ".read (istream);"); // <d61056>
+ }
+
+ return index;
+ } // read
+
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ // <d59418 - KLR> per Simon, make "static" write call istream.write_value.
+ // put real marshalling code in write_value.
+ stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, get_instance());"); // <d60929>
+ stream.println (" }");
+ stream.println ();
+
+ // <d62062>
+ // per Simon, 4/27/99, add static _write that marshals the state of this
+ // value for non-custom valuetypes
+ if (!((ValueEntry)entry).isCustom ())
+ {
+ stream.println (" public static void _write (org.omg.CORBA.portable.OutputStream ostream, " + Util.javaName (entry) + " value)");
+ stream.println (" {");
+ write (0, " ", "value", entry, stream);
+ stream.println (" }");
+ stream.println ();
+ }
+
+ // done with "_write", now do "write_value
+ stream.println (" public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable obj)"); // <d60929>
+ stream.println (" {");
+
+ // per Simon, 3/3/99, write_value for custom values throws an exception
+ if (((ValueEntry)entry).isCustom ())
+ {
+ stream.println (" throw new org.omg.CORBA.BAD_OPERATION (\"custom values should use marshal()\");");
+ }
+ else {
+ String entryName = Util.javaName(entry);
+ stream.println (" _write (ostream, (" + entryName + ") obj);"); // <d62062>
+// write (0, " ", "value", entry, stream); <d62062>
+ }
+ } // helperWrite
+
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ // First do the state members from concrete parent hierarchy
+ Vector vParents = ((ValueEntry)entry).derivedFrom ();
+ if (vParents != null && vParents.size () != 0)
+ {
+ ValueEntry parent = (ValueEntry)vParents.elementAt (0);
+ if (parent == null)
+ return index;
+ // Per Simon, 4/06/99 - call parent write. <d60929>
+ // Per Simon, 4/27/99 - call parent _write. <d62062>
+ if (! Util.javaQualifiedName(parent).equals ("java.io.Serializable")) // <d60929>
+ stream.println(indent + Util.helperName (parent, true) + "._write (ostream, value);"); // <d60929> <d61056> <d62062>
+ }
+
+ Vector vMembers = ((ValueEntry) entry ).state ();
+ int noOfMembers = vMembers == null ? 0 : vMembers.size ();
+ for (int k = 0; k < noOfMembers; k++)
+ {
+ TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
+ String memberName = member.name ();
+ SymtabEntry mType = member.type ();
+
+ if (mType instanceof PrimitiveEntry ||
+ mType instanceof TypedefEntry ||
+ mType instanceof SequenceEntry ||
+ mType instanceof StringEntry ||
+ !member.arrayInfo ().isEmpty ())
+ index = ((JavaGenerator)member.generator ()).write (index, indent, name + '.' + memberName, member, stream);
+ else
+ stream.println (indent + Util.helperName (mType, true) + // <d61056>
+ ".write (ostream, " + name + '.' + memberName + ");");
+ }
+
+ return index;
+ } // write
+
+ /**
+ *
+ **/
+ protected void writeAbstract ()
+ {
+ stream.print ("public interface " + v.name ());
+
+ // workaround: if the abstract value type does not have any parent, a vector
+ // containing ValueBase should be returned instead of an empty vector
+ if (v.derivedFrom ().size () == 0)
+ stream.print (" extends org.omg.CORBA.portable.ValueBase"); // <d60929>
+ else
+ {
+ SymtabEntry parent;
+ // list the values the abstract value type inherits
+ for (int i = 0; i < v.derivedFrom ().size (); i++)
+ {
+ if (i == 0)
+ stream.print (" extends ");
+ else
+ stream.print (", ");
+ parent = (SymtabEntry) v.derivedFrom ().elementAt (i);
+ stream.print (Util.javaName (parent));
+ }
+ }
+
+ // list the interface the abstract value type supports
+ if (v.supports ().size () > 0)
+ {
+ stream.print (", ");
+ SymtabEntry intf = (SymtabEntry) v.supports ().elementAt (0);
+ stream.print (Util.javaName (intf));
+ }
+ stream.println ();
+ stream.println ("{");
+ }
+
+ protected int emit = 0;
+ protected Factories factories = null;
+ protected Hashtable symbolTable = null;
+ protected ValueEntry v = null;
+ protected PrintWriter stream = null;
+ protected boolean explicitDefaultInit = false; // <d57067 - klr>
+} // class ValueGen
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java
new file mode 100644
index 0000000..93701b0
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/ValueGen24.java
@@ -0,0 +1,417 @@
+/*
+ * Copyright (c) 1999, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * COMPONENT_NAME: idl.toJava
+ *
+ * ORIGINS: 27
+ *
+ * Licensed Materials - Property of IBM
+ * 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+ * RMI-IIOP v1.0
+ *
+ */
+
+package com.sun.tools.corba.se.idl.toJavaPortable;
+
+// NOTES:
+// -D62023 <klr> Update for Java 2.4 RTF
+// -D62794.1 <klr> Don't include operations inherited from abstract valuetypes
+// -D62794.1 <scn> Don't include operations inherited from supported interfaces
+
+import java.io.File;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.Vector;
+
+import com.sun.tools.corba.se.idl.GenFileStream;
+import com.sun.tools.corba.se.idl.InterfaceEntry;
+import com.sun.tools.corba.se.idl.SymtabEntry;
+import com.sun.tools.corba.se.idl.TypedefEntry;
+import com.sun.tools.corba.se.idl.ValueEntry;
+import com.sun.tools.corba.se.idl.ValueBoxEntry;
+import com.sun.tools.corba.se.idl.InterfaceState;
+import com.sun.tools.corba.se.idl.MethodEntry;
+import com.sun.tools.corba.se.idl.AttributeEntry;
+import com.sun.tools.corba.se.idl.PrimitiveEntry;
+import com.sun.tools.corba.se.idl.SequenceEntry;
+import com.sun.tools.corba.se.idl.StringEntry;
+import com.sun.tools.corba.se.idl.StructEntry;
+
+/**
+ *
+ **/
+public class ValueGen24 extends ValueGen
+{
+ /**
+ * Public zero-argument constructor.
+ **/
+ public ValueGen24 ()
+ {
+ } // ctor
+
+ /**
+ * d62023 - delete constructor; helper is abstract
+ **/
+ protected void writeConstructor ()
+ {
+ } // writeConstructor
+
+ /**
+ * <pre>
+ * d62023 - delete write_value from non-boxed helpers
+ * - delete _write from non-boxed helpers
+ * </pre>
+ **/
+ public void helperWrite (SymtabEntry entry, PrintWriter stream)
+ {
+ // REVISIT: Abstract/Custom??
+ // per Simon mail 5/17/99
+ stream.println (" ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, id ());");
+ } // helperWrite
+
+ /**
+ * d62023
+ **/
+ public void helperRead (String entryName, SymtabEntry entry, PrintWriter stream)
+ {
+ // REVISIT: Abstract/Custom??
+ // per Simon mail 5/17/99
+ stream.println (" return (" + entryName + ")((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (id ());");
+ } // helperRead
+
+ /**
+ * d62023 - suppress initializers from mapped value; now generated in
+ * the Helper class and Factory class
+ **/
+ protected void writeInitializers ()
+ {
+ // override to do nothing
+ } // writeInitializers
+
+ /**
+ * d62023 - goes in mapped class, not Helper
+ **/
+ protected void writeTruncatable () // <d60929>
+ {
+ if (!v.isAbstract ()) {
+ stream.println (" private static String[] _truncatable_ids = {");
+ stream.print (" " + Util.helperName(v, true) + ".id ()");
+
+ // Any safe ValueEntry must have a concete value parent.
+ // The topmost parent cannot be safe since it doesn't have
+ // a concrete parent.
+ ValueEntry child = v;
+ while (child.isSafe ())
+ {
+ stream.println(",");
+ ValueEntry parent = (ValueEntry)child.derivedFrom ().elementAt (0);
+ stream.print(" \"" + Util.stripLeadingUnderscoresFromID (parent.repositoryID ().ID ()) + "\"");
+ child = parent;
+ }
+ stream.println();
+ stream.println(" };");
+ stream.println();
+ stream.println (" public String[] _truncatable_ids() {");
+ stream.println (" return _truncatable_ids;");
+ stream.println (" }");
+ stream.println ();
+ }
+ } // writeTruncatable
+
+ class ImplStreamWriter {
+ private boolean isImplementsWritten = false ;
+
+ public void writeClassName( String name )
+ {
+ if (!isImplementsWritten) {
+ stream.print( " implements " ) ;
+ isImplementsWritten = true ;
+ } else
+ stream.print( ", " ) ;
+
+ stream.print( name ) ;
+ }
+ }
+
+ /**
+ * d62023 - CustomMarshal {@literal ->} CustomValue for custom valuetypes
+ * mapped class is abstract
+ **/
+ protected void writeHeading ()
+ {
+ ImplStreamWriter isw = new ImplStreamWriter() ;
+
+ Util.writePackage (stream, v);
+ Util.writeProlog (stream, ((GenFileStream)stream).name ());
+
+ if (v.comment () != null)
+ v.comment ().generate ("", stream);
+
+ if (v.isAbstract ()) {
+ writeAbstract ();
+ return;
+ } else
+ stream.print ("public abstract class " + v.name ());
+
+ // There should always be at least one parent: ValueBase
+ SymtabEntry parent = (SymtabEntry) v.derivedFrom ().elementAt (0);
+
+ // If parent is ValueBase, it's mapped to java.io.Serializable
+ String parentName = Util.javaName (parent);
+ boolean cv = false; // true if we've already implemented CustomValue
+
+ if (parentName.equals ("java.io.Serializable")) {
+ if (((ValueEntry)v).isCustom ()) {
+ isw.writeClassName( "org.omg.CORBA.portable.CustomValue" ) ;
+ cv = true;
+ } else
+ isw.writeClassName( "org.omg.CORBA.portable.StreamableValue" ) ;
+ } else if ( !((ValueEntry)parent).isAbstract ())
+ stream.print (" extends " + parentName);
+
+ // if inheriting from abstract values
+ for (int i = 0; i < v.derivedFrom ().size (); i++) {
+ parent = (SymtabEntry) v.derivedFrom ().elementAt (i);
+ if ( ((ValueEntry)parent).isAbstract ()) {
+ isw.writeClassName( Util.javaName(parent) ) ;
+ }
+ }
+
+ // Write out the supported interfaces
+ Enumeration enumeration = v.supports().elements();
+ while (enumeration.hasMoreElements()) {
+ InterfaceEntry ie = (InterfaceEntry)(enumeration.nextElement()) ;
+ String cname = Util.javaName(ie) ;
+ if (!ie.isAbstract())
+ cname += "Operations" ;
+ isw.writeClassName( cname ) ;
+ }
+
+ // for when a custom valuetype inherits from a non-custom valuetype
+ if ( v.isCustom () && !cv)
+ isw.writeClassName( "org.omg.CORBA.portable.CustomValue" ) ;
+
+ stream.println ();
+ stream.println ("{");
+ } // writeHeading
+
+ /**
+ * d62023 - private state maps to protected, not default
+ **/
+ protected void writeMembers ()
+ {
+ // if the value type contains no data members, a null return is expected
+ if (v.state () == null)
+ return;
+
+ for (int i = 0; i < v.state ().size (); i ++)
+ {
+ InterfaceState member = (InterfaceState) v.state ().elementAt (i);
+ SymtabEntry entry = (SymtabEntry) member.entry;
+ Util.fillInfo (entry);
+
+ if (entry.comment () != null)
+ entry.comment ().generate (" ", stream);
+
+ String modifier = " ";
+ if (member.modifier == InterfaceState.Public)
+ modifier = " public ";
+ else
+ modifier = " protected ";
+ Util.writeInitializer (modifier, entry.name (), "", entry, stream);
+ }
+ stream.println();
+ } // writeMembers
+
+ /**
+ * d62023 - methods need to be abstract writeStreamable
+ **/
+ protected void writeMethods ()
+ {
+ // contained vector contains methods, attributes, const, enums, exceptions,
+ // structs, unions, or typedefs that are declared inside the value object.
+ // State members of the nested types are also included in this vector.
+ // Thus, if the declaration of a constructed type is nested in the decl.
+ // of a state member, e.g struct x {boolean b;} memberx;
+ // the generation of the nested type must be handled here.
+ Enumeration e = v.contained ().elements ();
+ while (e.hasMoreElements ())
+ {
+ SymtabEntry contained = (SymtabEntry)e.nextElement ();
+ if (contained instanceof AttributeEntry)
+ {
+ AttributeEntry element = (AttributeEntry)contained;
+ ((AttributeGen24)element.generator ()).abstractMethod (symbolTable, element, stream);
+ }
+ else if (contained instanceof MethodEntry)
+ {
+ MethodEntry element = (MethodEntry)contained;
+ ((MethodGen24)element.generator ()).abstractMethod (symbolTable, element, stream);
+ }
+ else
+ {
+ // Generate the type referenced by the typedef.
+ if (contained instanceof TypedefEntry)
+ contained.type ().generate (symbolTable, stream);
+
+ // Note that we also need to generate the typedef itself if
+ // contained is a typedef.
+ contained.generate (symbolTable, stream);
+ }
+ }
+
+ // Abstract values are mapped to interfaces. There is no need to generate
+ // the bindings for inheriting methods in case of inheritance from other
+ // abstract values or supporting interface
+ if (v.isAbstract ())
+ return;
+
+ // Non-abstract, Non-Custom valuetypes support the Streamable interface
+ if (!(v.isCustom () || v.isAbstract ()))
+ writeStreamableMethods ();
+ } // writeMethods
+
+ /**
+ * d62023 - call super._read()
+ **/
+ public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ // First do the state members from concrete parent hierarchy
+ Vector vParents = ((ValueEntry) entry).derivedFrom ();
+ if (vParents != null && vParents.size() != 0)
+ {
+ ValueEntry parent = (ValueEntry) vParents.elementAt (0);
+ if (parent == null)
+ return index;
+
+ // call super._read if non-abstract value parent
+ if ((!parent.isAbstract ()) && (! Util.javaQualifiedName(parent).equals ("java.io.Serializable"))) // <d60929>
+ stream.println(indent + "super._read (istream);");
+ }
+
+ Vector vMembers = ((ValueEntry) entry).state ();
+ int noOfMembers = vMembers == null ? 0 : vMembers.size ();
+
+ for (int k = 0; k < noOfMembers; k++)
+ {
+ TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
+ String memberName = member.name ();
+ SymtabEntry mType = member.type ();
+
+ if (mType instanceof PrimitiveEntry ||
+ mType instanceof TypedefEntry ||
+ mType instanceof SequenceEntry ||
+ mType instanceof StringEntry ||
+ !member.arrayInfo ().isEmpty ())
+ index = ((JavaGenerator)member.generator ()).read (index, indent, name + '.' + memberName, member, stream);
+ else
+ stream.println (indent + name + '.' + memberName + " = " +
+ Util.helperName (mType, true) + ".read (istream);"); // <d61056>
+ }
+
+ return index;
+ } // read
+
+ /**
+ * d62023 - call super._write()
+ **/
+ public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
+ {
+ // First do the state members from concrete parent hierarchy
+ Vector vParents = ((ValueEntry)entry).derivedFrom ();
+ if (vParents != null && vParents.size () != 0)
+ {
+ ValueEntry parent = (ValueEntry)vParents.elementAt (0);
+ if (parent == null)
+ return index;
+ // call super._read if non-abstract value parent
+ if ((!parent.isAbstract ()) && (! Util.javaQualifiedName(parent).equals ("java.io.Serializable"))) // <d60929>
+ stream.println(indent + "super._write (ostream);");
+ }
+
+ Vector vMembers = ((ValueEntry) entry ).state ();
+ int noOfMembers = vMembers == null ? 0 : vMembers.size ();
+ for (int k = 0; k < noOfMembers; k++)
+ {
+ TypedefEntry member = (TypedefEntry)((InterfaceState)vMembers.elementAt (k)).entry;
+ String memberName = member.name ();
+ SymtabEntry mType = member.type ();
+
+ if (mType instanceof PrimitiveEntry ||
+ mType instanceof TypedefEntry ||
+ mType instanceof SequenceEntry ||
+ mType instanceof StringEntry ||
+ !member.arrayInfo ().isEmpty ())
+ index = ((JavaGenerator)member.generator ()).write (index, indent, name + '.' + memberName, member, stream);
+ else
+ stream.println (indent + Util.helperName (mType, true) + // <d61056>
+ ".write (ostream, " + name + '.' + memberName + ");");
+ }
+
+ return index;
+ } // write
+
+ /**
+ * d62023 - generate factory interface and default factory
+ **/
+ public void generate (Hashtable symbolTable, ValueEntry v, PrintWriter str)
+ {
+ this.symbolTable = symbolTable;
+ this.v = v;
+ init ();
+
+ openStream ();
+ if (stream == null)
+ return;
+ generateTie ();
+ generateHelper ();
+ generateHolder ();
+ if (!v.isAbstract ()) {
+ generateValueFactory ();
+ generateDefaultFactory ();
+ }
+ writeHeading ();
+ writeBody ();
+ writeClosing ();
+ closeStream ();
+ } // generate
+
+ /**
+ *
+ **/
+ protected void generateValueFactory ()
+ {
+ ((Factories)Compile.compiler.factories ()).valueFactory ().generate (symbolTable, v);
+ } // generateValueFactory
+
+ /**
+ *
+ **/
+ protected void generateDefaultFactory ()
+ {
+ ((Factories)Compile.compiler.factories ()).defaultFactory ().generate (symbolTable, v);
+ } // generateDefaultFactory
+}
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp
new file mode 100644
index 0000000..a6611ad
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable.prp
@@ -0,0 +1,111 @@
+#
+# Copyright (c) 1999, 2009, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# COMPONENT_NAME: idl.toJava
+#
+# ORIGINS: 27
+#
+# Licensed Materials - Property of IBM
+# 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+# RMI-IIOP v1.0
+#
+#
+# Translator: Each line below is of the form "<key>=<message>".
+# The keys are NOT to be translated.
+# The messages ARE to be translated.
+#
+# DO NOT translate the following:
+# IBM
+# IDL
+# Java
+#
+# %0 is a parameter to the message. Do not translate it.
+#
+# A backslash (\) at the end of a line is a line continuation
+# character. A backslash at the beginning of a line means don't
+# ignore leading blanks (they normally are). These backslashes
+# should remain in the message.
+#
+# Translator: Start Translating
+#
+toJavaProlog1=Generated by the %0
+toJavaProlog2=from %0
+PreEmit.indeterminateTypeInfo=Cannot determine type infomation for %0.
+InterfaceGen.noImpl=No local implementation found for %0.
+Version.product=IDL-to-Java compiler (portable), version "%0"
+Version.number=3.2
+NameModifier.TooManyPercent=Pattern contains more than one percent characters
+NameModifier.NoPercent=Pattern does not contain a percent character
+NameModifier.InvalidChar=Pattern contains an invalid character %0
+#
+# Translator: In the list of options below, do not translate:
+# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase
+# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile"
+#
+usage=Compiler Usage:\n\
+\n\
+\ java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] <idl file>\n\
+\n\
+where <idl file> is the name of a file containing IDL definitions, and\n\
+[options] is any combination of the options listed below. The options\n\
+are optional and may appear in any order; <idl file> is required and\n\
+must appear last.\n\
+\ \n\
+Options:\n\
+ -d <symbol> This is equivalent to the following line in an\n\
+\ IDL file: #define <symbol>\n\
+ -emitAll Emit all types, including those found in #included files.\n\
+ -f<side> Define what bindings to emit. <side> is one of client,\n\
+\ server, all, serverTIE, allTIE. serverTIE and allTIE\n\
+\ cause delegate model skeletons to be emitted. If this\n\
+\ flag is not used, -fclient is assumed.\n\
+ -i <include path> By default, the current directory is scanned for\n\
+\ included files. This option adds another directory.\n\
+ -keep If a file to be generated already exists, do not\n\
+\ overwrite it. By default it is overwritten.\n\
+ -noWarn Suppress warnings.\n\
+ -oldImplBase Generate skeletons compatible with old (pre-1.4) JDK ORBs.\n\
+ -pkgPrefix <t> <prefix> When the type or module name <t> is encountered at\n\
+\ file scope, begin the Java package name for all files\n\
+\ generated for <t> with <prefix>.\n\
+ -pkgTranslate <t> <pkg> When the type or module name <t> in encountered, replace\n\
+\ it with <pkg> in the generated java package. Note that\n\
+\ pkgPrefix changes are made first. <t> must match the\n\
+\ full package name exactly. Also, <t> must not be\n\
+\ org, org.omg, or any subpackage of org.omg.\n\
+ -skeletonName <xxx%yyy> Name the skeleton according to the pattern.\n\
+\ The defaults are:\n\
+\ %POA for the POA base class (-fserver or -fall) \n\
+\ _%ImplBase for the oldImplBase base class\n\
+\ (-oldImplBase and (-fserver or -fall)).\n\
+ -td <dir> use <dir> for the output directory instead of\n\
+\ the current directory.\n\
+ -tieName <xxx%yyy> Name the tie according to the pattern. The defaults are:\n\
+\ %POATie for the POA tie (-fserverTie or -fallTie) \n\
+\ %_Tie for the oldImplBase tie\n\
+\ (-oldImplBase and (-fserverTie or -fallTie)).\n\
+ -v, -verbose Verbose mode.\n\
+ -version Display the version number and quit.\n
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp
new file mode 100644
index 0000000..52bb4f3
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_ja.prp
@@ -0,0 +1,69 @@
+#
+# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# COMPONENT_NAME: idl.toJava
+#
+# ORIGINS: 27
+#
+# Licensed Materials - Property of IBM
+# 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+# RMI-IIOP v1.0
+#
+#
+# Translator: Each line below is of the form "<key>=<message>".
+# The keys are NOT to be translated.
+# The messages ARE to be translated.
+#
+# DO NOT translate the following:
+# IBM
+# IDL
+# Java
+#
+# %0 is a parameter to the message. Do not translate it.
+#
+# A backslash (\) at the end of a line is a line continuation
+# character. A backslash at the beginning of a line means don't
+# ignore leading blanks (they normally are). These backslashes
+# should remain in the message.
+#
+# Translator: Start Translating
+#
+toJavaProlog1=%0\u306B\u3088\u3063\u3066\u751F\u6210\u3055\u308C\u307E\u3057\u305F
+toJavaProlog2=%0\u304B\u3089
+PreEmit.indeterminateTypeInfo=%0\u306E\u30BF\u30A4\u30D7\u60C5\u5831\u3092\u5224\u5225\u3067\u304D\u307E\u305B\u3093\u3002
+InterfaceGen.noImpl=%0\u306E\u30ED\u30FC\u30AB\u30EB\u5B9F\u88C5\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002
+Version.product=IDL-to-Java\u30B3\u30F3\u30D1\u30A4\u30E9(\u30DD\u30FC\u30BF\u30D6\u30EB)\u3001\u30D0\u30FC\u30B8\u30E7\u30F3"%0"
+Version.number=3.2
+NameModifier.TooManyPercent=\u30D1\u30BF\u30FC\u30F3\u306B\u8907\u6570\u306E\u30D1\u30FC\u30BB\u30F3\u30C8\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
+NameModifier.NoPercent=\u30D1\u30BF\u30FC\u30F3\u306B\u30D1\u30FC\u30BB\u30F3\u30C8\u6587\u5B57\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093
+NameModifier.InvalidChar=\u30D1\u30BF\u30FC\u30F3\u306B\u7121\u52B9\u306A\u6587\u5B57%0\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059
+#
+# Translator: In the list of options below, do not translate:
+# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase
+# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile"
+#
+usage=\u30B3\u30F3\u30D1\u30A4\u30E9\u306E\u4F7F\u7528\u65B9\u6CD5:\n\n java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] <idl file>\n\n<idl file>\u306FIDL\u5B9A\u7FA9\u3092\u542B\u3080\u30D5\u30A1\u30A4\u30EB\u306E\u540D\u524D\u3067\u3001\n[options]\u306F\u6B21\u306B\u30EA\u30B9\u30C8\u3059\u308B\u30AA\u30D7\u30B7\u30E7\u30F3\u306E\u7D44\u5408\u305B\u3067\u3059\u3002\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\n\u7701\u7565\u53EF\u80FD\u3067\u3001\u4EFB\u610F\u306E\u9806\u5E8F\u3067\u8868\u793A\u3055\u308C\u307E\u3059\u3002<idl file>\u306F\u5FC5\u9808\u3067\u3001\n\u6700\u5F8C\u306B\u8868\u793A\u3059\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\n \n\u30AA\u30D7\u30B7\u30E7\u30F3:\n-d <symbol> IDL\u30D5\u30A1\u30A4\u30EB\u306E\u6B21\u306E\u884C\u3068\n \u540C\u3058\u3067\u3059: #define <symbol>\n-emitAll #included\u30D5\u30A1\u30A4\u30EB\u3067\u898B\u3064\u304B\u3063\u305F\u30BF\u30A4\u30D7\u3092\u542B\u3080\u3001\u3059\u3079\u3066\u306E\u30BF\u30A4\u30D7\u3092\u767A\u884C\u3057\u307E\u3059\u3002\n-f<side> \u767A\u884C\u3059\u308B\u30D0\u30A4\u30F3\u30C7\u30A3\u30F3\u30B0\u3092\u5B9A\u7FA9\u3057\u307E\u3059\u3002<side>\u306Fclient\u3001\n server\u3001all\u3001serverTIE\u3001allTIE\u306E\u3044\u305A\u308C\u304B\u3067\u3059\u3002serverTIE\u3068allTIE\u306F\n \u59D4\u4EFB\u30E2\u30C7\u30EB\u30FB\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u767A\u884C\u3057\u307E\u3059\u3002\u3053\u306E\u30D5\u30E9\u30B0\u3092\n \u4F7F\u7528\u3057\u306A\u3044\u5834\u5408\u306F\u3001-fclient\u3068\u307F\u306A\u3055\u308C\u307E\u3059\u3002\n-i <include path> \u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u30A4\u30F3\u30AF\u30EB\u30FC\u30C9\u3055\u308C\u305F\u30D5\u30A1\u30A4\u30EB\u304C\n \u30B9\u30AD\u30E3\u30F3\u3055\u308C\u307E\u3059\u3002\u3053\u306E\u30AA\u30D7\u30B7\u30E7\u30F3\u306F\u5225\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u8FFD\u52A0\u3057\u307E\u3059\u3002\n-keep \u751F\u6210\u3055\u308C\u308B\u30D5\u30A1\u30A4\u30EB\u304C\u3059\u3067\u306B\u5B58\u5728\u3059\u308B\u5834\u5408\u306F\u3001\u4E0A\u66F8\u304D\n \u3057\u307E\u305B\u3093\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u3067\u306F\u4E0A\u66F8\u304D\u3055\u308C\u307E\u3059\u3002\n-noWarn \u8B66\u544A\u3092\u51FA\u3055\u306A\u3044\u3088\u3046\u306B\u3057\u307E\u3059\u3002\n-oldImplBase \u53E4\u3044(1.4\u4EE5\u524D) JDK ORB\u3068\u4E92\u63DB\u6027\u306E\u3042\u308B\u30B9\u30B1\u30EB\u30C8\u30F3\u3092\u751F\u6210\u3057\u307E\u3059\u3002\n-pkgPrefix <t> <prefix> \u30D5\u30A1\u30A4\u30EB\u30FB\u30B9\u30B3\u30FC\u30D7\u3067\u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D<t>\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n <t>\u306B\u5BFE\u3057\u3066\u751F\u6210\u3055\u308C\u305F\u3059\u3079\u3066\u306E\u30D5\u30A1\u30A4\u30EB\u306EJava\u30D1\u30C3\u30B1\u30FC\u30B8\u540D\u3092\n <prefix>\u3067\u59CB\u3081\u307E\u3059\u3002\n-pkgTranslate <t> <pkg> \u30BF\u30A4\u30D7\u307E\u305F\u306F\u30E2\u30B8\u30E5\u30FC\u30EB\u540D<t>\u304C\u691C\u51FA\u3055\u308C\u305F\u5834\u5408\u3001\n \u751F\u6210\u3055\u308C\u305FJava\u30D1\u30C3\u30B1\u30FC\u30B8\u5185\u3067<pkg>\u306B\u7F6E\u63DB\u3055\u308C\u307E\u3059\u3002pkgPrefix\u306E\n \u5909\u66F4\u304C\u5148\u306B\u884C\u308F\u308C\u308B\u3053\u3068\u306B\u6CE8\u610F\u3057\u3066\u304F\u3060\u3055\u3044\u3002<t>\u306F\u30D1\u30C3\u30B1\u30FC\u30B8\u306E\n \u6B63\u5F0F\u540D\u3068\u5B8C\u5168\u306B\u4E00\u81F4\u3057\u3066\u3044\u308B\u5FC5\u8981\u304C\u3042\u308A\u307E\u3059\u3002\u307E\u305F\u3001<t>\u3092\n \
+org\u3001org.omg\u307E\u305F\u306Forg.omg\u306E\u30B5\u30D6\u30D1\u30C3\u30B1\u30FC\u30B8\u306B\u3057\u306A\u3044\u3067\u304F\u3060\u3055\u3044\u3002\n-skeletonName <xxx%yyy> \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066\u30B9\u30B1\u30EB\u30C8\u30F3\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\n \u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n POA\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F%POA (-fserver\u307E\u305F\u306F-fall) \n oldImplBase\u30D9\u30FC\u30B9\u30FB\u30AF\u30E9\u30B9\u306E\u5834\u5408\u306F_%ImplBase\n (-oldImplBase\u304A\u3088\u3073(-fserver\u307E\u305F\u306F-fall))\u3002\n-td <dir> \u51FA\u529B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306B\u306F\u3001\u73FE\u5728\u306E\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u306E\u304B\u308F\u308A\u306B<dir>\u3092\n \u4F7F\u7528\u3057\u307E\u3059\u3002\n-tieName <xxx%yyy> \u30D1\u30BF\u30FC\u30F3\u306B\u5F93\u3063\u3066tie\u306B\u540D\u524D\u3092\u4ED8\u3051\u307E\u3059\u3002\u30C7\u30D5\u30A9\u30EB\u30C8\u306F\u6B21\u306E\u3068\u304A\u308A\u3067\u3059:\n POA tie\u306E\u5834\u5408\u306F%POATie (-fserverTie\u307E\u305F\u306F-fallTie) \n oldImplBase tie\u306E\u5834\u5408\u306F%_Tie\n (-oldImplBase\u304A\u3088\u3073(-fserverTie\u307E\u305F\u306F-fallTie))\u3002\n-v, -verbose \u8A73\u7D30\u30E2\u30FC\u30C9\u3002\n-version \u30D0\u30FC\u30B8\u30E7\u30F3\u756A\u53F7\u3092\u8868\u793A\u3057\u3066\u7D42\u4E86\u3057\u307E\u3059\u3002\n
diff --git a/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp
new file mode 100644
index 0000000..f436137
--- /dev/null
+++ b/src/java.corba/share/classes/com/sun/tools/corba/se/idl/toJavaPortable/toJavaPortable_zh_CN.prp
@@ -0,0 +1,68 @@
+#
+# Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# This code is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License version 2 only, as
+# published by the Free Software Foundation. Oracle designates this
+# particular file as subject to the "Classpath" exception as provided
+# by Oracle in the LICENSE file that accompanied this code.
+#
+# This code is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+# version 2 for more details (a copy is included in the LICENSE file that
+# accompanied this code).
+#
+# You should have received a copy of the GNU General Public License version
+# 2 along with this work; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+#
+# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+# or visit www.oracle.com if you need additional information or have any
+# questions.
+#
+
+#
+# COMPONENT_NAME: idl.toJava
+#
+# ORIGINS: 27
+#
+# Licensed Materials - Property of IBM
+# 5639-D57 (C) COPYRIGHT International Business Machines Corp. 1997, 1999
+# RMI-IIOP v1.0
+#
+#
+# Translator: Each line below is of the form "<key>=<message>".
+# The keys are NOT to be translated.
+# The messages ARE to be translated.
+#
+# DO NOT translate the following:
+# IBM
+# IDL
+# Java
+#
+# %0 is a parameter to the message. Do not translate it.
+#
+# A backslash (\) at the end of a line is a line continuation
+# character. A backslash at the beginning of a line means don't
+# ignore leading blanks (they normally are). These backslashes
+# should remain in the message.
+#
+# Translator: Start Translating
+#
+toJavaProlog1=\u7531%0\u751F\u6210
+toJavaProlog2=\u4ECE%0
+PreEmit.indeterminateTypeInfo=\u65E0\u6CD5\u786E\u5B9A%0\u7684\u7C7B\u578B\u4FE1\u606F\u3002
+InterfaceGen.noImpl=\u627E\u4E0D\u5230%0\u7684\u672C\u5730\u5B9E\u73B0\u3002
+Version.product=IDL-to-Java \u7F16\u8BD1\u5668 (\u53EF\u79FB\u690D), \u7248\u672C "%0"
+Version.number=3.2
+NameModifier.TooManyPercent=\u6A21\u5F0F\u4E2D\u5305\u542B\u591A\u4E2A\u767E\u5206\u6BD4\u5B57\u7B26
+NameModifier.NoPercent=\u6A21\u5F0F\u4E2D\u4E0D\u5305\u542B\u767E\u5206\u6BD4\u5B57\u7B26
+NameModifier.InvalidChar=\u6A21\u5F0F\u4E2D\u5305\u542B\u65E0\u6548\u5B57\u7B26 %0
+#
+# Translator: In the list of options below, do not translate:
+# -d, -emitAll, -f, -i, -keep, -m, -sep, -pkgPrefix, -td, -v, -verbose, -version, -implbase
+# Do not translate the string "java com.sun.tools.corba.se.idl.toJavaPortable.Compile"
+#
+usage=\u7F16\u8BD1\u5668\u7528\u6CD5:\n\n java com.sun.tools.corba.se.idl.toJavaPortable.Compile [\u9009\u9879] <idl \u6587\u4EF6>\n\n\u5176\u4E2D, <idl \u6587\u4EF6> \u662F\u5305\u542B IDL \u5B9A\u4E49\u7684\u6587\u4EF6\u7684\u540D\u79F0, \u800C\n[\u9009\u9879] \u662F\u4E0B\u5217\u9009\u9879\u7684\u4EFB\u610F\u7EC4\u5408\u3002\u9009\u9879\n\u662F\u53EF\u9009\u7684, \u5E76\u4E14\u663E\u793A\u987A\u5E8F\u5E76\u4E0D\u56FA\u5B9A; <idl \u6587\u4EF6> \u662F\u5FC5\u9700\u7684,\n\u5E76\u4E14\u5FC5\u987B\u663E\u793A\u5728\u6700\u540E\u3002\n \n\u9009\u9879:\n-d <\u7B26\u53F7> \u8FD9\u7B49\u540C\u4E8E IDL \u6587\u4EF6\u4E2D\u7684\n \u4E0B\u9762\u4E00\u884C: #define <\u7B26\u53F7>\n-emitAll \u53D1\u51FA\u6240\u6709\u7C7B\u578B, \u5305\u62EC\u5728 #included \u6587\u4EF6\u4E2D\u627E\u5230\u7684\u7C7B\u578B\u3002\n-f<side> \u5B9A\u4E49\u8981\u53D1\u51FA\u54EA\u4E9B\u7ED1\u5B9A\u3002<side> \u662F client,\n server, all, serverTIE, allTIE \u4E4B\u4E00\u3002serverTIE \u548C allTIE\n \u5BFC\u81F4\u53D1\u51FA\u59D4\u6D3E\u6A21\u578B\u9AA8\u67B6\u3002\u5982\u679C\u672A\u4F7F\u7528\n \u6B64\u6807\u8BB0, \u5C06\u5047\u5B9A\u4E3A -fclient\u3002\n-i <\u5305\u542B\u8DEF\u5F84> \u9ED8\u8BA4\u60C5\u51B5\u4E0B, \u5C06\u5728\u5F53\u524D\u76EE\u5F55\u4E2D\u626B\u63CF\n \u5305\u542B\u7684\u6587\u4EF6\u3002\u6B64\u9009\u9879\u5C06\u6DFB\u52A0\u53E6\u4E00\u4E2A\u76EE\u5F55\u3002\n-keep \u5982\u679C\u8981\u751F\u6210\u7684\u6587\u4EF6\u5DF2\u5B58\u5728, \u8BF7\u4E0D\u8981\n \u8986\u76D6\u5B83\u3002\u9ED8\u8BA4\u60C5\u51B5\u4E0B\u4F1A\u8986\u76D6\u5B83\u3002\n-noWarn \u9690\u85CF\u8B66\u544A\u3002\n-oldImplBase \u751F\u6210\u4E0E\u65E7\u7248 (1.4 \u7248\u4E4B\u524D) JDK ORB \u517C\u5BB9\u7684\u9AA8\u67B6\u3002\n-pkgPrefix <t> <\u524D\u7F00> \u5F53\u5728\u6587\u4EF6\u8303\u56F4\u5185\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D <t> \u65F6,\n \u5728\u4E3A <t> \u751F\u6210\u7684\u6240\u6709\u6587\u4EF6\u7684 Java \u7A0B\u5E8F\u5305\u540D\u524D\n \u6DFB\u52A0 <\u524D\u7F00>\u3002\n-pkgTranslate <t> <pkg> \u5F53\u9047\u5230\u7C7B\u578B\u6216\u6A21\u5757\u540D <t> \u65F6, \u5728\n \u751F\u6210\u7684 Java \u7A0B\u5E8F\u5305\u4E2D\u5C06\u5176\u66FF\u6362\u4E3A <pkg>\u3002\u8BF7\u6CE8\u610F, \n \u5C06\u9996\u5148\u8FDB\u884C pkgPrefix \u66F4\u6539\u3002<t> \u5FC5\u987B\u4E0E\n \u5B8C\u6574\u7A0B\u5E8F\u5305\u540D\u5B8C\u5168\u5339\u914D\u3002\u53E6\u5916, <t> \u4E0D\u80FD\u4E3A\n org, org.omg \u6216 org.omg \u7684\u4EFB\u4F55\u5B50\u7A0B\u5E8F\u5305\u3002\n-skeletonName <xxx%yyy> \u6839\u636E\u6A21\u5F0F\u547D\u540D\u9AA8\u67B6\u3002\n \u9ED8\u8BA4\u503C\u4E3A:\n %POA \u8868\u793A POA \u57FA\u7C7B (-fserver \u6216 -fall) \n _%ImplBase \u8868\u793A oldImplBase \u57FA\u7C7B\n (-oldImplBase \u548C (-fserver \u6216 -fall))\u3002\n-td <dir> \u4F7F\u7528 <dir> \u8868\u793A\u8F93\u51FA\u76EE\u5F55\u4EE5\u4EE3\u66FF\n \u5F53\u524D\u76EE\u5F55\u3002\n-tieName <xxx%yyy> \u6839\u636E\u6A21\u5F0F\u547D\u540D tie\u3002\u9ED8\u8BA4\u503C\u4E3A:\n %POATie \u8868\u793A POA tie (-fserverTie \u6216 -fallTie) \n %_Tie \u8868\u793A oldImplBase tie\n (-oldImplBase \u548C (-fserverTie \u6216 -fallTie))\u3002\n-v, -verbose \u8BE6\u7EC6\u6A21\u5F0F\u3002\n-version \u663E\u793A\u7248\u672C\u53F7\u5E76\u9000\u51FA\u3002\n
diff --git a/src/java.corba/share/classes/javax/activity/ActivityCompletedException.java b/src/java.corba/share/classes/javax/activity/ActivityCompletedException.java
new file mode 100644
index 0000000..7989922
--- /dev/null
+++ b/src/java.corba/share/classes/javax/activity/ActivityCompletedException.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.activity;
+
+/**
+ * This exception may be thrown on any method for which Activity context is
+ * accessed and indicates that ongoing work within the Activity is not
+ * possible. This may be because the Activity has been instructed to complete
+ * with CompletionStatusFailOnly or has ended as a result of a timeout. This
+ * exception will be propagated across ORB boundaries via an
+ * org.omg.CORBA.ACTIVITY_COMPLETED system exception. An application should
+ * handle this error by attempting to complete the Activity.
+ */
+public class ActivityCompletedException extends java.rmi.RemoteException
+{
+ /**
+ * Constructs a new instance with null as its detail message.
+ */
+ public ActivityCompletedException() { super(); }
+
+ /**
+ * Constructs a new instance with the specified detail message.
+ *
+ * @param message the detail message.
+ */
+ public ActivityCompletedException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new throwable with the specified cause.
+ *
+ * @param cause a chained exception of type
+ * <code>Throwable</code>.
+ */
+ public ActivityCompletedException(Throwable cause) {
+ this("", cause);
+ }
+
+ /**
+ * Constructs a new throwable with the specified detail message and cause.
+ *
+ * @param message the detail message.
+ *
+ * @param cause a chained exception of type
+ * <code>Throwable</code>.
+ */
+ public ActivityCompletedException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/src/java.corba/share/classes/javax/activity/ActivityRequiredException.java b/src/java.corba/share/classes/javax/activity/ActivityRequiredException.java
new file mode 100644
index 0000000..ce44b17
--- /dev/null
+++ b/src/java.corba/share/classes/javax/activity/ActivityRequiredException.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.activity;
+
+/**
+ * This exception is thrown by a container if Activity context is not received
+ * on a method for which Activity context is mandatory. This exception
+ * indicates a deployment or application configuration error. This exception
+ * will be propagated across ORB boundaries via an
+ * org.omg.CORBA.ACTIVITY_REQUIRED system exception.
+ */
+public class ActivityRequiredException extends java.rmi.RemoteException
+{
+ /**
+ * Constructs a new instance with null as its detail message.
+ */
+ public ActivityRequiredException() { super(); }
+
+ /**
+ * Constructs a new instance with the specified detail message.
+ *
+ * @param message the detail message.
+ */
+ public ActivityRequiredException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new throwable with the specified cause.
+ *
+ * @param cause a chained exception of type
+ * <code>Throwable</code>.
+ */
+ public ActivityRequiredException(Throwable cause) {
+ this("", cause);
+ }
+
+ /**
+ * Constructs a new throwable with the specified detail message and cause.
+ *
+ * @param message the detail message.
+ *
+ * @param cause a chained exception of type
+ * <code>Throwable</code>.
+ */
+ public ActivityRequiredException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/src/java.corba/share/classes/javax/activity/InvalidActivityException.java b/src/java.corba/share/classes/javax/activity/InvalidActivityException.java
new file mode 100644
index 0000000..73feb03
--- /dev/null
+++ b/src/java.corba/share/classes/javax/activity/InvalidActivityException.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.activity;
+
+/**
+ * This exception may be thrown on any method for which Activity context
+ * is accessed and indicates that the attempted invocation or the Activity
+ * context associated with the attempted invocation is incompatible with
+ * the Activity's current state. It may also be thrown by a container if
+ * Activity context is received on a method for which Activity context is
+ * forbidden. This exception will be propagated across J2EE Activity Service
+ * ORB boundaries via an org.omg.CORBA.INVALID_ACTIVITY system exception.
+ * An application should handle this error by attempting to complete the
+ * Activity.
+ */
+public class InvalidActivityException extends java.rmi.RemoteException
+{
+ /**
+ * Constructs a new instance with null as its detail message.
+ */
+ public InvalidActivityException() { super(); }
+
+ /**
+ * Constructs a new instance with the specified detail message.
+ *
+ * @param message the detail message.
+ */
+ public InvalidActivityException(String message) {
+ super(message);
+ }
+
+ /**
+ * Constructs a new throwable with the specified cause.
+ *
+ * @param cause a chained exception of type
+ * <code>Throwable</code>.
+ */
+ public InvalidActivityException(Throwable cause) {
+ this("", cause);
+ }
+
+ /**
+ * Constructs a new throwable with the specified detail message and cause.
+ *
+ * @param message the detail message.
+ *
+ * @param cause a chained exception of type
+ * <code>Throwable</code>.
+ */
+ public InvalidActivityException(String message, Throwable cause) {
+ super(message, cause);
+ }
+}
diff --git a/src/java.corba/share/classes/javax/activity/package.html b/src/java.corba/share/classes/javax/activity/package.html
new file mode 100644
index 0000000..d9696cc
--- /dev/null
+++ b/src/java.corba/share/classes/javax/activity/package.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+Copyright (c) 2004, 2015, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+
+</head>
+<body bgcolor="white">
+Contains Activity service related exceptions thrown by the ORB machinery during
+unmarshalling.
+
+@since 1.5
+</body>
+</html>
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/ClassDesc.java b/src/java.corba/share/classes/javax/rmi/CORBA/ClassDesc.java
new file mode 100644
index 0000000..15c6af9
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/ClassDesc.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package javax.rmi.CORBA;
+
+/**
+ * This class is used to marshal java.lang.Class objects over IIOP.
+ */
+public class ClassDesc implements java.io.Serializable {
+
+ /**
+ * @serial The class's RepositoryId.
+ */
+ private String repid;
+
+ /**
+ * @serial A space-separated list of codebase URLs.
+ */
+ private String codebase;
+}
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/GetORBPropertiesFileAction.java b/src/java.corba/share/classes/javax/rmi/CORBA/GetORBPropertiesFileAction.java
new file mode 100644
index 0000000..064753e
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/GetORBPropertiesFileAction.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * (C) Copyright IBM Corp. 1993 - 1997 - All Rights Reserved
+ *
+ * The original version of this source code and documentation is
+ * copyrighted and owned by IBM, Inc. These materials are provided under
+ * terms of a License Agreement between IBM and Sun. This technology is
+ * protected by multiple US and International patents. This notice and
+ * attribution to IBM may not be removed.
+ *
+ */
+
+
+package javax.rmi.CORBA;
+
+import java.io.IOException;
+import java.io.File;
+import java.io.FileInputStream;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Properties;
+
+class GetORBPropertiesFileAction implements PrivilegedAction {
+ private boolean debug = false ;
+
+ public GetORBPropertiesFileAction () {
+ }
+
+ private String getSystemProperty(final String name) {
+ // This will not throw a SecurityException because this
+ // class was loaded from rt.jar using the bootstrap classloader.
+ String propValue = (String) AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public java.lang.Object run() {
+ return System.getProperty(name);
+ }
+ }
+ );
+
+ return propValue;
+ }
+
+ private void getPropertiesFromFile( Properties props, String fileName )
+ {
+ try {
+ File file = new File( fileName ) ;
+ if (!file.exists())
+ return ;
+
+ FileInputStream in = new FileInputStream( file ) ;
+
+ try {
+ props.load( in ) ;
+ } finally {
+ in.close() ;
+ }
+ } catch (Exception exc) {
+ if (debug)
+ System.out.println( "ORB properties file " + fileName +
+ " not found: " + exc) ;
+ }
+ }
+
+ public Object run()
+ {
+ Properties defaults = new Properties() ;
+
+ String javaHome = getSystemProperty( "java.home" ) ;
+ String fileName = javaHome + File.separator + "lib" + File.separator +
+ "orb.properties" ;
+
+ getPropertiesFromFile( defaults, fileName ) ;
+
+ Properties results = new Properties( defaults ) ;
+
+ String userHome = getSystemProperty( "user.home" ) ;
+ fileName = userHome + File.separator + "orb.properties" ;
+
+ getPropertiesFromFile( results, fileName ) ;
+ return results ;
+ }
+}
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/PortableRemoteObjectDelegate.java b/src/java.corba/share/classes/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
new file mode 100644
index 0000000..b4aaa9d
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/PortableRemoteObjectDelegate.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package javax.rmi.CORBA;
+
+import java.rmi.RemoteException;
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+
+/**
+ * Supports delegation for method implementations in {@link javax.rmi.PortableRemoteObject}.
+ * The delegate is a singleton instance of a class that implements this
+ * interface and provides a replacement implementation for all the
+ * methods of <code>javax.rmi.PortableRemoteObject</code>.
+ *
+ * Delegates are enabled by providing the delegate's class name as the
+ * value of the
+ * <code>javax.rmi.CORBA.PortableRemoteObjectClass</code>
+ * system property.
+ *
+ * @see javax.rmi.PortableRemoteObject
+ */
+public interface PortableRemoteObjectDelegate {
+
+ /**
+ * Delegation call for {@link javax.rmi.PortableRemoteObject#exportObject}.
+ */
+ void exportObject(Remote obj)
+ throws RemoteException;
+
+ /**
+ * Delegation call for {@link javax.rmi.PortableRemoteObject#toStub}.
+ */
+ Remote toStub (Remote obj)
+ throws NoSuchObjectException;
+
+ /**
+ * Delegation call for {@link javax.rmi.PortableRemoteObject#unexportObject}.
+ */
+ void unexportObject(Remote obj)
+ throws NoSuchObjectException;
+
+ /**
+ * Delegation call for {@link javax.rmi.PortableRemoteObject#narrow}.
+ */
+ java.lang.Object narrow (java.lang.Object narrowFrom,
+ java.lang.Class narrowTo)
+ throws ClassCastException;
+
+ /**
+ * Delegation call for {@link javax.rmi.PortableRemoteObject#connect}.
+ */
+ void connect (Remote target, Remote source)
+ throws RemoteException;
+
+}
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/Stub.java b/src/java.corba/share/classes/javax/rmi/CORBA/Stub.java
new file mode 100644
index 0000000..507b262
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/Stub.java
@@ -0,0 +1,261 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package javax.rmi.CORBA;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA_2_3.portable.ObjectImpl;
+
+import java.io.IOException;
+import java.rmi.RemoteException;
+import java.io.File;
+import java.io.FileInputStream;
+import java.net.MalformedURLException ;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Properties;
+import java.rmi.server.RMIClassLoader;
+
+import com.sun.corba.se.impl.orbutil.GetPropertyAction;
+
+
+/**
+ * Base class from which all RMI-IIOP stubs must inherit.
+ */
+public abstract class Stub extends ObjectImpl
+ implements java.io.Serializable {
+
+ private static final long serialVersionUID = 1087775603798577179L;
+
+ // This can only be set at object construction time (no sync necessary).
+ private transient StubDelegate stubDelegate = null;
+ private static Class stubDelegateClass = null;
+ private static final String StubClassKey = "javax.rmi.CORBA.StubClass";
+
+ static {
+ Object stubDelegateInstance = createDelegate(StubClassKey);
+ if (stubDelegateInstance != null)
+ stubDelegateClass = stubDelegateInstance.getClass();
+ }
+
+
+ /**
+ * 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 int hashCode() {
+
+ if (stubDelegate == null) {
+ setDefaultDelegate();
+ }
+
+ if (stubDelegate != null) {
+ return stubDelegate.hashCode(this);
+ }
+
+ return 0;
+ }
+
+ /**
+ * Compares two stubs for equality. Returns <code>true</code> when used to compare stubs
+ * that represent the same remote object, and <code>false</code> otherwise.
+ * @param obj the reference object with which to compare.
+ * @return <code>true</code> if this object is the same as the <code>obj</code>
+ * argument; <code>false</code> otherwise.
+ */
+ public boolean equals(java.lang.Object obj) {
+
+ if (stubDelegate == null) {
+ setDefaultDelegate();
+ }
+
+ if (stubDelegate != null) {
+ return stubDelegate.equals(this, obj);
+ }
+
+ return false;
+ }
+
+ /**
+ * 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 String toString() {
+
+
+ if (stubDelegate == null) {
+ setDefaultDelegate();
+ }
+
+ String ior;
+ if (stubDelegate != null) {
+ ior = stubDelegate.toString(this);
+ if (ior == null) {
+ return super.toString();
+ } else {
+ return ior;
+ }
+ }
+ return super.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
+ * {@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.
+ */
+ public void connect(ORB orb) throws RemoteException {
+
+ if (stubDelegate == null) {
+ setDefaultDelegate();
+ }
+
+ if (stubDelegate != null) {
+ stubDelegate.connect(this, orb);
+ }
+
+ }
+
+ /**
+ * Serialization method to restore the IOR state.
+ */
+ private void readObject(java.io.ObjectInputStream stream)
+ throws IOException, ClassNotFoundException {
+
+ if (stubDelegate == null) {
+ setDefaultDelegate();
+ }
+
+ if (stubDelegate != null) {
+ stubDelegate.readObject(this, 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).
+ */
+ private void writeObject(java.io.ObjectOutputStream stream) throws IOException {
+
+ if (stubDelegate == null) {
+ setDefaultDelegate();
+ }
+
+ if (stubDelegate != null) {
+ stubDelegate.writeObject(this, stream);
+ }
+ }
+
+ private void setDefaultDelegate() {
+ if (stubDelegateClass != null) {
+ try {
+ stubDelegate = (javax.rmi.CORBA.StubDelegate) stubDelegateClass.newInstance();
+ } catch (Exception ex) {
+ // what kind of exception to throw
+ // delegate not set therefore it is null and will return default
+ // values
+ }
+ }
+ }
+
+ // Same code as in PortableRemoteObject. Can not be shared because they
+ // are in different packages and the visibility needs to be package for
+ // security reasons. If you know a better solution how to share this code
+ // then remove it from PortableRemoteObject. Also in Util.java
+ private static Object createDelegate(String classKey) {
+ String className = (String)
+ AccessController.doPrivileged(new GetPropertyAction(classKey));
+ if (className == null) {
+ Properties props = getORBPropertiesFile();
+ if (props != null) {
+ className = props.getProperty(classKey);
+ }
+ }
+
+ if (className == null) {
+ return new com.sun.corba.se.impl.javax.rmi.CORBA.StubDelegateImpl();
+ }
+
+ try {
+ return loadDelegateClass(className).newInstance();
+ } catch (ClassNotFoundException ex) {
+ INITIALIZE exc = new INITIALIZE( "Cannot instantiate " + className);
+ exc.initCause( ex ) ;
+ throw exc ;
+ } catch (Exception ex) {
+ INITIALIZE exc = new INITIALIZE( "Error while instantiating" + className);
+ exc.initCause( ex ) ;
+ throw exc ;
+ }
+
+ }
+
+ private static Class loadDelegateClass( String className ) throws ClassNotFoundException
+ {
+ try {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return Class.forName(className, false, loader);
+ } catch (ClassNotFoundException e) {
+ // ignore, then try RMIClassLoader
+ }
+
+ try {
+ return RMIClassLoader.loadClass(className);
+ } catch (MalformedURLException e) {
+ String msg = "Could not load " + className + ": " + e.toString();
+ ClassNotFoundException exc = new ClassNotFoundException( msg ) ;
+ throw exc ;
+ }
+ }
+
+ /**
+ * Load the orb.properties file.
+ */
+ private static Properties getORBPropertiesFile () {
+ return (Properties) AccessController.doPrivileged(new GetORBPropertiesFileAction());
+ }
+
+}
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/StubDelegate.java b/src/java.corba/share/classes/javax/rmi/CORBA/StubDelegate.java
new file mode 100644
index 0000000..5932f26
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/StubDelegate.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package javax.rmi.CORBA;
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.rmi.RemoteException;
+import org.omg.CORBA.ORB;
+
+/**
+ * Supports delegation for method implementations in {@link Stub}.
+ * A delegate is an instance of a class that implements this
+ * interface and provides a replacement implementation for all the
+ * methods of <code>javax.rmi.CORBA.Stub</code>. If delegation is
+ * enabled, each stub has an associated delegate.
+ *
+ * Delegates are enabled by providing the delegate's class name as the
+ * value of the
+ * <code>javax.rmi.CORBA.StubClass</code>
+ * system property.
+ *
+ * @see Stub
+ */
+public interface StubDelegate {
+
+ /**
+ * Delegation call for {@link Stub#hashCode}.
+ */
+ int hashCode(Stub self);
+
+ /**
+ * Delegation call for {@link Stub#equals}.
+ */
+ boolean equals(Stub self, java.lang.Object obj);
+
+ /**
+ * Delegation call for {@link Stub#toString}.
+ */
+ String toString(Stub self);
+
+ /**
+ * Delegation call for {@link Stub#connect}.
+ */
+ void connect(Stub self, ORB orb)
+ throws RemoteException;
+
+ // _REVISIT_ cannot link to Stub.readObject directly... why not?
+ /**
+ * Delegation call for
+ * <a href="{@docRoot}/serialized-form.html#javax.rmi.CORBA.Stub"><code>Stub.readObject(java.io.ObjectInputStream)</code></a>.
+ */
+ void readObject(Stub self, ObjectInputStream s)
+ throws IOException, ClassNotFoundException;
+
+ // _REVISIT_ cannot link to Stub.writeObject directly... why not?
+ /**
+ * Delegation call for
+ * <a href="{@docRoot}/serialized-form.html#javax.rmi.CORBA.Stub"><code>Stub.writeObject(java.io.ObjectOutputStream)</code></a>.
+ */
+ void writeObject(Stub self, ObjectOutputStream s)
+ throws IOException;
+
+}
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/Tie.java b/src/java.corba/share/classes/javax/rmi/CORBA/Tie.java
new file mode 100644
index 0000000..9d3f36b
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/Tie.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package javax.rmi.CORBA;
+
+import java.rmi.Remote;
+import java.util.Hashtable;
+
+import org.omg.CORBA.portable.ApplicationException;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+import org.omg.CORBA.portable.ResponseHandler;
+import org.omg.CORBA.portable.Delegate;
+import org.omg.CORBA.ORB;
+
+/**
+ * Defines methods which all RMI-IIOP server side ties must implement.
+ */
+public interface Tie extends org.omg.CORBA.portable.InvokeHandler {
+ /**
+ * Returns an object reference for the target object represented by
+ * this tie.
+ * @return an object reference for the target object.
+ */
+ org.omg.CORBA.Object thisObject();
+
+ /**
+ * Deactivates the target object represented by this tie.
+ */
+ void deactivate() throws java.rmi.NoSuchObjectException;
+
+ /**
+ * Returns the ORB for this tie.
+ * @return the ORB.
+ */
+ ORB orb();
+
+ /**
+ * Sets the ORB for this tie.
+ * @param orb the ORB.
+ */
+ void orb(ORB orb);
+
+ /**
+ * Called by {@link Util#registerTarget} to set the target
+ * for this tie.
+ * @param target the object to use as the target for this tie.
+ */
+ void setTarget(java.rmi.Remote target);
+
+ /**
+ * Returns the target for this tie.
+ * @return the target.
+ */
+ java.rmi.Remote getTarget();
+}
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/Util.java b/src/java.corba/share/classes/javax/rmi/CORBA/Util.java
new file mode 100644
index 0000000..03a4073
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/Util.java
@@ -0,0 +1,405 @@
+/*
+ * Copyright (c) 1998, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package javax.rmi.CORBA;
+
+import java.rmi.RemoteException;
+
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.INITIALIZE;
+import org.omg.CORBA.SystemException;
+import org.omg.CORBA.Any;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.ObjectImpl;
+
+import javax.rmi.CORBA.Tie;
+import java.rmi.Remote;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.SerializablePermission;
+import java.net.MalformedURLException ;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Properties;
+import java.rmi.server.RMIClassLoader;
+
+import com.sun.corba.se.impl.orbutil.GetPropertyAction;
+
+/**
+ * Provides utility methods that can be used by stubs and ties to
+ * perform common operations.
+ */
+public class Util {
+
+ // This can only be set at static initialization time (no sync necessary).
+ private static final javax.rmi.CORBA.UtilDelegate utilDelegate;
+ private static final String UtilClassKey = "javax.rmi.CORBA.UtilClass";
+
+ static {
+ utilDelegate = (javax.rmi.CORBA.UtilDelegate)createDelegate(UtilClassKey);
+ }
+
+ private Util(){}
+
+ /**
+ * Maps a SystemException to a RemoteException.
+ * @param ex the SystemException to map.
+ * @return the mapped exception.
+ */
+ public static RemoteException mapSystemException(SystemException ex) {
+
+ if (utilDelegate != null) {
+ return utilDelegate.mapSystemException(ex);
+ }
+ return null;
+ }
+
+ /**
+ * 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 static void writeAny(OutputStream out, Object obj) {
+
+ if (utilDelegate != null) {
+ utilDelegate.writeAny(out, obj);
+ }
+ }
+
+ /**
+ * 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 static Object readAny(InputStream in) {
+
+ if (utilDelegate != null) {
+ return utilDelegate.readAny(in);
+ }
+ return null;
+ }
+
+ /**
+ * Writes a java.lang.Object as a CORBA Object. If {@code obj} is
+ * an exported RMI-IIOP server object, the tie is found
+ * and wired to {@code obj}, then written to
+ * {@code out.write_Object(org.omg.CORBA.Object)}.
+ * If {@code obj} is a CORBA Object, it is written to
+ * {@code out.write_Object(org.omg.CORBA.Object)}.
+ * @param out the stream in which to write the object.
+ * @param obj the object to write.
+ */
+ public static void writeRemoteObject(OutputStream out,
+ java.lang.Object obj) {
+
+ if (utilDelegate != null) {
+ utilDelegate.writeRemoteObject(out, obj);
+ }
+
+ }
+
+ /**
+ * Writes a java.lang.Object as either a value or a CORBA Object.
+ * If {@code obj} is a value object or a stub object, it is written to
+ * {@code out.write_abstract_interface(java.lang.Object)}.
+ * If {@code obj} is an exported
+ * RMI-IIOP server object, the tie is found and wired to {@code obj},
+ * then written to {@code out.write_abstract_interface(java.lang.Object)}.
+ * @param out the stream in which to write the object.
+ * @param obj the object to write.
+ */
+ public static void writeAbstractObject(OutputStream out,
+ java.lang.Object obj) {
+
+ if (utilDelegate != null) {
+ utilDelegate.writeAbstractObject(out, obj);
+ }
+ }
+
+ /**
+ * 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.
+ */
+ public static void registerTarget(javax.rmi.CORBA.Tie tie,
+ java.rmi.Remote target) {
+
+ if (utilDelegate != null) {
+ utilDelegate.registerTarget(tie, target);
+ }
+
+ }
+
+ /**
+ * Removes the associated tie from an internal table
+ * and calls {@link Tie#deactivate}
+ * to deactivate the object.
+ * @param target the object to unexport.
+ */
+ public static void unexportObject(java.rmi.Remote target)
+ throws java.rmi.NoSuchObjectException
+ {
+
+ if (utilDelegate != null) {
+ utilDelegate.unexportObject(target);
+ }
+
+ }
+
+ /**
+ * 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 static Tie getTie (Remote target) {
+
+ if (utilDelegate != null) {
+ return utilDelegate.getTie(target);
+ }
+ return null;
+ }
+
+
+ /**
+ * Returns a singleton instance of a class that implements the
+ * {@link ValueHandler} interface.
+ * @return a class which implements the ValueHandler interface.
+ */
+ public static ValueHandler createValueHandler() {
+
+ isCustomSerializationPermitted();
+
+ if (utilDelegate != null) {
+ return utilDelegate.createValueHandler();
+ }
+ return null;
+ }
+
+ /**
+ * 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 static String getCodebase(java.lang.Class clz) {
+ if (utilDelegate != null) {
+ return utilDelegate.getCodebase(clz);
+ }
+ return null;
+ }
+
+ /**
+ * Returns a class instance for the specified class.
+ * <P>The spec for this method is the "Java to IDL language
+ * mapping", ptc/00-01-06.
+ * <P>In Java SE Platform, this method works as follows:
+ * <UL><LI>Find the first non-null {@code ClassLoader} on the
+ * call stack and attempt to load the class using this
+ * {@code ClassLoader}.
+ * <LI>If the first step fails, and if {@code remoteCodebase}
+ * is non-null and
+ * {@code useCodebaseOnly} is false, then call
+ * {@code java.rmi.server.RMIClassLoader.loadClass(remoteCodebase, className)}.
+ * <LI>If {@code remoteCodebase} is null or {@code useCodebaseOnly}
+ * is true, then call {@code java.rmi.server.RMIClassLoader.loadClass(className)}.
+ * <LI>If a class was not successfully loaded by step 1, 2, or 3,
+ * and {@code loader} is non-null, then call {@code loader.loadClass(className)}.
+ * <LI>If a class was successfully loaded by step 1, 2, 3, or 4, then
+ * return the loaded class, else throw {@code ClassNotFoundException}.
+ * </UL>
+ *
+ * @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 {@code ClassLoader} that may be used to
+ * load the class if all other methods fail.
+ * @return the {@code Class} object representing the loaded class.
+ * @exception ClassNotFoundException if class cannot be loaded.
+ */
+ public static Class loadClass(String className,
+ String remoteCodebase,
+ ClassLoader loader)
+ throws ClassNotFoundException {
+ if (utilDelegate != null) {
+ return utilDelegate.loadClass(className,remoteCodebase,loader);
+ }
+ return null ;
+ }
+
+
+ /**
+ * The {@code isLocal} method has the same semantics as the
+ * {@code ObjectImpl._is_local}
+ * method, except that it can throw a {@code RemoteException}.
+ *
+ * The {@code _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 {@code _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 {@code _is_local()}
+ * method returns false otherwise. The default behavior of {@code _is_local()} is
+ * to return false.
+ *
+ * @throws RemoteException The Java to IDL specification does not
+ * specify the conditions that cause a {@code RemoteException} to be thrown.
+ */
+ public static boolean isLocal(Stub stub) throws RemoteException {
+
+ if (utilDelegate != null) {
+ return utilDelegate.isLocal(stub);
+ }
+
+ return false;
+ }
+
+ /**
+ * 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 static RemoteException wrapException(Throwable orig) {
+
+ if (utilDelegate != null) {
+ return utilDelegate.wrapException(orig);
+ }
+
+ return null;
+ }
+
+ /**
+ * 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 static Object[] copyObjects (Object[] obj, ORB orb)
+ throws RemoteException {
+
+ if (utilDelegate != null) {
+ return utilDelegate.copyObjects(obj, orb);
+ }
+
+ return null;
+ }
+
+ /**
+ * 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 static Object copyObject (Object obj, ORB orb)
+ throws RemoteException {
+
+ if (utilDelegate != null) {
+ return utilDelegate.copyObject(obj, orb);
+ }
+ return null;
+ }
+
+ // Same code as in PortableRemoteObject. Can not be shared because they
+ // are in different packages and the visibility needs to be package for
+ // security reasons. If you know a better solution how to share this code
+ // then remove it from PortableRemoteObject. Also in Stub.java
+ private static Object createDelegate(String classKey) {
+
+ String className = (String)
+ AccessController.doPrivileged(new GetPropertyAction(classKey));
+ if (className == null) {
+ Properties props = getORBPropertiesFile();
+ if (props != null) {
+ className = props.getProperty(classKey);
+ }
+ }
+ if (className == null) {
+ return new com.sun.corba.se.impl.javax.rmi.CORBA.Util();
+ }
+
+ try {
+ return loadDelegateClass(className).newInstance();
+ } catch (ClassNotFoundException ex) {
+ INITIALIZE exc = new INITIALIZE( "Cannot instantiate " + className);
+ exc.initCause( ex ) ;
+ throw exc ;
+ } catch (Exception ex) {
+ INITIALIZE exc = new INITIALIZE( "Error while instantiating" + className);
+ exc.initCause( ex ) ;
+ throw exc ;
+ }
+ }
+
+ private static Class loadDelegateClass( String className ) throws ClassNotFoundException
+ {
+ try {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return Class.forName(className, false, loader);
+ } catch (ClassNotFoundException e) {
+ // ignore, then try RMIClassLoader
+ }
+
+ try {
+ return RMIClassLoader.loadClass(className);
+ } catch (MalformedURLException e) {
+ String msg = "Could not load " + className + ": " + e.toString();
+ ClassNotFoundException exc = new ClassNotFoundException( msg ) ;
+ throw exc ;
+ }
+ }
+ /**
+ * Load the orb.properties file.
+ */
+ private static Properties getORBPropertiesFile ()
+ {
+ return (Properties) AccessController.doPrivileged(
+ new GetORBPropertiesFileAction());
+ }
+
+ private static void isCustomSerializationPermitted() {
+ SecurityManager sm = System.getSecurityManager();
+ if ( sm != null) {
+ // check that a serialization permission has been
+ // set to allow the loading of the Util delegate
+ // which provides access to custom ValueHandler
+ sm.checkPermission(new SerializablePermission(
+ "enableCustomValueHandler"));
+}
+ }
+}
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/UtilDelegate.java b/src/java.corba/share/classes/javax/rmi/CORBA/UtilDelegate.java
new file mode 100644
index 0000000..c9f6dc1
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/UtilDelegate.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package javax.rmi.CORBA;
+
+import java.io.Serializable;
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+import javax.rmi.CORBA.Tie;
+import javax.rmi.CORBA.ValueHandler;
+import org.omg.CORBA.ORB;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.SystemException;
+
+/**
+ * Supports delegation for method implementations in {@link Util}. The
+ * delegate is a singleton instance of a class that implements this
+ * interface and provides a replacement implementation for all the
+ * methods of <code>javax.rmi.CORBA.Util</code>.
+ *
+ * Delegation is enabled by providing the delegate's class name as the
+ * value of the
+ * <code>javax.rmi.CORBA.UtilClass</code>
+ * system property.
+ *
+ * @see Util
+ */
+public interface UtilDelegate {
+
+ /**
+ * Delegation call for {@link Util#mapSystemException}.
+ */
+ RemoteException mapSystemException(SystemException ex);
+
+ /**
+ * Delegation call for {@link Util#writeAny}.
+ */
+ void writeAny(OutputStream out, Object obj);
+
+ /**
+ * Delegation call for {@link Util#readAny}.
+ */
+ java.lang.Object readAny(InputStream in);
+
+ /**
+ * Delegation call for {@link Util#writeRemoteObject}.
+ */
+ void writeRemoteObject(OutputStream out, Object obj);
+
+ /**
+ * Delegation call for {@link Util#writeAbstractObject}.
+ */
+ void writeAbstractObject(OutputStream out, Object obj);
+
+ /**
+ * Delegation call for {@link Util#registerTarget}.
+ */
+ void registerTarget(Tie tie, Remote target);
+
+ /**
+ * Delegation call for {@link Util#unexportObject}.
+ */
+ void unexportObject(Remote target) throws java.rmi.NoSuchObjectException;
+
+ /**
+ * Delegation call for {@link Util#getTie}.
+ */
+ Tie getTie(Remote target);
+
+ /**
+ * Delegation call for {@link Util#createValueHandler}.
+ */
+ ValueHandler createValueHandler();
+
+ /**
+ * Delegation call for {@link Util#getCodebase}.
+ */
+ String getCodebase(Class clz);
+
+ /**
+ * Delegation call for {@link Util#loadClass}.
+ */
+ Class loadClass(String className, String remoteCodebase, ClassLoader loader)
+ throws ClassNotFoundException;
+
+ /**
+ * Delegation call for {@link Util#isLocal}.
+ */
+ boolean isLocal(Stub stub) throws RemoteException;
+
+ /**
+ * Delegation call for {@link Util#wrapException}.
+ */
+ RemoteException wrapException(Throwable obj);
+
+ /**
+ * Delegation call for {@link Util#copyObject}.
+ */
+ Object copyObject(Object obj, ORB orb) throws RemoteException;
+
+ /**
+ * Delegation call for {@link Util#copyObjects}.
+ */
+ Object[] copyObjects(Object[] obj, ORB orb) throws RemoteException;
+
+}
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/ValueHandler.java b/src/java.corba/share/classes/javax/rmi/CORBA/ValueHandler.java
new file mode 100644
index 0000000..d05a736
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/ValueHandler.java
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package javax.rmi.CORBA;
+
+/**
+ * Defines methods which allow serialization of Java objects
+ * to and from GIOP streams.
+ **/
+public interface ValueHandler {
+
+ /**
+ * Writes a 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.
+ **/
+ void writeValue(org.omg.CORBA.portable.OutputStream out,
+ java.io.Serializable value);
+
+ /**
+ * Reads a value from the stream using Java semantics.
+ * @param in the stream to read the value from.
+ * @param offset the current position in the input stream.
+ * @param clz the type of the value to be read in.
+ * @param repositoryID the RepositoryId of the value to be read in.
+ * @param sender the sending context runtime codebase.
+ * @return the value read from the stream.
+ **/
+ java.io.Serializable readValue(org.omg.CORBA.portable.InputStream in,
+ int offset,
+ java.lang.Class clz,
+ String repositoryID,
+ org.omg.SendingContext.RunTime sender);
+
+ /**
+ * Returns the CORBA RepositoryId for the given Java class.
+ * @param clz a Java class.
+ * @return the CORBA RepositoryId for the class.
+ **/
+ java.lang.String getRMIRepositoryID(java.lang.Class clz);
+
+ /**
+ * Indicates whether the given class performs custom or
+ * default marshaling.
+ * @param clz the class to test for custom marshaling.
+ * @return <code>true</code> if the class performs custom marshaling, <code>false</code>
+ * if it does not.
+ **/
+ boolean isCustomMarshaled(java.lang.Class clz);
+
+ /**
+ * 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 client
+ * does the same on the first GIOP request.
+ * @return the SendingContext.CodeBase of this ValueHandler.
+ **/
+ org.omg.SendingContext.RunTime getRunTimeCodeBase();
+
+ /**
+ * If the value contains a <code>writeReplace</code> method then the result
+ * is returned. Otherwise, the value itself is returned.
+ * @param value the value to be marshaled.
+ * @return the true value to marshal on the wire.
+ **/
+ java.io.Serializable writeReplace(java.io.Serializable value);
+
+}
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/ValueHandlerMultiFormat.java b/src/java.corba/share/classes/javax/rmi/CORBA/ValueHandlerMultiFormat.java
new file mode 100644
index 0000000..6869c87
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/ValueHandlerMultiFormat.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2002, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package javax.rmi.CORBA;
+
+/**
+ * Java to IDL ptc 02-01-12 1.5.1.5
+ * @since 1.5
+ */
+public interface ValueHandlerMultiFormat extends ValueHandler {
+
+ /**
+ * Returns the maximum stream format version for
+ * RMI/IDL custom value types that is supported
+ * by this ValueHandler object. The ValueHandler
+ * object must support the returned stream format version and
+ * all lower versions.
+ *
+ * An ORB may use this value to include in a standard
+ * IOR tagged component or service context to indicate to other
+ * ORBs the maximum RMI-IIOP stream format that it
+ * supports. If not included, the default for GIOP 1.2
+ * is stream format version 1, and stream format version
+ * 2 for GIOP 1.3 and higher.
+ */
+ byte getMaximumStreamFormatVersion();
+
+ /**
+ * Allows the ORB to pass the stream format
+ * version for RMI/IDL custom value types. If the ORB
+ * calls this method, it must pass a stream format version
+ * between 1 and the value returned by the
+ * getMaximumStreamFormatVersion method inclusive,
+ * or else a BAD_PARAM exception with standard minor code
+ * will be thrown.
+ *
+ * If the ORB calls the older ValueHandler.writeValue(OutputStream,
+ * Serializable) method, stream format version 1 is implied.
+ *
+ * The ORB output stream passed to the ValueHandlerMultiFormat.writeValue
+ * method must implement the ValueOutputStream interface, and the
+ * ORB input stream passed to the ValueHandler.readValue method must
+ * implement the ValueInputStream interface.
+ */
+ void writeValue(org.omg.CORBA.portable.OutputStream out,
+ java.io.Serializable value,
+ byte streamFormatVersion);
+}
diff --git a/src/java.corba/share/classes/javax/rmi/CORBA/package.html b/src/java.corba/share/classes/javax/rmi/CORBA/package.html
new file mode 100644
index 0000000..db004c6
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/CORBA/package.html
@@ -0,0 +1,35 @@
+<html>
+<head>
+<title>javax.rmi.CORBA package</title>
+<!--
+Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+</head>
+<body bgcolor="white">
+Contains portability APIs for RMI-IIOP. These APIs
+provide a standard interface between the generated stubs and ties and the
+RMI-IIOP runtime. They also allow third party ORBs to be used for RMI over IIOP
+as an alternative to the ORB supplied by Sun. They are not intended to be called
+directly from RMI-IIOP applications. See also the {@link javax.rmi} package.
+</body>
diff --git a/src/java.corba/share/classes/javax/rmi/PortableRemoteObject.java b/src/java.corba/share/classes/javax/rmi/PortableRemoteObject.java
new file mode 100644
index 0000000..6cd0dc7
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/PortableRemoteObject.java
@@ -0,0 +1,295 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package javax.rmi;
+
+import java.lang.reflect.Method ;
+
+import org.omg.CORBA.INITIALIZE;
+import javax.rmi.CORBA.Util;
+
+import java.rmi.RemoteException;
+import java.rmi.NoSuchObjectException;
+import java.rmi.Remote;
+import java.io.File;
+import java.io.FileInputStream;
+import java.util.Properties;
+import java.net.MalformedURLException ;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.rmi.server.RMIClassLoader;
+
+import com.sun.corba.se.impl.orbutil.GetPropertyAction;
+
+/**
+ * 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.
+ *
+ * <p>See also {@extLink rmi_iiop_guides RMI-IIOP developer's guides}.</p>
+ */
+public class PortableRemoteObject {
+
+ private static final javax.rmi.CORBA.PortableRemoteObjectDelegate proDelegate;
+
+ private static final String PortableRemoteObjectClassKey =
+ "javax.rmi.CORBA.PortableRemoteObjectClass";
+
+ static {
+ proDelegate = (javax.rmi.CORBA.PortableRemoteObjectDelegate)
+ createDelegate(PortableRemoteObjectClassKey);
+ }
+
+ /**
+ * Initializes the object by calling <code>exportObject(this)</code>.
+ * @exception RemoteException if export fails.
+ */
+ protected PortableRemoteObject() throws RemoteException {
+ if (proDelegate != null) {
+ PortableRemoteObject.exportObject((Remote)this);
+ }
+ }
+
+ /**
+ * 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 static void exportObject(Remote obj)
+ throws RemoteException {
+
+ // Let the delegate do everything, including error handling.
+ if (proDelegate != null) {
+ proDelegate.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}.
+ * @return the most derived stub for the object.
+ * @exception NoSuchObjectException if a stub cannot be located for the given server object.
+ */
+ public static Remote toStub (Remote obj)
+ throws NoSuchObjectException {
+
+ if (proDelegate != null) {
+ return proDelegate.toStub(obj);
+ }
+ return null;
+ }
+
+ /**
+ * 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.
+ */
+ public static void unexportObject(Remote obj)
+ throws NoSuchObjectException {
+
+ if (proDelegate != null) {
+ proDelegate.unexportObject(obj);
+ }
+
+ }
+
+ /**
+ * 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 static java.lang.Object narrow ( java.lang.Object narrowFrom,
+ java.lang.Class narrowTo)
+ throws ClassCastException {
+
+ if (proDelegate != null) {
+ return proDelegate.narrow(narrowFrom, narrowTo);
+ }
+ return null;
+
+ }
+
+ /**
+ * 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} method for more information.
+ * @param target the object to connect.
+ * @param source a previously connected object.
+ * @throws RemoteException if <code>source</code> is not connected
+ * or if <code>target</code> is already connected to a different ORB than
+ * <code>source</code>.
+ */
+ public static void connect (Remote target, Remote source)
+ throws RemoteException {
+
+ if (proDelegate != null) {
+ proDelegate.connect(target, source);
+ }
+
+ }
+
+ // Same code as in javax.rmi.CORBA.Util. Can not be shared because they
+ // are in different packages and the visibility needs to be package for
+ // security reasons. If you know a better solution how to share this code
+ // then remove it from here.
+ private static Object createDelegate(String classKey) {
+ String className = (String)
+ AccessController.doPrivileged(new GetPropertyAction(classKey));
+ if (className == null) {
+ Properties props = getORBPropertiesFile();
+ if (props != null) {
+ className = props.getProperty(classKey);
+ }
+ }
+ if (className == null) {
+ return new com.sun.corba.se.impl.javax.rmi.PortableRemoteObject();
+ }
+
+ try {
+ return (Object) loadDelegateClass(className).newInstance();
+ } catch (ClassNotFoundException ex) {
+ INITIALIZE exc = new INITIALIZE( "Cannot instantiate " + className);
+ exc.initCause( ex ) ;
+ throw exc ;
+ } catch (Exception ex) {
+ INITIALIZE exc = new INITIALIZE( "Error while instantiating" + className);
+ exc.initCause( ex ) ;
+ throw exc ;
+ }
+
+ }
+
+ private static Class loadDelegateClass( String className ) throws ClassNotFoundException
+ {
+ try {
+ ClassLoader loader = Thread.currentThread().getContextClassLoader();
+ return Class.forName(className, false, loader);
+ } catch (ClassNotFoundException e) {
+ // ignore, then try RMIClassLoader
+ }
+
+ try {
+ return RMIClassLoader.loadClass(className);
+ } catch (MalformedURLException e) {
+ String msg = "Could not load " + className + ": " + e.toString();
+ ClassNotFoundException exc = new ClassNotFoundException( msg ) ;
+ throw exc ;
+ }
+ }
+
+ /**
+ * Load the orb.properties file.
+ */
+ private static Properties getORBPropertiesFile () {
+ return (Properties) AccessController.doPrivileged(new GetORBPropertiesFileAction());
+ }
+}
+
+class GetORBPropertiesFileAction implements PrivilegedAction {
+ private boolean debug = false ;
+
+ public GetORBPropertiesFileAction () {
+ }
+
+ private String getSystemProperty(final String name) {
+ // This will not throw a SecurityException because this
+ // class was loaded from rt.jar using the bootstrap classloader.
+ String propValue = (String) AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public java.lang.Object run() {
+ return System.getProperty(name);
+ }
+ }
+ );
+
+ return propValue;
+ }
+
+ private void getPropertiesFromFile( Properties props, String fileName )
+ {
+ try {
+ File file = new File( fileName ) ;
+ if (!file.exists())
+ return ;
+
+ FileInputStream in = new FileInputStream( file ) ;
+
+ try {
+ props.load( in ) ;
+ } finally {
+ in.close() ;
+ }
+ } catch (Exception exc) {
+ if (debug)
+ System.out.println( "ORB properties file " + fileName +
+ " not found: " + exc) ;
+ }
+ }
+
+ public Object run()
+ {
+ Properties defaults = new Properties() ;
+
+ String javaHome = getSystemProperty( "java.home" ) ;
+ String fileName = javaHome + File.separator + "lib" + File.separator +
+ "orb.properties" ;
+
+ getPropertiesFromFile( defaults, fileName ) ;
+
+ Properties results = new Properties( defaults ) ;
+
+ String userHome = getSystemProperty( "user.home" ) ;
+ fileName = userHome + File.separator + "orb.properties" ;
+
+ getPropertiesFromFile( results, fileName ) ;
+ return results ;
+ }
+}
diff --git a/src/java.corba/share/classes/javax/rmi/package.html b/src/java.corba/share/classes/javax/rmi/package.html
new file mode 100644
index 0000000..e743b10
--- /dev/null
+++ b/src/java.corba/share/classes/javax/rmi/package.html
@@ -0,0 +1,34 @@
+<html>
+<head>
+<title>javax.rmi package</title>
+<!--
+Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+</head>
+<body bgcolor="white">
+Contains user APIs for RMI-IIOP. These APIs are
+provided for use by RMI-IIOP applications, and provide equivalent
+semantics when running over either IIOP or JRMP. See also the
+{@link javax.rmi.CORBA} package.
+</body>
diff --git a/src/java.corba/share/classes/module-info.java b/src/java.corba/share/classes/module-info.java
new file mode 100644
index 0000000..b2d862f
--- /dev/null
+++ b/src/java.corba/share/classes/module-info.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Defines the Java binding of the OMG CORBA APIs, and the RMI-IIOP API.
+ *
+ * <p> This module is upgradeable.
+ *
+ * @moduleGraph
+ * @since 9
+ */
+@Deprecated(since="9", forRemoval=true)
+module java.corba {
+ requires java.logging;
+ requires java.naming;
+ requires java.transaction;
+ requires jdk.unsupported;
+
+ requires transitive java.desktop;
+ requires transitive java.rmi;
+
+ exports javax.activity;
+ exports javax.rmi;
+ exports javax.rmi.CORBA;
+ exports org.omg.CORBA;
+ exports org.omg.CORBA.DynAnyPackage;
+ exports org.omg.CORBA.ORBPackage;
+ exports org.omg.CORBA.TypeCodePackage;
+ exports org.omg.CORBA.portable;
+ exports org.omg.CORBA_2_3;
+ exports org.omg.CORBA_2_3.portable;
+ exports org.omg.CosNaming;
+ exports org.omg.CosNaming.NamingContextExtPackage;
+ exports org.omg.CosNaming.NamingContextPackage;
+ exports org.omg.Dynamic;
+ exports org.omg.DynamicAny;
+ exports org.omg.DynamicAny.DynAnyFactoryPackage;
+ exports org.omg.DynamicAny.DynAnyPackage;
+ exports org.omg.IOP;
+ exports org.omg.IOP.CodecFactoryPackage;
+ exports org.omg.IOP.CodecPackage;
+ exports org.omg.Messaging;
+ exports org.omg.PortableInterceptor;
+ exports org.omg.PortableInterceptor.ORBInitInfoPackage;
+ exports org.omg.PortableServer;
+ exports org.omg.PortableServer.CurrentPackage;
+ exports org.omg.PortableServer.POAManagerPackage;
+ exports org.omg.PortableServer.POAPackage;
+ exports org.omg.PortableServer.ServantLocatorPackage;
+ exports org.omg.PortableServer.portable;
+ exports org.omg.SendingContext;
+ exports org.omg.stub.java.rmi;
+
+ // rmic --iiop
+ exports com.sun.corba.se.impl.util to jdk.rmic;
+
+ // JNDI CosNaming provider
+ opens com.sun.jndi.cosnaming to java.naming; // jndiprovider.properties
+ exports com.sun.jndi.url.corbaname to java.naming;
+ exports com.sun.jndi.url.iiop to java.naming;
+ exports com.sun.jndi.url.iiopname to java.naming;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_COMPLETED.java b/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_COMPLETED.java
new file mode 100644
index 0000000..b733453
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_COMPLETED.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The <code>ACTIVITY_COMPLETED</code> system exception may be raised on any
+ * method for which Activity context is accessed. It indicates that the
+ * Activity context in which the method call was made has been completed due
+ * to a timeout of either the Activity itself or a transaction that encompasses
+ * the Activity, or that the Activity completed in a manner other than that
+ * originally requested.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since J2SE 1.5
+ */
+
+public final class ACTIVITY_COMPLETED extends SystemException {
+
+ /**
+ * Constructs an <code>ACTIVITY_COMPLETED</code> exception with
+ * minor code set to 0 and CompletionStatus set to COMPLETED_NO.
+ */
+ public ACTIVITY_COMPLETED() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>ACTIVITY_COMPLETED</code> exception with the
+ * specified message.
+ *
+ * @param detailMessage string containing a detailed message.
+ */
+ public ACTIVITY_COMPLETED(String detailMessage) {
+ this(detailMessage, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>ACTIVITY_COMPLETED</code> exception with the
+ * specified minor code and completion status.
+ *
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public ACTIVITY_COMPLETED(int minorCode,
+ CompletionStatus completionStatus) {
+ this("", minorCode, completionStatus);
+ }
+
+ /**
+ * Constructs an <code>ACTIVITY_COMPLETED</code> exception with the
+ * specified message, minor code, and completion status.
+ *
+ * @param detailMessage string containing a detailed message.
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public ACTIVITY_COMPLETED(String detailMessage,
+ int minorCode,
+ CompletionStatus completionStatus) {
+ super(detailMessage, minorCode, completionStatus);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_REQUIRED.java b/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_REQUIRED.java
new file mode 100644
index 0000000..1e31993
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ACTIVITY_REQUIRED.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The <code>ACTIVITY_REQUIRED</code> system exception may be raised on any
+ * method for which an Activity context is required. It indicates that an
+ * Activity context was necessary to perform the invoked operation, but one
+ * was not found associated with the calling thread.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since J2SE 1.5
+ */
+
+public final class ACTIVITY_REQUIRED extends SystemException {
+
+ /**
+ * Constructs an <code>ACTIVITY_REQUIRED</code> exception with
+ * minor code set to 0 and CompletionStatus set to COMPLETED_NO.
+ */
+ public ACTIVITY_REQUIRED() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>ACTIVITY_REQUIRED</code> exception with the
+ * specified message.
+ *
+ * @param detailMessage string containing a detailed message.
+ */
+ public ACTIVITY_REQUIRED(String detailMessage) {
+ this(detailMessage, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>ACTIVITY_REQUIRED</code> exception with the
+ * specified minor code and completion status.
+ *
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public ACTIVITY_REQUIRED(int minorCode,
+ CompletionStatus completionStatus) {
+ this("", minorCode, completionStatus);
+ }
+
+ /**
+ * Constructs an <code>ACTIVITY_REQUIRED</code> exception with the
+ * specified message, minor code, and completion status.
+ *
+ * @param detailMessage string containing a detailed message.
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public ACTIVITY_REQUIRED(String detailMessage,
+ int minorCode,
+ CompletionStatus completionStatus) {
+ super(detailMessage, minorCode, completionStatus);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ARG_IN.java b/src/java.corba/share/classes/org/omg/CORBA/ARG_IN.java
new file mode 100644
index 0000000..14d415e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ARG_IN.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Signifies an "input" argument to an invocation,
+ * meaning that the argument is being passed from the client to
+ * the server.
+ * <code>ARG_IN.value</code> is one of the possible values used to
+ * indicate the direction in
+ * which a parameter is being passed during an invocation performed
+ * using the Dynamic Invocation Interface (DII).
+ * <P>
+ * The code fragment below shows a typical usage:
+ * <PRE>
+ * ORB orb = ORB.init(args, null);
+ * org.omg.CORBA.NamedValue nv = orb.create_named_value(
+ * "IDLArgumentIdentifier", myAny, org.omg.CORBA.ARG_IN.value);
+ * </PRE>
+ *
+ * @see org.omg.CORBA.NamedValue
+ * @since JDK1.2
+ */
+public interface ARG_IN {
+
+ /**
+ * The value indicating an input argument.
+ */
+ int value = 1;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ARG_INOUT.java b/src/java.corba/share/classes/org/omg/CORBA/ARG_INOUT.java
new file mode 100644
index 0000000..b33b8c0
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ARG_INOUT.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Signifies an argument used for both input and output in an invocation,
+ * meaning that the argument is being passed from the client to
+ * the server and then back from the server to the client.
+ * <code>ARG_INOUT.value</code> is one of the possible values used to
+ * indicate the direction in
+ * which a parameter is being passed during a dynamic invocation
+ * using the Dynamic Invocation Interface (DII).
+ * <P>
+ * The code fragment below shows a typical usage:
+ * <PRE>
+ * ORB orb = ORB.init(args, null);
+ * org.omg.CORBA.NamedValue nv = orb.create_named_value(
+ * "argumentIdentifier", myAny, org.omg.CORBA.ARG_INOUT.value);
+ * </PRE>
+ *
+ * @see org.omg.CORBA.NamedValue
+ * @since JDK1.2
+ */
+public interface ARG_INOUT {
+
+/**
+ * The constant value indicating an argument used for both
+ * input and output.
+ */
+ int value = 3;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ARG_OUT.java b/src/java.corba/share/classes/org/omg/CORBA/ARG_OUT.java
new file mode 100644
index 0000000..8d4443b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ARG_OUT.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A constant that signifies an "output" argument to an invocation,
+ * meaning that the argument is being passed from the server to
+ * the client.
+ * <code>ARG_OUT.value</code> is one of the possible values used
+ * to indicate the direction in
+ * which a parameter is being passed during a dynamic invocation
+ * using the Dynamic Invocation Interface (DII).
+ * <P>
+ * The code fragment below shows a typical usage:
+ * <PRE>
+ * ORB orb = ORB.init(args, null);
+ * org.omg.CORBA.NamedValue nv = orb.create_named_value(
+ * "argumentIdentifier", myAny, org.omg.CORBA.ARG_OUT.value);
+ * </PRE>
+ *
+ * @see org.omg.CORBA.NamedValue
+ * @since JDK1.2
+ */
+public interface ARG_OUT {
+
+/**
+ * The constant value indicating an output argument.
+ */
+ int value = 2;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/Any.java b/src/java.corba/share/classes/org/omg/CORBA/Any.java
new file mode 100644
index 0000000..c02b4fa
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/Any.java
@@ -0,0 +1,721 @@
+/*
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * Serves as a container for any data that can be
+ * described in IDL or for any IDL primitive type.
+ * An <code>Any</code> object is used as a component of a
+ * <code>NamedValue</code> object, which provides information about
+ * arguments or return values in requests, and which is used to define
+ * name/value pairs in <code>Context</code> objects.
+ <p>
+ *
+ * An <code>Any</code> object consists of two parts:
+ * <OL>
+ * <LI>a data value
+ * <LI>a <code>TypeCode</code> object describing the type of the data
+ * value contained in the <code>Any</code> object. For example,
+ * a <code>TypeCode</code> object for an array contains
+ * a field for the length of the array and a field for
+ * the type of elements in the array. (Note that in this case, the
+ * second field of the <code>TypeCode</code> object is itself a
+ * <code>TypeCode</code> object.)
+ * </OL>
+ *
+ * <P>
+ * <a id="anyOps"></a>
+ * A large part of the <code>Any</code> class consists of pairs of methods
+ * for inserting values into and extracting values from an
+ * <code>Any</code> object.
+ * <P>
+ * For a given primitive type X, these methods are:
+ * <dl>
+ * <dt><code><b>void insert_X(X x)</b></code>
+ * <dd> This method allows the insertion of
+ * an instance <code>x</code> of primitive type <code>X</code>
+ * into the <code>value</code> field of the <code>Any</code> object.
+ * Note that the method
+ * <code>insert_X</code> also resets the <code>Any</code> object's
+ * <code>type</code> field if necessary.
+ * <dt> <code><b>X extract_X()</b></code>
+ * <dd> This method allows the extraction of an instance of
+ * type <code>X</code> from the <code>Any</code> object.
+ * <BR>
+ * <P>
+ * This method throws the exception <code>BAD_OPERATION</code> under two conditions:
+ * <OL>
+ * <LI> the type of the element contained in the <code>Any</code> object is not
+ * <code>X</code>
+ * <LI> the method <code>extract_X</code> is called before
+ * the <code>value</code> field of the <code>Any</code> object
+ * has been set
+ * </OL>
+ * </dl>
+ * <P>
+ * There are distinct method pairs for each
+ * primitive IDL data type (<code>insert_long</code> and <code>extract_long</code>,
+ * <code>insert_string</code> and <code>extract_string</code>, and so on).<BR>
+ * <P>
+ * The class <code>Any</code> also has methods for
+ * getting and setting the type code,
+ * for testing two <code>Any</code> objects for equality,
+ * and for reading an <code>Any</code> object from a stream or
+ * writing it to a stream.
+ * <BR>
+ * @since JDK1.2
+ */
+abstract public class Any implements IDLEntity {
+
+ /**
+ * Checks for equality between this <code>Any</code> object and the
+ * given <code>Any</code> object. Two <code>Any</code> objects are
+ * equal if both their values and type codes are equal.
+ *
+ * @param a the <code>Any</code> object to test for equality
+ * @return <code>true</code> if the <code>Any</code> objects are equal;
+ * <code>false</code> otherwise
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ abstract public boolean equal(Any a);
+
+ /**
+ * Returns type information for the element contained in this
+ * <code>Any</code> object.
+ *
+ * @return the <code>TypeCode</code> object containing type information
+ * about the value contained in this <code>Any</code> object
+ */
+ abstract public TypeCode type();
+
+ /**
+ * Sets this <code>Any</code> object's <code>type</code> field
+ * to the given <code>TypeCode</code> object and clears its value.
+ * <P>
+ * Note that using this method to set the type code wipes out the
+ * value if there is one. The method
+ * is provided primarily so that the type may be set properly for
+ * IDL <code>out</code> parameters. Generally, setting the type
+ * is done by the <code>insert_X</code> methods, which will set the type
+ * to X if it is not already set to X.
+ *
+ * @param t the <code>TypeCode</code> object giving
+ * information for the value in
+ * this <code>Any</code> object
+ */
+ abstract public void type(TypeCode t);
+
+ ///////////////////////////////////////////////////////////////////////////
+ // marshalling/unmarshalling routines
+
+ /**
+ * Reads off (unmarshals) the value of an <code>Any</code> object from
+ * the given input stream using the given typecode.
+ *
+ * @param is the <code>org.omg.CORBA.portable.InputStream</code>
+ * object from which to read
+ * the value contained in this <code>Any</code> object
+ *
+ * @param t a <code>TypeCode</code> object containing type information
+ * about the value to be read
+ *
+ * @exception MARSHAL when the given <code>TypeCode</code> object is
+ * not consistent with the value that was contained
+ * in the input stream
+ */
+ abstract public void read_value(InputStream is, TypeCode t)
+ throws MARSHAL;
+
+ /**
+ * Writes out the value of this <code>Any</code> object
+ * to the given output stream. If both <code>typecode</code>
+ * and <code>value</code> need to be written, use
+ * <code>create_output_stream()</code> to create an <code>OutputStream</code>,
+ * then use <code>write_any</code> on the <code>OutputStream</code>.
+ * <P>
+ * If this method is called on an <code>Any</code> object that has not
+ * had a value inserted into its <code>value</code> field, it will throw
+ * the exception <code>java.lang.NullPointerException</code>.
+ *
+ * @param os the <code>org.omg.CORBA.portable.OutputStream</code>
+ * object into which to marshal the value
+ * of this <code>Any</code> object
+ *
+ */
+ abstract public void write_value(OutputStream os);
+
+ /**
+ * Creates an output stream into which this <code>Any</code> object's
+ * value can be marshalled.
+ *
+ * @return the newly-created <code>OutputStream</code>
+ */
+ abstract public OutputStream create_output_stream();
+
+ /**
+ * Creates an input stream from which this <code>Any</code> object's value
+ * can be unmarshalled.
+ *
+ * @return the newly-created <code>InputStream</code>
+ */
+ abstract public InputStream create_input_stream();
+
+ ///////////////////////////////////////////////////////////////////////////
+ // basic insertion/extraction methods
+
+ /**
+ * Extracts the <code>short</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>short</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>short</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public short extract_short() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>short</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param s the <code>short</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_short(short s);
+
+ /**
+ * Extracts the <code>int</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>int</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than an <code>int</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public int extract_long() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>int</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param l the <code>int</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_long(int l);
+
+
+ /**
+ * Extracts the <code>long</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>long</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>long</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public long extract_longlong() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>long</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param l the <code>long</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_longlong(long l);
+
+ /**
+ * Extracts the <code>short</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>short</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>short</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public short extract_ushort() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>short</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param s the <code>short</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_ushort(short s);
+
+ /**
+ * Extracts the <code>int</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>int</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than an <code>int</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public int extract_ulong() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>int</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param l the <code>int</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_ulong(int l);
+
+ /**
+ * Extracts the <code>long</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>long</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>long</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public long extract_ulonglong() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>long</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param l the <code>long</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_ulonglong(long l);
+
+ /**
+ * Extracts the <code>float</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>float</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>float</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public float extract_float() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>float</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param f the <code>float</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_float(float f);
+
+ /**
+ * Extracts the <code>double</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>double</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>double</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public double extract_double() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>double</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param d the <code>double</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_double(double d);
+
+ /**
+ * Extracts the <code>boolean</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>boolean</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>boolean</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public boolean extract_boolean() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>boolean</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param b the <code>boolean</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_boolean(boolean b);
+
+ /**
+ * Extracts the <code>char</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>char</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>char</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public char extract_char() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>char</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param c the <code>char</code> to insert into this
+ * <code>Any</code> object
+ * @exception DATA_CONVERSION if there is a data conversion
+ * error
+ */
+ abstract public void insert_char(char c) throws DATA_CONVERSION;
+
+ /**
+ * Extracts the <code>char</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>char</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>char</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public char extract_wchar() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>char</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param c the <code>char</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_wchar(char c);
+
+ /**
+ * Extracts the <code>byte</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>byte</code> stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>byte</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public byte extract_octet() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>byte</code>
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param b the <code>byte</code> to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_octet(byte b);
+
+ /**
+ * Extracts the <code>Any</code> object in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>Any</code> object stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than an <code>Any</code> object or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public Any extract_any() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>Any</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param a the <code>Any</code> object to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_any(Any a);
+
+ /**
+ * Extracts the <code>org.omg.CORBA.Object</code> in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>org.omg.CORBA.Object</code> stored in
+ * this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than an
+ * <code>org.omg.CORBA.Object</code> or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public org.omg.CORBA.Object extract_Object() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>org.omg.CORBA.Object</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param o the <code>org.omg.CORBA.Object</code> object to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_Object(org.omg.CORBA.Object o);
+
+ /**
+ * Extracts the <code>java.io.Serializable</code> object in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>java.io.Serializable</code> object stored in
+ * this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>java.io.Serializable</code>
+ * object or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public java.io.Serializable extract_Value() throws BAD_OPERATION ;
+
+ /**
+ * Inserts the given <code>java.io.Serializable</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param v the <code>java.io.Serializable</code> object to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_Value(java.io.Serializable v) ;
+
+ /**
+ * Inserts the given <code>java.io.Serializable</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param v the <code>java.io.Serializable</code> object to insert into this
+ * <code>Any</code> object
+ * @param t the <code>TypeCode</code> object that is to be inserted into
+ * this <code>Any</code> object's <code>type</code> field
+ * and that describes the <code>java.io.Serializable</code>
+ * object being inserted
+ * @throws MARSHAL if the ORB has a problem marshalling or
+ * unmarshalling parameters
+ */
+ abstract public void insert_Value(java.io.Serializable v, TypeCode t)
+ throws MARSHAL ;
+/**
+ * Inserts the given <code>org.omg.CORBA.Object</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param o the <code>org.omg.CORBA.Object</code> instance to insert into this
+ * <code>Any</code> object
+ * @param t the <code>TypeCode</code> object that is to be inserted into
+ * this <code>Any</code> object and that describes
+ * the <code>Object</code> being inserted
+ * @exception BAD_OPERATION if this method is invalid for this
+ * <code>Any</code> object
+ *
+ */
+ abstract public void insert_Object(org.omg.CORBA.Object o, TypeCode t)
+ throws BAD_PARAM;
+
+ /**
+ * Extracts the <code>String</code> object in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>String</code> object stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>String</code> object or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public String extract_string() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>String</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param s the <code>String</code> object to insert into this
+ * <code>Any</code> object
+ * @exception DATA_CONVERSION if there is a data conversion error
+ * @exception MARSHAL if the ORB has a problem marshalling or
+ * unmarshalling parameters
+ */
+ abstract public void insert_string(String s) throws DATA_CONVERSION, MARSHAL;
+
+ /**
+ * Extracts the <code>String</code> object in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>String</code> object stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>String</code> object or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public String extract_wstring() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>String</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param s the <code>String</code> object to insert into this
+ * <code>Any</code> object
+ * @exception MARSHAL if the ORB has a problem marshalling or
+ * unmarshalling parameters
+ */
+ abstract public void insert_wstring(String s) throws MARSHAL;
+
+ /**
+ * Extracts the <code>TypeCode</code> object in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>TypeCode</code> object stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a <code>TypeCode</code> object or the
+ * <code>value</code> field has not yet been set
+ */
+ abstract public TypeCode extract_TypeCode() throws BAD_OPERATION;
+
+ /**
+ * Inserts the given <code>TypeCode</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param t the <code>TypeCode</code> object to insert into this
+ * <code>Any</code> object
+ */
+ abstract public void insert_TypeCode(TypeCode t);
+
+ /**
+ * Extracts the <code>Principal</code> object in this
+ * <code>Any</code> object's <code>value</code> field.
+ * Note that the class <code>Principal</code> has been deprecated.
+ *
+ * @return the <code>Principal</code> object stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a
+ * <code>Principal</code> object or the
+ * <code>value</code> field has not yet been set
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ * @deprecated Deprecated by CORBA 2.2.
+ */
+ @Deprecated
+ public Principal extract_Principal() throws BAD_OPERATION {
+ throw new org.omg.CORBA.NO_IMPLEMENT() ;
+ }
+
+ /**
+ * Inserts the given <code>Principal</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ * Note that the class <code>Principal</code> has been deprecated.
+ *
+ * @param p the <code>Principal</code> object to insert into this
+ * <code>Any</code> object
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ * @deprecated Deprecated by CORBA 2.2.
+ */
+ @Deprecated
+ public void insert_Principal(Principal p) {
+ throw new org.omg.CORBA.NO_IMPLEMENT() ;
+ }
+
+ ///////////////////////////////////////////////////////////////////////////
+ // insertion/extraction of streamables
+
+ /**
+ * Extracts a <code>Streamable</code> from this <code>Any</code> object's
+ * <code>value</code> field. This method allows the extraction of
+ * non-primitive IDL types.
+ *
+ * @return the <code>Streamable</code> stored in the <code>Any</code> object.
+ * @throws BAD_INV_ORDER if the caller has invoked operations in the wrong order
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.portable.Streamable extract_Streamable()
+ throws org.omg.CORBA.BAD_INV_ORDER {
+ throw new org.omg.CORBA.NO_IMPLEMENT() ;
+ }
+
+ /**
+ * Inserts the given <code>Streamable</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ * This method allows the insertion of non-primitive IDL types.
+ *
+ * @param s the <code>Streamable</code> object to insert into this
+ * <code>Any</code> object; may be a non-primitive
+ * IDL type
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public void insert_Streamable(Streamable s) {
+ throw new org.omg.CORBA.NO_IMPLEMENT() ;
+ }
+
+ /**
+ * Extracts the <code>java.math.BigDecimal</code> object in this
+ * <code>Any</code> object's <code>value</code> field.
+ *
+ * @return the <code>java.math.BigDecimal</code> object
+ * stored in this <code>Any</code> object
+ * @exception BAD_OPERATION if this <code>Any</code> object
+ * contains something other than a
+ * <code>java.math.BigDecimal</code> object or the
+ * <code>value</code> field has not yet been set
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public java.math.BigDecimal extract_fixed() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Throws an <a href="package-summary.html#NO_IMPLEMENT">
+ * <code>org.omg.CORBA.NO_IMPLEMENT</code></a> exception.
+ * <P>
+ * Inserts the given <code>java.math.BigDecimal</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param value the <code>java.math.BigDecimal</code> object
+ * to insert into this <code>Any</code> object
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public void insert_fixed(java.math.BigDecimal value) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Throws an <a href="package-summary.html#NO_IMPLEMENT">
+ * <code>org.omg.CORBA.NO_IMPLEMENT</code></a> exception.
+ * <P>
+ * Inserts the given <code>java.math.BigDecimal</code> object
+ * into this <code>Any</code> object's <code>value</code> field.
+ *
+ * @param value the <code>java.math.BigDecimal</code> object
+ * to insert into this <code>Any</code> object
+ * @param type the <code>TypeCode</code> object that is to be inserted into
+ * this <code>Any</code> object's <code>type</code> field
+ * and that describes the <code>java.math.BigDecimal</code>
+ * object being inserted
+ * @throws org.omg.CORBA.BAD_INV_ORDER if this method is invoked improperly
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public void insert_fixed(java.math.BigDecimal value, org.omg.CORBA.TypeCode type)
+ throws org.omg.CORBA.BAD_INV_ORDER
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/AnyHolder.java b/src/java.corba/share/classes/org/omg/CORBA/AnyHolder.java
new file mode 100644
index 0000000..fed1979
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/AnyHolder.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Holder for {@code Any}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for {@code Any} objects
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code any} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code AnyHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myAnyHolder} is an instance of {@code AnyHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myAnyHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class AnyHolder implements Streamable {
+ /**
+ * The {@code Any} value held by this {@code AnyHolder} object.
+ */
+
+ public Any value;
+
+ /**
+ * Constructs a new {@code AnyHolder} object with its
+ * {@code value} field initialized to {@code null}.
+ */
+ public AnyHolder() {
+ }
+
+ /**
+ * Constructs a new {@code AnyHolder} object for the given
+ * {@code Any} object.
+ * @param initial the {@code Any} object with which to initialize
+ * the {@code value} field of the new
+ * {@code AnyHolder} object
+ */
+ public AnyHolder(Any initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads from {@code input} and initalizes the value in the Holder
+ * with the unmarshalled data.
+ *
+ * @param input the InputStream containing CDR formatted data from the wire.
+ */
+ public void _read(InputStream input) {
+ value = input.read_any();
+ }
+
+ /**
+ * Marshals to {@code output} the value in
+ * this {@code AnyHolder} object.
+ *
+ * @param output the OutputStream which will contain the CDR formatted data.
+ */
+ public void _write(OutputStream output) {
+ output.write_any(value);
+ }
+
+ /**
+ * Returns the {@code TypeCode} object corresponding to the value
+ * held in this {@code AnyHolder} object.
+ *
+ * @return the TypeCode of the value held in
+ * this {@code AnyHolder} object
+ */
+ public TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_any);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/AnySeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/AnySeqHelper.java
new file mode 100644
index 0000000..1897a8e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/AnySeqHelper.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code AnySeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/AnySeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
+
+public abstract class AnySeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/AnySeq: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 ());
+ }
+
+ 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);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.AnySeqHelper.id (), "AnySeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.Any[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.Any value[] = null;
+ int _len0 = istream.read_long ();
+ value = new org.omg.CORBA.Any[_len0];
+ for (int _o1 = 0;_o1 < value.length; ++_o1)
+ value[_o1] = istream.read_any ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Any[] value)
+ {
+ ostream.write_long (value.length);
+ for (int _i0 = 0;_i0 < value.length; ++_i0)
+ ostream.write_any (value[_i0]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/AnySeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/AnySeqHolder.java
new file mode 100644
index 0000000..4f5dd59
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/AnySeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Holder for {@code AnySeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/AnySeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
+
+public final class AnySeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.omg.CORBA.Any value[] = null;
+
+ public AnySeqHolder ()
+ {
+ }
+
+ public AnySeqHolder (org.omg.CORBA.Any[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.AnySeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.AnySeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.AnySeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BAD_CONTEXT.java b/src/java.corba/share/classes/org/omg/CORBA/BAD_CONTEXT.java
new file mode 100644
index 0000000..f32f686
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BAD_CONTEXT.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown when an operation is invoked by a client but the passed
+ * context does not contain the context values required by the operation.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class BAD_CONTEXT extends SystemException {
+
+ /**
+ * Constructs a <code>BAD_CONTEXT</code> exception
+ * with a default minor code
+ * of 0 and a completion state of COMPLETED_NO.
+ */
+ public BAD_CONTEXT() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>BAD_CONTEXT</code> exception
+ * with the specified detail message, a minor code
+ * of 0 and a completion state of COMPLETED_NO.
+ * @param s a <code>String</code> object containing a detail message
+ */
+ public BAD_CONTEXT(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>BAD_CONTEXT</code> exception
+ * with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code> indicating
+ * the completion status
+ */
+ public BAD_CONTEXT(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>BAD_CONTEXT</code> exception
+ * with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code> indicating
+ * the completion status
+ */
+ public BAD_CONTEXT(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BAD_INV_ORDER.java b/src/java.corba/share/classes/org/omg/CORBA/BAD_INV_ORDER.java
new file mode 100644
index 0000000..1830428
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BAD_INV_ORDER.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception indicates that the caller has invoked operations in
+ * the wrong order. For example, it can be raised by an ORB if an
+ * application makes an ORB-related call without having correctly
+ * initialized the ORB first.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class BAD_INV_ORDER extends SystemException {
+
+ /**
+ * Constructs a <code>BAD_INV_ORDER</code> exception with a default
+ * minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public BAD_INV_ORDER() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>BAD_INV_ORDER</code> exception with the specified detail
+ * message, a minor code of 0, and a completion state of COMPLETED_NO.
+ *
+ * @param s the String containing a detail message
+ */
+ public BAD_INV_ORDER(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>BAD_INV_ORDER</code> exceptionBAD_INV_ORDER with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code> indicating
+ * the completion status
+ */
+ public BAD_INV_ORDER(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>BAD_INV_ORDER</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public BAD_INV_ORDER(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BAD_OPERATION.java b/src/java.corba/share/classes/org/omg/CORBA/BAD_OPERATION.java
new file mode 100644
index 0000000..44ce517
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BAD_OPERATION.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown when an object reference denotes an existing object,
+ * but that the object does not support the operation that was invoked.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class BAD_OPERATION extends SystemException {
+
+ /**
+ * Constructs a <code>BAD_OPERATION</code> exception with a default
+ * minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public BAD_OPERATION() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>BAD_OPERATION</code> exception with the specified detail
+ * message, a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public BAD_OPERATION(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>BAD_OPERATION</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code> indicating
+ * the completion status
+ */
+ public BAD_OPERATION(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>BAD_OPERATION</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code> indicating
+ * the completion status
+ */
+ public BAD_OPERATION(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BAD_PARAM.java b/src/java.corba/share/classes/org/omg/CORBA/BAD_PARAM.java
new file mode 100644
index 0000000..cdeee3b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BAD_PARAM.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown
+ * when a parameter passed to a call is out of range or
+ * otherwise considered illegal. An ORB may raise this exception
+ * if null values or null pointers are passed to an operation (for
+ * language mappings where the concept of a null pointers or null
+ * values applies). BAD_PARAM can also be raised as a result of a
+ * client generating requests with incorrect parameters using the DII. <P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions},
+ * {@extLink jidlexception_minorcodes meaning of minor codes}
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class BAD_PARAM extends SystemException {
+
+ /**
+ * Constructs a <code>BAD_PARAM</code> exception with a default
+ * minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public BAD_PARAM() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>BAD_PARAM</code> exception with the specified detail
+ * message, a minor code of 0, and a completion state of COMPLETED_NO.
+ *
+ * @param s the String containing a detail message describing this
+ * exception
+ */
+ public BAD_PARAM(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>BAD_PARAM</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public BAD_PARAM(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>BAD_PARAM</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a <code>String</code> that describes
+ * this particular exception.
+ *
+ * @param s the <code>String</code> containing a detail message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public BAD_PARAM(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY.java b/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY.java
new file mode 100644
index 0000000..91ff0f6
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+/**
+ * A {@code PolicyErrorCode} which would be filled in
+ * the {@code PolicyError} exception.
+ *
+ * @author rip-dev
+ */
+
+public interface BAD_POLICY {
+ /**
+ * The Error code in PolicyError exception.
+ */
+ final short value = (short) (0L);
+};
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_TYPE.java b/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_TYPE.java
new file mode 100644
index 0000000..532797d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_TYPE.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A {@code PolicyErrorCode} which would be filled in
+ * the {@code PolicyError} exception.
+ *
+ * @author rip-dev
+ */
+public interface BAD_POLICY_TYPE {
+ /**
+ * The Error code in PolicyError exception.
+ */
+ final short value = (short) (2L);
+};
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_VALUE.java b/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_VALUE.java
new file mode 100644
index 0000000..94ff3e2
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BAD_POLICY_VALUE.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+* Contains the value used to indicate a policy value that is
+* incorrect for a valid policy type in a call to the
+* <code>create_policy</code> method defined in the ORB class.
+*
+*/
+public interface BAD_POLICY_VALUE {
+ /**
+ * The value used to represent a bad policy value error
+ * in a <code>PolicyError</code> exception.
+ * @see org.omg.CORBA.PolicyError
+ */
+ final short value = (short) (3L);
+};
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BAD_QOS.java b/src/java.corba/share/classes/org/omg/CORBA/BAD_QOS.java
new file mode 100644
index 0000000..c21b30a
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BAD_QOS.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The <code>BAD_QOS</code> exception is raised whenever an object cannot
+ * support the quality of service required by an invocation parameter that
+ * has a quality of service semantics associated with it.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since J2SE 1.5
+ */
+
+public final class BAD_QOS extends SystemException {
+
+ /**
+ * Constructs an <code>BAD_QOS</code> exception with
+ * minor code set to 0 and CompletionStatus set to COMPLETED_NO.
+ */
+ public BAD_QOS() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>BAD_QOS</code> exception with the
+ * specified message.
+ *
+ * @param detailMessage string containing a detailed message.
+ */
+ public BAD_QOS(String detailMessage) {
+ this(detailMessage, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>BAD_QOS</code> exception with the
+ * specified minor code and completion status.
+ *
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public BAD_QOS(int minorCode,
+ CompletionStatus completionStatus) {
+ this("", minorCode, completionStatus);
+ }
+
+ /**
+ * Constructs an <code>BAD_QOS</code> exception with the
+ * specified message, minor code, and completion status.
+ *
+ * @param detailMessage string containing a detailed message.
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public BAD_QOS(String detailMessage,
+ int minorCode,
+ CompletionStatus completionStatus) {
+ super(detailMessage, minorCode, completionStatus);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java b/src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java
new file mode 100644
index 0000000..076aea3
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BAD_TYPECODE.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown when the ORB has encountered a malformed type code
+ * (for example, a type code with an invalid {@code TCKind} value).<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class BAD_TYPECODE extends SystemException {
+
+ /**
+ * Constructs a {@code BAD_TYPECODE} exception with a default
+ * minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public BAD_TYPECODE() {
+ this("");
+ }
+
+ /**
+ * Constructs a {@code BAD_TYPECODE} exception with the specified detail,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ *
+ * @param s the String containing a detail message
+ */
+ public BAD_TYPECODE(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a {@code BAD_TYPECODE} exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed an instance of {@code CompletionStatus} indicating
+ * the completion status
+ */
+ public BAD_TYPECODE(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a {@code BAD_TYPECODE} exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed an instance of {@code CompletionStatus} indicating
+ * the completion status
+ */
+ public BAD_TYPECODE(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BooleanHolder.java b/src/java.corba/share/classes/org/omg/CORBA/BooleanHolder.java
new file mode 100644
index 0000000..f0f14e6
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BooleanHolder.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 1995, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+
+/**
+ * The Holder for {@code Boolean}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a {@code boolean}
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code boolean} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code BooleanHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myBooleanHolder} is an instance of {@code BooleanHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myBooleanHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class BooleanHolder implements Streamable {
+
+ /**
+ * The {@code boolean} value held by this {@code BooleanHolder}
+ * object.
+ */
+ public boolean value;
+
+ /**
+ * Constructs a new {@code BooleanHolder} object with its
+ * {@code value} field initialized to {@code false}.
+ */
+ public BooleanHolder() {
+ }
+
+ /**
+ * Constructs a new {@code BooleanHolder} object with its
+ * {@code value} field initialized with the given {@code boolean}.
+ * @param initial the {@code boolean} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code BooleanHolder} object
+ */
+ public BooleanHolder(boolean initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads unmarshalled data from {@code input} and assigns it to this
+ * {@code BooleanHolder} object's {@code value} field.
+ *
+ * @param input the {@code InputStream} object containing
+ * CDR formatted data from the wire
+ */
+ public void _read(InputStream input) {
+ value = input.read_boolean();
+ }
+
+ /**
+ * Marshals the value in this {@code BooleanHolder} object's
+ * {@code value} field to the output stream {@code output}.
+ *
+ * @param output the OutputStream which will contain the CDR formatted data
+ */
+ public void _write(OutputStream output) {
+ output.write_boolean(value);
+ }
+
+ /**
+ * Retrieves the {@code TypeCode} object that corresponds to the
+ * value held in this {@code BooleanHolder} object.
+ *
+ * @return the {@code TypeCode} for the value held
+ * in this {@code BooleanHolder} object
+ */
+ public TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_boolean);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHelper.java
new file mode 100644
index 0000000..c072b5f
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code BooleanSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/BooleanSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
+
+public abstract class BooleanSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/BooleanSeq:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, boolean[] 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 boolean[] 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_boolean);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.BooleanSeqHelper.id (), "BooleanSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static boolean[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ boolean value[] = null;
+ int _len0 = istream.read_long ();
+ value = new boolean[_len0];
+ istream.read_boolean_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, boolean[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_boolean_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHolder.java
new file mode 100644
index 0000000..0c45eff
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BooleanSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Holder for {@code BooleanSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/BooleanSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
+
+public final class BooleanSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public boolean value[] = null;
+
+ public BooleanSeqHolder ()
+ {
+ }
+
+ public BooleanSeqHolder (boolean[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.BooleanSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.BooleanSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.BooleanSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/Bounds.java b/src/java.corba/share/classes/org/omg/CORBA/Bounds.java
new file mode 100644
index 0000000..3c6c023
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/Bounds.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A user exception thrown when a parameter is not within
+ * the legal bounds for the object that a method is trying
+ * to access.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public final class Bounds extends org.omg.CORBA.UserException {
+
+ /**
+ * Constructs an <code>Bounds</code> with no specified detail message.
+ */
+ public Bounds() {
+ super();
+ }
+
+ /**
+ * Constructs an <code>Bounds</code> with the specified detail message.
+ *
+ * @param reason the detail message.
+ */
+ public Bounds(String reason) {
+ super(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/BoundsHelper.java b/src/java.corba/share/classes/org/omg/CORBA/BoundsHelper.java
new file mode 100644
index 0000000..0d5d6cc
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/BoundsHelper.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+
+/**
+ * This Helper class is used to facilitate the marshalling of {@code Bounds}.
+ * For more information on Helper files, see
+ * <a href="{@docRoot}/org/omg/CORBA/doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.
+ */
+
+abstract public class BoundsHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/Bounds:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Bounds 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.Bounds 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 [0];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.BoundsHelper.id (), "Bounds", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.Bounds read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.Bounds value = new org.omg.CORBA.Bounds ();
+ // read and discard the repository ID
+ istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Bounds value)
+ {
+ // write the repository ID
+ ostream.write_string (id ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ByteHolder.java b/src/java.corba/share/classes/org/omg/CORBA/ByteHolder.java
new file mode 100644
index 0000000..75c76c5
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ByteHolder.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Holder for {@code Byte}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a {@code byte}
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code octet} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code ByteHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myByteHolder} is an instance of {@code ByteHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myByteHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class ByteHolder implements Streamable {
+ /**
+ * The {@code byte} value held by this {@code ByteHolder}
+ * object.
+ */
+
+ public byte value;
+
+ /**
+ * Constructs a new {@code ByteHolder} object with its
+ * {@code value} field initialized to 0.
+ */
+ public ByteHolder() {
+ }
+
+ /**
+ * Constructs a new {@code ByteHolder} object for the given
+ * {@code byte}.
+ * @param initial the {@code byte} with which to initialize
+ * the {@code value} field of the new
+ * {@code ByteHolder} object
+ */
+ public ByteHolder(byte initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads from {@code input} and initalizes the value in
+ * this {@code ByteHolder} object
+ * with the unmarshalled data.
+ *
+ * @param input the InputStream containing CDR formatted data from the wire.
+ */
+ public void _read(InputStream input) {
+ value = input.read_octet();
+ }
+
+ /**
+ * Marshals to {@code output} the value in
+ * this {@code ByteHolder} object.
+ *
+ * @param output the OutputStream which will contain the CDR formatted data.
+ */
+ public void _write(OutputStream output) {
+ output.write_octet(value);
+ }
+
+ /**
+ * Returns the TypeCode corresponding to the value held in
+ * this {@code ByteHolder} object.
+ *
+ * @return the TypeCode of the value held in
+ * this {@code ByteHolder} object
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_octet);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CODESET_INCOMPATIBLE.java b/src/java.corba/share/classes/org/omg/CORBA/CODESET_INCOMPATIBLE.java
new file mode 100644
index 0000000..5b1e465
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CODESET_INCOMPATIBLE.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception is raised whenever meaningful communication is not possible
+ * between client and server native code sets.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since J2SE 1.5
+ */
+
+public final class CODESET_INCOMPATIBLE extends SystemException {
+
+ /**
+ * Constructs an <code>CODESET_INCOMPATIBLE</code> exception with
+ * minor code set to 0 and CompletionStatus set to COMPLETED_NO.
+ */
+ public CODESET_INCOMPATIBLE() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>CODESET_INCOMPATIBLE</code> exception with the
+ * specified message.
+ *
+ * @param detailMessage string containing a detailed message.
+ */
+ public CODESET_INCOMPATIBLE(String detailMessage) {
+ this(detailMessage, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>CODESET_INCOMPATIBLE</code> exception with the
+ * specified minor code and completion status.
+ *
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public CODESET_INCOMPATIBLE(int minorCode,
+ CompletionStatus completionStatus) {
+ this("", minorCode, completionStatus);
+ }
+
+ /**
+ * Constructs an <code>CODESET_INCOMPATIBLE</code> exception with the
+ * specified message, minor code, and completion status.
+ *
+ * @param detailMessage string containing a detailed message.
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public CODESET_INCOMPATIBLE(String detailMessage,
+ int minorCode,
+ CompletionStatus completionStatus) {
+ super(detailMessage, minorCode, completionStatus);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/COMM_FAILURE.java b/src/java.corba/share/classes/org/omg/CORBA/COMM_FAILURE.java
new file mode 100644
index 0000000..b85c267
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/COMM_FAILURE.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception is raised if communication is lost while an operation
+ * is in progress, after the request was sent by the client, but before
+ * the reply from the server has been returned to the client.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * <P>
+ * See the section {@extLink jidlexception_minorcodes Minor Code Meanings}
+ * to see the minor codes for this exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class COMM_FAILURE extends SystemException {
+
+ /**
+ * Constructs a <code>COMM_FAILURE</code> exception with
+ * a default minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public COMM_FAILURE() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>COMM_FAILURE</code> exception with the specified detail
+ * message, a minor code of 0, and a completion state of COMPLETED_NO.
+ *
+ * @param s the <code>String</code> containing a detail message describing
+ * this exception
+ */
+ public COMM_FAILURE(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>COMM_FAILURE</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status, which must be one of
+ * <code>COMPLETED_YES</code>, <code>COMPLETED_NO</code>, or
+ * <code>COMPLETED_MAYBE</code>.
+ */
+ public COMM_FAILURE(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>COMM_FAILURE</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed the completion status, which must be one of
+ * <code>COMPLETED_YES</code>, <code>COMPLETED_NO</code>, or
+ * <code>COMPLETED_MAYBE</code>.
+ */
+ public COMM_FAILURE(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CTX_RESTRICT_SCOPE.java b/src/java.corba/share/classes/org/omg/CORBA/CTX_RESTRICT_SCOPE.java
new file mode 100644
index 0000000..dbfa9f8
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CTX_RESTRICT_SCOPE.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A flag that can be used as the second parameter to the method
+ * <code>Context.get_values</code> to restrict the search scope.
+ * When this flag is used, it restricts the search for
+ * context values to this particular <code>Context</code> object
+ * or to the scope specified in the first parameter to
+ * <code>Context.get_values</code>.
+ * <P>
+ * Usage:
+ * <PRE>
+ * NVList props = myContext.get_values("_USER",
+ * CTX_RESTRICT_SCOPE.value, "id*");
+ * </PRE>
+ *
+ * @see org.omg.CORBA.Context#get_values(String, int, String)
+ * @since JDK1.2
+ */
+public interface CTX_RESTRICT_SCOPE {
+
+/**
+ * The field containing the <code>int</code> value of a
+ * <code>CTX_RESTRICT_SCOPE</code> flag.
+ */
+ int value = 15;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CharHolder.java b/src/java.corba/share/classes/org/omg/CORBA/CharHolder.java
new file mode 100644
index 0000000..35ce03c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CharHolder.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 1995, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Holder for {@code Char}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a {@code char}
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code char} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code CharHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myCharHolder} is an instance of {@code CharHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myCharHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class CharHolder implements Streamable {
+
+ /**
+ * The {@code char} value held by this {@code CharHolder}
+ * object.
+ */
+ public char value;
+
+ /**
+ * Constructs a new {@code CharHolder} object with its
+ * {@code value} field initialized to {@code 0}.
+ */
+ public CharHolder() {
+ }
+
+ /**
+ * Constructs a new {@code CharHolder} object for the given
+ * {@code char}.
+ * @param initial the {@code char} with which to initialize
+ * the {@code value} field of the new
+ * {@code CharHolder} object
+ */
+ public CharHolder(char initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads from {@code input} and initalizes the value in
+ * this {@code CharHolder} object
+ * with the unmarshalled data.
+ *
+ * @param input the InputStream containing CDR formatted data from the wire
+ */
+ public void _read(InputStream input) {
+ value = input.read_char();
+ }
+
+ /**
+ * Marshals to {@code output} the value in
+ * this {@code CharHolder} object.
+ *
+ * @param output the OutputStream which will contain the CDR formatted data
+ */
+ public void _write(OutputStream output) {
+ output.write_char(value);
+ }
+
+ /**
+ * Returns the {@code TypeCode} object corresponding
+ * to the value held in
+ * this {@code CharHolder} object.
+ *
+ * @return the TypeCode of the value held in
+ * this {@code CharHolder} object
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_char);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CharSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/CharSeqHelper.java
new file mode 100644
index 0000000..2a0f112
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CharSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code CharSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/CharSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
+
+public abstract class CharSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/CharSeq:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, char[] 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 char[] 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_char);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.CharSeqHelper.id (), "CharSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static char[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ char value[] = null;
+ int _len0 = istream.read_long ();
+ value = new char[_len0];
+ istream.read_char_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, char[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_char_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CharSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/CharSeqHolder.java
new file mode 100644
index 0000000..739a128
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CharSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Holder for {@code CharSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/CharSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
+
+public final class CharSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public char value[] = null;
+
+ public CharSeqHolder ()
+ {
+ }
+
+ public CharSeqHolder (char[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.CharSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.CharSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.CharSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CompletionStatus.java b/src/java.corba/share/classes/org/omg/CORBA/CompletionStatus.java
new file mode 100644
index 0000000..a8ad47d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CompletionStatus.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+/**
+ * An object that indicates whether a method had completed running
+ * when a <code>SystemException</code> was thrown.
+ * <P>
+ * The class <code>CompletionStatus</code>
+ * contains three <code>CompletionStatus</code> instances, which are constants
+ * representing each
+ * possible completion status: <code>COMPLETED_MAYBE</code>,
+ * <code>COMPLETED_NO</code>, and <code>COMPLETED_YES</code>.
+ * It also contains
+ * three <code>int</code> members, each a constant corresponding to one of
+ * the <code>CompletionStatus</code> instances. These <code>int</code>
+ * members make it possible to use a <code>switch</code> statement.
+ * <P>
+ * The class also contains two methods:
+ * <UL>
+ * <LI><code>public int <b>value</b>()</code> -- which accesses the
+ * <code>value</code> field of a <code>CompletionStatus</code> object
+ * <LI><code>public static CompletionStatus
+ * <b>from_int</b>(int i)</code> --
+ * for creating an instance from one of the <code>int</code> members
+ * </UL>
+ * @see org.omg.CORBA.SystemException
+ * @since JDK1.2
+ */
+
+public final class CompletionStatus implements org.omg.CORBA.portable.IDLEntity
+{
+/**
+ * The constant indicating that a method completed running
+ * before a <code>SystemException</code> was thrown.
+ */
+ public static final int _COMPLETED_YES = 0,
+
+/**
+ * The constant indicating that a method had not completed running
+ * when a <code>SystemException</code> was thrown.
+ */
+ _COMPLETED_NO = 1,
+
+/**
+ * The constant indicating that it is unknown whether a method had
+ * completed running when a <code>SystemException</code> was thrown.
+ */
+ _COMPLETED_MAYBE = 2;
+
+
+/**
+ * An instance of <code>CompletionStatus</code> initialized with
+ * the constant <code>_COMPLETED_YES</code>.
+ */
+ public static final CompletionStatus COMPLETED_YES = new CompletionStatus(_COMPLETED_YES);
+
+/**
+ * An instance of <code>CompletionStatus</code> initialized with
+ * the constant <code>_COMPLETED_NO</code>.
+ */
+ public static final CompletionStatus COMPLETED_NO = new CompletionStatus(_COMPLETED_NO);
+
+ /**
+ * An instance of <code>CompletionStatus</code> initialized with
+ * the constant <code>_COMPLETED_MAYBE</code>.
+ */
+ public static final CompletionStatus COMPLETED_MAYBE = new CompletionStatus(_COMPLETED_MAYBE);
+
+ /**
+ * Retrieves the value of this <code>CompletionStatus</code> object.
+ *
+ * @return one of the possible <code>CompletionStatus</code> values:
+ * <code>_COMPLETED_YES</code>, <code>_COMPLETED_NO</code>, or
+ * <code>_COMPLETED_MAYBE</code>
+ *
+ */
+ public int value() { return _value; }
+
+/**
+ * Creates a <code>CompletionStatus</code> object from the given <code>int</code>.
+ *
+ * @param i one of <code>_COMPLETED_YES</code>, <code>_COMPLETED_NO</code>, or
+ * <code>_COMPLETED_MAYBE</code>
+ *
+ * @return one of the possible <code>CompletionStatus</code> objects
+ * with values:
+ * <code>_COMPLETED_YES</code>, <code>_COMPLETED_NO</code>, or
+ * <code>_COMPLETED_MAYBE</code>
+ *
+ * @exception org.omg.CORBA.BAD_PARAM if the argument given is not one of the
+ * <code>int</code> constants defined in <code>CompletionStatus</code>
+ */
+ public static CompletionStatus from_int(int i) {
+ switch (i) {
+ case _COMPLETED_YES:
+ return COMPLETED_YES;
+ case _COMPLETED_NO:
+ return COMPLETED_NO;
+ case _COMPLETED_MAYBE:
+ return COMPLETED_MAYBE;
+ default:
+ throw new org.omg.CORBA.BAD_PARAM();
+ }
+ }
+
+
+/**
+ * Creates a <code>CompletionStatus</code> object from the given <code>int</code>.
+ *
+ * @param _value one of <code>_COMPLETED_YES</code>, <code>_COMPLETED_NO</code>, or
+ * <code>_COMPLETED_MAYBE</code>
+ *
+ */
+ private CompletionStatus(int _value) {
+ this._value = _value;
+ }
+
+ private int _value;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CompletionStatusHelper.java b/src/java.corba/share/classes/org/omg/CORBA/CompletionStatusHelper.java
new file mode 100644
index 0000000..1be74d5
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CompletionStatusHelper.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code CompletionStatus}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/CompletionStatusHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * 03 June 1999 11:52:03 o'clock GMT+00:00
+ */
+
+abstract public class CompletionStatusHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/CompletionStatus:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.CompletionStatus 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.CompletionStatus 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 (org.omg.CORBA.CompletionStatusHelper.id (), "CompletionStatus", new String[] { "COMPLETED_YES", "COMPLETED_NO", "COMPLETED_MAYBE"} );
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.CompletionStatus read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return org.omg.CORBA.CompletionStatus.from_int (istream.read_long ());
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.CompletionStatus value)
+ {
+ ostream.write_long (value.value ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/Context.java b/src/java.corba/share/classes/org/omg/CORBA/Context.java
new file mode 100644
index 0000000..60c7e7d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/Context.java
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 1996, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * An object used in <code>Request</code> operations
+ * to specify the context object in which context strings
+ * must be resolved before being sent along with the request invocation.
+ * A <code>Context</code> object
+ * contains a list of properties in the form of <code>NamedValue</code>
+ * objects. These properties represent information
+ * about the client, the environment, or the circumstances of a request
+ * and generally are properties that might be inconvenient
+ * to pass as parameters.
+ * <P>
+ * A <code>Context</code> object is created by first calling the
+ * <code>ORB</code> method <code>get_default_context</code>
+ * and then calling the method <code>create_child</code> on the
+ * default context.
+ * <P>
+ * Each property in a <code>Context</code> object is represented by
+ * a <code>NamedValue</code> object. The property name is contained
+ * in the <code>NamedValue</code> object's <code>name</code> field, and
+ * the value associated with the name is contained in the <code>Any</code>
+ * object that was assigned to the <code>NamedValue</code> object's
+ * <code>value</code> field.
+ * <P>
+ * <code>Context</code> properties can represent a portion of a client's
+ * or application's environment that is meant to be propagated to
+ * (and made implicitly part of) a server's environment.
+ * (Examples might be a window identifier or user preference information).
+ * Once a server has been invoked (that is, after the properties are
+ * propagated), the server may query its <code>Context</code> object
+ * for these properties using the method <code>get_values</code>.
+ *
+ *<P>
+ * When an operation declaration includes a context clause,
+ * the stubs and skeletons will have an additional argument
+ * added for the context. When an operation invocation occurs,
+ * the ORB causes the properties that were named in the operation
+ * definition in IDL and
+ * that are present in the client's <code>Context</code> object
+ * to be provided in the <code>Context</code> object parameter to
+ * the invoked method.
+ * <P>
+ * <code>Context</code> property names (which are strings)
+ * typically have the form of an OMG IDL identifier or
+ * a series of OMG IDL identifiers separated by periods.
+ * A context property name pattern is either a property name
+ * or a property name followed by a single "*". A property
+ * name pattern without a trailing "*" is said to match only
+ * itself. A property name pattern of the form "&lt;name&gt;*" matches any
+ * property name that starts with &lt;name&gt; and continues with zero
+ * or more additional characters.
+ * <P>
+ * Property name patterns are used in the context clause of
+ * an operation definition and as a parameter for the
+ * method <code>Context.get_values</code>.
+ * <P>
+ * <code>Context</code> objects may be "chained" together to achieve a
+ * particular defaulting behavior. A <code>Context</code>
+ * object created with the method <code>create_child</code> will
+ * be chained to its parent (the <code>Context</code> object
+ * that created it), and that means that the parent will be searched
+ * after the child in a search for property names.
+ *<P>
+ * Properties defined in a particular <code>Context</code> object
+ * effectively override those properties in the next higher level.
+ * The scope used in a search for properties may be restricted by specifying a
+ * starting scope and by using the flag <code>CTX_RESTRICT_SCOPE</code>
+ * when invoking the method <code>get_values</code>.
+ * <P>
+ * A <code>Context</code> object may be named for purposes of specifying
+ * a starting search scope.
+ *
+ * @since JDK1.2
+ */
+
+public abstract class Context {
+
+ /**
+ * Retrieves the name of this <code>Context</code> object.
+ *
+ * @return the name of this <code>Context</code> object
+ */
+
+ public abstract String context_name();
+
+
+ /**
+ * Retrieves the parent of this <code>Context</code> object.
+ *
+ * @return the <code>Context</code> object that is the
+ * parent of this <code>Context</code> object
+ */
+
+ public abstract Context parent();
+
+ /**
+ * Creates a <code>Context</code> object with the given string as its
+ * name and with this <code>Context</code> object set as its parent.
+ * <P>
+ * The new <code>Context</code> object is chained into its parent
+ * <code>Context</code> object. This means that in a search for
+ * matching property names, if a match is not found in this context,
+ * the search will continue in the parent. If that is not successful,
+ * the search will continue in the grandparent, if there is one, and
+ * so on.
+ *
+ *
+ * @param child_ctx_name the <code>String</code> object to be set as
+ * the name of the new <code>Context</code> object
+ * @return the newly-created child <code>Context</code> object
+ * initialized with the specified name
+ */
+
+ public abstract Context create_child(String child_ctx_name);
+
+ /**
+ * Creates a <code>NamedValue</code> object and adds it to this
+ * <code>Context</code> object. The <code>name</code> field of the
+ * new <code>NamedValue</code> object is set to the given string,
+ * the <code>value</code> field is set to the given <code>Any</code>
+ * object, and the <code>flags</code> field is set to zero.
+ *
+ * @param propname the name of the property to be set
+ * @param propvalue the <code>Any</code> object to which the
+ * value of the property will be set. The
+ * <code>Any</code> object's <code>value</code>
+ * field contains the value to be associated
+ * with the given propname; the
+ * <code>kind</code> field must be set to
+ * <code>TCKind.tk_string</code>.
+ */
+
+ public abstract void set_one_value(String propname, Any propvalue);
+
+ /**
+ I Sets one or more property values in this <code>Context</code>
+ * object. The <code>NVList</code> supplied to this method
+ * contains one or more <code>NamedValue</code> objects.
+ * In each <code>NamedValue</code> object,
+ * the <code>name</code> field holds the name of the property, and
+ * the <code>flags</code> field must be set to zero.
+ * The <code>NamedValue</code> object's <code>value</code> field
+ * contains an <code>Any</code> object, which, in turn, contains the value
+ * for the property. Since the value is always a string,
+ * the <code>Any</code> object must have the <code>kind</code>
+ * field of its <code>TypeCode</code> set to <code>TCKind.tk_string</code>.
+ *
+ * @param values an NVList containing the property
+ * names and associated values to be set
+ *
+ * @see #get_values
+ * @see org.omg.CORBA.NamedValue
+ * @see org.omg.CORBA.Any
+ */
+
+ public abstract void set_values(NVList values);
+
+ /**
+ * Deletes from this <code>Context</code> object the
+ * <code>NamedValue</code> object(s) whose
+ * <code>name</code> field matches the given property name.
+ * If the <code>String</code> object supplied for
+ * <code>propname</code> has a
+ * trailing wildcard character ("*"), then
+ * all <code>NamedValue</code> objects whose <code>name</code>
+ * fields match will be deleted. The search scope is always
+ * limited to this <code>Context</code> object.
+ * <P>
+ * If no matching property is found, an exception is returned.
+ *
+ * @param propname name of the property to be deleted
+ */
+
+ public abstract void delete_values(String propname);
+
+ /**
+ * Retrieves the <code>NamedValue</code> objects whose
+ * <code>name</code> field matches the given name or name
+ * pattern. This method allows for wildcard searches,
+ * which means that there can be multiple matches and
+ * therefore multiple values returned. If the
+ * property is not found at the indicated level, the search
+ * continues up the context object tree until a match is found or
+ * all <code>Context</code> objects in the chain have been exhausted.
+ * <P>
+ * If no match is found, an error is returned and no property list
+ * is returned.
+ *
+ * @param start_scope a <code>String</code> object indicating the
+ * context object level at which to initiate the
+ * search for the specified properties
+ * (for example, "_USER", "_GROUP", "_SYSTEM"). Valid scope
+ * names are implementation-specific. If a
+ * scope name is omitted, the search
+ * begins with the specified context
+ * object. If the specified scope name is
+ * not found, an exception is returned.
+ * @param op_flags an operation flag. The one flag
+ * that may be specified is <code>CTX_RESTRICT_SCOPE</code>.
+ * If this flag is specified, searching is limited to the
+ * specified <code>start_scope</code> or this
+ * <code>Context</code> object.
+ * @param pattern the property name whose values are to
+ * be retrieved. <code>pattern</code> may be a
+ * name or a name with a
+ * trailing wildcard character ("*").
+ *
+ * @return an <code>NVList</code> containing all the property values
+ * (in the form of <code>NamedValue</code> objects)
+ * whose associated property name matches the given name or
+ * name pattern
+ * @see #set_values
+ * @see org.omg.CORBA.NamedValue
+ */
+
+ abstract public NVList get_values(String start_scope, int op_flags,
+ String pattern);
+};
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ContextList.java b/src/java.corba/share/classes/org/omg/CORBA/ContextList.java
new file mode 100644
index 0000000..46cb764
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ContextList.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * An object containing a modifiable list of <code>String</code> objects
+ * that represent property names.
+ * This class is used in <code>Request</code> operations to
+ * describe the contexts that need to be resolved and sent with the
+ * invocation. (A context is resolved by giving a property name
+ * and getting back the value associated with it.) This is done
+ * by calling the <code>Context</code> method
+ * <code>get_values</code> and supplying a string from a
+ * <code>ContextList</code> object as the third parameter.
+ * The method <code>get_values</code> returns an <code>NVList</code>
+ * object containing the <code>NamedValue</code> objects that hold
+ * the value(s) identified by the given string.
+ * <P>
+ * A <code>ContextList</code> object is created by the ORB, as
+ * illustrated here:
+ * <PRE>
+ * ORB orb = ORB.init(args, null);
+ * org.omg.CORBA.ContextList ctxList = orb.create_context_list();
+ * </PRE>
+ * The variable <code>ctxList</code> represents an empty
+ * <code>ContextList</code> object. Strings are added to
+ * the list with the method <code>add</code>, accessed
+ * with the method <code>item</code>, and removed with the
+ * method <code>remove</code>.
+ *
+ * @see Context
+ * @since JDK1.2
+ */
+
+public abstract class ContextList {
+
+ /**
+ * Returns the number of <code>String</code> objects in this
+ * <code>ContextList</code> object.
+ *
+ * @return an <code>int</code> representing the number of
+ * <code>String</code>s in this <code>ContextList</code> object
+ */
+
+ public abstract int count();
+
+ /**
+ * Adds a <code>String</code> object to this <code>ContextList</code>
+ * object.
+ *
+ * @param ctx the <code>String</code> object to be added
+ */
+
+ public abstract void add(String ctx);
+
+ /**
+ * Returns the <code>String</code> object at the given index.
+ *
+ * @param index the index of the string desired, with 0 being the
+ index of the first string
+ * @return the string at the given index
+ * @exception org.omg.CORBA.Bounds if the index is greater than
+ * or equal to the number of strings in this
+ * <code>ContextList</code> object
+ */
+
+ public abstract String item(int index) throws org.omg.CORBA.Bounds;
+
+ /**
+ * Removes the <code>String</code> object at the given index. Note that
+ * the indices of all strings following the one removed are
+ * shifted down by one.
+ *
+ * @param index the index of the <code>String</code> object to be removed,
+ * with 0 designating the first string
+ * @exception org.omg.CORBA.Bounds if the index is greater than
+ * or equal to the number of <code>String</code> objects in
+ * this <code>ContextList</code> object
+ */
+
+ public abstract void remove(int index) throws org.omg.CORBA.Bounds;
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/Current.java b/src/java.corba/share/classes/org/omg/CORBA/Current.java
new file mode 100644
index 0000000..a713349
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/Current.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* Interfaces derived from the {@code Current} interface enable ORB and CORBA
+* services to provide access to information (context) associated with
+* the thread of execution in which they are running. This information
+* is accessed in a structured manner using interfaces derived from the
+* {@code Current} interface defined in the CORBA module.
+*
+* <P>Each ORB or CORBA service that needs its own context derives an
+* interface from the CORBA module's {@code Current}. Users of the
+* service can obtain an instance of the appropriate {@code Current}
+* interface by invoking {@code ORB::resolve_initial_references}.<P>
+*
+* org/omg/CORBA/Current.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+* Saturday, July 17, 1999 12:26:21 AM PDT.
+*/
+
+public interface Current extends CurrentOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
+{
+} // interface Current
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CurrentHelper.java b/src/java.corba/share/classes/org/omg/CORBA/CurrentHelper.java
new file mode 100644
index 0000000..f838de5
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CurrentHelper.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code Current}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/CurrentHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:21 AM PDT
+ */
+
+abstract public class CurrentHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/Current:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Current that)
+ {
+ throw new org.omg.CORBA.MARSHAL() ;
+ }
+
+ public static org.omg.CORBA.Current extract (org.omg.CORBA.Any a)
+ {
+ throw new org.omg.CORBA.MARSHAL() ;
+ }
+
+ 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 (org.omg.CORBA.CurrentHelper.id (), "Current");
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.Current read (org.omg.CORBA.portable.InputStream istream)
+ {
+ throw new org.omg.CORBA.MARSHAL() ;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Current value)
+ {
+ throw new org.omg.CORBA.MARSHAL() ;
+ }
+
+ public static org.omg.CORBA.Current narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.omg.CORBA.Current)
+ return (org.omg.CORBA.Current)obj;
+ else
+ throw new org.omg.CORBA.BAD_PARAM ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CurrentHolder.java b/src/java.corba/share/classes/org/omg/CORBA/CurrentHolder.java
new file mode 100644
index 0000000..74f16d3
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CurrentHolder.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+/**
+ * The Holder for {@code Current}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/CurrentHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:21 AM PDT
+ */
+
+public final class CurrentHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.omg.CORBA.Current value = null;
+
+ public CurrentHolder ()
+ {
+ }
+
+ public CurrentHolder (org.omg.CORBA.Current initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.CurrentHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.CurrentHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.CurrentHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CurrentOperations.java b/src/java.corba/share/classes/org/omg/CORBA/CurrentOperations.java
new file mode 100644
index 0000000..f058e66
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CurrentOperations.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The interface for {@code Current}. For more information on
+ * Operations interfaces, see <a href="doc-files/generatedfiles.html">
+ * "Generated Files"</a>.
+ *
+ * org/omg/CORBA/CurrentOperations.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:21 AM PDT.
+ */
+
+public interface CurrentOperations
+{
+} // interface CurrentOperations
diff --git a/src/java.corba/share/classes/org/omg/CORBA/CustomMarshal.java b/src/java.corba/share/classes/org/omg/CORBA/CustomMarshal.java
new file mode 100644
index 0000000..7937391
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/CustomMarshal.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.DataOutputStream;
+import org.omg.CORBA.DataInputStream;
+
+/**
+ * An abstract value type that is meant to
+ * be used by the ORB, not the user. Semantically it is treated
+ * as a custom value type's implicit base class, although the custom
+ * valuetype does not actually inherit it in IDL. The implementer
+ * of a custom value type shall provide an implementation of the
+ * {@code CustomMarshal} operations. The manner in which this is done is
+ * specified in the IDL to Java langauge mapping. Each custom
+ * marshaled value type shall have its own implementation.
+ * @see DataInputStream
+ */
+public interface CustomMarshal {
+ /**
+ * Marshal method has to be implemented by the Customized Marshal class.
+ * This is the method invoked for Marshalling.
+ *
+ * @param os a DataOutputStream
+ */
+ void marshal(DataOutputStream os);
+ /**
+ * Unmarshal method has to be implemented by the Customized Marshal class.
+ * This is the method invoked for Unmarshalling.
+ *
+ * @param is a DataInputStream
+ */
+ void unmarshal(DataInputStream is);
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DATA_CONVERSION.java b/src/java.corba/share/classes/org/omg/CORBA/DATA_CONVERSION.java
new file mode 100644
index 0000000..3a58ea7
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DATA_CONVERSION.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception is raised if an ORB cannot convert the representation
+ * of data as marshaled into its native representation or vice-versa.
+ * For example, DATA_CONVERSION can be raised if wide character codeset
+ * conversion fails, or if an ORB cannot convert floating point values
+ * between different representations.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * <P>
+ * See the section {@extLink jidlexception_minorcodes Minor Code Meanings}
+ * to see the minor codes for this exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class DATA_CONVERSION extends SystemException {
+
+ /**
+ * Constructs a <code>DATA_CONVERSION</code> exception with a default minor code
+ * of 0 and a completion state of COMPLETED_NO.
+ */
+ public DATA_CONVERSION() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>DATA_CONVERSION</code> exception with the specified detail.
+ * @param s the String containing a detail message
+ */
+ public DATA_CONVERSION(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>DATA_CONVERSION</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public DATA_CONVERSION(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>DATA_CONVERSION</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public DATA_CONVERSION(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DataInputStream.java b/src/java.corba/share/classes/org/omg/CORBA/DataInputStream.java
new file mode 100644
index 0000000..d90792a
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DataInputStream.java
@@ -0,0 +1,344 @@
+/*
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/** Defines the methods used to read primitive data types from input streams
+* for unmarshaling custom value types. This interface is used by user
+* written custom unmarshaling code for custom value types.
+* @see org.omg.CORBA.DataOutputStream
+* @see org.omg.CORBA.CustomMarshal
+*/
+public interface DataInputStream extends org.omg.CORBA.portable.ValueBase
+{
+ /** Reads an IDL <code>Any</code> value from the input stream.
+ * @return the <code>Any</code> read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ org.omg.CORBA.Any read_any ();
+
+ /** Reads an IDL boolean value from the input stream.
+ * @return the boolean read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ boolean read_boolean ();
+
+ /** Reads an IDL character value from the input stream.
+ * @return the character read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ char read_char ();
+
+ /** Reads an IDL wide character value from the input stream.
+ * @return the wide character read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ char read_wchar ();
+
+ /** Reads an IDL octet value from the input stream.
+ * @return the octet value read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ byte read_octet ();
+
+ /** Reads an IDL short from the input stream.
+ * @return the short read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ short read_short ();
+
+ /** Reads an IDL unsigned short from the input stream.
+ * @return the unsigned short read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ short read_ushort ();
+
+ /** Reads an IDL long from the input stream.
+ * @return the long read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ int read_long ();
+
+ /** Reads an IDL unsigned long from the input stream.
+ * @return the unsigned long read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ int read_ulong ();
+
+ /** Reads an IDL long long from the input stream.
+ * @return the long long read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ long read_longlong ();
+
+ /** Reads an unsigned IDL long long from the input stream.
+ * @return the unsigned long long read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ long read_ulonglong ();
+
+ /** Reads an IDL float from the input stream.
+ * @return the float read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ float read_float ();
+
+ /** Reads an IDL double from the input stream.
+ * @return the double read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ double read_double ();
+ // read_longdouble not supported by IDL/Java mapping
+
+ /** Reads an IDL string from the input stream.
+ * @return the string read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ String read_string ();
+
+ /** Reads an IDL wide string from the input stream.
+ * @return the wide string read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ String read_wstring ();
+
+ /** Reads an IDL CORBA::Object from the input stream.
+ * @return the CORBA::Object read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ org.omg.CORBA.Object read_Object ();
+
+ /** Reads an IDL Abstract interface from the input stream.
+ * @return the Abstract interface read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ java.lang.Object read_Abstract ();
+
+ /** Reads an IDL value type from the input stream.
+ * @return the value type read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ java.io.Serializable read_Value ();
+
+ /** Reads an IDL typecode from the input stream.
+ * @return the typecode read.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ org.omg.CORBA.TypeCode read_TypeCode ();
+
+ /** Reads array of IDL Anys from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_any_array (org.omg.CORBA.AnySeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL booleans from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_boolean_array (org.omg.CORBA.BooleanSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL characters from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_char_array (org.omg.CORBA.CharSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL wide characters from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_wchar_array (org.omg.CORBA.WCharSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL octets from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_octet_array (org.omg.CORBA.OctetSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL shorts from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_short_array (org.omg.CORBA.ShortSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL unsigned shorts from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_ushort_array (org.omg.CORBA.UShortSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL longs from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_long_array (org.omg.CORBA.LongSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL unsigned longs from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_ulong_array (org.omg.CORBA.ULongSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL unsigned long longs from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_ulonglong_array (org.omg.CORBA.ULongLongSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL long longs from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_longlong_array (org.omg.CORBA.LongLongSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL floats from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_float_array (org.omg.CORBA.FloatSeqHolder seq, int offset, int length);
+
+ /** Reads array of IDL doubles from offset for length elements from the
+ * input stream.
+ * @param seq The out parameter holder for the array to be read.
+ * @param offset The index into seq of the first element to read from the
+ * input stream.
+ * @param length The number of elements to read from the input stream.
+ * @throws org.omg.CORBA.MARSHAL
+ * If an inconsistency is detected, including not having registered
+ * a streaming policy, then the standard system exception MARSHAL is raised.
+ */
+ void read_double_array (org.omg.CORBA.DoubleSeqHolder seq, int offset, int length);
+} // interface DataInputStream
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DataOutputStream.java b/src/java.corba/share/classes/org/omg/CORBA/DataOutputStream.java
new file mode 100644
index 0000000..c6ea054
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DataOutputStream.java
@@ -0,0 +1,283 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/** Defines the methods used to write primitive data types to output streams
+* for marshalling custom value types. This interface is used by user
+* written custom marshalling code for custom value types.
+* @see org.omg.CORBA.DataInputStream
+* @see org.omg.CORBA.CustomMarshal
+*/
+public interface DataOutputStream extends org.omg.CORBA.portable.ValueBase
+{
+ /**
+ * Writes the Any value to the output stream.
+ * @param value The value to be written.
+ */
+ void write_any (org.omg.CORBA.Any value);
+
+ /**
+ * Writes the boolean value to the output stream.
+ * @param value The value to be written.
+ */
+ void write_boolean (boolean value);
+
+ /**
+ * Writes the IDL character value to the output stream.
+ * @param value The value to be written.
+ */
+ void write_char (char value);
+
+ /**
+ * Writes the IDL wide character value to the output stream.
+ * @param value The value to be written.
+ */
+ void write_wchar (char value);
+
+ /**
+ * Writes the IDL octet value (represented as a Java byte) to the output stream.
+ * @param value The value to be written.
+ */
+ void write_octet (byte value);
+
+ /**
+ * Writes the IDL short value to the output stream.
+ * @param value The value to be written.
+ */
+ void write_short (short value);
+
+ /**
+ * Writes the IDL unsigned short value (represented as a Java short
+ * value) to the output stream.
+ * @param value The value to be written.
+ */
+ void write_ushort (short value);
+
+ /**
+ * Writes the IDL long value (represented as a Java int) to the output stream.
+ * @param value The value to be written.
+ */
+ void write_long (int value);
+
+ /**
+ * Writes the IDL unsigned long value (represented as a Java int) to the output stream.
+ * @param value The value to be written.
+ */
+ void write_ulong (int value);
+
+ /**
+ * Writes the IDL long long value (represented as a Java long) to the output stream.
+ * @param value The value to be written.
+ */
+ void write_longlong (long value);
+
+ /**
+ * Writes the IDL unsigned long long value (represented as a Java long)
+ * to the output stream.
+ * @param value The value to be written.
+ */
+ void write_ulonglong (long value);
+
+ /**
+ * Writes the IDL float value to the output stream.
+ * @param value The value to be written.
+ */
+ void write_float (float value);
+
+ /**
+ * Writes the IDL double value to the output stream.
+ * @param value The value to be written.
+ */
+ void write_double (double value);
+
+ // write_longdouble not supported by IDL/Java mapping
+
+ /**
+ * Writes the IDL string value to the output stream.
+ * @param value The value to be written.
+ */
+ void write_string (String value);
+
+ /**
+ * Writes the IDL wide string value (represented as a Java String) to the output stream.
+ * @param value The value to be written.
+ */
+ void write_wstring (String value);
+
+ /**
+ * Writes the IDL CORBA::Object value to the output stream.
+ * @param value The value to be written.
+ */
+ void write_Object (org.omg.CORBA.Object value);
+
+ /**
+ * Writes the IDL Abstract interface type to the output stream.
+ * @param value The value to be written.
+ */
+ void write_Abstract (java.lang.Object value);
+
+ /**
+ * Writes the IDL value type value to the output stream.
+ * @param value The value to be written.
+ */
+ void write_Value (java.io.Serializable value);
+
+ /**
+ * Writes the typecode to the output stream.
+ * @param value The value to be written.
+ */
+ void write_TypeCode (org.omg.CORBA.TypeCode value);
+
+ /**
+ * Writes the array of IDL Anys from offset for length elements to the
+ * output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_any_array (org.omg.CORBA.Any[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL booleans from offset for length elements to the
+ * output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_boolean_array (boolean[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL characters from offset for length elements to the
+ * output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_char_array (char[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL wide characters from offset for length elements to the
+ * output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_wchar_array (char[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL octets from offset for length elements to the
+ * output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_octet_array (byte[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL shorts from offset for length elements to the
+ * output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_short_array (short[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL unsigned shorts (represented as Java shorts)
+ * from offset for length elements to the output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_ushort_array (short[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL longs from offset for length elements to the
+ * output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_long_array (int[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL unsigned longs (represented as Java ints)
+ * from offset for length elements to the output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_ulong_array (int[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL unsigned long longs (represented as Java longs)
+ * from offset for length elements to the output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_ulonglong_array (long[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL long longs from offset for length elements to the
+ * output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_longlong_array (long[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL floats from offset for length elements to the
+ * output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_float_array (float[] seq, int offset, int length);
+
+ /**
+ * Writes the array of IDL doubles from offset for length elements to the
+ * output stream.
+ * @param seq The array to be written.
+ * @param offset The index into seq of the first element to write to the
+ * output stream.
+ * @param length The number of elements to write to the output stream.
+ */
+ void write_double_array (double[] seq, int offset, int length);
+} // interface DataOutputStream
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DefinitionKind.java b/src/java.corba/share/classes/org/omg/CORBA/DefinitionKind.java
new file mode 100644
index 0000000..5abed1d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DefinitionKind.java
@@ -0,0 +1,501 @@
+/*
+ * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * File: ./org/omg/CORBA/DefinitionKind.java
+ * From: ./ir.idl
+ * Date: Fri Aug 28 16:03:31 1998
+ * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
+ */
+
+package org.omg.CORBA;
+
+/**
+* The class that provides the constants used to identify the type of an
+* Interface Repository object. This class contains two kinds of constants,
+* those that are an <code>int</code> and those that are an instance of the class
+* <code>DefinitionKind</code>. This class provides the method
+* <code>from_int</code>, which given one
+* of the <code>int</code> constants, creates the corresponding
+* <code>DefinitionKind</code> instance. It also provides the method
+* <code>value</code>, which returns the <code>int</code> constant that
+* is the value for a <code>DefinitionKind</code> instance.
+*
+* @see IRObject
+*/
+
+public class DefinitionKind implements org.omg.CORBA.portable.IDLEntity {
+
+/**
+ * The constant that indicates that an Interface Repository object
+ * does not have a definition kind.
+ */
+ public static final int _dk_none = 0,
+
+/**
+ * The constant that indicates that the type of an Interface Repository object
+ * may be any type.
+ */
+ _dk_all = 1,
+
+/**
+ * The constant that indicates that an Interface Repository object is an
+ * attribute.
+ */
+ _dk_Attribute = 2,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * constant.
+ */
+ _dk_Constant = 3,
+
+/**
+ * The constant that indicates that an Interface Repository object is an
+ * exception.
+ */
+
+ _dk_Exception = 4,
+
+/**
+ * The constant that indicates that an Interface Repository object is an
+ * interface.
+ */
+
+ _dk_Interface = 5,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * module.
+ */
+
+ _dk_Module = 6,
+
+/**
+ * The constant that indicates that an Interface Repository object is an
+ * operation.
+ */
+
+ _dk_Operation = 7,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * Typedef.
+ */
+
+ _dk_Typedef = 8,
+
+/**
+ * The constant that indicates that an Interface Repository object is an
+ * Alias.
+ */
+
+ _dk_Alias = 9,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * Struct.
+ */
+
+ _dk_Struct = 10,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * Union.
+ */
+
+ _dk_Union = 11,
+
+/**
+ * The constant that indicates that an Interface Repository object is an
+ * Enum.
+ */
+
+ _dk_Enum = 12,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * Primitive.
+ */
+
+ _dk_Primitive = 13,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * String.
+ */
+
+ _dk_String = 14,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * Sequence.
+ */
+
+ _dk_Sequence = 15,
+
+/**
+ * The constant that indicates that an Interface Repository object is an
+ * Array.
+ */
+
+ _dk_Array = 16,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * Repository.
+ */
+
+ _dk_Repository = 17,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * Wstring.
+ */
+
+ _dk_Wstring = 18,
+
+/**
+ * The constant that indicates that an Interface Repository object is of type
+ * Fixed.
+ */
+
+ _dk_Fixed = 19,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * Value.
+ */
+
+ _dk_Value = 20,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * ValueBox.
+ */
+
+ _dk_ValueBox = 21,
+
+/**
+ * The constant that indicates that an Interface Repository object is a
+ * ValueMember.
+ */
+
+ _dk_ValueMember = 22,
+
+/**
+ * The constant that indicates that an Interface Repository object is of type
+ * Native.
+ */
+
+ _dk_Native = 23,
+
+/**
+ * The constant that indicates that an Interface Repository object
+ * is representing an abstract interface.
+ */
+ _dk_AbstractInterface = 24;
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object has no definition kind.
+ */
+
+ public static final DefinitionKind dk_none = new DefinitionKind(_dk_none);
+
+ /**
+ * The wildcard <code>DefinitionKind</code> constant, useful
+ * in all occasions where any
+ * <code>DefinitionKind</code> is appropriate. The Container's
+ * <code>contents</code> method
+ * makes use of this constant to return all contained definitions of any kind.
+ */
+
+ public static final DefinitionKind dk_all = new DefinitionKind(_dk_all);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is an Attribute.
+ */
+
+ public static final DefinitionKind dk_Attribute = new DefinitionKind(_dk_Attribute);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a constant.
+ */
+
+ public static final DefinitionKind dk_Constant = new DefinitionKind(_dk_Constant);
+
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is an Exception.
+ */
+
+ public static final DefinitionKind dk_Exception = new DefinitionKind(_dk_Exception);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is an Interface.
+ */
+
+ public static final DefinitionKind dk_Interface = new DefinitionKind(_dk_Interface);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Module.
+ */
+
+ public static final DefinitionKind dk_Module = new DefinitionKind(_dk_Module);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is an Operation.
+ */
+
+ public static final DefinitionKind dk_Operation = new DefinitionKind(_dk_Operation);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Typedef.
+ */
+
+ public static final DefinitionKind dk_Typedef = new DefinitionKind(_dk_Typedef);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is an Alias.
+ */
+
+ public static final DefinitionKind dk_Alias = new DefinitionKind(_dk_Alias);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Struct.
+ */
+
+ public static final DefinitionKind dk_Struct = new DefinitionKind(_dk_Struct);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Union.
+ */
+
+ public static final DefinitionKind dk_Union = new DefinitionKind(_dk_Union);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is an Enum.
+ */
+
+ public static final DefinitionKind dk_Enum = new DefinitionKind(_dk_Enum);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Primitive.
+ */
+
+ public static final DefinitionKind dk_Primitive = new DefinitionKind(_dk_Primitive);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a String.
+ */
+
+ public static final DefinitionKind dk_String = new DefinitionKind(_dk_String);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Sequence.
+ */
+
+ public static final DefinitionKind dk_Sequence = new DefinitionKind(_dk_Sequence);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is an Array.
+ */
+
+ public static final DefinitionKind dk_Array = new DefinitionKind(_dk_Array);
+
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Repository.
+ */
+
+ public static final DefinitionKind dk_Repository = new DefinitionKind(_dk_Repository);
+
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Wstring.
+ */
+
+ public static final DefinitionKind dk_Wstring = new DefinitionKind(_dk_Wstring);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Fixed value.
+ */
+
+ public static final DefinitionKind dk_Fixed = new DefinitionKind(_dk_Fixed);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Value.
+ */
+
+ public static final DefinitionKind dk_Value = new DefinitionKind(_dk_Value);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a ValueBox.
+ */
+
+ public static final DefinitionKind dk_ValueBox = new DefinitionKind(_dk_ValueBox);
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a ValueMember.
+ */
+
+ public static final DefinitionKind dk_ValueMember = new DefinitionKind(_dk_ValueMember);
+
+
+/**
+ * The static instance of <code>DefinitionKind</code> indicating that an
+ * Interface Repository object is a Native value.
+ */
+
+ public static final DefinitionKind dk_Native = new DefinitionKind(_dk_Native);
+
+
+/**
+* The static instance of <code>DefinitionKind</code> indicating that an
+* Interface Repository object represents an abstract interface.
+*/
+ public static final DefinitionKind dk_AbstractInterface = new DefinitionKind(_dk_AbstractInterface);
+
+
+ /**
+ * Returns the <code>int</code> constant identifying the type of an IR object.
+ * @return the <code>int</code> constant from the class
+ * <code>DefinitionKind</code> that is the value of this
+ * <code>DefinitionKind</code> instance
+ */
+
+ public int value() {
+ return _value;
+ }
+
+
+ /**
+ * Creates a <code>DefinitionKind</code> instance corresponding to the given code
+.
+ * @param i one of the <code>int</code> constants from the class
+ * <code>DefinitionKind</code>
+ * @return the <code>DefinitionKind</code> instance corresponding
+ * to the given code
+ * @throws org.omg.CORBA.BAD_PARAM if the given parameter is not
+ one
+ * of the <code>int</code> constants from the class
+ * <code>DefinitionKind</code>
+ */
+
+ public static DefinitionKind from_int(int i) {
+ switch (i) {
+ case _dk_none:
+ return dk_none;
+ case _dk_all:
+ return dk_all;
+ case _dk_Attribute:
+ return dk_Attribute;
+ case _dk_Constant:
+ return dk_Constant;
+ case _dk_Exception:
+ return dk_Exception;
+ case _dk_Interface:
+ return dk_Interface;
+ case _dk_Module:
+ return dk_Module;
+ case _dk_Operation:
+ return dk_Operation;
+ case _dk_Typedef:
+ return dk_Typedef;
+ case _dk_Alias:
+ return dk_Alias;
+ case _dk_Struct:
+ return dk_Struct;
+ case _dk_Union:
+ return dk_Union;
+ case _dk_Enum:
+ return dk_Enum;
+ case _dk_Primitive:
+ return dk_Primitive;
+ case _dk_String:
+ return dk_String;
+ case _dk_Sequence:
+ return dk_Sequence;
+ case _dk_Array:
+ return dk_Array;
+ case _dk_Repository:
+ return dk_Repository;
+ case _dk_Wstring:
+ return dk_Wstring;
+ case _dk_Fixed:
+ return dk_Fixed;
+ case _dk_Value:
+ return dk_Value;
+ case _dk_ValueBox:
+ return dk_ValueBox;
+ case _dk_ValueMember:
+ return dk_ValueMember;
+ case _dk_Native:
+ return dk_Native;
+ default:
+ throw new org.omg.CORBA.BAD_PARAM();
+ }
+ }
+
+ /**
+ * Constructs a <code>DefinitionKind</code> object with its <code>_value</code>
+ * field initialized with the given value.
+ * @param _value one of the <code>int</code> constants defined in the
+ * class <code>DefinitionKind</code>
+ */
+
+ protected DefinitionKind(int _value){
+ this._value = _value;
+ }
+
+ /**
+ * The field that holds a value for a <code>DefinitionKind</code> object.
+ * @serial
+ */
+
+ private int _value;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DefinitionKindHelper.java b/src/java.corba/share/classes/org/omg/CORBA/DefinitionKindHelper.java
new file mode 100644
index 0000000..945ceeb
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DefinitionKindHelper.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code DefinitionKind}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/DefinitionKindHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ir.idl
+ * 03 June 1999 11:33:43 o'clock GMT+00:00
+ */
+
+abstract public class DefinitionKindHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/DefinitionKind:1.0";
+
+ 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 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 (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 ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.DefinitionKind read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return org.omg.CORBA.DefinitionKind.from_int (istream.read_long ());
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.DefinitionKind value)
+ {
+ ostream.write_long (value.value ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DomainManager.java b/src/java.corba/share/classes/org/omg/CORBA/DomainManager.java
new file mode 100644
index 0000000..2bdc89f
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DomainManager.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Provides mechanisms for establishing and navigating relationships to
+ * superior and subordinate domains, as well as for creating and accessing
+ * policies. The {@code DomainManager} has associated with it the policy
+ * objects for a particular domain.
+ * The domain manager also records the membership of
+ * the domain and provides the means to add and remove members. The domain
+ * manager is itself a member of a domain, possibly the domain it manages.
+ * The domain manager provides mechanisms for establishing and navigating
+ * relationships to superior and subordinate domains and
+ * creating and accessing policies.
+ */
+
+public interface DomainManager extends DomainManagerOperations,
+ org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
+{
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DomainManagerOperations.java b/src/java.corba/share/classes/org/omg/CORBA/DomainManagerOperations.java
new file mode 100644
index 0000000..4324b1b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DomainManagerOperations.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Provides the {@code DomainManager} with the means to access policies.
+ * <P>
+ * The {@code DomainManager} has associated with it the policy objects for a
+ * particular domain. The domain manager also records the membership of
+ * the domain and provides the means to add and remove members. The domain
+ * manager is itself a member of a domain, possibly the domain it manages.
+ * The domain manager provides mechanisms for establishing and navigating
+ * relationships to superior and subordinate domains and
+ * creating and accessing policies.
+ */
+
+public interface DomainManagerOperations
+{
+ /**
+ * This returns the policy of the specified type for objects in
+ * this domain. The types of policies available are domain specific.
+ * See the CORBA specification for a list of standard ORB policies.
+ *
+ * @param policy_type Type of policy to request
+ */
+ public org.omg.CORBA.Policy get_domain_policy(int policy_type);
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DoubleHolder.java b/src/java.corba/share/classes/org/omg/CORBA/DoubleHolder.java
new file mode 100644
index 0000000..3d1cd73
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DoubleHolder.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 1995, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Holder for {@code Double}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a {@code double}
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code double} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code DoubleHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myDoubleHolder} is an instance of {@code DoubleHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myDoubleHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class DoubleHolder implements Streamable {
+
+ /**
+ * The {@code double} value held by this {@code DoubleHolder}
+ * object.
+ */
+
+ public double value;
+
+ /**
+ * Constructs a new {@code DoubleHolder} object with its
+ * {@code value} field initialized to 0.0.
+ */
+ public DoubleHolder() {
+ }
+
+ /**
+ * Constructs a new {@code DoubleHolder} object for the given
+ * {@code double}.
+ * @param initial the {@code double} with which to initialize
+ * the {@code value} field of the new
+ * {@code DoubleHolder} object
+ */
+ public DoubleHolder(double initial) {
+ value = initial;
+ }
+
+ /**
+ * Read a double value from the input stream and store it in the
+ * value member.
+ *
+ * @param input the {@code InputStream} to read from.
+ */
+ public void _read(InputStream input) {
+ value = input.read_double();
+ }
+
+ /**
+ * Write the double value stored in this holder to an
+ * {@code OutputStream}.
+ *
+ * @param output the {@code OutputStream} to write into.
+ */
+ public void _write(OutputStream output) {
+ output.write_double(value);
+ }
+
+ /**
+ * Return the {@code TypeCode} of this holder object.
+ *
+ * @return the {@code TypeCode} object.
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_double);
+ }
+
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHelper.java
new file mode 100644
index 0000000..5c63c49
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code DoubleSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/DoubleSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:37 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
+
+public abstract class DoubleSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/DoubleSeq:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, double[] 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 double[] 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_double);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.DoubleSeqHelper.id (), "DoubleSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static double[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ double value[] = null;
+ int _len0 = istream.read_long ();
+ value = new double[_len0];
+ istream.read_double_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, double[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_double_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHolder.java
new file mode 100644
index 0000000..d71651c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DoubleSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Holder for {@code DoubleSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/DoubleSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:37 o'clock GMT+00:00
+ */
+
+public final class DoubleSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public double value[] = null;
+
+ public DoubleSeqHolder ()
+ {
+ }
+
+ public DoubleSeqHolder (double[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.DoubleSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.DoubleSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.DoubleSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynAny.java b/src/java.corba/share/classes/org/omg/CORBA/DynAny.java
new file mode 100644
index 0000000..0d45b25
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynAny.java
@@ -0,0 +1,732 @@
+/*
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA;
+
+
+/**
+ * Enables {@code org.omg.CORBA.Any} values to be dynamically
+ * interpreted (traversed) and
+ * constructed. A {@code DynAny} object is associated with a data value
+ * which may correspond to a copy of the value inserted into an {@code Any}.
+ * The {@code DynAny} APIs enable traversal of the data value associated with an
+ * Any at runtime and extraction of the primitive constituents of the
+ * data value.
+ * @deprecated Use the new <a href="../DynamicAny/DynAny.html">DynAny</a> instead
+ */
+@Deprecated
+public interface DynAny extends org.omg.CORBA.Object
+{
+ /**
+ * Returns the {@code TypeCode} of the object inserted into
+ * this {@code DynAny}.
+ *
+ * @return the {@code TypeCode} object.
+ */
+ public org.omg.CORBA.TypeCode type() ;
+
+ /**
+ * Copy the contents from one Dynamic Any into another.
+ *
+ * @param dyn_any the {@code DynAny} object whose contents
+ * are assigned to this {@code DynAny}.
+ * @throws org.omg.CORBA.DynAnyPackage.Invalid if the source
+ * {@code DynAny} is invalid
+ */
+ public void assign(org.omg.CORBA.DynAny dyn_any)
+ throws org.omg.CORBA.DynAnyPackage.Invalid;
+
+ /**
+ * Make a {@code DynAny} object from an {@code Any}
+ * object.
+ *
+ * @param value the {@code Any} object.
+ * @throws org.omg.CORBA.DynAnyPackage.Invalid if the source
+ * {@code Any} object is empty or bad
+ */
+ public void from_any(org.omg.CORBA.Any value)
+ throws org.omg.CORBA.DynAnyPackage.Invalid;
+
+ /**
+ * Convert a {@code DynAny} object to an {@code Any}
+ * object.
+ *
+ * @return the {@code Any} object.
+ * @throws org.omg.CORBA.DynAnyPackage.Invalid if this
+ * {@code DynAny} is empty or bad.
+ * created or does not contain a meaningful value
+ */
+ public org.omg.CORBA.Any to_any()
+ throws org.omg.CORBA.DynAnyPackage.Invalid;
+
+ /**
+ * Destroys this {@code DynAny} object and frees any resources
+ * used to represent the data value associated with it. This method
+ * also destroys all {@code DynAny} objects obtained from it.
+ * <p>
+ * Destruction of {@code DynAny} objects should be handled with
+ * care, taking into account issues dealing with the representation of
+ * data values associated with {@code DynAny} objects. A programmer
+ * who wants to destroy a {@code DynAny} object but still be able
+ * to manipulate some component of the data value associated with it,
+ * should first create a {@code DynAny} object for the component
+ * and then make a copy of the created {@code DynAny} object.
+ */
+ public void destroy() ;
+
+ /**
+ * Clones this {@code DynAny} object.
+ *
+ * @return a copy of this {@code DynAny} object
+ */
+ public org.omg.CORBA.DynAny copy() ;
+
+ /**
+ * Inserts the given {@code boolean} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code boolean} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_boolean(boolean value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code byte} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code byte} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_octet(byte value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code char} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code char} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_char(char value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code short} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code short} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_short(short value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code short} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code short} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_ushort(short value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code int} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code int} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_long(int value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code int} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code int} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_ulong(int value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code float} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code float} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_float(float value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code double} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code double} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_double(double value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code String} object as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code String} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_string(String value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code org.omg.CORBA.Object} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code org.omg.CORBA.Object} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_reference(org.omg.CORBA.Object value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code org.omg.CORBA.TypeCode} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code org.omg.CORBA.TypeCode} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_typecode(org.omg.CORBA.TypeCode value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code long} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code long} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_longlong(long value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code long} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code long} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_ulonglong(long value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code char} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code char} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_wchar(char value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code String} as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code String} to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_wstring(String value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Inserts the given {@code org.omg.CORBA.Any} object as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code org.omg.CORBA.Any} object to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_any(org.omg.CORBA.Any value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ // orbos 98-01-18: Objects By Value -- begin
+
+ /**
+ * Inserts the given {@code java.io.Serializable} object as the value for this
+ * {@code DynAny} object.
+ *
+ * <p> If this method is called on a constructed {@code DynAny}
+ * object, it initializes the next component of the constructed data
+ * value associated with this {@code DynAny} object.
+ *
+ * @param value the {@code java.io.Serializable} object to insert into this
+ * {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue
+ * if the value inserted is not consistent with the type
+ * of the accessed component in this {@code DynAny} object
+ */
+ public void insert_val(java.io.Serializable value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+
+ /**
+ * Retrieves the {@code java.io.Serializable} object contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code java.io.Serializable} object that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code java.io.Serializable} object
+ */
+ public java.io.Serializable get_val()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+ // orbos 98-01-18: Objects By Value -- end
+
+ /**
+ * Retrieves the {@code boolean} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code boolean} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code boolean}
+ */
+ public boolean get_boolean()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code byte} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code byte} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code byte}
+ */
+ public byte get_octet()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+ /**
+ * Retrieves the {@code char} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code char} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code char}
+ */
+ public char get_char()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code short} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code short} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code short}
+ */
+ public short get_short()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code short} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code short} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code short}
+ */
+ public short get_ushort()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code int} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code int} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code int}
+ */
+ public int get_long()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code int} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code int} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code int}
+ */
+ public int get_ulong()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code float} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code float} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code float}
+ */
+ public float get_float()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code double} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code double} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code double}
+ */
+ public double get_double()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code String} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code String} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code String}
+ */
+ public String get_string()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code org.omg.CORBA.Other} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code org.omg.CORBA.Other} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for an {@code org.omg.CORBA.Other}
+ */
+ public org.omg.CORBA.Object get_reference()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code org.omg.CORBA.TypeCode} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code org.omg.CORBA.TypeCode} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code org.omg.CORBA.TypeCode}
+ */
+ public org.omg.CORBA.TypeCode get_typecode()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code long} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code long} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code long}
+ */
+ public long get_longlong()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code long} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code long} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code long}
+ */
+ public long get_ulonglong()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code char} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code char} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code char}
+ */
+ public char get_wchar()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code String} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code String} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for a {@code String}
+ */
+ public String get_wstring()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+
+ /**
+ * Retrieves the {@code org.omg.CORBA.Any} contained
+ * in this {@code DynAny} object.
+ *
+ * @return the {@code org.omg.CORBA.Any} that is the
+ * value for this {@code DynAny} object
+ * @throws org.omg.CORBA.DynAnyPackage.TypeMismatch
+ * if the type code of the accessed component in this
+ * {@code DynAny} object is not equivalent to
+ * the type code for an {@code org.omg.CORBA.Any}
+ */
+ public org.omg.CORBA.Any get_any()
+ throws org.omg.CORBA.DynAnyPackage.TypeMismatch;
+
+ /**
+ * Returns a {@code DynAny} object reference that can
+ * be used to get/set the value of the component currently accessed.
+ * The appropriate {@code insert} method
+ * can be called on the resulting {@code DynAny} object
+ * to initialize the component.
+ * The appropriate {@code get} method
+ * can be called on the resulting {@code DynAny} object
+ * to extract the value of the component.
+ *
+ * @return a {@code DynAny} object reference that can be
+ * used to retrieve or set the value of the component currently
+ * accessed
+ */
+ public org.omg.CORBA.DynAny current_component() ;
+
+ /**
+ * Moves to the next component of this {@code DynAny} object.
+ * This method is used for iterating through the components of
+ * a constructed type, effectively moving a pointer from one
+ * component to the next. The pointer starts out on the first
+ * component when a {@code DynAny} object is created.
+ *
+ * @return {@code true} if the pointer points to a component;
+ * {@code false} if there are no more components or this
+ * {@code DynAny} is associated with a basic type rather than
+ * a constructed type
+ */
+ public boolean next() ;
+
+ /**
+ * Moves the internal pointer to the given index. Logically, this method
+ * sets a new offset for this pointer.
+ *
+ * @param index an {@code int} indicating the position to which
+ * the pointer should move. The first position is 0.
+ * @return {@code true} if the pointer points to a component;
+ * {@code false} if there is no component at the designated
+ * index. If this {@code DynAny} object is associated with a
+ * basic type, this method returns {@code false} for any index
+ * other than 0.
+ */
+ public boolean seek(int index) ;
+
+ /**
+ * Moves the internal pointer to the first component.
+ */
+ public void rewind() ;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/Invalid.java b/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/Invalid.java
new file mode 100644
index 0000000..9b87ab5
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/Invalid.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA.DynAnyPackage;
+
+/**
+ * Invalid is thrown by dynamic any operations when a bad
+ * <code>DynAny</code> or <code>Any</code> is passed as a parameter.
+ */
+public final class Invalid
+ extends org.omg.CORBA.UserException {
+
+ /**
+ * Constructs an <code>Invalid</code> object.
+ */
+ public Invalid() {
+ super();
+ }
+
+ /**
+ * Constructs an <code>Invalid</code> object.
+ * @param reason a <code>String</code> giving more information
+ * regarding the bad parameter passed to a dynamic any operation.
+ */
+ public Invalid(String reason) {
+ super(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/InvalidSeq.java b/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/InvalidSeq.java
new file mode 100644
index 0000000..399eab5
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/InvalidSeq.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA.DynAnyPackage;
+
+/**
+ * The InvalidSeq exception is thrown by all operations on dynamic
+ * anys that take a sequence (Java array) as an argument, when that
+ * sequence is invalid.
+ */
+public final class InvalidSeq
+ extends org.omg.CORBA.UserException {
+
+ /**
+ * Constructs an <code>InvalidSeq</code> object.
+ */
+ public InvalidSeq() {
+ super();
+ }
+
+ /**
+ * Constructs an <code>InvalidSeq</code> object.
+ * @param reason a <code>String</code> giving more information
+ * regarding the exception.
+ */
+ public InvalidSeq(String reason) {
+ super(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/InvalidValue.java b/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/InvalidValue.java
new file mode 100644
index 0000000..ea42c83
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/InvalidValue.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.DynAnyPackage;
+
+/**
+ * @author unattributed
+ *
+ * Dynamic Any insert operations raise the <code>InvalidValue</code>
+ * exception if the value inserted is not consistent with the type
+ * of the accessed component in the <code>DynAny</code> object.
+ */
+public final class InvalidValue
+ extends org.omg.CORBA.UserException {
+
+ /**
+ * Constructs an <code>InvalidValue</code> object.
+ */
+ public InvalidValue() {
+ super();
+ }
+
+ /**
+ * Constructs an <code>InvalidValue</code> object.
+ * @param reason a <code>String</code> giving more information
+ * regarding the exception.
+ */
+ public InvalidValue(String reason) {
+ super(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/TypeMismatch.java b/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/TypeMismatch.java
new file mode 100644
index 0000000..698be59
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/TypeMismatch.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA.DynAnyPackage;
+
+/**
+ * TypeMismatch is thrown by dynamic any accessor methods when
+ * type of the actual contents do not match what is trying to be
+ * accessed.
+ */
+public final class TypeMismatch
+ extends org.omg.CORBA.UserException {
+
+ /**
+ * Constructs a <code>TypeMismatch</code> object.
+ */
+ public TypeMismatch() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>TypeMismatch</code> object.
+ * @param reason a <code>String</code> giving more information
+ * regarding the exception.
+ */
+ public TypeMismatch(String reason) {
+ super(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/package.html b/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/package.html
new file mode 100644
index 0000000..0908e64
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynAnyPackage/package.html
@@ -0,0 +1,42 @@
+
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+</head>
+<body bgcolor="white">
+
+Provides the exceptions used with the <code>DynAny</code> interface
+(<code>InvalidValue</code>,
+<code>Invalid</code>, <code>InvalidSeq</code>, and
+<code>TypeMismatch</code>).
+
+
+
+@since JDK1.2
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynArray.java b/src/java.corba/share/classes/org/omg/CORBA/DynArray.java
new file mode 100644
index 0000000..83236a0
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynArray.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA;
+
+
+/**
+ * Represents a {@code DynAny} object associated with an array.
+ *
+ * @deprecated Use the new <a href="../DynamicAny/DynArray.html">DynArray</a> instead
+ */
+@Deprecated
+public interface DynArray extends org.omg.CORBA.Object, org.omg.CORBA.DynAny
+{
+ /**
+ * Returns the value of all the elements of this array.
+ *
+ * @return the array of <code>Any</code> objects that is the value
+ * for this <code>DynArray</code> object
+ * @see #set_elements
+ */
+ public org.omg.CORBA.Any[] get_elements();
+
+ /**
+ * Sets the value of this
+ * <code>DynArray</code> object to the given array.
+ *
+ * @param value the array of <code>Any</code> objects
+ * @exception org.omg.CORBA.DynAnyPackage.InvalidSeq if the
+ * sequence is bad
+ * @see #get_elements
+ */
+ public void set_elements(org.omg.CORBA.Any[] value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidSeq;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynEnum.java b/src/java.corba/share/classes/org/omg/CORBA/DynEnum.java
new file mode 100644
index 0000000..d98957c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynEnum.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA;
+
+/**
+ * Represents a {@code DynAny} object associated with an IDL enum.
+ *
+ * @deprecated Use the new <a href="../DynamicAny/DynEnum.html">DynEnum</a> instead
+ */
+@Deprecated
+public interface DynEnum extends org.omg.CORBA.Object, org.omg.CORBA.DynAny
+{
+ /**
+ * Return the value of the IDL enum stored in this
+ * {@code DynEnum} as a string.
+ *
+ * @return the stringified value.
+ */
+ public String value_as_string();
+
+ /**
+ * Set a particular enum in this {@code DynEnum}.
+ *
+ * @param arg the string corresponding to the value.
+ */
+ public void value_as_string(String arg);
+
+ /**
+ * Return the value of the IDL enum as a Java int.
+ *
+ * @return the integer value.
+ */
+ public int value_as_ulong();
+
+ /**
+ * Set the value of the IDL enum.
+ *
+ * @param arg the int value of the enum.
+ */
+ public void value_as_ulong(int arg);
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynFixed.java b/src/java.corba/share/classes/org/omg/CORBA/DynFixed.java
new file mode 100644
index 0000000..7cf872e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynFixed.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA;
+
+/**
+ * Represents a <code>DynAny</code> object that is associated
+ * with an IDL fixed type.
+ * @deprecated Use the new <a href="../DynamicAny/DynFixed.html">DynFixed</a> instead
+ */
+@Deprecated
+public interface DynFixed extends org.omg.CORBA.Object, org.omg.CORBA.DynAny
+{
+ /**
+ * Returns the value of the fixed type represented in this
+ * <code>DynFixed</code> object.
+ *
+ * @return the value as a byte array
+ * @see #set_value
+ */
+ public byte[] get_value();
+
+ /**
+ * Sets the given fixed type instance as the value for this
+ * <code>DynFixed</code> object.
+ *
+ * @param val the value of the fixed type as a byte array
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidValue if the given
+ * argument is bad
+ * @see #get_value
+ */
+ public void set_value(byte[] val)
+ throws org.omg.CORBA.DynAnyPackage.InvalidValue;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynSequence.java b/src/java.corba/share/classes/org/omg/CORBA/DynSequence.java
new file mode 100644
index 0000000..c536183
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynSequence.java
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA;
+
+/**
+ * The representation of a <code>DynAny</code> object that is associated
+ * with an IDL sequence.
+ * @deprecated Use the new <a href="../DynamicAny/DynSequence.html">DynSequence</a> instead
+ */
+@Deprecated
+public interface DynSequence extends org.omg.CORBA.Object, org.omg.CORBA.DynAny
+{
+
+ /**
+ * Returns the length of the sequence represented by this
+ * <code>DynFixed</code> object.
+ *
+ * @return the length of the sequence
+ */
+ public int length();
+
+ /**
+ * Sets the length of the sequence represented by this
+ * <code>DynFixed</code> object to the given argument.
+ *
+ * @param arg the length of the sequence
+ */
+ public void length(int arg);
+
+ /**
+ * Returns the value of every element in this sequence.
+ *
+ * @return an array of <code>Any</code> objects containing the values in
+ * the sequence
+ * @see #set_elements
+ */
+ public org.omg.CORBA.Any[] get_elements();
+
+ /**
+ * Sets the values of all elements in this sequence with the given
+ * array.
+ *
+ * @param value the array of <code>Any</code> objects to be set
+ * @exception org.omg.CORBA.DynAnyPackage.InvalidSeq if the array
+ * of values is bad
+ * @see #get_elements
+ */
+ public void set_elements(org.omg.CORBA.Any[] value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidSeq;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynStruct.java b/src/java.corba/share/classes/org/omg/CORBA/DynStruct.java
new file mode 100644
index 0000000..448f158
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynStruct.java
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA;
+
+/**
+ * The representation of a <code>DynAny</code> object that is associated
+ * with an IDL struct.
+ * @deprecated Use the new <a href="../DynamicAny/DynStruct.html">DynStruct</a> instead
+ */
+@Deprecated
+public interface DynStruct extends org.omg.CORBA.Object, org.omg.CORBA.DynAny
+{
+ /**
+ * During a traversal, returns the name of the current member.
+ *
+ * @return the string name of the current member
+ */
+ public String current_member_name();
+
+ /**
+ * Returns the <code>TCKind</code> object that describes the kind of
+ * the current member.
+ *
+ * @return the <code>TCKind</code> object that describes the current member
+ */
+ public org.omg.CORBA.TCKind current_member_kind();
+
+ /**
+ * Returns an array containing all the members of the stored struct.
+ *
+ * @return the array of name-value pairs
+ * @see #set_members
+ */
+ public org.omg.CORBA.NameValuePair[] get_members();
+
+ /**
+ * Set the members of the struct.
+ *
+ * @param value the array of name-value pairs.
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidSeq if the given argument
+ * is invalid
+ * @see #get_members
+ */
+ public void set_members(org.omg.CORBA.NameValuePair[] value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidSeq;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynUnion.java b/src/java.corba/share/classes/org/omg/CORBA/DynUnion.java
new file mode 100644
index 0000000..6ce271d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynUnion.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA;
+
+/**
+ * The <code>DynUnion</code> interface represents a <code>DynAny</code> object
+ * that is associated with an IDL union.
+ * Union values can be traversed using the operations defined in <code>DynAny</code>.
+ * The first component in the union corresponds to the discriminator;
+ * the second corresponds to the actual value of the union.
+ * Calling the method <code>next()</code> twice allows you to access both components.
+ * @deprecated Use the new <a href="../DynamicAny/DynUnion.html">DynUnion</a> instead
+ */
+@Deprecated
+public interface DynUnion extends org.omg.CORBA.Object, org.omg.CORBA.DynAny
+{
+ /**
+ * Determines whether the discriminator associated with this union has been assigned
+ * a valid default value.
+ * @return <code>true</code> if the discriminator has a default value;
+ * <code>false</code> otherwise
+ */
+ public boolean set_as_default();
+
+ /**
+ * Determines whether the discriminator associated with this union gets assigned
+ * a valid default value.
+ * @param arg <code>true</code> if the discriminator gets assigned a default value
+ */
+ public void set_as_default(boolean arg);
+
+ /**
+ * Returns a DynAny object reference that must be narrowed to the type
+ * of the discriminator in order to insert/get the discriminator value.
+ * @return a <code>DynAny</code> object reference representing the discriminator value
+ */
+ public org.omg.CORBA.DynAny discriminator();
+
+ /**
+ * Returns the TCKind object associated with the discriminator of this union.
+ * @return the <code>TCKind</code> object associated with the discriminator of this union
+ */
+ public org.omg.CORBA.TCKind discriminator_kind();
+
+ /**
+ * Returns a DynAny object reference that is used in order to insert/get
+ * a member of this union.
+ * @return the <code>DynAny</code> object representing a member of this union
+ */
+ public org.omg.CORBA.DynAny member();
+
+ /**
+ * Allows for the inspection of the name of this union member
+ * without checking the value of the discriminator.
+ * @return the name of this union member
+ */
+ public String member_name();
+
+ /**
+ * Allows for the assignment of the name of this union member.
+ * @param arg the new name of this union member
+ */
+ public void member_name(String arg);
+
+ /**
+ * Returns the TCKind associated with the member of this union.
+ * @return the <code>TCKind</code> object associated with the member of this union
+ */
+ public org.omg.CORBA.TCKind member_kind();
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynValue.java b/src/java.corba/share/classes/org/omg/CORBA/DynValue.java
new file mode 100644
index 0000000..40972ae
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynValue.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 1998, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The representation of a <code>DynAny</code> object that is associated
+ * with an IDL value type.
+ * @deprecated Use the new <a href="../DynamicAny/DynValue.html">DynValue</a> instead
+ */
+@Deprecated
+public interface DynValue extends org.omg.CORBA.Object, org.omg.CORBA.DynAny {
+
+ /**
+ * Returns the name of the current member while traversing a
+ * <code>DynAny</code> object that represents a Value object.
+ *
+ * @return the name of the current member
+ */
+ String current_member_name();
+
+ /**
+ * Returns the <code>TCKind</code> object that describes the current member.
+ *
+ * @return the <code>TCKind</code> object corresponding to the current
+ * member
+ */
+ TCKind current_member_kind();
+
+ /**
+ * Returns an array containing all the members of the value object
+ * stored in this <code>DynValue</code>.
+ *
+ * @return an array of name-value pairs.
+ * @see #set_members
+ */
+ org.omg.CORBA.NameValuePair[] get_members();
+
+ /**
+ * Sets the members of the value object this <code>DynValue</code>
+ * object represents to the given array of <code>NameValuePair</code>
+ * objects.
+ *
+ * @param value the array of name-value pairs to be set
+ * @throws org.omg.CORBA.DynAnyPackage.InvalidSeq
+ * if an inconsistent value is part of the given array
+ * @see #get_members
+ */
+ void set_members(NameValuePair[] value)
+ throws org.omg.CORBA.DynAnyPackage.InvalidSeq;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/DynamicImplementation.java b/src/java.corba/share/classes/org/omg/CORBA/DynamicImplementation.java
new file mode 100644
index 0000000..b7c547e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/DynamicImplementation.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.ObjectImpl;
+
+/**
+ * @deprecated org.omg.CORBA.DynamicImplementation
+ */
+@Deprecated
+public class DynamicImplementation extends org.omg.CORBA.portable.ObjectImpl {
+
+ /**
+ * @deprecated Deprecated by Portable Object Adapter
+ */
+ @Deprecated
+ public void invoke(ServerRequest request) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ public String[] _ids() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/Environment.java b/src/java.corba/share/classes/org/omg/CORBA/Environment.java
new file mode 100644
index 0000000..77548e5
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/Environment.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A container (holder) for an exception that is used in <code>Request</code>
+ * operations to make exceptions available to the client. An
+ * <code>Environment</code> object is created with the <code>ORB</code>
+ * method <code>create_environment</code>.
+ *
+ * @since JDK1.2
+ */
+
+public abstract class Environment {
+
+ /**
+ * Retrieves the exception in this <code>Environment</code> object.
+ *
+ * @return the exception in this <code>Environment</code> object
+ */
+
+ public abstract java.lang.Exception exception();
+
+ /**
+ * Inserts the given exception into this <code>Environment</code> object.
+ *
+ * @param except the exception to be set
+ */
+
+ public abstract void exception(java.lang.Exception except);
+
+ /**
+ * Clears this <code>Environment</code> object of its exception.
+ */
+
+ public abstract void clear();
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ExceptionList.java b/src/java.corba/share/classes/org/omg/CORBA/ExceptionList.java
new file mode 100644
index 0000000..5e7e3f1
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ExceptionList.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * An object used in <code>Request</code> operations to
+ * describe the exceptions that can be thrown by a method. It maintains a
+ * modifiable list of <code>TypeCode</code>s of the exceptions.
+ * <P>
+ * The following code fragment demonstrates creating
+ * an <code>ExceptionList</code> object:
+ * <PRE>
+ * ORB orb = ORB.init(args, null);
+ * org.omg.CORBA.ExceptionList excList = orb.create_exception_list();
+ * </PRE>
+ * The variable <code>excList</code> represents an <code>ExceptionList</code>
+ * object with no <code>TypeCode</code> objects in it.
+ * <P>
+ * To add items to the list, you first create a <code>TypeCode</code> object
+ * for the exception you want to include, using the <code>ORB</code> method
+ * <code>create_exception_tc</code>. Then you use the <code>ExceptionList</code>
+ * method <code>add</code> to add it to the list.
+ * The class <code>ExceptionList</code> has a method for getting
+ * the number of <code>TypeCode</code> objects in the list, and after
+ * items have been added, it is possible to call methods for accessing
+ * or deleting an item at a designated index.
+ *
+ * @since JDK1.2
+ */
+
+public abstract class ExceptionList {
+
+ /**
+ * Retrieves the number of <code>TypeCode</code> objects in this
+ * <code>ExceptionList</code> object.
+ *
+ * @return the number of <code>TypeCode</code> objects in this
+ * <code>ExceptionList</code> object
+ */
+
+ public abstract int count();
+
+ /**
+ * Adds a <code>TypeCode</code> object describing an exception
+ * to this <code>ExceptionList</code> object.
+ *
+ * @param exc the <code>TypeCode</code> object to be added
+ */
+
+ public abstract void add(TypeCode exc);
+
+ /**
+ * Returns the <code>TypeCode</code> object at the given index. The first
+ * item is at index 0.
+ *
+ * @param index the index of the <code>TypeCode</code> object desired.
+ * This must be an <code>int</code> between 0 and the
+ * number of <code>TypeCode</code> objects
+ * minus one, inclusive.
+ * @return the <code>TypeCode</code> object at the given index
+ * @exception org.omg.CORBA.Bounds if the index given is greater than
+ * or equal to the number of <code>TypeCode</code> objects
+ * in this <code>ExceptionList</code> object
+ */
+
+ public abstract TypeCode item(int index)
+ throws org.omg.CORBA.Bounds;
+
+ /**
+ * Removes the <code>TypeCode</code> object at the given index.
+ * Note that the indices of all the <code>TypeCoded</code> objects
+ * following the one deleted are shifted down by one.
+ *
+ * @param index the index of the <code>TypeCode</code> object to be
+ * removed.
+ * This must be an <code>int</code> between 0 and the
+ * number of <code>TypeCode</code> objects
+ * minus one, inclusive.
+ *
+ * @exception org.omg.CORBA.Bounds if the index is greater than
+ * or equal to the number of <code>TypeCode</code> objects
+ * in this <code>ExceptionList</code> object
+ */
+
+ public abstract void remove(int index)
+ throws org.omg.CORBA.Bounds;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/FREE_MEM.java b/src/java.corba/share/classes/org/omg/CORBA/FREE_MEM.java
new file mode 100644
index 0000000..6196a7c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/FREE_MEM.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown
+ * when the ORB failed in an attempt to free dynamic memory, for example
+ * because of heap corruption or memory segments being locked.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class FREE_MEM extends SystemException {
+ /**
+ * Constructs a <code>FREE_MEM</code> exception with a default
+ * minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public FREE_MEM() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>FREE_MEM</code> exception with the specified detail
+ * message, a minor code of 0, and a completion state of COMPLETED_NO.
+ *
+ * @param s the String containing a detail message
+ */
+ public FREE_MEM(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>FREE_MEM</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public FREE_MEM(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>FREE_MEM</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public FREE_MEM(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/FieldNameHelper.java b/src/java.corba/share/classes/org/omg/CORBA/FieldNameHelper.java
new file mode 100644
index 0000000..9e97bca
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/FieldNameHelper.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code FieldName}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/FieldNameHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * 03 June 1999 11:52:03 o'clock GMT+00:00
+ */
+
+abstract public class FieldNameHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/FieldName:1.0";
+
+ 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 ());
+ }
+
+ 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 (org.omg.CORBA.FieldNameHelper.id (), "FieldName", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value = null;
+ value = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ ostream.write_string (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/FixedHolder.java b/src/java.corba/share/classes/org/omg/CORBA/FixedHolder.java
new file mode 100644
index 0000000..c51e902
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/FixedHolder.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+
+/**
+ * The Holder for {@code Fixed}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * FixedHolder is a container class for values of IDL type "fixed",
+ * which is mapped to the Java class java.math.BigDecimal.
+ * It is usually used to store "out" and "inout" IDL method parameters.
+ * If an IDL method signature has a fixed as an "out" or "inout" parameter,
+ * the programmer must pass an instance of FixedHolder as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the contained
+ * value corresponding to the "out" value returned from the server.
+ *
+ */
+public final class FixedHolder implements Streamable {
+ /**
+ * The value held by the FixedHolder
+ */
+ public java.math.BigDecimal value;
+
+ /**
+ * Construct the FixedHolder without initializing the contained value.
+ */
+ public FixedHolder() {
+ }
+
+ /**
+ * Construct the FixedHolder and initialize it with the given value.
+ * @param initial the value used to initialize the FixedHolder
+ */
+ public FixedHolder(java.math.BigDecimal initial) {
+ value = initial;
+ }
+
+ /**
+ * Read a fixed point value from the input stream and store it in
+ * the value member.
+ *
+ * @param input the {@code InputStream} to read from.
+ */
+ public void _read(InputStream input) {
+ value = input.read_fixed();
+ }
+
+ /**
+ * Write the fixed point value stored in this holder to an
+ * {@code OutputStream}.
+ *
+ * @param output the {@code OutputStream} to write into.
+ */
+ public void _write(OutputStream output) {
+ output.write_fixed(value);
+ }
+
+
+ /**
+ * Return the {@code TypeCode} of this holder object.
+ *
+ * @return the {@code TypeCode} object.
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_fixed);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/FloatHolder.java b/src/java.corba/share/classes/org/omg/CORBA/FloatHolder.java
new file mode 100644
index 0000000..3199974
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/FloatHolder.java
@@ -0,0 +1,105 @@
+/*
+ * Copyright (c) 1995, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+
+/**
+ * The Holder for {@code Float}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a {@code float}
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code float} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code FloatHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myFloatHolder} is an instance of {@code FloatHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myFloatHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class FloatHolder implements Streamable {
+ /**
+ * The {@code float} value held by this {@code FloatHolder}
+ * object.
+ */
+ public float value;
+
+ /**
+ * Constructs a new {@code FloatHolder} object with its
+ * {@code value} field initialized to 0.0.
+ */
+ public FloatHolder() {
+ }
+
+ /**
+ * Constructs a new {@code FloatHolder} object for the given
+ * {@code float}.
+ * @param initial the {@code float} with which to initialize
+ * the {@code value} field of the new
+ * {@code FloatHolder} object
+ */
+ public FloatHolder(float initial) {
+ value = initial;
+ }
+
+ /**
+ * Read a float from an input stream and initialize the value
+ * member with the float value.
+ *
+ * @param input the {@code InputStream} to read from.
+ */
+ public void _read(InputStream input) {
+ value = input.read_float();
+ }
+
+ /**
+ * Write the float value into an output stream.
+ *
+ * @param output the {@code OutputStream} to write into.
+ */
+ public void _write(OutputStream output) {
+ output.write_float(value);
+ }
+
+ /**
+ * Return the {@code TypeCode} of this Streamable.
+ *
+ * @return the {@code TypeCode} object.
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_float);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHelper.java
new file mode 100644
index 0000000..a8684b5
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code FloatSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/FloatSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:37 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
+
+public abstract class FloatSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/FloatSeq:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, float[] 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 float[] 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_float);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.FloatSeqHelper.id (), "FloatSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static float[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ float value[] = null;
+ int _len0 = istream.read_long ();
+ value = new float[_len0];
+ istream.read_float_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, float[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_float_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHolder.java
new file mode 100644
index 0000000..645bbb9
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/FloatSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Holder for {@code FloatSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/FloatSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:37 o'clock GMT+00:00
+ */
+
+public final class FloatSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public float value[] = null;
+
+ public FloatSeqHolder ()
+ {
+ }
+
+ public FloatSeqHolder (float[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.FloatSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.FloatSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.FloatSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/IDLType.java b/src/java.corba/share/classes/org/omg/CORBA/IDLType.java
new file mode 100644
index 0000000..dbd4595
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/IDLType.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * File: ./org/omg/CORBA/IDLType.java
+ * From: ./ir.idl
+ * Date: Fri Aug 28 16:03:31 1998
+ * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
+ */
+
+package org.omg.CORBA;
+/**
+* tempout/org/omg/CORBA/IDLType.java
+* Generated by the IBM IDL-to-Java compiler, version 1.0
+* from ../../Lib/ir.idl
+* Thursday, February 25, 1999 2:11:23 o'clock PM PST
+*/
+
+/**
+ * An abstract interface inherited by all Interface Repository
+ * (IR) objects that represent OMG IDL types. It provides access
+ * to the <code>TypeCode</code> object describing the type and is used in defining the
+ * other interfaces wherever definitions of <code>IDLType</code> must be referenced.
+ */
+
+public interface IDLType extends IDLTypeOperations, org.omg.CORBA.IRObject, org.omg.CORBA.portable.IDLEntity
+{
+} // interface IDLType
diff --git a/src/java.corba/share/classes/org/omg/CORBA/IDLTypeHelper.java b/src/java.corba/share/classes/org/omg/CORBA/IDLTypeHelper.java
new file mode 100644
index 0000000..76bdbe4
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/IDLTypeHelper.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code IDLType}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/IDLTypeHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ir.idl
+ * 03 June 1999 11:33:44 o'clock GMT+00:00
+ */
+
+abstract public class IDLTypeHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/IDLType:1.0";
+
+ 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 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 (org.omg.CORBA.IDLTypeHelper.id (), "IDLType");
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.IDLType read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return narrow (istream.read_Object (_IDLTypeStub.class));
+ }
+
+ 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 org.omg.CORBA.IDLType narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.omg.CORBA.IDLType)
+ 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.omg.CORBA._IDLTypeStub (delegate);
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/IDLTypeOperations.java b/src/java.corba/share/classes/org/omg/CORBA/IDLTypeOperations.java
new file mode 100644
index 0000000..ac2eaba
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/IDLTypeOperations.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+/**
+ * The interface for {@code IDLType}. For more information on
+ * Operations interfaces, see <a href="doc-files/generatedfiles.html#operations">
+ * "Generated Files: Operations files"</a>.
+ */
+
+/*
+ tempout/org/omg/CORBA/IDLTypeOperations.java
+ Generated by the IBM IDL-to-Java compiler, version 1.0
+ from ../../Lib/ir.idl
+ Thursday, February 25, 1999 2:11:23 o'clock PM PST
+*/
+
+/**
+ * This interface must be implemented by all IDLType objects.
+ * The IDLType is inherited by all IR objects that
+ * represent IDL types, including interfaces, typedefs, and
+ * anonymous types.
+ * @see IDLType
+ * @see IRObject
+ * @see IRObjectOperations
+ */
+
+public interface IDLTypeOperations extends org.omg.CORBA.IRObjectOperations
+{
+ /**
+ * The type attribute describes the type defined by an object
+ * derived from {@code IDLType}.
+ * @return the {@code TypeCode} defined by this object.
+ */
+ org.omg.CORBA.TypeCode type ();
+} // interface IDLTypeOperations
diff --git a/src/java.corba/share/classes/org/omg/CORBA/IMP_LIMIT.java b/src/java.corba/share/classes/org/omg/CORBA/IMP_LIMIT.java
new file mode 100644
index 0000000..93df8e3
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/IMP_LIMIT.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception indicates that an implementation limit was
+ * exceeded in the ORB run time. For example, an ORB may reach
+ * the maximum number of references it can hold simultaneously
+ * in an address space, the size of a parameter may have
+ * exceeded the allowed maximum, or an ORB may impose a maximum
+ * on the number of clients or servers that can run simultaneously.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+
+public final class IMP_LIMIT extends SystemException {
+ /**
+ * Constructs an <code>IMP_LIMIT</code> exception with a default
+ * minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public IMP_LIMIT() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>IMP_LIMIT</code> exception with the specified detail
+ * message, a minor code of 0, and a completion state of COMPLETED_NO.
+ *
+ * @param s the String containing a detail message
+ */
+ public IMP_LIMIT(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>IMP_LIMIT</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public IMP_LIMIT(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an <code>IMP_LIMIT</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public IMP_LIMIT(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/INITIALIZE.java b/src/java.corba/share/classes/org/omg/CORBA/INITIALIZE.java
new file mode 100644
index 0000000..9768d98
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/INITIALIZE.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown
+ * when an ORB has encountered a failure during its initialization,
+ * such as failure to acquire networking resources or detecting a
+ * configuration error.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class INITIALIZE extends SystemException {
+ /**
+ * Constructs an <code>INITIALIZE</code> exception with a default
+ * minor code of 0 and a completion state of
+ * <code>CompletionStatus.COMPLETED_NO</code>.
+ */
+ public INITIALIZE() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>INITIALIZE</code> exception with the specified detail
+ * message, a minor code of 0, and a completion state of
+ * <code>CompletionStatus.COMPLETED_NO</code>.
+ * @param s the String containing a detail message
+ */
+ public INITIALIZE(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>INITIALIZE</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code>
+ * indicating the completion status of the method
+ * that threw this exception
+ */
+ public INITIALIZE(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an <code>INITIALIZE</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code>
+ * indicating the completion status of the method
+ * that threw this exception
+ */
+ public INITIALIZE(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/INTERNAL.java b/src/java.corba/share/classes/org/omg/CORBA/INTERNAL.java
new file mode 100644
index 0000000..bec91d6
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/INTERNAL.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception indicates an internal failure in an ORB, for
+ * example, if an ORB has detected corruption of its internal
+ * data structures.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * <P>
+ * See the section {@extLink jidlexception_minorcodes meaning of minor codes}
+ * to see the minor codes for this exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class INTERNAL extends SystemException {
+ /**
+ * Constructs an <code>INTERNAL</code> exception with a default
+ * minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public INTERNAL() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>INTERNAL</code> exception with the specified detail
+ * message, a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public INTERNAL(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>INTERNAL</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code>
+ * that indicates the completion status of the method
+ * that threw this exception
+ */
+ public INTERNAL(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an <code>INTERNAL</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code>
+ * that indicates the completion status of the method
+ * that threw this exception
+ */
+ public INTERNAL(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/INTF_REPOS.java b/src/java.corba/share/classes/org/omg/CORBA/INTF_REPOS.java
new file mode 100644
index 0000000..ef06d42
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/INTF_REPOS.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception raised
+ * when an ORB cannot reach the interface
+ * repository, or some other failure relating to the interface repository
+ * is detected.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class INTF_REPOS extends SystemException {
+ /**
+ * Constructs an <code>INTF_REPOS</code> exception with a default minor code
+ * of 0 and a completion state of COMPLETED_NO.
+ */
+ public INTF_REPOS() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>INTF_REPOS</code> exception with the specified detail.
+ * @param s the String containing a detail message
+ */
+ public INTF_REPOS(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>INTF_REPOS</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public INTF_REPOS(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an <code>INTF_REPOS</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public INTF_REPOS(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/INVALID_ACTIVITY.java b/src/java.corba/share/classes/org/omg/CORBA/INVALID_ACTIVITY.java
new file mode 100644
index 0000000..12a13f8
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/INVALID_ACTIVITY.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The <code>INVALID_ACTIVITY</code> system exception may be raised on the
+ * Activity or Transaction services' resume methods if a transaction or
+ * Activity is resumed in a context different to that from which it was
+ * suspended. It is also raised when an attempted invocation is made that
+ * is incompatible with the Activity's current state.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since J2SE 1.5
+ */
+
+public final class INVALID_ACTIVITY extends SystemException {
+
+ /**
+ * Constructs an <code>INVALID_ACTIVITY</code> exception with
+ * minor code set to 0 and CompletionStatus set to COMPLETED_NO.
+ */
+ public INVALID_ACTIVITY() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>INVALID_ACTIVITY</code> exception with the
+ * specified message.
+ *
+ * @param detailMessage string containing a detailed message.
+ */
+ public INVALID_ACTIVITY(String detailMessage) {
+ this(detailMessage, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>INVALID_ACTIVITY</code> exception with the
+ * specified minor code and completion status.
+ *
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public INVALID_ACTIVITY(int minorCode,
+ CompletionStatus completionStatus) {
+ this("", minorCode, completionStatus);
+ }
+
+ /**
+ * Constructs an <code>INVALID_ACTIVITY</code> exception with the
+ * specified message, minor code, and completion status.
+ *
+ * @param detailMessage string containing a detailed message.
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public INVALID_ACTIVITY(String detailMessage,
+ int minorCode,
+ CompletionStatus completionStatus) {
+ super(detailMessage, minorCode, completionStatus);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/INVALID_TRANSACTION.java b/src/java.corba/share/classes/org/omg/CORBA/INVALID_TRANSACTION.java
new file mode 100644
index 0000000..219c549
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/INVALID_TRANSACTION.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown
+ * when the request carried an invalid transaction context.
+ * For example, this exception could be raised if an error
+ * occurred when trying to register a resource.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ *
+ */
+
+public final class INVALID_TRANSACTION extends SystemException {
+ /**
+ * Constructs an <code>INVALID_TRANSACTION</code> exception with a default minor code
+ * of 0 and a completion state of COMPLETED_NO.
+ */
+ public INVALID_TRANSACTION() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>INVALID_TRANSACTION</code> exception
+ * with the specified detail message.
+ * @param s the String containing a detail message
+ */
+ public INVALID_TRANSACTION(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>INVALID_TRANSACTION</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public INVALID_TRANSACTION(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an <code>INVALID_TRANSACTION</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public INVALID_TRANSACTION(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/INV_FLAG.java b/src/java.corba/share/classes/org/omg/CORBA/INV_FLAG.java
new file mode 100644
index 0000000..6ad485c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/INV_FLAG.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown
+ * when an invalid flag was passed to an operation (for example, when
+ * creating a DII request).<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class INV_FLAG extends SystemException {
+ /**
+ * Constructs an <code>INV_FLAG</code> exception with a default
+ * minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public INV_FLAG() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>INV_FLAG</code> exception with the specified detail
+ * message, a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public INV_FLAG(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>INV_FLAG</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code>
+ * indicating the completion status
+ */
+ public INV_FLAG(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an <code>INV_FLAG</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed an instance of <code>CompletionStatus</code>
+ * indicating the completion status
+ */
+ public INV_FLAG(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/INV_IDENT.java b/src/java.corba/share/classes/org/omg/CORBA/INV_IDENT.java
new file mode 100644
index 0000000..167ff5f
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/INV_IDENT.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception indicates that an IDL identifier is syntactically
+ * invalid. It may be raised if, for example, an identifier passed
+ * to the interface repository does not conform to IDL identifier
+ * syntax, or if an illegal operation name is used with the DII.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class INV_IDENT extends SystemException {
+ /**
+ * Constructs an <code>INV_IDENT</code> exception with a default
+ * minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public INV_IDENT() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>INV_IDENT</code> exception with the specified detail
+ * message, a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public INV_IDENT(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>INV_IDENT</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed a <code>CompletionStatus</code> object indicating
+ * the completion status
+ */
+ public INV_IDENT(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an <code>INV_IDENT</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed a <code>CompletionStatus</code> object indicating
+ * the completion status
+ */
+ public INV_IDENT(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java b/src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java
new file mode 100644
index 0000000..821ffcf
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/INV_OBJREF.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception indicates that an object reference is internally
+ * malformed. For example, the repository ID may have incorrect
+ * syntax or the addressing information may be invalid. This
+ * exception is raised by ORB::string_to_object if the passed
+ * string does not decode correctly. An ORB may choose to detect
+ * calls via nil references (but is not obliged to do detect them).
+ * {@code INV_OBJREF} is used to indicate this.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * <P>
+ * See the section {@extLink jidlexception_minorcodes Minor Code Meanings}
+ * to see the minor codes for this exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class INV_OBJREF extends SystemException {
+ /**
+ * Constructs an {@code INV_OBJREF} exception with a default
+ * minor code of 0 and a completion state of COMPLETED_NO.
+ */
+ public INV_OBJREF() {
+ this("");
+ }
+
+ /**
+ * Constructs an {@code INV_OBJREF} exception with the specified detail
+ * message, a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public INV_OBJREF(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an {@code INV_OBJREF} exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed a {@code CompletionStatus} instance indicating
+ * the completion status
+ */
+ public INV_OBJREF(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an {@code INV_OBJREF} exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param s the String containing a detail message
+ * @param minor the minor code
+ * @param completed a {@code CompletionStatus} instance indicating
+ * the completion status
+ */
+ public INV_OBJREF(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java b/src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java
new file mode 100644
index 0000000..5eea852
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/INV_POLICY.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Standard exception thrown
+ * when an invocation cannot be made because of an incompatibility between
+ * {@code Policy} overrides that apply to the particular invocation.
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public final class INV_POLICY extends SystemException {
+ /**
+ * Constructs a {@code INV_POLICY} exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public INV_POLICY() {
+ this("");
+ }
+
+ /**
+ * Constructs a {@code INV_POLICY} exception with the
+ * specified description message,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public INV_POLICY(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a {@code INV_POLICY} exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public INV_POLICY(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a {@code INV_POLICY} exception with the
+ * specified description message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public INV_POLICY(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/IRObject.java b/src/java.corba/share/classes/org/omg/CORBA/IRObject.java
new file mode 100644
index 0000000..b60694a
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/IRObject.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * File: ./org/omg/CORBA/IRObject.java
+ * From: ./ir.idl
+ * Date: Fri Aug 28 16:03:31 1998
+ * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
+ */
+
+package org.omg.CORBA;
+/**
+An IRObject IDL interface represents the most generic interface
+from which all other Interface Repository interfaces are derived,
+even the Repository itself.
+*/
+
+public interface IRObject extends IRObjectOperations, org.omg.CORBA.Object,
+ org.omg.CORBA.portable.IDLEntity
+{
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/IRObjectOperations.java b/src/java.corba/share/classes/org/omg/CORBA/IRObjectOperations.java
new file mode 100644
index 0000000..bd38f6b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/IRObjectOperations.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The interface for {@code IRObject}. For more information on
+ * Operations interfaces, see <a href="doc-files/generatedfiles.html#operations">
+ * "Generated Files: Operations files"</a>.
+ */
+
+/*
+ tempout/org/omg/CORBA/IRObjectOperations.java
+ Generated by the IBM IDL-to-Java compiler, version 1.0
+ from ../../Lib/ir.idl
+ Thursday, February 25, 1999 2:11:21 o'clock PM PST
+*/
+
+/**
+ * This is the Operations interface for the mapping from {@code IRObject}.
+ * Several interfaces are used as base interfaces for objects in
+ * the Interface Repository (IR). These base interfaces are not instantiable.
+ * A common set of operations is used to locate objects within the
+ * Interface Repository. Some of these operations are defined in
+ * the IRObject. All IR objects inherit from the IRObject interface,
+ * which provides an operation for identifying the actual type of
+ * the object. (The IDL base interface IRObject represents the most
+ * generic interface from which all other Interface Repository interfaces
+ * are derived, even the Repository itself.) All java implementations of
+ * IR objects must implement the IRObjectOperations interface.
+ * @see IDLTypeOperations
+ * @see IDLType
+ * @see IRObject
+ */
+public interface IRObjectOperations
+{
+
+ // read interface
+ /**
+ * Returns the {@code DefinitionKind} corresponding to this Interface Repository object.
+ * @return the {@code DefinitionKind} corresponding to this Interface Repository object.
+ */
+ org.omg.CORBA.DefinitionKind def_kind ();
+
+ // write interface
+ /**
+ * Destroys this object. If the object is a Container,
+ * this method is applied to all its contents. If the object contains an IDLType
+ * attribute for an anonymous type, that IDLType is destroyed.
+ * If the object is currently contained in some other object, it is removed.
+ * If the method is invoked on a {@code Repository} or on a {@code PrimitiveDef}
+ * then the {@code BAD_INV_ORDER} exception is raised with minor value 2.
+ * An attempt to destroy an object that would leave the repository in an
+ * incoherent state causes {@code BAD_INV_ORDER} exception to be raised
+ * with the minor code 1.
+ * @exception BAD_INV_ORDER if this method is invoked on a repository or
+ * {@code PrimitiveDef}, or if an attempt to destroy an
+ * object would leave the repository in an incoherent state
+ */
+ void destroy ();
+} // interface IRObjectOperations
diff --git a/src/java.corba/share/classes/org/omg/CORBA/IdentifierHelper.java b/src/java.corba/share/classes/org/omg/CORBA/IdentifierHelper.java
new file mode 100644
index 0000000..665e23c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/IdentifierHelper.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code Identifier}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/IdentifierHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ir.idl
+ * 03 June 1999 11:33:42 o'clock GMT+00:00
+ */
+
+abstract public class IdentifierHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/Identifier:1.0";
+
+ 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 ());
+ }
+
+ 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 (org.omg.CORBA.IdentifierHelper.id (), "Identifier", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value = null;
+ value = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ ostream.write_string (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/IntHolder.java b/src/java.corba/share/classes/org/omg/CORBA/IntHolder.java
new file mode 100644
index 0000000..2b43131
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/IntHolder.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Holder for {@code Int}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for an {@code int}
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code long} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code IntHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myIntHolder} is an instance of {@code IntHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myIntHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class IntHolder implements Streamable {
+
+ /**
+ * The {@code int} value held by this {@code IntHolder}
+ * object in its {@code value} field.
+ */
+ public int value;
+
+ /**
+ * Constructs a new {@code IntHolder} object with its
+ * {@code value} field initialized to {@code 0}.
+ */
+ public IntHolder() {
+ }
+
+ /**
+ * Constructs a new {@code IntHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code int}.
+ * @param initial the {@code int} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code IntHolder} object
+ */
+ public IntHolder(int initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads unmarshalled data from {@code input} and assigns it to
+ * the {@code value} field in this {@code IntHolder} object.
+ *
+ * @param input the {@code InputStream} object containing CDR
+ * formatted data from the wire
+ */
+ public void _read(InputStream input) {
+ value = input.read_long();
+ }
+
+ /**
+ * Marshals the value in this {@code IntHolder} object's
+ * {@code value} field to the output stream {@code output}.
+ *
+ * @param output the {@code OutputStream} object that will contain
+ * the CDR formatted data
+ */
+ public void _write(OutputStream output) {
+ output.write_long(value);
+ }
+
+ /**
+ * Retrieves the {@code TypeCode} object that corresponds
+ * to the value held in this {@code IntHolder} object's
+ * {@code value} field.
+ *
+ * @return the type code for the value held in this {@code IntHolder}
+ * object
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_long);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/LocalObject.java b/src/java.corba/share/classes/org/omg/CORBA/LocalObject.java
new file mode 100644
index 0000000..fedbead
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/LocalObject.java
@@ -0,0 +1,514 @@
+/*
+ * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+import org.omg.CORBA.portable.*;
+
+
+/**
+ * Used as a base class for implementation of a local IDL interface in the
+ * Java language mapping. It is a class which implements all the operations
+ * in the {@code org.omg.CORBA.Object} interface.
+ * <P>Local interfaces are implemented by using CORBA::LocalObject
+ * to provide implementations of {@code Object} pseudo
+ * operations and any other ORB-specific support mechanisms that are
+ * appropriate for such objects. Object implementation techniques are
+ * inherently language-mapping specific. Therefore, the
+ * {@code LocalObject} type is not defined in IDL, but is specified
+ * in each language mapping.
+ * <P>Methods that do not apply to local objects throw
+ * an {@code org.omg.CORBA.NO_IMPLEMENT} exception with the message,
+ * "This is a locally contrained object." Attempting to use a
+ * {@code LocalObject} to create a DII request results in NO_IMPLEMENT
+ * system exception. Attempting to marshal or stringify a
+ * {@code LocalObject} results in a MARSHAL system exception. Narrowing
+ * and widening references to {@code LocalObjects} must work as for regular
+ * object references.
+ * <P>{@code LocalObject} is to be used as the base class of locally
+ * constrained objects, such as those in the PortableServer module.
+ * The specification here is based on the CORBA Components
+ * Volume I - orbos/99-07-01
+ *
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+
+public class LocalObject implements org.omg.CORBA.Object
+{
+ private static String reason = "This is a locally constrained object.";
+
+ /**
+ * Constructs a default {@code LocalObject} instance.
+ */
+ public LocalObject() {}
+
+ /**
+ * Determines whether the two object references are equivalent,
+ * so far as the ORB can easily determine. Two object references are equivalent
+ * if they are identical. Two distinct object references which in fact refer to
+ * the same object are also equivalent. However, ORBs are not required
+ * to attempt determination of whether two distinct object references
+ * refer to the same object, since such determination could be impractically
+ * expensive.
+ * <P>Default implementation of the org.omg.CORBA.Object method.
+ *
+ * @param that the object reference with which to check for equivalence
+ * @return {@code true} if this object reference is known to be
+ * equivalent to the given object reference.
+ * Note that {@code false} indicates only that the two
+ * object references are distinct, not necessarily that
+ * they reference distinct objects.
+ */
+ public boolean _is_equivalent(org.omg.CORBA.Object that) {
+ return equals(that) ;
+ }
+
+ /**
+ * Always returns {@code false}.
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @return {@code false}
+ */
+ public boolean _non_existent() {
+ return false;
+ }
+
+ /**
+ * Returns a hash value that is consistent for the
+ * lifetime of the object, using the given number as the maximum.
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @param maximum an {@code int} identifying maximum value of
+ * the hashcode
+ * @return this instance's hashcode
+ */
+ public int _hash(int maximum) {
+ return hashCode() ;
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object." This method
+ * does not apply to local objects and is therefore not implemented.
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @param repository_id a {@code String}
+ * @return NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @exception NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public boolean _is_a(String repository_id) {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @return a duplicate of this {@code LocalObject} instance.
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.Object _duplicate() {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public void _release() {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @param operation a {@code String} giving the name of an operation
+ * to be performed by the request that is returned
+ * @return a {@code Request} object with the given operation
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public Request _request(String operation) {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @param ctx a {@code Context} object containing
+ * a list of properties
+ * @param operation the {@code String} representing the name of the
+ * method to be invoked
+ * @param arg_list an {@code NVList} containing the actual arguments
+ * to the method being invoked
+ * @param result a {@code NamedValue} object to serve as a
+ * container for the method's return value
+ * @return a new {@code Request} object initialized with the given
+ * arguments
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public Request _create_request(Context ctx,
+ String operation,
+ NVList arg_list,
+ NamedValue result) {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @param ctx a {@code Context} object containing
+ * a list of properties
+ * @param operation the name of the method to be invoked
+ * @param arg_list an {@code NVList} containing the actual arguments
+ * to the method being invoked
+ * @param result a {@code NamedValue} object to serve as a
+ * container for the method's return value
+ * @param exceptions an {@code ExceptionList} object containing a
+ * list of possible exceptions the method can throw
+ * @param contexts a {@code ContextList} object containing a list of
+ * context strings that need to be resolved and sent
+ * with the
+ * {@code Request} instance
+ * @return the new {@code Request} object initialized with the given
+ * arguments
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public Request _create_request(Context ctx,
+ String operation,
+ NVList arg_list,
+ NamedValue result,
+ ExceptionList exceptions,
+ ContextList contexts) {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object." This method
+ * does not apply to local objects and is therefore not implemented.
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @return NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @exception NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.Object _get_interface()
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.Object _get_interface_def()
+ {
+ // First try to call the delegate implementation class's
+ // "Object get_interface_def(..)" method (will work for JDK1.2
+ // ORBs).
+ // Else call the delegate implementation class's
+ // "InterfaceDef get_interface(..)" method using reflection
+ // (will work for pre-JDK1.2 ORBs).
+
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ * @return the ORB instance that created the Delegate contained in this
+ * {@code ObjectImpl}
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.ORB _orb() {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object." This method
+ * does not apply to local objects and is therefore not implemented.
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @param policy_type an {@code int}
+ * @return NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @exception NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.Policy _get_policy(int policy_type) {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object." This method
+ * does not apply to local objects and is therefore not implemented.
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.DomainManager[] _get_domain_managers() {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object." This method
+ * does not apply to local objects and is therefore not implemented.
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @param policies an array
+ * @param set_add a flag
+ * @return NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @exception NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.Object
+ _set_policy_override(org.omg.CORBA.Policy[] policies,
+ org.omg.CORBA.SetOverrideType set_add) {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.<P>
+ * Returns {@code true} for this {@code LocalObject} instance.
+ *
+ * @return {@code true} always
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public boolean _is_local() {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @param operation a {@code String} indicating which operation
+ * to preinvoke
+ * @param expectedType the class of the type of operation mentioned above
+ * @return NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @exception NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local object
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public ServantObject _servant_preinvoke(String operation,
+ Class expectedType) {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @param servant the servant object on which to post-invoke
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public void _servant_postinvoke(ServantObject servant) {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /*
+ * The following methods were added by orbos/98-04-03: Java to IDL
+ * Mapping. These are used by RMI over IIOP.
+ */
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ * <P>Called by a stub to obtain an OutputStream for
+ * marshaling arguments. The stub must supply the operation name,
+ * and indicate if a response is expected (i.e is this a oneway call).
+ *
+ * @param operation the name of the operation being requested
+ * @param responseExpected {@code true} if a response is expected,
+ * {@code false} if it is a one-way call
+ * @return NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @exception NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public OutputStream _request(String operation,
+ boolean responseExpected) {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ * <P>Called to invoke an operation. The stub provides an
+ * {@code OutputStream} that was previously returned by a
+ * {@code _request()}
+ * call. {@code _invoke} returns an {@code InputStream} which
+ * contains the
+ * marshaled reply. If an exception occurs, {@code _invoke} may throw an
+ * {@code ApplicationException} object which contains an
+ * {@code InputStream} from
+ * which the user exception state may be unmarshaled.
+ *
+ * @param output the {@code OutputStream} to invoke
+ * @return NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @throws ApplicationException If an exception occurs,
+ * {@code _invoke} may throw an
+ * {@code ApplicationException} object which contains
+ * an {@code InputStream} from
+ * which the user exception state may be unmarshaled.
+ * @throws RemarshalException If an exception occurs,
+ * {@code _invoke} may throw an
+ * {@code ApplicationException} object which contains
+ * an {@code InputStream} from
+ * which the user exception state may be unmarshaled.
+ * @exception NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public InputStream _invoke(OutputStream output)
+ throws ApplicationException, RemarshalException
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object."
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ * <P>May optionally be called by a stub to release a
+ * reply stream back to the ORB when the unmarshaling has
+ * completed. The stub passes the {@code InputStream} returned by
+ * {@code _invoke()} or
+ * {@code ApplicationException.getInputStream()}.
+ * A null
+ * value may also be passed to {@code _releaseReply}, in which case the
+ * method is a no-op.
+ *
+ * @param input the reply stream back to the ORB or null
+ * @exception NO_IMPLEMENT
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public void _releaseReply(InputStream input) {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+
+ /**
+ * Throws an {@code org.omg.CORBA.NO_IMPLEMENT} exception with
+ * the message "This is a locally constrained object." This method
+ * does not apply to local objects and is therefore not implemented.
+ * This method is the default implementation of the
+ * {@code org.omg.CORBA.Object} method.
+ *
+ * @return NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @exception NO_IMPLEMENT because this is a locally constrained object
+ * and this method does not apply to local objects
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+
+ public boolean validate_connection() {
+ throw new org.omg.CORBA.NO_IMPLEMENT(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/LongHolder.java b/src/java.corba/share/classes/org/omg/CORBA/LongHolder.java
new file mode 100644
index 0000000..670bec5
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/LongHolder.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 1995, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Holder for {@code Long}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a {@code long}
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code long long} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code LongHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myLongHolder} is an instance of {@code LongHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myLongHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class LongHolder implements Streamable {
+
+ /**
+ * The {@code long} value held by this {@code LongHolder}
+ * object.
+ */
+ public long value;
+
+ /**
+ * Constructs a new {@code LongHolder} object with its
+ * {@code value} field initialized to {@code 0}.
+ */
+ public LongHolder() {
+ }
+
+ /**
+ * Constructs a new {@code LongHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code long}.
+ * @param initial the {@code long} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code LongHolder} object
+ */
+ public LongHolder(long initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads from {@code input} and initalizes the value in the Holder
+ * with the unmarshalled data.
+ *
+ * @param input the InputStream containing CDR formatted data from the wire
+ */
+ public void _read(InputStream input) {
+ value = input.read_longlong();
+ }
+
+ /**
+ * Marshals to {@code output} the value in the Holder.
+ *
+ * @param output the OutputStream which will contain the CDR formatted data
+ */
+ public void _write(OutputStream output) {
+ output.write_longlong(value);
+ }
+
+ /**
+ * Returns the {@code TypeCode} object
+ * corresponding to the value held in the Holder.
+ *
+ * @return the TypeCode of the value held in the holder
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_longlong);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHelper.java
new file mode 100644
index 0000000..63b77c4
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code LongLongSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/LongLongSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:37 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
+
+public abstract class LongLongSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/LongLongSeq:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, long[] 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 long[] 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_longlong);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.LongLongSeqHelper.id (), "LongLongSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static long[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ long value[] = null;
+ int _len0 = istream.read_long ();
+ value = new long[_len0];
+ istream.read_longlong_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, long[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_longlong_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHolder.java
new file mode 100644
index 0000000..abc0123
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/LongLongSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Holder for {@code LongLongSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/LongLongSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
+
+public final class LongLongSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public long value[] = null;
+
+ public LongLongSeqHolder ()
+ {
+ }
+
+ public LongLongSeqHolder (long[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.LongLongSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.LongLongSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.LongLongSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/LongSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/LongSeqHelper.java
new file mode 100644
index 0000000..2c9eb2a
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/LongSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code LongSeqHelper}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/LongSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
+
+public abstract class LongSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/LongSeq:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, int[] 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 int[] 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_long);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.LongSeqHelper.id (), "LongSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static int[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ int value[] = null;
+ int _len0 = istream.read_long ();
+ value = new int[_len0];
+ istream.read_long_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, int[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_long_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/LongSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/LongSeqHolder.java
new file mode 100644
index 0000000..6ff9e6a
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/LongSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Holder for {@code LongSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/LongSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
+
+public final class LongSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public int value[] = null;
+
+ public LongSeqHolder ()
+ {
+ }
+
+ public LongSeqHolder (int[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.LongSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.LongSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.LongSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java b/src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java
new file mode 100644
index 0000000..adec5d6
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/MARSHAL.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A request or reply from the network is structurally invalid.
+ * This error typically indicates a bug in either the client-side
+ * or server-side run time. For example, if a reply from the server
+ * indicates that the message contains 1000 bytes, but the actual
+ * message is shorter or longer than 1000 bytes, the ORB raises
+ * this exception. {@code MARSHAL} can also be caused by using
+ * the DII or DSI incorrectly, for example, if the type of the
+ * actual parameters sent does not agree with IDL signature of an
+ * operation.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * <P>
+ * See the section {@extLink jidlexception_minorcodes Minor Code Meanings}
+ * to see the minor codes for this exception.
+ *
+ * @since JDK1.2
+ */
+
+public final class MARSHAL extends SystemException {
+ /**
+ * Constructs a {@code MARSHAL} exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public MARSHAL() {
+ this("");
+ }
+
+ /**
+ * Constructs a {@code MARSHAL} exception with the specified description message,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a description of the exception
+ */
+ public MARSHAL(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a {@code MARSHAL} exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public MARSHAL(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a {@code MARSHAL} exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public MARSHAL(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java b/src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java
new file mode 100644
index 0000000..6beff5b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/NO_IMPLEMENT.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 1995, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception indicates that even though the operation that
+ * was invoked exists (it has an IDL definition), no implementation
+ * for that operation exists. {@code NO_IMPLEMENT} can, for
+ * example, be raised by an ORB if a client asks for an object's
+ * type definition from the interface repository, but no interface
+ * repository is provided by the ORB.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * <P>
+ * See the section {extLink jidlexception_minorcodes Minor Code Meanings}
+ * to see the minor codes for this exception.
+ *
+ * @since JDK1.2
+ */
+
+public final class NO_IMPLEMENT extends SystemException {
+ /**
+ * Constructs a {@code NO_IMPLEMENT} exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public NO_IMPLEMENT() {
+ this("");
+ }
+
+ /**
+ * Constructs a {@code NO_IMPLEMENT} exception with the specified description message,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a description of the exception
+ */
+ public NO_IMPLEMENT(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a {@code NO_IMPLEMENT} exception with the specified
+ * minor code and completion status.
+ * @param minor an {@code int} specifying the minor code
+ * @param completed a {@code CompletionStatus} instance indicating
+ * the completion status
+ */
+ public NO_IMPLEMENT(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a {@code NO_IMPLEMENT} exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor an {@code int} specifying the minor code
+ * @param completed a {@code CompletionStatus} instance indicating
+ * the completion status
+ */
+ public NO_IMPLEMENT(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/NO_MEMORY.java b/src/java.corba/share/classes/org/omg/CORBA/NO_MEMORY.java
new file mode 100644
index 0000000..b88a926
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/NO_MEMORY.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown when the ORB run time has run out of memory.
+ * <P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class NO_MEMORY extends SystemException {
+ /**
+ * Constructs a <code>NO_MEMORY</code> exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public NO_MEMORY() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>NO_MEMORY</code> exception with the specified description message,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a description message
+ */
+ public NO_MEMORY(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>NO_MEMORY</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public NO_MEMORY(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>NO_MEMORY</code> exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public NO_MEMORY(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/NO_PERMISSION.java b/src/java.corba/share/classes/org/omg/CORBA/NO_PERMISSION.java
new file mode 100644
index 0000000..a2dadde
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/NO_PERMISSION.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown when an invocation failed because the caller
+ * has insufficient privileges.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class NO_PERMISSION extends SystemException {
+ /**
+ * Constructs a <code>NO_PERMISSION</code> exception with a default minor code
+ * of 0 and a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public NO_PERMISSION() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>NO_PERMISSION</code> exception with the specified description,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a description message
+ */
+ public NO_PERMISSION(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>NO_PERMISSION</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public NO_PERMISSION(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>NO_PERMISSION</code> exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public NO_PERMISSION(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/NO_RESOURCES.java b/src/java.corba/share/classes/org/omg/CORBA/NO_RESOURCES.java
new file mode 100644
index 0000000..82552ad
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/NO_RESOURCES.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown when the ORB has encountered some general resource
+ * limitation. For example, the run time may have reached the maximum
+ * permissible number of open connections.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class NO_RESOURCES extends SystemException {
+ /**
+ * Constructs a <code>NO_RESOURCES</code> exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public NO_RESOURCES() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>NO_RESOURCES</code> exception with the specified description,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a description message
+ */
+ public NO_RESOURCES(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>NO_RESOURCES</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public NO_RESOURCES(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>NO_RESOURCES</code> exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public NO_RESOURCES(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/NO_RESPONSE.java b/src/java.corba/share/classes/org/omg/CORBA/NO_RESPONSE.java
new file mode 100644
index 0000000..759986c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/NO_RESPONSE.java
@@ -0,0 +1,80 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception is raised if a client attempts to retrieve the result
+ * of a deferred synchronous call, but the response for the request is
+ * not yet available.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class NO_RESPONSE extends SystemException {
+ /**
+ * Constructs a <code>NO_RESPONSE</code> exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public NO_RESPONSE() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>NO_RESPONSE</code> exception with the specified description message,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a description message
+ */
+ public NO_RESPONSE(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>NO_RESPONSE</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public NO_RESPONSE(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>NO_RESPONSE</code> exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public NO_RESPONSE(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/NVList.java b/src/java.corba/share/classes/org/omg/CORBA/NVList.java
new file mode 100644
index 0000000..e60a7e3
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/NVList.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A modifiable list containing <code>NamedValue</code> objects.
+ * <P>
+ * The class <code>NVList</code> is used as follows:
+ * <UL>
+ * <LI>to describe arguments for a <code>Request</code> object
+ * in the Dynamic Invocation Interface and
+ * the Dynamic Skeleton Interface
+ * <LI>to describe context values in a <code>Context</code> object
+ * </UL>
+ * <P>
+ * Each <code>NamedValue</code> object consists of the following:
+ * <UL>
+ * <LI>a name, which is a <code>String</code> object
+ * <LI>a value, as an <code>Any</code> object
+ * <LI>an argument mode flag
+ * </UL>
+ * <P>
+ * An <code>NVList</code> object
+ * may be created using one of the following
+ * <code>ORB</code> methods:
+ * <OL>
+ * <LI><code>org.omg.CORBA.ORB.create_list</code>
+ * <PRE>
+ * org.omg.CORBA.NVList nv = orb.create_list(3);
+ * </PRE>
+ * The variable <code>nv</code> represents a newly-created
+ * <code>NVList</code> object. The argument is a memory-management
+ * hint to the orb and does not imply the actual length of the list.
+ * If, for example, you want to use an <code>NVList</code> object
+ * in a request, and the method being invoked takes three parameters,
+ * you might optimize by supplying 3 to the method
+ * <code>create_list</code>. Note that the new <code>NVList</code>
+ * will not necessarily have a length of 3; it
+ * could have a length of 2 or 4, for instance.
+ * Note also that you can add any number of
+ * <code>NamedValue</code> objects to this list regardless of
+ * its original length.
+ * <LI><code>org.omg.CORBA.ORB.create_operation_list</code>
+ * <PRE>
+ * org.omg.CORBA.NVList nv = orb.create_operation_list(myOperationDef);
+ * </PRE>
+ * The variable <code>nv</code> represents a newly-created
+ * <code>NVList</code> object that contains descriptions of the
+ * arguments to the method described in the given
+ * <code>OperationDef</code> object.
+ * </OL>
+ * <P>
+ * The methods in the class <code>NVList</code> all deal with
+ * the <code>NamedValue</code> objects in the list.
+ * There are three methods for adding a <code>NamedValue</code> object,
+ * a method for getting the count of <code>NamedValue</code> objects in
+ * the list, a method for retrieving a <code>NamedValue</code> object
+ * at a given index, and a method for removing a <code>NamedValue</code> object
+ * at a given index.
+ *
+ * @see org.omg.CORBA.Request
+ * @see org.omg.CORBA.ServerRequest
+ * @see org.omg.CORBA.NamedValue
+ * @see org.omg.CORBA.Context
+ *
+ * @since JDK1.2
+ */
+
+public abstract class NVList {
+
+ /**
+ * Returns the number of <code>NamedValue</code> objects that have
+ * been added to this <code>NVList</code> object.
+ *
+ * @return an <code>int</code> indicating the number of
+ * <code>NamedValue</code> objects in this <code>NVList</code>.
+ */
+
+ public abstract int count();
+
+ /**
+ * Creates a new <code>NamedValue</code> object initialized with the given flag
+ * and adds it to the end of this <code>NVList</code> object.
+ * The flag can be any one of the argument passing modes:
+ * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or
+ * <code>ARG_INOUT.value</code>.
+ *
+ * @param flags one of the argument mode flags
+ * @return the newly-created <code>NamedValue</code> object
+ */
+
+ public abstract NamedValue add(int flags);
+
+ /**
+ * Creates a new <code>NamedValue</code> object initialized with the
+ * given name and flag,
+ * and adds it to the end of this <code>NVList</code> object.
+ * The flag can be any one of the argument passing modes:
+ * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or
+ * <code>ARG_INOUT.value</code>.
+ *
+ * @param item_name the name for the new <code>NamedValue</code> object
+ * @param flags one of the argument mode flags
+ * @return the newly-created <code>NamedValue</code> object
+ */
+
+ public abstract NamedValue add_item(String item_name, int flags);
+
+ /**
+ * Creates a new <code>NamedValue</code> object initialized with the
+ * given name, value, and flag,
+ * and adds it to the end of this <code>NVList</code> object.
+ *
+ * @param item_name the name for the new <code>NamedValue</code> object
+ * @param val an <code>Any</code> object containing the value
+ * for the new <code>NamedValue</code> object
+ * @param flags one of the following argument passing modes:
+ * <code>ARG_IN.value</code>, <code>ARG_OUT.value</code>, or
+ * <code>ARG_INOUT.value</code>
+ * @return the newly created <code>NamedValue</code> object
+ */
+
+ public abstract NamedValue add_value(String item_name, Any val, int flags);
+
+ /**
+ * Retrieves the <code>NamedValue</code> object at the given index.
+ *
+ * @param index the index of the desired <code>NamedValue</code> object,
+ * which must be between zero and the length of the list
+ * minus one, inclusive. The first item is at index zero.
+ * @return the <code>NamedValue</code> object at the given index
+ * @exception org.omg.CORBA.Bounds if the index is greater than
+ * or equal to number of <code>NamedValue</code> objects
+ */
+
+ public abstract NamedValue item(int index) throws org.omg.CORBA.Bounds;
+
+ /**
+ * Removes the <code>NamedValue</code> object at the given index.
+ * Note that the indices of all <code>NamedValue</code> objects following
+ * the one removed are shifted down by one.
+ *
+ * @param index the index of the <code>NamedValue</code> object to be
+ * removed, which must be between zero and the length
+ * of the list minus one, inclusive.
+ * The first item is at index zero.
+ * @exception org.omg.CORBA.Bounds if the index is greater than
+ * or equal to number of <code>NamedValue</code> objects in
+ * the list
+ */
+
+ public abstract void remove(int index) throws org.omg.CORBA.Bounds;
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/NameValuePair.java b/src/java.corba/share/classes/org/omg/CORBA/NameValuePair.java
new file mode 100644
index 0000000..bd851c3
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/NameValuePair.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA;
+
+/**
+ * Associates a name with a value that is an
+ * attribute of an IDL struct, and is used in the {@code DynStruct} APIs.
+ */
+
+public final class NameValuePair implements org.omg.CORBA.portable.IDLEntity {
+
+ /**
+ * The name to be associated with a value by this {@code NameValuePair} object.
+ */
+ public String id;
+
+ /**
+ * The value to be associated with a name by this {@code NameValuePair} object.
+ */
+ public org.omg.CORBA.Any value;
+
+ /**
+ * Constructs an empty {@code NameValuePair} object.
+ * To associate a name with a value after using this constructor, the fields
+ * of this object have to be accessed individually.
+ */
+ public NameValuePair() { }
+
+ /**
+ * Constructs a {@code NameValuePair} object that associates
+ * the given name with the given {@code org.omg.CORBA.Any} object.
+ * @param __id the name to be associated with the given {@code Any} object
+ * @param __value the {@code Any} object to be associated with the given name
+ */
+ public NameValuePair(String __id, org.omg.CORBA.Any __value) {
+ id = __id;
+ value = __value;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/NameValuePairHelper.java b/src/java.corba/share/classes/org/omg/CORBA/NameValuePairHelper.java
new file mode 100644
index 0000000..ec411e1
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/NameValuePairHelper.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code NameValuePair}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/NameValuePairHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * 03 June 1999 11:52:03 o'clock GMT+00:00
+ */
+
+abstract public class NameValuePairHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/NameValuePair:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.NameValuePair 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.NameValuePair 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 = org.omg.CORBA.ORB.init ().create_string_tc (0);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.FieldNameHelper.id (), "FieldName", _tcOf_members0);
+ _members0[0] = new org.omg.CORBA.StructMember (
+ "id",
+ _tcOf_members0,
+ null);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any);
+ _members0[1] = new org.omg.CORBA.StructMember (
+ "value",
+ _tcOf_members0,
+ null);
+ __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.omg.CORBA.NameValuePairHelper.id (), "NameValuePair", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.NameValuePair read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.NameValuePair value = new org.omg.CORBA.NameValuePair ();
+ value.id = istream.read_string ();
+ value.value = istream.read_any ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.NameValuePair value)
+ {
+ ostream.write_string (value.id);
+ ostream.write_any (value.value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/NamedValue.java b/src/java.corba/share/classes/org/omg/CORBA/NamedValue.java
new file mode 100644
index 0000000..a3deb94
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/NamedValue.java
@@ -0,0 +1,125 @@
+/*
+ * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * An object used in the DII and DSI to describe
+ * arguments and return values. <code>NamedValue</code> objects
+ * are also used in the <code>Context</code>
+ * object routines to pass lists of property names and values.
+ * <P>
+ * A <code>NamedValue</code> object contains:
+ * <UL>
+ * <LI>a name -- If the <code>NamedValue</code> object is used to
+ * describe arguments to a request, the name will be an argument
+ * identifier specified in the OMG IDL interface definition
+ * for the operation being described.
+ * <LI>a value -- an <code>Any</code> object
+ * <LI>an argument mode flag -- one of the following:
+ * <UL>
+ * <LI><code>ARG_IN.value</code>
+ * <LI><code>ARG_OUT.value</code>
+ * <LI><code>ARG_INOUT.value</code>
+ * <LI>zero -- if this <code>NamedValue</code> object represents a property
+ * in a <code>Context</code> object rather than a parameter or
+ * return value
+ * </UL>
+ * </UL>
+ * <P>
+ * The class <code>NamedValue</code> has three methods, which
+ * access its fields. The following code fragment demonstrates
+ * creating a <code>NamedValue</code> object and then accessing
+ * its fields:
+ * <PRE>
+ * ORB orb = ORB.init(args, null);
+ * String s = "argument_1";
+ * org.omg.CORBA.Any myAny = orb.create_any();
+ * myAny.insert_long(12345);
+ * int in = org.omg.CORBA.ARG_IN.value;
+
+ * org.omg.CORBA.NamedValue nv = orb.create_named_value(
+ * s, myAny, in);
+ * System.out.println("This nv name is " + nv.name());
+ * try {
+ * System.out.println("This nv value is " + nv.value().extract_long());
+ * System.out.println("This nv flag is " + nv.flags());
+ * } catch (org.omg.CORBA.BAD_OPERATION b) {
+ * System.out.println("extract failed");
+ * }
+ * </PRE>
+ *
+ * <P>
+ * If this code fragment were put into a <code>main</code> method,
+ * the output would be something like the following:
+ * <PRE>
+ * This nv name is argument_1
+ * This nv value is 12345
+ * This nv flag is 1
+ * </PRE>
+ * <P>
+ * Note that the method <code>value</code> returns an <code>Any</code>
+ * object. In order to access the <code>long</code> contained in the
+ * <code>Any</code> object,
+ * we used the method <code>extract_long</code>.
+ *
+ * @see Any
+ * @see ARG_IN
+ * @see ARG_INOUT
+ * @see ARG_OUT
+ *
+ * @since JDK1.2
+ */
+
+public abstract class NamedValue {
+
+ /**
+ * Retrieves the name for this <code>NamedValue</code> object.
+ *
+ * @return a <code>String</code> object representing
+ * the name of this <code>NamedValue</code> object
+ */
+
+ public abstract String name();
+
+ /**
+ * Retrieves the value for this <code>NamedValue</code> object.
+ *
+ * @return an <code>Any</code> object containing
+ * the value of this <code>NamedValue</code> object
+ */
+
+ public abstract Any value();
+
+ /**
+ * Retrieves the argument mode flag for this <code>NamedValue</code> object.
+ *
+ * @return an <code>int</code> representing the argument
+ * mode for this <code>NamedValue</code> object
+ */
+
+ public abstract int flags();
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/OBJECT_NOT_EXIST.java b/src/java.corba/share/classes/org/omg/CORBA/OBJECT_NOT_EXIST.java
new file mode 100644
index 0000000..e9871fe
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/OBJECT_NOT_EXIST.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception raised whenever an invocation on a deleted object was
+ * performed. It is an authoritative "hard" fault report. Anyone
+ * receiving it is allowed (even expected) to delete all copies of
+ * this object reference and to perform other appropriate "final
+ * recovery" style procedures. Bridges forward this exception to
+ * clients, also destroying any records they may hold (for example,
+ * proxy objects used in reference translation). The clients could
+ * in turn purge any of their own data structures.
+ * <P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * <P>
+ * See the section {@extLink jidlexception_minorcodes Minor Code Meanings}
+ * to see the minor codes for this exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class OBJECT_NOT_EXIST extends SystemException {
+ /**
+ * Constructs an <code>OBJECT_NOT_EXIST</code> exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public OBJECT_NOT_EXIST() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>OBJECT_NOT_EXIST</code> exception with the specified description,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a description message
+ */
+ public OBJECT_NOT_EXIST(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>OBJECT_NOT_EXIST</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public OBJECT_NOT_EXIST(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an <code>OBJECT_NOT_EXIST</code> exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public OBJECT_NOT_EXIST(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/OBJ_ADAPTER.java b/src/java.corba/share/classes/org/omg/CORBA/OBJ_ADAPTER.java
new file mode 100644
index 0000000..e0432a1
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/OBJ_ADAPTER.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception typically indicates an administrative mismatch, for
+ * example, a server may have made an attempt to register itself with
+ * an implementation repository under a name that is already in use,
+ * or is unknown to the repository. <P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * <P>
+ * See the section {@extLink jidlexception_minorcodes Minor Code Meanings}
+ * to see the minor codes for this exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since JDK1.2
+ */
+
+public final class OBJ_ADAPTER extends SystemException {
+ /**
+ * Constructs an <code>OBJ_ADAPTER</code> exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public OBJ_ADAPTER() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>OBJ_ADAPTER</code> exception with the specified description,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a description message
+ */
+ public OBJ_ADAPTER(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>OBJ_ADAPTER</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public OBJ_ADAPTER(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an <code>OBJ_ADAPTER</code> exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public OBJ_ADAPTER(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/OMGVMCID.java b/src/java.corba/share/classes/org/omg/CORBA/OMGVMCID.java
new file mode 100644
index 0000000..9a2738a
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/OMGVMCID.java
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The vendor minor code ID reserved for OMG. Minor codes for the standard
+ * exceptions are prefaced by the VMCID assigned to OMG, defined as the
+ * constant OMGVMCID, which, like all VMCIDs, occupies the high order 20 bits.
+ */
+
+public interface OMGVMCID {
+
+ /**
+ * The vendor minor code ID reserved for OMG. This value is or'd with
+ * the high order 20 bits of the minor code to produce the minor value
+ * in a system exception.
+ */
+ static final int value = 0x4f4d0000;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ORB.java b/src/java.corba/share/classes/org/omg/CORBA/ORB.java
new file mode 100644
index 0000000..eefcfba
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ORB.java
@@ -0,0 +1,1406 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.*;
+import org.omg.CORBA.ORBPackage.InvalidName;
+
+import java.util.Properties;
+import java.applet.Applet;
+import java.io.File;
+import java.io.FileInputStream;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * A class providing APIs for the CORBA Object Request Broker
+ * features. The {@code ORB} class also provides
+ * "pluggable ORB implementation" APIs that allow another vendor's ORB
+ * implementation to be used.
+ * <P>
+ * An ORB makes it possible for CORBA objects to communicate
+ * with each other by connecting objects making requests (clients) with
+ * objects servicing requests (servers).
+ * <P>
+ *
+ * The {@code ORB} class, which
+ * encapsulates generic CORBA functionality, does the following:
+ * (Note that items 5 and 6, which include most of the methods in
+ * the class {@code ORB}, are typically used with the
+ * {@code Dynamic Invocation Interface} (DII) and
+ * the {@code Dynamic Skeleton Interface} (DSI).
+ * These interfaces may be used by a developer directly, but
+ * most commonly they are used by the ORB internally and are
+ * not seen by the general programmer.)
+ * <OL>
+ * <li> initializes the ORB implementation by supplying values for
+ * predefined properties and environmental parameters
+ * <li> obtains initial object references to services such as
+ * the NameService using the method {@code resolve_initial_references}
+ * <li> converts object references to strings and back
+ * <li> connects the ORB to a servant (an instance of a CORBA object
+ * implementation) and disconnects the ORB from a servant
+ * <li> creates objects such as
+ * <ul>
+ * <li>{@code TypeCode}
+ * <li>{@code Any}
+ * <li>{@code NamedValue}
+ * <li>{@code Context}
+ * <li>{@code Environment}
+ * <li>lists (such as {@code NVList}) containing these objects
+ * </ul>
+ * <li> sends multiple messages in the DII
+ * </OL>
+ *
+ * <P>
+ * The {@code ORB} class can be used to obtain references to objects
+ * implemented anywhere on the network.
+ * <P>
+ * An application or applet gains access to the CORBA environment
+ * by initializing itself into an {@code ORB} using one of
+ * three {@code init} methods. Two of the three methods use the properties
+ * (associations of a name with a value) shown in the
+ * table below.<BR>
+ * <TABLE class="plain">
+ * <CAPTION>Standard Java CORBA Properties:</CAPTION>
+ * <thead>
+ * <TR><TH>Property Name</TH> <TH>Property Value</TH></TR>
+ * </thead>
+ * <tbody>
+ * <TR><TD>org.omg.CORBA.ORBClass</TD>
+ * <TD>class name of an ORB implementation</TD></TR>
+ * <TR><TD>org.omg.CORBA.ORBSingletonClass</TD>
+ * <TD>class name of the ORB returned by {@code init()}</TD></TR>
+ * </tbody>
+ * </TABLE>
+ * <P>
+ * These properties allow a different vendor's {@code ORB}
+ * implementation to be "plugged in."
+ * <P>
+ * When an ORB instance is being created, the class name of the ORB
+ * implementation is located using
+ * the following standard search order:
+ *
+ * <OL>
+ * <LI>check in Applet parameter or application string array, if any
+ *
+ * <LI>check in properties parameter, if any
+ *
+ * <LI>check in the System properties, if any
+ *
+ * <LI>check in the orb.properties file located in the user.home
+ * directory, if any
+ *
+ * <LI>check in the orb.properties file located in the run-time image,
+ * if any
+ *
+ * <LI>fall back on a hardcoded default behavior (use the Java&nbsp;IDL
+ * implementation)
+ * </OL>
+ * <P>
+ * Note that Java&nbsp;IDL provides a default implementation for the
+ * fully-functional ORB and for the Singleton ORB. When the method
+ * {@code init} is given no parameters, the default Singleton
+ * ORB is returned. When the method {@code init} is given parameters
+ * but no ORB class is specified, the Java&nbsp;IDL ORB implementation
+ * is returned.
+ * <P>
+ * The following code fragment creates an {@code ORB} object
+ * initialized with the default ORB Singleton.
+ * This ORB has a
+ * restricted implementation to prevent malicious applets from doing
+ * anything beyond creating typecodes.
+ * It is called a singleton
+ * because there is only one instance for an entire virtual machine.
+ * <PRE>
+ * ORB orb = ORB.init();
+ * </PRE>
+ * <P>
+ * The following code fragment creates an {@code ORB} object
+ * for an application. The parameter {@code args}
+ * represents the arguments supplied to the application's {@code main}
+ * method. Since the property specifies the ORB class to be
+ * "SomeORBImplementation", the new ORB will be initialized with
+ * that ORB implementation. If p had been null,
+ * and the arguments had not specified an ORB class,
+ * the new ORB would have been
+ * initialized with the default Java&nbsp;IDL implementation.
+ * <PRE>
+ * Properties p = new Properties();
+ * p.put("org.omg.CORBA.ORBClass", "SomeORBImplementation");
+ * ORB orb = ORB.init(args, p);
+ * </PRE>
+ * <P>
+ * The following code fragment creates an {@code ORB} object
+ * for the applet supplied as the first parameter. If the given
+ * applet does not specify an ORB class, the new ORB will be
+ * initialized with the default Java&nbsp;IDL implementation.
+ * <PRE>
+ * ORB orb = ORB.init(myApplet, null);
+ * </PRE>
+ * <P>
+ * An application or applet can be initialized in one or more ORBs.
+ * ORB initialization is a bootstrap call into the CORBA world.
+ *
+ *
+ * @implNote
+ * When a singleton ORB is configured via the system property,
+ * or orb.properties, it will be
+ * located, and loaded via the system class loader.
+ * Thus, where appropriate, it is necessary that
+ * the classes for this alternative ORBSingleton are available on the application's class path.
+ * It should be noted that the singleton ORB is system wide.
+ * <P>
+ * When a per-application ORB is created via the 2-arg init methods,
+ * then it will be located using the thread context class loader.
+ * <P>
+ * The IDL to Java Language OMG specification documents the ${java.home}/lib directory as the location,
+ * in the Java run-time image, to search for orb.properties.
+ * This location is not intended for user editable configuration files.
+ * Therefore, the implementation first checks the ${java.home}/conf directory for orb.properties,
+ * and thereafter the ${java.home}/lib directory.
+ *
+ * <p>See also {@extLink idl_guides IDL developer's guide}.</p>
+ *
+ * @since JDK1.2
+ */
+abstract public class ORB {
+
+ //
+ // This is the ORB implementation used when nothing else is specified.
+ // Whoever provides this class customizes this string to
+ // point at their ORB implementation.
+ //
+ private static final String ORBClassKey = "org.omg.CORBA.ORBClass";
+ private static final String ORBSingletonClassKey = "org.omg.CORBA.ORBSingletonClass";
+
+ // check that access to the class is not restricted by the security manager.
+ private static void checkPackageAccess(String name) {
+ SecurityManager s = System.getSecurityManager();
+ if (s != null) {
+ String cname = name.replace('/', '.');
+ if (cname.startsWith("[")) {
+ int b = cname.lastIndexOf('[') + 2;
+ if (b > 1 && b < cname.length()) {
+ cname = cname.substring(b);
+ }
+ }
+ int i = cname.lastIndexOf('.');
+ if (i != -1) {
+ s.checkPackageAccess(cname.substring(0, i));
+ }
+ }
+ }
+
+ //
+ // The global instance of the singleton ORB implementation which
+ // acts as a factory for typecodes for generated Helper classes.
+ // TypeCodes should be immutable since they may be shared across
+ // different security contexts (applets). There should be no way to
+ // use a TypeCode as a storage depot for illicitly passing
+ // information or Java objects between different security contexts.
+ //
+ static private ORB singleton;
+
+ // Get System property
+ private static String getSystemProperty(final String name) {
+
+ // This will not throw a SecurityException because this
+ // class was loaded from rt.jar using the bootstrap classloader.
+ String propValue = (String) AccessController.doPrivileged(
+ new PrivilegedAction() {
+ public java.lang.Object run() {
+ return System.getProperty(name);
+ }
+ }
+ );
+
+ return propValue;
+ }
+
+ // Get property from orb.properties in either <user.home> or <java-home>/lib
+ // directories.
+ private static String getPropertyFromFile(final String name) {
+ // This will not throw a SecurityException because this
+ // class was loaded from rt.jar using the bootstrap classloader.
+
+ String propValue = (String) AccessController.doPrivileged(
+ new PrivilegedAction() {
+ private Properties getFileProperties( String fileName ) {
+ try {
+ File propFile = new File( fileName ) ;
+ if (!propFile.exists())
+ return null ;
+
+ Properties props = new Properties() ;
+ FileInputStream fis = new FileInputStream(propFile);
+ try {
+ props.load( fis );
+ } finally {
+ fis.close() ;
+ }
+
+ return props ;
+ } catch (Exception exc) {
+ return null ;
+ }
+ }
+
+ public java.lang.Object run() {
+ String userHome = System.getProperty("user.home");
+ String fileName = userHome + File.separator +
+ "orb.properties" ;
+ Properties props = getFileProperties( fileName ) ;
+
+ if (props != null) {
+ String value = props.getProperty( name ) ;
+ if (value != null)
+ return value ;
+ }
+
+ String javaHome = System.getProperty("java.home");
+
+ fileName = javaHome + File.separator + "conf"
+ + File.separator + "orb.properties";
+ props = getFileProperties(fileName);
+
+ if (props != null) {
+ String value = props.getProperty(name);
+ if (value != null)
+ return value;
+ }
+
+ fileName = javaHome + File.separator + "lib"
+ + File.separator + "orb.properties";
+ props = getFileProperties(fileName);
+
+ if (props == null)
+ return null;
+ else
+ return props.getProperty(name);
+ }
+ }
+ );
+
+ return propValue;
+ }
+
+ /**
+ * Returns the {@code ORB} singleton object. This method always returns the
+ * same ORB instance, which is an instance of the class described by the
+ * {@code org.omg.CORBA.ORBSingletonClass} system property.
+ * <P>
+ * This no-argument version of the method {@code init} is used primarily
+ * as a factory for {@code TypeCode} objects, which are used by
+ * {@code Helper} classes to implement the method {@code type}.
+ * It is also used to create {@code Any} objects that are used to
+ * describe {@code union} labels (as part of creating a
+ * {@code TypeCode} object for a {@code union}).
+ * <P>
+ * This method is not intended to be used by applets, and in the event
+ * that it is called in an applet environment, the ORB it returns
+ * is restricted so that it can be used only as a factory for
+ * {@code TypeCode} objects. Any {@code TypeCode} objects
+ * it produces can be safely shared among untrusted applets.
+ * <P>
+ * If an ORB is created using this method from an applet,
+ * a system exception will be thrown if
+ * methods other than those for
+ * creating {@code TypeCode} objects are invoked.
+ *
+ * @return the singleton ORB
+ *
+ * @implNote
+ * When configured via the system property, or orb.properties,
+ * the system-wide singleton ORB is located via the
+ * system class loader.
+ */
+ public static synchronized ORB init() {
+ if (singleton == null) {
+ String className = getSystemProperty(ORBSingletonClassKey);
+ if (className == null)
+ className = getPropertyFromFile(ORBSingletonClassKey);
+ if ((className == null) ||
+ (className.equals("com.sun.corba.se.impl.orb.ORBSingleton"))) {
+ singleton = new com.sun.corba.se.impl.orb.ORBSingleton();
+ } else {
+ singleton = create_impl_with_systemclassloader(className);
+ }
+ }
+ return singleton;
+ }
+
+ private static ORB create_impl_with_systemclassloader(String className) {
+
+ try {
+ checkPackageAccess(className);
+ ClassLoader cl = ClassLoader.getSystemClassLoader();
+ Class<org.omg.CORBA.ORB> orbBaseClass = org.omg.CORBA.ORB.class;
+ Class<?> singletonOrbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass);
+ return (ORB)singletonOrbClass.newInstance();
+ } catch (Throwable ex) {
+ SystemException systemException = new INITIALIZE(
+ "can't instantiate default ORB implementation " + className);
+ systemException.initCause(ex);
+ throw systemException;
+ }
+ }
+
+ private static ORB create_impl(String className) {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if (cl == null)
+ cl = ClassLoader.getSystemClassLoader();
+
+ try {
+ checkPackageAccess(className);
+ Class<org.omg.CORBA.ORB> orbBaseClass = org.omg.CORBA.ORB.class;
+ Class<?> orbClass = Class.forName(className, true, cl).asSubclass(orbBaseClass);
+ return (ORB)orbClass.newInstance();
+ } catch (Throwable ex) {
+ SystemException systemException = new INITIALIZE(
+ "can't instantiate default ORB implementation " + className);
+ systemException.initCause(ex);
+ throw systemException;
+ }
+ }
+
+ /**
+ * Creates a new {@code ORB} instance for a standalone
+ * application. This method may be called from applications
+ * only and returns a new fully functional {@code ORB} object
+ * each time it is called.
+ * @param args command-line arguments for the application's {@code main}
+ * method; may be {@code null}
+ * @param props application-specific properties; may be {@code null}
+ * @return the newly-created ORB instance
+ *
+ * @implNote
+ * When configured via the system property, or orb.properties,
+ * the ORB is located via the thread context class loader.
+ */
+ public static ORB init(String[] args, Properties props) {
+ //
+ // Note that there is no standard command-line argument for
+ // specifying the default ORB implementation. For an
+ // application you can choose an implementation either by
+ // setting the CLASSPATH to pick a different org.omg.CORBA
+ // and it's baked-in ORB implementation default or by
+ // setting an entry in the properties object or in the
+ // system properties.
+ //
+ String className = null;
+ ORB orb;
+
+ if (props != null)
+ className = props.getProperty(ORBClassKey);
+ if (className == null)
+ className = getSystemProperty(ORBClassKey);
+ if (className == null)
+ className = getPropertyFromFile(ORBClassKey);
+ if ((className == null) ||
+ (className.equals("com.sun.corba.se.impl.orb.ORBImpl"))) {
+ orb = new com.sun.corba.se.impl.orb.ORBImpl();
+ } else {
+ orb = create_impl(className);
+ }
+ orb.set_parameters(args, props);
+ return orb;
+ }
+
+
+ /**
+ * Creates a new {@code ORB} instance for an applet. This
+ * method may be called from applets only and returns a new
+ * fully-functional {@code ORB} object each time it is called.
+ * @param app the applet; may be {@code null}
+ * @param props applet-specific properties; may be {@code null}
+ * @return the newly-created ORB instance
+ *
+ * @implNote
+ * When configured via the system property, or orb.properties,
+ * the ORB is located via the thread context class loader.
+ */
+ public static ORB init(Applet app, Properties props) {
+ String className;
+ ORB orb;
+
+ className = app.getParameter(ORBClassKey);
+ if (className == null && props != null)
+ className = props.getProperty(ORBClassKey);
+ if (className == null)
+ className = getSystemProperty(ORBClassKey);
+ if (className == null)
+ className = getPropertyFromFile(ORBClassKey);
+ if ((className == null) ||
+ (className.equals("com.sun.corba.se.impl.orb.ORBImpl"))) {
+ orb = new com.sun.corba.se.impl.orb.ORBImpl();
+ } else {
+ orb = create_impl(className);
+ }
+ orb.set_parameters(app, props);
+ return orb;
+ }
+
+ /**
+ * Allows the ORB implementation to be initialized with the given
+ * parameters and properties. This method, used in applications only,
+ * is implemented by subclass ORB implementations and called
+ * by the appropriate {@code init} method to pass in its parameters.
+ *
+ * @param args command-line arguments for the application's {@code main}
+ * method; may be {@code null}
+ * @param props application-specific properties; may be {@code null}
+ */
+ abstract protected void set_parameters(String[] args, Properties props);
+
+ /**
+ * Allows the ORB implementation to be initialized with the given
+ * applet and parameters. This method, used in applets only,
+ * is implemented by subclass ORB implementations and called
+ * by the appropriate {@code init} method to pass in its parameters.
+ *
+ * @param app the applet; may be {@code null}
+ * @param props applet-specific properties; may be {@code null}
+ */
+ abstract protected void set_parameters(Applet app, Properties props);
+
+ /**
+ * Connects the given servant object (a Java object that is
+ * an instance of the server implementation class)
+ * to the ORB. The servant class must
+ * extend the {@code ImplBase} class corresponding to the interface that is
+ * supported by the server. The servant must thus be a CORBA object
+ * reference, and inherit from {@code org.omg.CORBA.Object}.
+ * Servants created by the user can start receiving remote invocations
+ * after the method {@code connect} has been called. A servant may also be
+ * automatically and implicitly connected to the ORB if it is passed as
+ * an IDL parameter in an IDL method invocation on a non-local object,
+ * that is, if the servant object has to be marshalled and sent outside of the
+ * process address space.
+ * <P>
+ * Calling the method {@code connect} has no effect
+ * when the servant object is already connected to the ORB.
+ * <P>
+ * Deprecated by the OMG in favor of the Portable Object Adapter APIs.
+ *
+ * @param obj The servant object reference
+ */
+ public void connect(org.omg.CORBA.Object obj) {
+ throw new NO_IMPLEMENT();
+ }
+
+ /**
+ * Destroys the ORB so that its resources can be reclaimed.
+ * Any operation invoked on a destroyed ORB reference will throw the
+ * {@code OBJECT_NOT_EXIST} exception.
+ * Once an ORB has been destroyed, another call to {@code init}
+ * with the same ORBid will return a reference to a newly constructed ORB.<p>
+ * If {@code destroy} is called on an ORB that has not been shut down,
+ * it will start the shut down process and block until the ORB has shut down
+ * before it destroys the ORB.<br>
+ * If an application calls {@code destroy} in a thread that is currently servicing
+ * an invocation, the {@code BAD_INV_ORDER} system exception will be thrown
+ * with the OMG minor code 3, since blocking would result in a deadlock.<p>
+ * For maximum portability and to avoid resource leaks, an application should
+ * always call {@code shutdown} and {@code destroy}
+ * on all ORB instances before exiting.
+ *
+ * @throws org.omg.CORBA.BAD_INV_ORDER if the current thread is servicing an invocation
+ */
+ public void destroy( ) {
+ throw new NO_IMPLEMENT();
+ }
+
+ /**
+ * Disconnects the given servant object from the ORB. After this method returns,
+ * the ORB will reject incoming remote requests for the disconnected
+ * servant and will send the exception
+ * {@code org.omg.CORBA.OBJECT_NOT_EXIST} back to the
+ * remote client. Thus the object appears to be destroyed from the
+ * point of view of remote clients. Note, however, that local requests issued
+ * using the servant directly do not
+ * pass through the ORB; hence, they will continue to be processed by the
+ * servant.
+ * <P>
+ * Calling the method {@code disconnect} has no effect
+ * if the servant is not connected to the ORB.
+ * <P>
+ * Deprecated by the OMG in favor of the Portable Object Adapter APIs.
+ *
+ * @param obj The servant object to be disconnected from the ORB
+ */
+ public void disconnect(org.omg.CORBA.Object obj) {
+ throw new NO_IMPLEMENT();
+ }
+
+ //
+ // ORB method implementations.
+ //
+ // We are trying to accomplish 2 things at once in this class.
+ // It can act as a default ORB implementation front-end,
+ // creating an actual ORB implementation object which is a
+ // subclass of this ORB class and then delegating the method
+ // implementations.
+ //
+ // To accomplish the delegation model, the 'delegate' private instance
+ // variable is set if an instance of this class is created directly.
+ //
+
+ /**
+ * Returns a list of the initially available CORBA object references,
+ * such as "NameService" and "InterfaceRepository".
+ *
+ * @return an array of {@code String} objects that represent
+ * the object references for CORBA services
+ * that are initially available with this ORB
+ */
+ abstract public String[] list_initial_services();
+
+ /**
+ * Resolves a specific object reference from the set of available
+ * initial service names.
+ *
+ * @param object_name the name of the initial service as a string
+ * @return the object reference associated with the given name
+ * @exception InvalidName if the given name is not associated with a
+ * known service
+ */
+ abstract public org.omg.CORBA.Object resolve_initial_references(String object_name)
+ throws InvalidName;
+
+ /**
+ * Converts the given CORBA object reference to a string.
+ * Note that the format of this string is predefined by IIOP, allowing
+ * strings generated by a different ORB to be converted back into an object
+ * reference.
+ * <P>
+ * The resulting {@code String} object may be stored or communicated
+ * in any way that a {@code String} object can be manipulated.
+ *
+ * @param obj the object reference to stringify
+ * @return the string representing the object reference
+ */
+ abstract public String object_to_string(org.omg.CORBA.Object obj);
+
+ /**
+ * Converts a string produced by the method {@code object_to_string}
+ * back to a CORBA object reference.
+ *
+ * @param str the string to be converted back to an object reference. It must
+ * be the result of converting an object reference to a string using the
+ * method {@code object_to_string}.
+ * @return the object reference
+ */
+ abstract public org.omg.CORBA.Object string_to_object(String str);
+
+ /**
+ * Allocates an {@code NVList} with (probably) enough
+ * space for the specified number of {@code NamedValue} objects.
+ * Note that the specified size is only a hint to help with
+ * storage allocation and does not imply the maximum size of the list.
+ *
+ * @param count suggested number of {@code NamedValue} objects for
+ * which to allocate space
+ * @return the newly-created {@code NVList}
+ *
+ * @see NVList
+ */
+ abstract public NVList create_list(int count);
+
+ /**
+ * Creates an {@code NVList} initialized with argument
+ * descriptions for the operation described in the given
+ * {@code OperationDef} object. This {@code OperationDef} object
+ * is obtained from an Interface Repository. The arguments in the
+ * returned {@code NVList} object are in the same order as in the
+ * original IDL operation definition, which makes it possible for the list
+ * to be used in dynamic invocation requests.
+ *
+ * @param oper the {@code OperationDef} object to use to create the list
+ * @return a newly-created {@code NVList} object containing
+ * descriptions of the arguments to the method described in the given
+ * {@code OperationDef} object
+ *
+ * @see NVList
+ */
+ public NVList create_operation_list(org.omg.CORBA.Object oper)
+ {
+ // If we came here, it means that the actual ORB implementation
+ // did not have a create_operation_list(...CORBA.Object oper) method,
+ // so lets check if it has a create_operation_list(OperationDef oper)
+ // method.
+ try {
+ // First try to load the OperationDef class
+ String opDefClassName = "org.omg.CORBA.OperationDef";
+ Class<?> opDefClass = null;
+
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ if ( cl == null )
+ cl = ClassLoader.getSystemClassLoader();
+ // if this throws a ClassNotFoundException, it will be caught below.
+ opDefClass = Class.forName(opDefClassName, true, cl);
+
+ // OK, we loaded OperationDef. Now try to get the
+ // create_operation_list(OperationDef oper) method.
+ Class<?>[] argc = { opDefClass };
+ java.lang.reflect.Method meth =
+ this.getClass().getMethod("create_operation_list", argc);
+
+ // OK, the method exists, so invoke it and be happy.
+ java.lang.Object[] argx = { oper };
+ return (org.omg.CORBA.NVList)meth.invoke(this, argx);
+ }
+ catch( java.lang.reflect.InvocationTargetException exs ) {
+ Throwable t = exs.getTargetException();
+ if (t instanceof Error) {
+ throw (Error) t;
+ }
+ else if (t instanceof RuntimeException) {
+ throw (RuntimeException) t;
+ }
+ else {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+ }
+ catch( RuntimeException ex ) {
+ throw ex;
+ }
+ catch( Exception exr ) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+ }
+
+
+ /**
+ * Creates a {@code NamedValue} object
+ * using the given name, value, and argument mode flags.
+ * <P>
+ * A {@code NamedValue} object serves as (1) a parameter or return
+ * value or (2) a context property.
+ * It may be used by itself or
+ * as an element in an {@code NVList} object.
+ *
+ * @param s the name of the {@code NamedValue} object
+ * @param any the {@code Any} value to be inserted into the
+ * {@code NamedValue} object
+ * @param flags the argument mode flags for the {@code NamedValue}: one of
+ * {@code ARG_IN.value}, {@code ARG_OUT.value},
+ * or {@code ARG_INOUT.value}.
+ *
+ * @return the newly-created {@code NamedValue} object
+ * @see NamedValue
+ */
+ abstract public NamedValue create_named_value(String s, Any any, int flags);
+
+ /**
+ * Creates an empty {@code ExceptionList} object.
+ *
+ * @return the newly-created {@code ExceptionList} object
+ */
+ abstract public ExceptionList create_exception_list();
+
+ /**
+ * Creates an empty {@code ContextList} object.
+ *
+ * @return the newly-created {@code ContextList} object
+ * @see ContextList
+ * @see Context
+ */
+ abstract public ContextList create_context_list();
+
+ /**
+ * Gets the default {@code Context} object.
+ *
+ * @return the default {@code Context} object
+ * @see Context
+ */
+ abstract public Context get_default_context();
+
+ /**
+ * Creates an {@code Environment} object.
+ *
+ * @return the newly-created {@code Environment} object
+ * @see Environment
+ */
+ abstract public Environment create_environment();
+
+ /**
+ * Creates a new {@code org.omg.CORBA.portable.OutputStream} into which
+ * IDL method parameters can be marshalled during method invocation.
+ * @return the newly-created
+ * {@code org.omg.CORBA.portable.OutputStream} object
+ */
+ abstract public org.omg.CORBA.portable.OutputStream create_output_stream();
+
+ /**
+ * Sends multiple dynamic (DII) requests asynchronously without expecting
+ * any responses. Note that oneway invocations are not guaranteed to
+ * reach the server.
+ *
+ * @param req an array of request objects
+ */
+ abstract public void send_multiple_requests_oneway(Request[] req);
+
+ /**
+ * Sends multiple dynamic (DII) requests asynchronously.
+ *
+ * @param req an array of {@code Request} objects
+ */
+ abstract public void send_multiple_requests_deferred(Request[] req);
+
+ /**
+ * Finds out if any of the deferred (asynchronous) invocations have
+ * a response yet.
+ * @return {@code true} if there is a response available;
+ * {@code false} otherwise
+ */
+ abstract public boolean poll_next_response();
+
+ /**
+ * Gets the next {@code Request} instance for which a response
+ * has been received.
+ *
+ * @return the next {@code Request} object ready with a response
+ * @exception WrongTransaction if the method {@code get_next_response}
+ * is called from a transaction scope different
+ * from the one from which the original request was sent. See the
+ * OMG Transaction Service specification for details.
+ */
+ abstract public Request get_next_response() throws WrongTransaction;
+
+ /**
+ * Retrieves the {@code TypeCode} object that represents
+ * the given primitive IDL type.
+ *
+ * @param tcKind the {@code TCKind} instance corresponding to the
+ * desired primitive type
+ * @return the requested {@code TypeCode} object
+ */
+ abstract public TypeCode get_primitive_tc(TCKind tcKind);
+
+ /**
+ * Creates a {@code TypeCode} object representing an IDL {@code struct}.
+ * The {@code TypeCode} object is initialized with the given id,
+ * name, and members.
+ *
+ * @param id the repository id for the {@code struct}
+ * @param name the name of the {@code struct}
+ * @param members an array describing the members of the {@code struct}
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code struct}
+ */
+ abstract public TypeCode create_struct_tc(String id, String name,
+ StructMember[] members);
+
+ /**
+ * Creates a {@code TypeCode} object representing an IDL {@code union}.
+ * The {@code TypeCode} object is initialized with the given id,
+ * name, discriminator type, and members.
+ *
+ * @param id the repository id of the {@code union}
+ * @param name the name of the {@code union}
+ * @param discriminator_type the type of the {@code union} discriminator
+ * @param members an array describing the members of the {@code union}
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code union}
+ */
+ abstract public TypeCode create_union_tc(String id, String name,
+ TypeCode discriminator_type,
+ UnionMember[] members);
+
+ /**
+ * Creates a {@code TypeCode} object representing an IDL {@code enum}.
+ * The {@code TypeCode} object is initialized with the given id,
+ * name, and members.
+ *
+ * @param id the repository id for the {@code enum}
+ * @param name the name for the {@code enum}
+ * @param members an array describing the members of the {@code enum}
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code enum}
+ */
+ abstract public TypeCode create_enum_tc(String id, String name, String[] members);
+
+ /**
+ * Creates a {@code TypeCode} object representing an IDL {@code alias}
+ * ({@code typedef}).
+ * The {@code TypeCode} object is initialized with the given id,
+ * name, and original type.
+ *
+ * @param id the repository id for the alias
+ * @param name the name for the alias
+ * @param original_type
+ * the {@code TypeCode} object describing the original type
+ * for which this is an alias
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code alias}
+ */
+ abstract public TypeCode create_alias_tc(String id, String name,
+ TypeCode original_type);
+
+ /**
+ * Creates a {@code TypeCode} object representing an IDL {@code exception}.
+ * The {@code TypeCode} object is initialized with the given id,
+ * name, and members.
+ *
+ * @param id the repository id for the {@code exception}
+ * @param name the name for the {@code exception}
+ * @param members an array describing the members of the {@code exception}
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code exception}
+ */
+ abstract public TypeCode create_exception_tc(String id, String name,
+ StructMember[] members);
+
+ /**
+ * Creates a {@code TypeCode} object representing an IDL {@code interface}.
+ * The {@code TypeCode} object is initialized with the given id
+ * and name.
+ *
+ * @param id the repository id for the interface
+ * @param name the name for the interface
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code interface}
+ */
+
+ abstract public TypeCode create_interface_tc(String id, String name);
+
+ /**
+ * Creates a {@code TypeCode} object representing a bounded IDL
+ * {@code string}.
+ * The {@code TypeCode} object is initialized with the given bound,
+ * which represents the maximum length of the string. Zero indicates
+ * that the string described by this type code is unbounded.
+ *
+ * @param bound the bound for the {@code string}; cannot be negative
+ * @return a newly-created {@code TypeCode} object describing
+ * a bounded IDL {@code string}
+ * @exception BAD_PARAM if bound is a negative value
+ */
+
+ abstract public TypeCode create_string_tc(int bound);
+
+ /**
+ * Creates a {@code TypeCode} object representing a bounded IDL
+ * {@code wstring} (wide string).
+ * The {@code TypeCode} object is initialized with the given bound,
+ * which represents the maximum length of the wide string. Zero indicates
+ * that the string described by this type code is unbounded.
+ *
+ * @param bound the bound for the {@code wstring}; cannot be negative
+ * @return a newly-created {@code TypeCode} object describing
+ * a bounded IDL {@code wstring}
+ * @exception BAD_PARAM if bound is a negative value
+ */
+ abstract public TypeCode create_wstring_tc(int bound);
+
+ /**
+ * Creates a {@code TypeCode} object representing an IDL {@code sequence}.
+ * The {@code TypeCode} object is initialized with the given bound and
+ * element type.
+ *
+ * @param bound the bound for the {@code sequence}, 0 if unbounded
+ * @param element_type the {@code TypeCode} object describing
+ * the elements contained in the {@code sequence}
+ *
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code sequence}
+ */
+ abstract public TypeCode create_sequence_tc(int bound, TypeCode element_type);
+
+ /**
+ * Creates a {@code TypeCode} object representing a
+ * a recursive IDL {@code sequence}.
+ * <P>
+ * For the IDL {@code struct} Node in following code fragment,
+ * the offset parameter for creating its sequence would be 1:
+ * <PRE>
+ * Struct Node {
+ * long value;
+ * Sequence &lt;Node&gt; subnodes;
+ * };
+ * </PRE>
+ *
+ * @param bound the bound for the sequence, 0 if unbounded
+ * @param offset the index to the enclosing {@code TypeCode} object
+ * that describes the elements of this sequence
+ * @return a newly-created {@code TypeCode} object describing
+ * a recursive sequence
+ * @deprecated Use a combination of create_recursive_tc and create_sequence_tc instead
+ * @see #create_recursive_tc(String) create_recursive_tc
+ * @see #create_sequence_tc(int, TypeCode) create_sequence_tc
+ */
+ @Deprecated
+ abstract public TypeCode create_recursive_sequence_tc(int bound, int offset);
+
+ /**
+ * Creates a {@code TypeCode} object representing an IDL {@code array}.
+ * The {@code TypeCode} object is initialized with the given length and
+ * element type.
+ *
+ * @param length the length of the {@code array}
+ * @param element_type a {@code TypeCode} object describing the type
+ * of element contained in the {@code array}
+ * @return a newly-created {@code TypeCode} object describing
+ * an IDL {@code array}
+ */
+ abstract public TypeCode create_array_tc(int length, TypeCode element_type);
+
+ /**
+ * Create a {@code TypeCode} object for an IDL native type.
+ *
+ * @param id the logical id for the native type.
+ * @param name the name of the native type.
+ * @return the requested TypeCode.
+ */
+ public org.omg.CORBA.TypeCode create_native_tc(String id,
+ String name)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Create a {@code TypeCode} object for an IDL abstract interface.
+ *
+ * @param id the logical id for the abstract interface type.
+ * @param name the name of the abstract interface type.
+ * @return the requested TypeCode.
+ */
+ public org.omg.CORBA.TypeCode create_abstract_interface_tc(
+ String id,
+ String name)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+ /**
+ * Create a {@code TypeCode} object for an IDL fixed type.
+ *
+ * @param digits specifies the total number of decimal digits in the number
+ * and must be from 1 to 31 inclusive.
+ * @param scale specifies the position of the decimal point.
+ * @return the requested TypeCode.
+ */
+ public org.omg.CORBA.TypeCode create_fixed_tc(short digits, short scale)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+ // orbos 98-01-18: Objects By Value -- begin
+
+
+ /**
+ * Create a {@code TypeCode} object for an IDL value type.
+ * The concrete_base parameter is the TypeCode for the immediate
+ * concrete valuetype base of the valuetype for which the TypeCode
+ * is being created.
+ * It may be null if the valuetype does not have a concrete base.
+ *
+ * @param id the logical id for the value type.
+ * @param name the name of the value type.
+ * @param type_modifier one of the value type modifier constants:
+ * VM_NONE, VM_CUSTOM, VM_ABSTRACT or VM_TRUNCATABLE
+ * @param concrete_base a {@code TypeCode} object
+ * describing the concrete valuetype base
+ * @param members an array containing the members of the value type
+ * @return the requested TypeCode
+ */
+ public org.omg.CORBA.TypeCode create_value_tc(String id,
+ String name,
+ short type_modifier,
+ TypeCode concrete_base,
+ ValueMember[] members)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Create a recursive {@code TypeCode} object which
+ * serves as a placeholder for a concrete TypeCode during the process of creating
+ * TypeCodes which contain recursion. The id parameter specifies the repository id of
+ * the type for which the recursive TypeCode is serving as a placeholder. Once the
+ * recursive TypeCode has been properly embedded in the enclosing TypeCode which
+ * corresponds to the specified repository id, it will function as a normal TypeCode.
+ * Invoking operations on the recursive TypeCode before it has been embedded in the
+ * enclosing TypeCode will result in a {@code BAD_TYPECODE} exception.
+ * <P>
+ * For example, the following IDL type declaration contains recursion:
+ * <PRE>
+ * Struct Node {
+ * Sequence&lt;Node&gt; subnodes;
+ * };
+ * </PRE>
+ * <P>
+ * To create a TypeCode for struct Node, you would invoke the TypeCode creation
+ * operations as shown below:
+ * <PRE>
+ * String nodeID = "IDL:Node:1.0";
+ * TypeCode recursiveSeqTC = orb.create_sequence_tc(0, orb.create_recursive_tc(nodeID));
+ * StructMember[] members = { new StructMember("subnodes", recursiveSeqTC, null) };
+ * TypeCode structNodeTC = orb.create_struct_tc(nodeID, "Node", members);
+ * </PRE>
+ * <P>
+ * Also note that the following is an illegal IDL type declaration:
+ * <PRE>
+ * Struct Node {
+ * Node next;
+ * };
+ * </PRE>
+ * <P>
+ * Recursive types can only appear within sequences which can be empty.
+ * That way marshaling problems, when transmitting the struct in an Any, are avoided.
+ *
+ * @param id the logical id of the referenced type
+ * @return the requested TypeCode
+ */
+ public org.omg.CORBA.TypeCode create_recursive_tc(String id) {
+ // implemented in subclass
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Creates a {@code TypeCode} object for an IDL value box.
+ *
+ * @param id the logical id for the value type
+ * @param name the name of the value type
+ * @param boxed_type the TypeCode for the type
+ * @return the requested TypeCode
+ */
+ public org.omg.CORBA.TypeCode create_value_box_tc(String id,
+ String name,
+ TypeCode boxed_type)
+ {
+ // implemented in subclass
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ // orbos 98-01-18: Objects By Value -- end
+
+ /**
+ * Creates an IDL {@code Any} object initialized to
+ * contain a {@code Typecode} object whose {@code kind} field
+ * is set to {@code TCKind.tc_null}.
+ *
+ * @return a newly-created {@code Any} object
+ */
+ abstract public Any create_any();
+
+
+
+
+ /**
+ * Retrieves a {@code Current} object.
+ * The {@code Current} interface is used to manage thread-specific
+ * information for use by services such as transactions and security.
+ *
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ *
+ * @return a newly-created {@code Current} object
+ * @deprecated use {@code resolve_initial_references}.
+ */
+ @Deprecated
+ public org.omg.CORBA.Current get_current()
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * This operation blocks the current thread until the ORB has
+ * completed the shutdown process, initiated when some thread calls
+ * {@code shutdown}. It may be used by multiple threads which
+ * get all notified when the ORB shuts down.
+ *
+ */
+ public void run()
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Instructs the ORB to shut down, which causes all
+ * object adapters to shut down, in preparation for destruction.<br>
+ * If the {@code wait_for_completion} parameter
+ * is true, this operation blocks until all ORB processing (including
+ * processing of currently executing requests, object deactivation,
+ * and other object adapter operations) has completed.
+ * If an application does this in a thread that is currently servicing
+ * an invocation, the {@code BAD_INV_ORDER} system exception
+ * will be thrown with the OMG minor code 3,
+ * since blocking would result in a deadlock.<br>
+ * If the {@code wait_for_completion} parameter is {@code FALSE},
+ * then shutdown may not have completed upon return.<p>
+ * While the ORB is in the process of shutting down, the ORB operates as normal,
+ * servicing incoming and outgoing requests until all requests have been completed.
+ * Once an ORB has shutdown, only object reference management operations
+ * may be invoked on the ORB or any object reference obtained from it.
+ * An application may also invoke the {@code destroy} operation on the ORB itself.
+ * Invoking any other operation will throw the {@code BAD_INV_ORDER}
+ * system exception with the OMG minor code 4.<p>
+ * The {@code ORB.run} method will return after
+ * {@code shutdown} has been called.
+ *
+ * @param wait_for_completion {@code true} if the call
+ * should block until the shutdown is complete;
+ * {@code false} if it should return immediately
+ * @throws org.omg.CORBA.BAD_INV_ORDER if the current thread is servicing
+ * an invocation
+ */
+ public void shutdown(boolean wait_for_completion)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Returns {@code true} if the ORB needs the main thread to
+ * perform some work, and {@code false} if the ORB does not
+ * need the main thread.
+ *
+ * @return {@code true} if there is work pending, meaning that the ORB
+ * needs the main thread to perform some work; {@code false}
+ * if there is no work pending and thus the ORB does not need the
+ * main thread
+ *
+ */
+ public boolean work_pending()
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Performs an implementation-dependent unit of work if called
+ * by the main thread. Otherwise it does nothing.
+ * The methods {@code work_pending} and {@code perform_work}
+ * can be used in
+ * conjunction to implement a simple polling loop that multiplexes
+ * the main thread among the ORB and other activities.
+ *
+ */
+ public void perform_work()
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Used to obtain information about CORBA facilities and services
+ * that are supported by this ORB. The service type for which
+ * information is being requested is passed in as the in
+ * parameter {@code service_type}, the values defined by
+ * constants in the CORBA module. If service information is
+ * available for that type, that is returned in the out parameter
+ * {@code service_info}, and the operation returns the
+ * value {@code true}. If no information for the requested
+ * services type is available, the operation returns {@code false}
+ * (i.e., the service is not supported by this ORB).
+ *
+ * @param service_type a {@code short} indicating the
+ * service type for which information is being requested
+ * @param service_info a {@code ServiceInformationHolder} object
+ * that will hold the {@code ServiceInformation} object
+ * produced by this method
+ * @return {@code true} if service information is available
+ * for the {@code service_type};
+ * {@code false} if no information for the
+ * requested services type is available
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public boolean get_service_information(short service_type,
+ ServiceInformationHolder service_info)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ // orbos 98-01-18: Objects By Value -- begin
+
+ /**
+ * Creates a new {@code DynAny} object from the given
+ * {@code Any} object.
+ *
+ * @param value the {@code Any} object from which to create a new
+ * {@code DynAny} object
+ * @return the new {@code DynAny} object created from the given
+ * {@code Any} object
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
+ */
+ @Deprecated
+ public org.omg.CORBA.DynAny create_dyn_any(org.omg.CORBA.Any value)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Creates a basic {@code DynAny} object from the given
+ * {@code TypeCode} object.
+ *
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynAny} object
+ * @return the new {@code DynAny} object created from the given
+ * {@code TypeCode} object
+ * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
+ * {@code TypeCode} object is not consistent with the operation.
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
+ */
+ @Deprecated
+ public org.omg.CORBA.DynAny create_basic_dyn_any(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Creates a new {@code DynStruct} object from the given
+ * {@code TypeCode} object.
+ *
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynStruct} object
+ * @return the new {@code DynStruct} object created from the given
+ * {@code TypeCode} object
+ * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
+ * {@code TypeCode} object is not consistent with the operation.
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
+ */
+ @Deprecated
+ public org.omg.CORBA.DynStruct create_dyn_struct(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Creates a new {@code DynSequence} object from the given
+ * {@code TypeCode} object.
+ *
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynSequence} object
+ * @return the new {@code DynSequence} object created from the given
+ * {@code TypeCode} object
+ * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
+ * {@code TypeCode} object is not consistent with the operation.
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
+ */
+ @Deprecated
+ public org.omg.CORBA.DynSequence create_dyn_sequence(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+ /**
+ * Creates a new {@code DynArray} object from the given
+ * {@code TypeCode} object.
+ *
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynArray} object
+ * @return the new {@code DynArray} object created from the given
+ * {@code TypeCode} object
+ * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
+ * {@code TypeCode} object is not consistent with the operation.
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
+ */
+ @Deprecated
+ public org.omg.CORBA.DynArray create_dyn_array(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Creates a new {@code DynUnion} object from the given
+ * {@code TypeCode} object.
+ *
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynUnion} object
+ * @return the new {@code DynUnion} object created from the given
+ * {@code TypeCode} object
+ * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
+ * {@code TypeCode} object is not consistent with the operation.
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
+ */
+ @Deprecated
+ public org.omg.CORBA.DynUnion create_dyn_union(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Creates a new {@code DynEnum} object from the given
+ * {@code TypeCode} object.
+ *
+ * @param type the {@code TypeCode} object from which to create a new
+ * {@code DynEnum} object
+ * @return the new {@code DynEnum} object created from the given
+ * {@code TypeCode} object
+ * @throws org.omg.CORBA.ORBPackage.InconsistentTypeCode if the given
+ * {@code TypeCode} object is not consistent with the operation.
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ * @deprecated Use the new <a href="../DynamicAny/DynAnyFactory.html">DynAnyFactory</a> API instead
+ */
+ @Deprecated
+ public org.omg.CORBA.DynEnum create_dyn_enum(org.omg.CORBA.TypeCode type) throws org.omg.CORBA.ORBPackage.InconsistentTypeCode
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Can be invoked to create new instances of policy objects
+ * of a specific type with specified initial state. If
+ * {@code create_policy} fails to instantiate a new Policy
+ * object due to its inability to interpret the requested type
+ * and content of the policy, it raises the {@code PolicyError}
+ * exception with the appropriate reason.
+ * @param type the {@code PolicyType} of the policy object to
+ * be created
+ * @param val the value that will be used to set the initial
+ * state of the {@code Policy} object that is created
+ * @return Reference to a newly created {@code Policy} object
+ * of type specified by the {@code type} parameter and
+ * initialized to a state specified by the {@code val}
+ * parameter
+ * @throws org.omg.CORBA.PolicyError when the requested
+ * policy is not supported or a requested initial state
+ * for the policy is not supported.
+ */
+ public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val)
+ throws org.omg.CORBA.PolicyError
+ {
+ // Currently not implemented until PIORB.
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InconsistentTypeCode.java b/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InconsistentTypeCode.java
new file mode 100644
index 0000000..a608d82
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InconsistentTypeCode.java
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA.ORBPackage;
+
+/**
+ * InconsistentTypeCode is thrown when an attempt is made to create a
+ * dynamic any with a type code that does not match the particular
+ * subclass of <code>DynAny</code>.
+ */
+public final class InconsistentTypeCode
+ extends org.omg.CORBA.UserException {
+ /**
+ * Constructs an <code>InconsistentTypeCode</code> user exception
+ * with no reason message.
+ */
+ public InconsistentTypeCode() {
+ super();
+ }
+
+ /**
+ * Constructs an <code>InconsistentTypeCode</code> user exception
+ * with the specified reason message.
+ * @param reason The String containing a reason message
+ */
+ public InconsistentTypeCode(String reason) {
+ super(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidName.java b/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidName.java
new file mode 100644
index 0000000..1079d95
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidName.java
@@ -0,0 +1,53 @@
+/*
+ * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.ORBPackage;
+
+/**
+ * The <code>InvalidName</code> exception is raised when
+ * <code>ORB.resolve_initial_references</code> is passed a name
+ * for which there is no initial reference.
+ *
+ * @see org.omg.CORBA.ORB#resolve_initial_references(String)
+ * @since JDK1.2
+ */
+
+final public class InvalidName extends org.omg.CORBA.UserException {
+ /**
+ * Constructs an <code>InvalidName</code> exception with no reason message.
+ */
+ public InvalidName() {
+ super();
+ }
+
+ /**
+ * Constructs an <code>InvalidName</code> exception with the specified
+ * reason message.
+ * @param reason the String containing a reason message
+ */
+ public InvalidName(String reason) {
+ super(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidNameHelper.java b/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidNameHelper.java
new file mode 100644
index 0000000..afb6dac
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/InvalidNameHelper.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.ORBPackage;
+
+
+/**
+ * This Helper class is used to facilitate the marshalling of
+ * {@code ORBPackage/InvalidName}.
+ * For more information on Helper files, see
+ * <a href="{@docRoot}/org/omg/CORBA/doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.
+ */
+
+abstract public class InvalidNameHelper
+{
+ private static String _id = "IDL:omg.org.CORBA/ORB/InvalidName:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.ORBPackage.InvalidName 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.ORBPackage.InvalidName 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 [0];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.ORBPackage.InvalidNameHelper.id (), "InvalidName", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.ORBPackage.InvalidName read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.ORBPackage.InvalidName value = new org.omg.CORBA.ORBPackage.InvalidName ();
+ // read and discard the repository ID
+ istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.ORBPackage.InvalidName value)
+ {
+ // write the repository ID
+ ostream.write_string (id ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/package.html b/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/package.html
new file mode 100644
index 0000000..7fcb5e8
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ORBPackage/package.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+</head>
+<body bgcolor="white">
+
+Provides the exception <code>InvalidName</code>, which is thrown
+by the method <code>ORB.resolve_initial_references</code>
+and the exception <code>InconsistentTypeCode</code>, which is thrown
+by the Dynamic Any creation methods in the ORB class.
+
+
+ <h2>Related Documentation</h2>
+
+For an overview, please see:
+<ul>
+ <li><a href="../package-summary.html#package_description">
+ comments on the <code>CORBA</code> package</a>
+
+ </ul>
+
+
+@since JDK1.2
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/CORBA/Object.java b/src/java.corba/share/classes/org/omg/CORBA/Object.java
new file mode 100644
index 0000000..7875dd9
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/Object.java
@@ -0,0 +1,282 @@
+/*
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The definition for a CORBA object reference.
+ * <p>
+ * A CORBA object reference is a handle for a particular
+ * CORBA object implemented by a server. A CORBA object reference
+ * identifies the same CORBA object each time the reference is used to invoke
+ * a method on the object.
+ * A CORBA object may have multiple, distinct object references.
+ * <p>
+ * The <code>org.omg.CORBA.Object</code> interface is the root of
+ * the inheritance hierarchy for all CORBA object references in the Java
+ * programming language, analogous to <code>java.rmi.Remote</code>
+ * for RMI remote objects.
+ * <p>
+ * A CORBA object may be either local or remote.
+ * If it is a local object (that is, running in the same
+ * VM as the client), invocations may be directly serviced by
+ * the object instance, and the object reference could point to the actual
+ * instance of the object implementation class.
+ * If a CORBA object is a remote object (that is, running in a different
+ * VM from the client), the object reference points to a stub (proxy) which uses the
+ * ORB machinery to make a remote invocation on the server where the object
+ * implementation resides.
+ * <p>
+ * Default implementations of the methods in the interface
+ * <code>org.omg.CORBA.Object</code>
+ * are provided in the class <code>org.omg.CORBA.portable.ObjectImpl</code>,
+ * which is the base class for stubs and object implementations.
+ *
+ * @see org.omg.CORBA.portable.ObjectImpl
+ */
+
+public interface Object {
+
+ /**
+ * Checks whether this object is an instance of a class that
+ * implements the given interface.
+ *
+ * @param repositoryIdentifier the interface to check against
+ * @return <code>true</code> if this object reference is an instance
+ * of a class that implements the interface;
+ * <code>false</code> otherwise
+ */
+ boolean _is_a(String repositoryIdentifier);
+
+
+ /**
+ * Determines whether the two object references are equivalent,
+ * so far as the ORB can easily determine. Two object references are equivalent
+ * if they are identical. Two distinct object references which in fact refer to
+ * the same object are also equivalent. However, ORBs are not required
+ * to attempt determination of whether two distinct object references
+ * refer to the same object, since such determination could be impractically
+ * expensive.
+ * @param other the other object reference with which to check for equivalence
+ * @return <code>true</code> if this object reference is known to be
+ * equivalent to the given object reference.
+ * Note that <code>false</code> indicates only that the two
+ * object references are distinct, not necessarily that
+ * they reference distinct objects.
+ */
+ boolean _is_equivalent(org.omg.CORBA.Object other);
+
+
+ /**
+ * Determines whether the server object for this object reference has been
+ * destroyed.
+ * @return <code>true</code> if the ORB knows authoritatively that the
+ * server object does not exist; <code>false</code> otherwise
+ */
+ boolean _non_existent();
+
+
+ /**
+ * Returns an ORB-internal identifier for this object reference.
+ * This is a hash identifier, which does
+ * not change during the lifetime of the object reference, and so
+ * neither will any hash function of that identifier change. The value returned
+ * is not guaranteed to be unique; in other words, another object
+ * reference may have the same hash value.
+ * If two object references hash differently,
+ * then they are distinct object references; however, both may still refer
+ * to the same CORBA object.
+ *
+ * @param maximum the upper bound on the hash value returned by the ORB
+ * @return the ORB-internal hash identifier for this object reference
+ */
+ int _hash(int maximum);
+
+
+ /**
+ * Returns a duplicate of this CORBA object reference.
+ * The server object implementation is not involved in creating
+ * the duplicate, and the implementation cannot distinguish whether
+ * the original object reference or a duplicate was used to make a request.
+ * <P>
+ * Note that this method is not very useful in the Java platform,
+ * since memory management is handled by the VM.
+ * It is included for compliance with the CORBA APIs.
+ * <P>
+ * The method <code>_duplicate</code> may return this object reference itself.
+ *
+ * @return a duplicate of this object reference or this object reference
+ * itself
+ */
+ org.omg.CORBA.Object _duplicate();
+
+
+ /**
+ * Signals that the caller is done using this object reference, so
+ * internal ORB resources associated with this object reference can be
+ * released. Note that the object implementation is not involved in
+ * this operation, and other references to the same object are not affected.
+ */
+ void _release();
+
+
+ /**
+ * Obtains an <code>InterfaceDef</code> for the object implementation
+ * referenced by this object reference.
+ * The <code>InterfaceDef</code> object
+ * may be used to introspect on the methods, attributes, and other
+ * type information for the object referred to by this object reference.
+ *
+ * @return the <code>InterfaceDef</code> object in the Interface Repository
+ * which provides type information about the object referred to by
+ * this object reference
+ */
+ org.omg.CORBA.Object _get_interface_def();
+
+
+
+ /**
+ * Creates a <code>Request</code> instance for use in the
+ * Dynamic Invocation Interface.
+ *
+ * @param operation the name of the method to be invoked using the
+ * <code>Request</code> instance
+ * @return the newly-created <code>Request</code> instance
+ */
+ Request _request(String operation);
+
+
+
+ /**
+ * Creates a <code>Request</code> instance initialized with the
+ * given context, method name, list of arguments, and container
+ * for the method's return value.
+ *
+ * @param ctx a <code>Context</code> object containing
+ * a list of properties
+ * @param operation the name of the method to be invoked
+ * @param arg_list an <code>NVList</code> containing the actual arguments
+ * to the method being invoked
+ * @param result a <code>NamedValue</code> object to serve as a
+ * container for the method's return value
+ * @return the newly-created <code>Request</code> object
+ *
+ * @see Request
+ * @see NVList
+ * @see NamedValue
+ */
+
+ Request _create_request(Context ctx,
+ String operation,
+ NVList arg_list,
+ NamedValue result);
+
+ /**
+ * Creates a <code>Request</code> instance initialized with the
+ * given context, method name, list of arguments, container
+ * for the method's return value, list of possible exceptions,
+ * and list of context strings needing to be resolved.
+ *
+ * @param ctx a <code>Context</code> object containing
+ * a list of properties
+ * @param operation the name of the method to be invoked
+ * @param arg_list an <code>NVList</code> containing the actual arguments
+ * to the method being invoked
+ * @param result a <code>NamedValue</code> object to serve as a
+ * container for the method's return value
+ * @param exclist an <code>ExceptionList</code> object containing a
+ * list of possible exceptions the method can throw
+ * @param ctxlist a <code>ContextList</code> object containing a list of
+ * context strings that need to be resolved and sent with the
+ * <code>Request</code> instance
+ * @return the newly-created <code>Request</code> object
+ *
+ * @see Request
+ * @see NVList
+ * @see NamedValue
+ * @see ExceptionList
+ * @see ContextList
+ */
+
+ Request _create_request(Context ctx,
+ String operation,
+ NVList arg_list,
+ NamedValue result,
+ ExceptionList exclist,
+ ContextList ctxlist);
+
+
+
+
+ /**
+ * Returns the <code>Policy</code> object of the specified type
+ * which applies to this object.
+ *
+ * @param policy_type the type of policy to be obtained
+ * @return A <code>Policy</code> object of the type specified by
+ * the policy_type parameter
+ * @exception org.omg.CORBA.BAD_PARAM when the value of policy type
+ * is not valid either because the specified type is not supported by this
+ * ORB or because a policy object of that type is not associated with this
+ * Object
+ */
+ Policy _get_policy(int policy_type);
+
+
+ /**
+ * Retrieves the <code>DomainManagers</code> of this object.
+ * This allows administration services (and applications) to retrieve the
+ * domain managers, and hence the security and other policies applicable
+ * to individual objects that are members of the domain.
+ *
+ * @return the list of immediately enclosing domain managers of this object.
+ * At least one domain manager is always returned in the list since by
+ * default each object is associated with at least one domain manager at
+ * creation.
+ */
+ DomainManager[] _get_domain_managers();
+
+
+ /**
+ * Returns a new <code>Object</code> with the given policies
+ * either replacing any existing policies in this
+ * <code>Object</code> or with the given policies added
+ * to the existing ones, depending on the value of the
+ * given <code>SetOverrideType</code> object.
+ *
+ * @param policies an array of <code>Policy</code> objects containing
+ * the policies to be added or to be used as replacements
+ * @param set_add either <code>SetOverrideType.SET_OVERRIDE</code>, indicating
+ * that the given policies will replace any existing ones, or
+ * <code>SetOverrideType.ADD_OVERRIDE</code>, indicating that
+ * the given policies should be added to any existing ones
+ * @return a new <code>Object</code> with the given policies replacing
+ * or added to those in this <code>Object</code>
+ */
+ org.omg.CORBA.Object _set_policy_override(Policy[] policies,
+ SetOverrideType set_add);
+
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ObjectHelper.java b/src/java.corba/share/classes/org/omg/CORBA/ObjectHelper.java
new file mode 100644
index 0000000..85aa169
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ObjectHelper.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * The Helper for {@code Object}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA;
+
+abstract public class ObjectHelper
+{
+ private static String _id = "";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Object 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.Object 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 (TCKind.tk_objref);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.Object read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return istream.read_Object ();
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Object value)
+ {
+ ostream.write_Object (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ObjectHolder.java b/src/java.corba/share/classes/org/omg/CORBA/ObjectHolder.java
new file mode 100644
index 0000000..f83f3b3
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ObjectHolder.java
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+
+/**
+ * The Holder for {@code Object}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a CORBA object reference (a value of type
+ * {@code org.omg.CORBA.Object}). It is usually
+ * used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has a CORBA Object reference as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code ObjectHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myObjectHolder} is an instance of {@code ObjectHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myObjectHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class ObjectHolder implements Streamable {
+ /**
+ * The {@code Object} value held by this {@code ObjectHolder}
+ * object.
+ */
+ public Object value;
+
+ /**
+ * Constructs a new {@code ObjectHolder} object with its
+ * {@code value} field initialized to {@code null}.
+ */
+ public ObjectHolder() {
+ }
+
+ /**
+ * Constructs a new {@code ObjectHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code Object}.
+ * @param initial the {@code Object} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code ObjectHolder} object
+ */
+ public ObjectHolder(Object initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads from {@code input} and initalizes the value in
+ * this {@code ObjectHolder} object
+ * with the unmarshalled data.
+ *
+ * @param input the InputStream containing CDR formatted data from the wire.
+ */
+ public void _read(InputStream input) {
+ value = input.read_Object();
+ }
+
+ /**
+ * Marshals to {@code output} the value in
+ * this {@code ObjectHolder} object.
+ *
+ * @param output the OutputStream which will contain the CDR formatted data.
+ */
+ public void _write(OutputStream output) {
+ output.write_Object(value);
+ }
+
+ /**
+ * Returns the TypeCode corresponding to the value held in
+ * this {@code ObjectHolder} object
+ *
+ * @return the TypeCode of the value held in
+ * this {@code ObjectHolder} object
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return org.omg.CORBA.ORB.init().get_primitive_tc(TCKind.tk_objref);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHelper.java
new file mode 100644
index 0000000..ca03a6a
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code OctetSeq}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/OctetSeqHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ *
+ * The class definition has been modified to conform to the following
+ * OMG specifications :
+ * <ul>
+ * <li> ORB core as defined by CORBA 2.3.1
+ * (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+ * </li>
+ *
+ * <li> IDL/Java Language Mapping as defined in
+ * <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+ * </li>
+ * </ul>
+ */
+
+public abstract class OctetSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/OctetSeq:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, byte[] 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 byte[] 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_octet);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.OctetSeqHelper.id (), "OctetSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static byte[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ byte value[] = null;
+ int _len0 = istream.read_long ();
+ value = new byte[_len0];
+ istream.read_octet_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, byte[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_octet_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHolder.java
new file mode 100644
index 0000000..868aadd
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/OctetSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Holder for {@code OctetSeq}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/OctetSeqHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from streams.idl
+ * 13 May 1999 22:41:36 o'clock GMT+00:00
+ */
+
+public final class OctetSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public byte value[] = null;
+
+ public OctetSeqHolder ()
+ {
+ }
+
+ public OctetSeqHolder (byte[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.OctetSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.OctetSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.OctetSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PERSIST_STORE.java b/src/java.corba/share/classes/org/omg/CORBA/PERSIST_STORE.java
new file mode 100644
index 0000000..00eff18
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PERSIST_STORE.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception indicates a persistent storage failure, for example,
+ * failure to establish a database connection or corruption of a
+ * database.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public final class PERSIST_STORE extends SystemException {
+ /**
+ * Constructs a <code>PERSIST_STORE</code> exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public PERSIST_STORE() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>PERSIST_STORE</code> exception with the specified description message,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public PERSIST_STORE(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>PERSIST_STORE</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public PERSIST_STORE(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>PERSIST_STORE</code> exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public PERSIST_STORE(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PRIVATE_MEMBER.java b/src/java.corba/share/classes/org/omg/CORBA/PRIVATE_MEMBER.java
new file mode 100644
index 0000000..d0ac239
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PRIVATE_MEMBER.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * File: ./org/omg/CORBA/PRIVATE_MEMBER.java
+ * From: ./ir.idl
+ * Date: Fri Aug 28 16:03:31 1998
+ * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Constant to define a private member in the <code>ValueMember</code> class.
+ * <P>
+ * <code>PRIVATE_MEMBER</code> is one of the two constants of typedef
+ * <code>Visibility</code> used in the interface repository
+ * to identify visibility of a <code>ValueMember</code> type.
+ * The other constant is <code>PUBLIC_MEMBER</code>.
+ *
+ * @author unattributed
+ */
+public interface PRIVATE_MEMBER {
+ final short value = (short) (0L);
+};
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PUBLIC_MEMBER.java b/src/java.corba/share/classes/org/omg/CORBA/PUBLIC_MEMBER.java
new file mode 100644
index 0000000..c7701fd
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PUBLIC_MEMBER.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * File: ./org/omg/CORBA/PUBLIC_MEMBER.java
+ * From: ./ir.idl
+ * Date: Fri Aug 28 16:03:31 1998
+ * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Constant to define a public member in the <code>ValueMember</code>
+ * class.
+ * <P>
+ * <code>PUBLIC_MEMBER</code> is one of the two constants of typedef
+ * <code>Visibility</code> used in the interface repository
+ * to identify visibility of a <code>ValueMember</code> type.
+ * The other constant is <code>PRIVATE_MEMBER</code>.
+ *
+ * @author unattributed
+ */
+public interface PUBLIC_MEMBER {
+ final short value = (short) (1L);
+};
diff --git a/src/java.corba/share/classes/org/omg/CORBA/Policy.java b/src/java.corba/share/classes/org/omg/CORBA/Policy.java
new file mode 100644
index 0000000..9fc9bef
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/Policy.java
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * Interfaces derived from the {@code Policy} interface allow an
+ * ORB or CORBA service access to certain choices that affect
+ * its operation. This information is accessed in a structured
+ * manner using interfaces derived from the {@code Policy}
+ * interface defined in the CORBA module. A CORBA service does not
+ * have to use this method of accessing operating options, but
+ * may choose to do so. The Security Service in particular uses
+ * this technique for associating Security Policy with objects
+ * in the system.
+ * An interface generated by the IDL-to-Java compiler.
+ * org/omg/CORBA/Policy.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:20 AM PDT
+ */
+
+public interface Policy extends PolicyOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
+{
+} // interface Policy
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PolicyError.java b/src/java.corba/share/classes/org/omg/CORBA/PolicyError.java
new file mode 100644
index 0000000..d95f6d7
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PolicyError.java
@@ -0,0 +1,71 @@
+/*
+ * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+* A user exception thrown when a policy error occurs. A <code>PolicyError</code>
+* exception may include one of the following policy error reason codes
+* defined in the org.omg.CORBA package: BAD_POLICY, BAD_POLICY_TYPE,
+* BAD_POLICY_VALUE, UNSUPPORTED_POLICY, UNSUPPORTED_POLICY_VALUE.
+*/
+
+public final class PolicyError extends org.omg.CORBA.UserException {
+
+ /**
+ * The reason for the <code>PolicyError</code> exception being thrown.
+ * @serial
+ */
+ public short reason;
+
+ /**
+ * Constructs a default <code>PolicyError</code> user exception
+ * with no reason code and an empty reason detail message.
+ */
+ public PolicyError() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>PolicyError</code> user exception
+ * initialized with the given reason code and an empty reason detail message.
+ * @param __reason the reason code.
+ */
+ public PolicyError(short __reason) {
+ super();
+ reason = __reason;
+ }
+
+ /**
+ * Constructs a <code>PolicyError</code> user exception
+ * initialized with the given reason detail message and reason code.
+ * @param reason_string the reason detail message.
+ * @param __reason the reason code.
+ */
+ public PolicyError(String reason_string, short __reason) {
+ super(reason_string);
+ reason = __reason;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PolicyHelper.java b/src/java.corba/share/classes/org/omg/CORBA/PolicyHelper.java
new file mode 100644
index 0000000..a775aff
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PolicyHelper.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code Policy}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/PolicyHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:20 AM PDT
+ */
+
+abstract public class PolicyHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/Policy:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Policy 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.Policy 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 (org.omg.CORBA.PolicyHelper.id (), "Policy");
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.Policy read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return narrow (istream.read_Object (_PolicyStub.class));
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Policy value)
+ {
+ ostream.write_Object ((org.omg.CORBA.Object) value);
+ }
+
+ public static org.omg.CORBA.Policy narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.omg.CORBA.Policy)
+ return (org.omg.CORBA.Policy)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.omg.CORBA._PolicyStub (delegate);
+ }
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PolicyHolder.java b/src/java.corba/share/classes/org/omg/CORBA/PolicyHolder.java
new file mode 100644
index 0000000..0d395d4
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PolicyHolder.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+/**
+ * The Holder for {@code Policy}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/PolicyHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:20 AM PDT
+ */
+
+public final class PolicyHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.omg.CORBA.Policy value = null;
+
+ public PolicyHolder ()
+ {
+ }
+
+ public PolicyHolder (org.omg.CORBA.Policy initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.PolicyHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.PolicyHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.PolicyHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PolicyListHelper.java b/src/java.corba/share/classes/org/omg/CORBA/PolicyListHelper.java
new file mode 100644
index 0000000..8877c68
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PolicyListHelper.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code PolicyList}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/PolicyListHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:21 AM PDT
+ */
+
+abstract public class PolicyListHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/PolicyList:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.Policy[] 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.Policy[] 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.PolicyHelper.type ();
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.PolicyListHelper.id (), "PolicyList", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.Policy[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.Policy value[] = null;
+ int _len0 = istream.read_long ();
+ value = new org.omg.CORBA.Policy[_len0];
+ for (int _o1 = 0;_o1 < value.length; ++_o1)
+ value[_o1] = org.omg.CORBA.PolicyHelper.read (istream);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.Policy[] value)
+ {
+ ostream.write_long (value.length);
+ for (int _i0 = 0;_i0 < value.length; ++_i0)
+ org.omg.CORBA.PolicyHelper.write (ostream, value[_i0]);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PolicyListHolder.java b/src/java.corba/share/classes/org/omg/CORBA/PolicyListHolder.java
new file mode 100644
index 0000000..5eb1102
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PolicyListHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Holder for {@code PolicyList}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * org/omg/CORBA/PolicyListHolder.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:21 AM PDT
+ */
+
+public final class PolicyListHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.omg.CORBA.Policy value[] = null;
+
+ public PolicyListHolder ()
+ {
+ }
+
+ public PolicyListHolder (org.omg.CORBA.Policy[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.PolicyListHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.PolicyListHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.PolicyListHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PolicyOperations.java b/src/java.corba/share/classes/org/omg/CORBA/PolicyOperations.java
new file mode 100644
index 0000000..305066f
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PolicyOperations.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The interface for {@code Policy}. For more information on
+ * Operations interfaces, see <a href="doc-files/generatedfiles.html#operations">
+ * "Generated Files: Operations files"</a>.
+ * <P>
+ * org/omg/CORBA/PolicyOperations.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:20 AM PDT
+ */
+
+/**
+ * Provides the operations for a {@code Policy} object.
+ */
+public interface PolicyOperations
+{
+
+ /**
+ * Returns the constant value that corresponds to the
+ * type of the policy object. The values of
+ * the policy objects are allocated by the OMG.
+ * New values for PolicyType should be obtained from the OMG by
+ * sending mail to request@omg.org. In general the constant
+ * values that are allocated are defined in conjunction with
+ * the definition of the corresponding policy object.
+ *
+ * @return the constant value that corresponds to the type of
+ * the policy object
+ */
+ int policy_type ();
+
+ /**
+ * Returns a copy of the {@code Policy} object. The copy does not retain
+ * any relationships that the policy had with any domain or object.
+ *
+ * @return a copy of the {@code Policy} object
+ */
+ org.omg.CORBA.Policy copy ();
+
+ /**
+ * Destroys the {@code Policy} object. It is the responsibility of
+ * the {@code Policy} object to determine whether it can be destroyed.
+ */
+ void destroy ();
+} // interface PolicyOperations
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PolicyTypeHelper.java b/src/java.corba/share/classes/org/omg/CORBA/PolicyTypeHelper.java
new file mode 100644
index 0000000..f58c932
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PolicyTypeHelper.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code PolicyType}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ * org/omg/CORBA/PolicyTypeHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl
+ * Saturday, July 17, 1999 12:26:20 AM PDT
+ */
+
+
+// basic Policy definition
+abstract public class PolicyTypeHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/PolicyType:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, int 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 int 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_ulong);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.PolicyTypeHelper.id (), "PolicyType", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static int read (org.omg.CORBA.portable.InputStream istream)
+ {
+ int value = (int)0;
+ value = istream.read_ulong ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, int value)
+ {
+ ostream.write_ulong (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/Principal.java b/src/java.corba/share/classes/org/omg/CORBA/Principal.java
new file mode 100644
index 0000000..f845970
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/Principal.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+
+/**
+ * A class that contains information about the identity of
+ * the client, for access control
+ * and other purposes. It contains a single attribute, the name of the
+ * <code>Principal</code>, encoded as a sequence of bytes.
+ *
+ * @deprecated Deprecated by CORBA 2.2.
+ */
+@Deprecated
+public class Principal {
+ /**
+ * Sets the name of this <code>Principal</code> object to the given value.
+ * @param value the value to be set in the <code>Principal</code>
+ * @deprecated Deprecated by CORBA 2.2.
+ */
+ @Deprecated
+ public void name(byte[] value) {
+ throw new org.omg.CORBA.NO_IMPLEMENT() ;
+ }
+
+ /**
+ * Gets the name of this <code>Principal</code> object.
+ * @return the name of this <code>Principal</code> object
+ * @deprecated Deprecated by CORBA 2.2.
+ */
+ @Deprecated
+ public byte[] name() {
+ throw new org.omg.CORBA.NO_IMPLEMENT() ;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/PrincipalHolder.java b/src/java.corba/share/classes/org/omg/CORBA/PrincipalHolder.java
new file mode 100644
index 0000000..a8df7fe
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/PrincipalHolder.java
@@ -0,0 +1,93 @@
+/*
+ * Copyright (c) 1996, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+
+/**
+ * The Holder for {@code Principal}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A container class for values of type {@code Principal}
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code Principal} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code PrincipalHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myPrincipalHolder} is an instance of {@code PrincipalHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myPrincipalHolder.value}.
+ *
+ * @since JDK1.2
+ * @deprecated Deprecated by CORBA 2.2.
+ */
+@Deprecated
+public final class PrincipalHolder implements Streamable {
+ /**
+ * The {@code Principal} value held by this {@code PrincipalHolder}
+ * object.
+ */
+ public Principal value;
+
+ /**
+ * Constructs a new {@code PrincipalHolder} object with its
+ * {@code value} field initialized to {@code null}.
+ */
+ public PrincipalHolder() {
+ }
+
+ /**
+ * Constructs a new {@code PrincipalHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code Principal} object.
+ * @param initial the {@code Principal} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code PrincipalHolder} object
+ */
+ public PrincipalHolder(Principal initial) {
+ value = initial;
+ }
+
+ public void _read(InputStream input) {
+ value = input.read_Principal();
+ }
+
+ public void _write(OutputStream output) {
+ output.write_Principal(value);
+ }
+
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_Principal);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/REBIND.java b/src/java.corba/share/classes/org/omg/CORBA/REBIND.java
new file mode 100644
index 0000000..6692b72
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/REBIND.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * <code>REBIND</code> is raised when the current effective RebindPolicy,
+ * has a value of NO_REBIND or NO_RECONNECT and an invocation on a bound
+ * object reference results in a LocateReply message with status
+ * OBJECT_FORWARD or a Reply message with status LOCATION_FORWARD.
+ * This exception is also raised if the current effective RebindPolicy has
+ * a value of NO_RECONNECT and a connection must be reopened.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since J2SE 1.5
+ */
+
+public final class REBIND extends SystemException {
+
+ /**
+ * Constructs an <code>REBIND</code> exception with
+ * minor code set to 0 and CompletionStatus set to COMPLETED_NO.
+ */
+ public REBIND() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>REBIND</code> exception with the
+ * specified message.
+ *
+ * @param detailMessage string containing a detailed message.
+ */
+ public REBIND(String detailMessage) {
+ this(detailMessage, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>REBIND</code> exception with the
+ * specified minor code and completion status.
+ *
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public REBIND(int minorCode,
+ CompletionStatus completionStatus) {
+ this("", minorCode, completionStatus);
+ }
+
+ /**
+ * Constructs an <code>REBIND</code> exception with the
+ * specified message, minor code, and completion status.
+ *
+ * @param detailMessage string containing a detailed message.
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public REBIND(String detailMessage,
+ int minorCode,
+ CompletionStatus completionStatus) {
+ super(detailMessage, minorCode, completionStatus);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/RepositoryIdHelper.java b/src/java.corba/share/classes/org/omg/CORBA/RepositoryIdHelper.java
new file mode 100644
index 0000000..a3ad94f
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/RepositoryIdHelper.java
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+ * The Helper for {@code RepositoryId}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ *
+ * org/omg/CORBA/RepositoryIdHelper.java
+ * Generated by the IDL-to-Java compiler (portable), version "3.0"
+ * from ir.idl
+ * 03 June 1999 11:33:43 o'clock GMT+00:00
+ */
+
+abstract public class RepositoryIdHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/RepositoryId:1.0";
+
+ 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 ());
+ }
+
+ 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 (org.omg.CORBA.RepositoryIdHelper.id (), "RepositoryId", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value = null;
+ value = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ ostream.write_string (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/Request.java b/src/java.corba/share/classes/org/omg/CORBA/Request.java
new file mode 100644
index 0000000..51667c8
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/Request.java
@@ -0,0 +1,301 @@
+/*
+ * Copyright (c) 1996, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * An object containing the information necessary for
+ * invoking a method. This class is
+ * the cornerstone of the ORB Dynamic
+ * Invocation Interface (DII), which allows dynamic creation and
+ * invocation of requests.
+ * A server cannot tell the difference between a client
+ * invocation using a client stub and a request using the DII.
+ * <P>
+ * A <code>Request</code> object consists of:
+ * <UL>
+ * <LI>the name of the operation to be invoked
+ * <LI>an <code>NVList</code> containing arguments for the operation.<BR>
+ * Each item in the list is a <code>NamedValue</code> object, which has three
+ * parts:
+ * <OL>
+ * <LI>the name of the argument
+ * <LI>the value of the argument (as an <code>Any</code> object)
+ * <LI>the argument mode flag indicating whether the argument is
+ * for input, output, or both
+ * </OL>
+ * </UL>
+ * <P>
+ * <code>Request</code> objects may also contain additional information,
+ * depending on how an operation was defined in the original IDL
+ * interface definition. For example, where appropriate, they may contain
+ * a <code>NamedValue</code> object to hold the return value or exception,
+ * a context, a list of possible exceptions, and a list of
+ * context strings that need to be resolved.
+ * <P>
+ * New <code>Request</code> objects are created using one of the
+ * <code>create_request</code> methods in the <code>Object</code> class.
+ * In other words, a <code>create_request</code> method is performed on the
+ * object which is to be invoked.
+ *
+ * @see org.omg.CORBA.NamedValue
+ *
+ */
+
+public abstract class Request {
+
+ /**
+ * Retrieves the the target object reference.
+ *
+ * @return the object reference that points to the
+ * object implementation for the method
+ * to be invoked
+ */
+
+ public abstract org.omg.CORBA.Object target();
+
+ /**
+ * Retrieves the name of the method to be invoked.
+ *
+ * @return the name of the method to be invoked
+ */
+
+ public abstract String operation();
+
+ /**
+ * Retrieves the <code>NVList</code> object containing the arguments
+ * to the method being invoked. The elements in the list are
+ * <code>NamedValue</code> objects, with each one describing an argument
+ * to the method.
+ *
+ * @return the <code>NVList</code> object containing the arguments
+ * for the method
+ *
+ */
+
+ public abstract NVList arguments();
+
+ /**
+ * Retrieves the <code>NamedValue</code> object containing the return
+ * value for the method.
+ *
+ * @return the <code>NamedValue</code> object containing the result
+ * of the method
+ */
+
+ public abstract NamedValue result();
+
+ /**
+ * Retrieves the <code>Environment</code> object for this request.
+ * It contains the exception that the method being invoked has
+ * thrown (after the invocation returns).
+ *
+ *
+ * @return the <code>Environment</code> object for this request
+ */
+
+ public abstract Environment env();
+
+ /**
+ * Retrieves the <code>ExceptionList</code> object for this request.
+ * This list contains <code>TypeCode</code> objects describing the
+ * exceptions that may be thrown by the method being invoked.
+ *
+ * @return the <code>ExceptionList</code> object describing the exceptions
+ * that may be thrown by the method being invoked
+ */
+
+ public abstract ExceptionList exceptions();
+
+ /**
+ * Retrieves the <code>ContextList</code> object for this request.
+ * This list contains context <code>String</code>s that need to
+ * be resolved and sent with the invocation.
+ *
+ *
+ * @return the list of context strings whose values
+ * need to be resolved and sent with the
+ * invocation.
+ */
+
+ public abstract ContextList contexts();
+
+ /**
+ * Retrieves the <code>Context</code> object for this request.
+ * This is a list of properties giving information about the
+ * client, the environment, or the circumstances of this request.
+ *
+ * @return the <code>Context</code> object that is to be used
+ * to resolve any context strings whose
+ * values need to be sent with the invocation
+ */
+
+ public abstract Context ctx();
+
+ /**
+ * Sets this request's <code>Context</code> object to the one given.
+ *
+ * @param c the new <code>Context</code> object to be used for
+ * resolving context strings
+ */
+
+ public abstract void ctx(Context c);
+
+
+ /**
+ * Creates an input argument and adds it to this <code>Request</code>
+ * object.
+ *
+ * @return an <code>Any</code> object that contains the
+ * value and typecode for the input argument added
+ */
+
+ public abstract Any add_in_arg();
+
+ /**
+ * Creates an input argument with the given name and adds it to
+ * this <code>Request</code> object.
+ *
+ * @param name the name of the argument being added
+ * @return an <code>Any</code> object that contains the
+ * value and typecode for the input argument added
+ */
+
+ public abstract Any add_named_in_arg(String name);
+
+ /**
+ * Adds an input/output argument to this <code>Request</code> object.
+ *
+ * @return an <code>Any</code> object that contains the
+ * value and typecode for the input/output argument added
+ */
+
+ public abstract Any add_inout_arg();
+
+ /**
+ * Adds an input/output argument with the given name to this
+ * <code>Request</code> object.
+ *
+ * @param name the name of the argument being added
+ * @return an <code>Any</code> object that contains the
+ * value and typecode for the input/output argument added
+ */
+
+ public abstract Any add_named_inout_arg(String name);
+
+
+ /**
+ * Adds an output argument to this <code>Request</code> object.
+ *
+ * @return an <code>Any</code> object that contains the
+ * value and typecode for the output argument added
+ */
+
+ public abstract Any add_out_arg();
+
+ /**
+ * Adds an output argument with the given name to this
+ * <code>Request</code> object.
+ *
+ * @param name the name of the argument being added
+ * @return an <code>Any</code> object that contains the
+ * value and typecode for the output argument added
+ */
+
+ public abstract Any add_named_out_arg(String name);
+
+ /**
+ * Sets the typecode for the return
+ * value of the method.
+ *
+ * @param tc the <code>TypeCode</code> object containing type information
+ * for the return value
+ */
+
+ public abstract void set_return_type(TypeCode tc);
+
+ /**
+ * Returns the <code>Any</code> object that contains the value for the
+ * result of the method.
+ *
+ * @return an <code>Any</code> object containing the value and
+ * typecode for the return value
+ */
+
+ public abstract Any return_value();
+
+ /**
+ * Makes a synchronous invocation using the
+ * information in the <code>Request</code> object. Exception information is
+ * placed into the <code>Request</code> object's environment object.
+ */
+
+ public abstract void invoke();
+
+ /**
+ * Makes a oneway invocation on the
+ * request. In other words, it does not expect or wait for a
+ * response. Note that this can be used even if the operation was
+ * not declared as oneway in the IDL declaration. No response or
+ * exception information is returned.
+ */
+
+ public abstract void send_oneway();
+
+ /**
+ * Makes an asynchronous invocation on
+ * the request. In other words, it does not wait for a response before it
+ * returns to the user. The user can then later use the methods
+ * <code>poll_response</code> and <code>get_response</code> to get
+ * the result or exception information for the invocation.
+ */
+
+ public abstract void send_deferred();
+
+ /**
+ * Allows the user to determine
+ * whether a response has been received for the invocation triggered
+ * earlier with the <code>send_deferred</code> method.
+ *
+ * @return <code>true</code> if the method response has
+ * been received; <code>false</code> otherwise
+ */
+
+ public abstract boolean poll_response();
+
+ /**
+ * Allows the user to access the
+ * response for the invocation triggered earlier with the
+ * <code>send_deferred</code> method.
+ *
+ * @exception WrongTransaction if the method <code>get_response</code> was invoked
+ * from a different transaction's scope than the one from which the
+ * request was originally sent. See the OMG Transaction Service specification
+ * for details.
+ */
+
+ public abstract void get_response() throws WrongTransaction;
+
+};
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ServerRequest.java b/src/java.corba/share/classes/org/omg/CORBA/ServerRequest.java
new file mode 100644
index 0000000..04cdeb6
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ServerRequest.java
@@ -0,0 +1,314 @@
+/*
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * An object that captures the explicit state of a request
+ * for the Dynamic Skeleton Interface (DSI). This class, the
+ * cornerstone of the DSI, is analogous to the <code>Request</code>
+ * object in the DII.
+ * <P>
+ * The ORB is responsible for creating this embodiment of a request,
+ * and delivering it to a Dynamic Implementation Routine (DIR).
+ * A dynamic servant (a DIR) is created by implementing the
+ * <code>DynamicImplementation</code> class,
+ * which has a single <code>invoke</code> method. This method accepts a
+ * <code>ServerRequest</code> object.
+ *
+ * The abstract class <code>ServerRequest</code> defines
+ * methods for accessing the
+ * method name, the arguments and the context of the request, as
+ * well as methods for setting the result of the request either as a
+ * return value or an exception. <p>
+ *
+ * A subtlety with accessing the arguments of the request is that the
+ * DIR needs to provide type information about the
+ * expected arguments, since there is no compiled information about
+ * these. This information is provided through an <code>NVList</code>,
+ * which is a list of <code>NamedValue</code> objects.
+ * Each <code>NamedValue</code> object
+ * contains an <code>Any</code> object, which in turn
+ * has a <code>TypeCode</code> object representing the type
+ * of the argument. <p>
+ *
+ * Similarly, type information needs to be provided for the response,
+ * for either the expected result or for an exception, so the methods
+ * <code>result</code> and <code>except</code> take an <code>Any</code>
+ * object as a parameter.
+ *
+ * @see org.omg.CORBA.DynamicImplementation
+ * @see org.omg.CORBA.NVList
+ * @see org.omg.CORBA.NamedValue
+ *
+ */
+
+public abstract class ServerRequest {
+
+ /**
+ * Retrieves the name of the operation being
+ * invoked. According to OMG IDL's rules, these names must be unique
+ * among all operations supported by this object's "most-derived"
+ * interface. Note that the operation names for getting and setting
+ * attributes are <code>_get_&lt;attribute_name&gt;</code>
+ * and <code>_set_&lt;attribute_name&gt;</code>,
+ * respectively.
+ *
+ * @return the name of the operation to be invoked
+ * @deprecated use operation()
+ */
+ @Deprecated
+ public String op_name()
+ {
+ return operation();
+ }
+
+
+ /**
+ * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception.
+ * <P>
+ * Retrieves the name of the operation being
+ * invoked. According to OMG IDL's rules, these names must be unique
+ * among all operations supported by this object's "most-derived"
+ * interface. Note that the operation names for getting and setting
+ * attributes are <code>_get_&lt;attribute_name&gt;</code>
+ * and <code>_set_&lt;attribute_name&gt;</code>,
+ * respectively.
+ *
+ * @return the name of the operation to be invoked
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
+ * package comments for unimplemented features</a>
+ */
+ public String operation()
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+ /**
+ * Specifies method parameter types and retrieves "in" and "inout"
+ * argument values.
+ * <P>
+ * Note that this method is deprecated; use the method
+ * <code>arguments</code> in its place.
+ * <P>
+ * Unless it calls the method <code>set_exception</code>,
+ * the DIR must call this method exactly once, even if the
+ * method signature contains no parameters. Once the method <code>
+ * arguments</code> or <code>set_exception</code>
+ * has been called, calling <code>arguments</code> on the same
+ * <code>ServerRequest</code> object
+ * will result in a <code>BAD_INV_ORDER</code> system exception.
+ * The DIR must pass in to the method <code>arguments</code>
+ * an NVList initialized with TypeCodes and Flags
+ * describing the parameter types for the operation, in the order in which
+ * they appear in the IDL specification (left to right). A
+ * potentially-different NVList will be returned from
+ * <code>arguments</code>, with the
+ * "in" and "inout" argument values supplied. If it does not call
+ * the method <code>set_exception</code>,
+ * the DIR must supply the returned NVList with return
+ * values for any "out" arguments before returning, and may also change
+ * the return values for any "inout" arguments.
+ *
+ * @param params the arguments of the method, in the
+ * form of an <code>NVList</code> object
+ * @deprecated use the method <code>arguments</code>
+ */
+ @Deprecated
+ public void params(NVList params)
+ {
+ arguments(params);
+ }
+
+ /**
+ * Specifies method parameter types and retrieves "in" and "inout"
+ * argument values.
+ * Unless it calls the method <code>set_exception</code>,
+ * the DIR must call this method exactly once, even if the
+ * method signature contains no parameters. Once the method <code>
+ * arguments</code> or <code>set_exception</code>
+ * has been called, calling <code>arguments</code> on the same
+ * <code>ServerRequest</code> object
+ * will result in a <code>BAD_INV_ORDER</code> system exception.
+ * The DIR must pass in to the method <code>arguments</code>
+ * an NVList initialized with TypeCodes and Flags
+ * describing the parameter types for the operation, in the order in which
+ * they appear in the IDL specification (left to right). A
+ * potentially-different NVList will be returned from
+ * <code>arguments</code>, with the
+ * "in" and "inout" argument values supplied. If it does not call
+ * the method <code>set_exception</code>,
+ * the DIR must supply the returned NVList with return
+ * values for any "out" arguments before returning, and it may also change
+ * the return values for any "inout" arguments.
+ *
+ * @param args the arguments of the method, in the
+ * form of an NVList
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
+ * package comments for unimplemented features</a>
+ */
+ public void arguments(org.omg.CORBA.NVList args) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+
+ /**
+ * Specifies any return value for the call.
+ * <P>
+ * Note that this method is deprecated; use the method
+ * <code>set_result</code> in its place.
+ * <P>
+ * Unless the method
+ * <code>set_exception</code> is called, if the invoked method
+ * has a non-void result type, the method <code>set_result</code>
+ * must be called exactly once before the DIR returns.
+ * If the operation has a void result type, the method
+ * <code>set_result</code> may optionally be
+ * called once with an <code>Any</code> object whose type is
+ * <code>tk_void</code>. Calling the method <code>set_result</code> before
+ * the method <code>arguments</code> has been called or after
+ * the method <code>set_result</code> or <code>set_exception</code> has been
+ * called will result in a BAD_INV_ORDER exception. Calling the method
+ * <code>set_result</code> without having previously called
+ * the method <code>ctx</code> when the IDL operation contains a
+ * context expression, or when the NVList passed to arguments did not
+ * describe all parameters passed by the client, may result in a MARSHAL
+ * system exception.
+ *
+ * @param any an <code>Any</code> object containing the return value to be set
+ * @deprecated use the method <code>set_result</code>
+ */
+ @Deprecated
+ public void result(Any any)
+ {
+ set_result(any);
+ }
+
+
+ /**
+ * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception.
+ * <P>
+ * Specifies any return value for the call. Unless the method
+ * <code>set_exception</code> is called, if the invoked method
+ * has a non-void result type, the method <code>set_result</code>
+ * must be called exactly once before the DIR returns.
+ * If the operation has a void result type, the method
+ * <code>set_result</code> may optionally be
+ * called once with an <code>Any</code> object whose type is
+ * <code>tk_void</code>. Calling the method <code>set_result</code> before
+ * the method <code>arguments</code> has been called or after
+ * the method <code>set_result</code> or <code>set_exception</code> has been
+ * called will result in a BAD_INV_ORDER exception. Calling the method
+ * <code>set_result</code> without having previously called
+ * the method <code>ctx</code> when the IDL operation contains a
+ * context expression, or when the NVList passed to arguments did not
+ * describe all parameters passed by the client, may result in a MARSHAL
+ * system exception.
+ *
+ * @param any an <code>Any</code> object containing the return value to be set
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
+ * package comments for unimplemented features</a>
+ */
+ public void set_result(org.omg.CORBA.Any any)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+ /**
+ * The DIR may call set_exception at any time to return an exception to the
+ * client. The Any passed to set_exception must contain either a system
+ * exception or a user exception specified in the raises expression
+ * of the invoked operation's IDL definition. Passing in an Any that does
+ * not
+ * contain an exception will result in a BAD_PARAM system exception. Passing
+ * in an unlisted user exception will result in either the DIR receiving a
+ * BAD_PARAM system exception or in the client receiving an
+ * UNKNOWN system exception.
+ *
+ * @param any the <code>Any</code> object containing the exception
+ * @deprecated use set_exception()
+ */
+ @Deprecated
+ public void except(Any any)
+ {
+ set_exception(any);
+ }
+
+ /**
+ * Throws an <code>org.omg.CORBA.NO_IMPLEMENT</code> exception.
+ * <P>
+ * Returns the given exception to the client. This method
+ * is invoked by the DIR, which may call it at any time.
+ * The <code>Any</code> object passed to this method must
+ * contain either a system
+ * exception or one of the user exceptions specified in the
+ * invoked operation's IDL definition. Passing in an
+ * <code>Any</code> object that does not contain an exception
+ * will cause a BAD_PARAM system exception to be thrown. Passing
+ * in an unlisted user exception will result in either the DIR receiving a
+ * BAD_PARAM system exception or in the client receiving an
+ * UNKNOWN system exception.
+ *
+ * @param any the <code>Any</code> object containing the exception
+ * @exception BAD_PARAM if the given <code>Any</code> object does not
+ * contain an exception or the exception is an
+ * unlisted user exception
+ * @exception UNKNOWN if the given exception is an unlisted
+ * user exception and the DIR did not
+ * receive a BAD_PARAM exception
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code>
+ * package comments for unimplemented features</a>
+ */
+ public void set_exception(Any any)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Returns the context information specified in IDL for the operation
+ * when the operation is not an attribute access and the operation's IDL
+ * definition contains a context expression; otherwise it returns
+ * a nil <code>Context</code> reference. Calling the method
+ * <code>ctx</code> before the method <code>arguments</code> has
+ * been called or after the method <code>ctx</code>,
+ * <code>set_result</code>, or <code>set_exception</code>
+ * has been called will result in a
+ * BAD_INV_ORDER system exception.
+ *
+ * @return the context object that is to be used
+ * to resolve any context strings whose
+ * values need to be sent with the invocation.
+ * @exception BAD_INV_ORDER if (1) the method <code>ctx</code> is called
+ * before the method <code>arguments</code> or
+ * (2) the method <code>ctx</code> is called
+ * after calling <code>set_result</code> or
+ * <code>set_exception</code>
+ */
+ public abstract Context ctx();
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ServiceDetail.java b/src/java.corba/share/classes/org/omg/CORBA/ServiceDetail.java
new file mode 100644
index 0000000..5802300
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ServiceDetail.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * An object that represents an ORB service: its <code>service_detail_type</code>
+ * field contains the type of the ORB service, and its <code>service_detail</code>
+ * field contains a description of the ORB service.
+
+ *
+ * @author RIP Team
+ */
+public final class ServiceDetail implements org.omg.CORBA.portable.IDLEntity
+{
+ /**
+ * The type of the ORB service that this <code>ServiceDetail</code>
+ * object represents.
+ */
+ public int service_detail_type;
+
+ /**
+ * The data describing the ORB service that this <code>ServiceDetail</code>
+ * object represents.
+ */
+ public byte[] service_detail;
+
+ /**
+ * Constructs a <code>ServiceDetail</code> object with 0 for the type of
+ * ORB service and an empty description.
+ */
+ public ServiceDetail() { }
+
+ /**
+ * Constructs a <code>ServiceDetail</code> object with the given
+ * ORB service type and the given description.
+ *
+ * @param service_detail_type an <code>int</code> specifying the type of
+ * ORB service
+ * @param service_detail a <code>byte</code> array describing the ORB service
+ */
+ public ServiceDetail(int service_detail_type, byte[] service_detail) {
+ this.service_detail_type = service_detail_type;
+ this.service_detail = service_detail;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ServiceDetailHelper.java b/src/java.corba/share/classes/org/omg/CORBA/ServiceDetailHelper.java
new file mode 100644
index 0000000..903a65e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ServiceDetailHelper.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /**
+ * The Helper for {@code ServiceDetail}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ */
+
+package org.omg.CORBA;
+
+
+public abstract class ServiceDetailHelper {
+
+ public static void write(org.omg.CORBA.portable.OutputStream out, org.omg.CORBA.ServiceDetail that) {
+ out.write_ulong(that.service_detail_type);
+ {
+ out.write_long(that.service_detail.length);
+ out.write_octet_array(that.service_detail, 0, that.service_detail.length);
+ }
+ }
+ public static org.omg.CORBA.ServiceDetail read(org.omg.CORBA.portable.InputStream in) {
+ org.omg.CORBA.ServiceDetail that = new org.omg.CORBA.ServiceDetail();
+ that.service_detail_type = in.read_ulong();
+ {
+ int __length = in.read_long();
+ that.service_detail = new byte[__length];
+ in.read_octet_array(that.service_detail, 0, that.service_detail.length);
+ }
+ return that;
+ }
+ public static org.omg.CORBA.ServiceDetail 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, org.omg.CORBA.ServiceDetail 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;
+ synchronized public static org.omg.CORBA.TypeCode type() {
+ int _memberCount = 2;
+ org.omg.CORBA.StructMember[] _members = null;
+ if (_tc == null) {
+ _members= new org.omg.CORBA.StructMember[2];
+ _members[0] = new org.omg.CORBA.StructMember(
+ "service_detail_type",
+ org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong),
+ null);
+
+ _members[1] = new org.omg.CORBA.StructMember(
+ "service_detail",
+ org.omg.CORBA.ORB.init().create_sequence_tc(0, org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_octet)),
+ null);
+ _tc = org.omg.CORBA.ORB.init().create_struct_tc(id(), "ServiceDetail", _members);
+ }
+ return _tc;
+ }
+ public static String id() {
+ return "IDL:omg.org/CORBA/ServiceDetail:1.0";
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ServiceInformation.java b/src/java.corba/share/classes/org/omg/CORBA/ServiceInformation.java
new file mode 100644
index 0000000..47098f2
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ServiceInformation.java
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+
+/**
+ * An IDL struct in the CORBA module that
+ * stores information about a CORBA service available in the
+ * ORB implementation and is obtained from the {@code ORB.get_service_information}
+ * method.
+ */
+public final class ServiceInformation implements org.omg.CORBA.portable.IDLEntity
+{
+ /** Array of ints representing service options.
+ */
+ public int[] service_options;
+
+ /** Array of ServiceDetails giving more details about the service.
+ */
+ public org.omg.CORBA.ServiceDetail[] service_details;
+
+ /** Constructs a ServiceInformation object with empty service_options
+ * and service_details.
+ */
+ public ServiceInformation() { }
+
+ /** Constructs a ServiceInformation object with the given service_options
+ * and service_details.
+ * @param __service_options An array of ints describing the service options.
+ * @param __service_details An array of ServiceDetails describing the service
+ * details.
+ */
+ public ServiceInformation(int[] __service_options,
+ org.omg.CORBA.ServiceDetail[] __service_details)
+ {
+ service_options = __service_options;
+ service_details = __service_details;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHelper.java b/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHelper.java
new file mode 100644
index 0000000..82103df
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHelper.java
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /**
+ * The Helper for {@code ServiceInformation}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ */
+
+package org.omg.CORBA;
+
+
+public abstract class ServiceInformationHelper {
+
+ public static void write(org.omg.CORBA.portable.OutputStream out, org.omg.CORBA.ServiceInformation that)
+ {
+ out.write_long(that.service_options.length);
+ out.write_ulong_array(that.service_options, 0, that.service_options.length);
+ out.write_long(that.service_details.length);
+ for (int i = 0 ; i < that.service_details.length ; i += 1) {
+ org.omg.CORBA.ServiceDetailHelper.write(out, that.service_details[i]);
+ }
+ }
+
+ public static org.omg.CORBA.ServiceInformation read(org.omg.CORBA.portable.InputStream in) {
+ org.omg.CORBA.ServiceInformation that = new org.omg.CORBA.ServiceInformation();
+ {
+ int __length = in.read_long();
+ that.service_options = new int[__length];
+ in.read_ulong_array(that.service_options, 0, that.service_options.length);
+ }
+ {
+ int __length = in.read_long();
+ that.service_details = new org.omg.CORBA.ServiceDetail[__length];
+ for (int __index = 0 ; __index < that.service_details.length ; __index += 1) {
+ that.service_details[__index] = org.omg.CORBA.ServiceDetailHelper.read(in);
+ }
+ }
+ return that;
+ }
+ public static org.omg.CORBA.ServiceInformation 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, org.omg.CORBA.ServiceInformation 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;
+ synchronized public static org.omg.CORBA.TypeCode type() {
+ int _memberCount = 2;
+ org.omg.CORBA.StructMember[] _members = null;
+ if (_tc == null) {
+ _members= new org.omg.CORBA.StructMember[2];
+ _members[0] = new org.omg.CORBA.StructMember(
+ "service_options",
+ org.omg.CORBA.ORB.init().create_sequence_tc(0, org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong)),
+ null);
+
+ _members[1] = new org.omg.CORBA.StructMember(
+ "service_details",
+ org.omg.CORBA.ORB.init().create_sequence_tc(0, org.omg.CORBA.ServiceDetailHelper.type()),
+ null);
+ _tc = org.omg.CORBA.ORB.init().create_struct_tc(id(), "ServiceInformation", _members);
+ }
+ return _tc;
+ }
+ public static String id() {
+ return "IDL:omg.org/CORBA/ServiceInformation:1.0";
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHolder.java b/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHolder.java
new file mode 100644
index 0000000..5e4f6a7
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ServiceInformationHolder.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The Holder for {@code ServiceInformation}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a {@code ServiceInformation} object
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code xxx} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code ServiceInformationHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myServiceInformationHolder} is an instance of {@code ServiceInformationHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myServiceInformationHolder.value}.
+ */
+public final class ServiceInformationHolder
+ implements org.omg.CORBA.portable.Streamable {
+
+ /**
+ * The {@code ServiceInformation} value held by this
+ * {@code ServiceInformationHolder} object in its {@code value} field.
+ */
+ public ServiceInformation value;
+
+ /**
+ * Constructs a new {@code ServiceInformationHolder} object with its
+ * {@code value} field initialized to null.
+ */
+ public ServiceInformationHolder() {
+ this(null);
+ }
+
+ /**
+ * Constructs a new {@code ServiceInformationHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code ServiceInformation} object.
+ *
+ * @param arg the {@code ServiceInformation} object with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code ServiceInformationHolder} object
+ */
+ public ServiceInformationHolder(org.omg.CORBA.ServiceInformation arg) {
+ value = arg;
+ }
+
+
+ /**
+ * Marshals the value in this {@code ServiceInformationHolder} object's
+ * {@code value} field to the output stream {@code out}.
+ *
+ * @param out the {@code OutputStream} object that will contain
+ * the CDR formatted data
+ */
+ public void _write(org.omg.CORBA.portable.OutputStream out) {
+ org.omg.CORBA.ServiceInformationHelper.write(out, value);
+ }
+
+ /**
+ * Reads unmarshalled data from the input stream {@code in} and assigns it to
+ * the {@code value} field in this {@code ServiceInformationHolder} object.
+ *
+ * @param in the {@code InputStream} object containing CDR
+ * formatted data from the wire
+ */
+ public void _read(org.omg.CORBA.portable.InputStream in) {
+ value = org.omg.CORBA.ServiceInformationHelper.read(in);
+ }
+
+ /**
+ * Retrieves the {@code TypeCode} object that corresponds
+ * to the value held in this {@code ServiceInformationHolder} object's
+ * {@code value} field.
+ *
+ * @return the type code for the value held in this {@code ServiceInformationHolder}
+ * object
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return org.omg.CORBA.ServiceInformationHelper.type();
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/SetOverrideType.java b/src/java.corba/share/classes/org/omg/CORBA/SetOverrideType.java
new file mode 100644
index 0000000..8281897
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/SetOverrideType.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The mapping of a CORBA <code>enum</code> tagging
+ * <code>SET_OVERRIDE</code> and <code>ADD_OVERRIDE</code>, which
+ * indicate whether policies should replace the
+ * existing policies of an <code>Object</code> or be added to them.
+ * <P>
+ * The method {@link org.omg.CORBA.Object#_set_policy_override} takes
+ * either <code>SetOverrideType.SET_OVERRIDE</code> or
+ * <code>SetOverrideType.ADD_OVERRIDE</code> as its second argument.
+ * The method <code>_set_policy_override</code>
+ * creates a new <code>Object</code> initialized with the
+ * <code>Policy</code> objects supplied as the first argument. If the
+ * second argument is <code>ADD_OVERRIDE</code>, the new policies
+ * are added to those of the <code>Object</code> instance that is
+ * calling the <code>_set_policy_override</code> method. If
+ * <code>SET_OVERRIDE</code> is given instead, the existing policies
+ * are replaced with the given ones.
+ *
+ * @author OMG
+ * @since JDK1.2
+ */
+
+public class SetOverrideType implements org.omg.CORBA.portable.IDLEntity {
+
+ /**
+ * The <code>int</code> constant for the enum value SET_OVERRIDE.
+ */
+ public static final int _SET_OVERRIDE = 0;
+
+ /**
+ * The <code>int</code> constant for the enum value ADD_OVERRIDE.
+ */
+ public static final int _ADD_OVERRIDE = 1;
+
+ /**
+ * The <code>SetOverrideType</code> constant for the enum value SET_OVERRIDE.
+ */
+ public static final SetOverrideType SET_OVERRIDE = new SetOverrideType(_SET_OVERRIDE);
+
+ /**
+ * The <code>SetOverrideType</code> constant for the enum value ADD_OVERRIDE.
+ */
+ public static final SetOverrideType ADD_OVERRIDE = new SetOverrideType(_ADD_OVERRIDE);
+
+ /**
+ * Retrieves the value of this <code>SetOverrideType</code> instance.
+ *
+ * @return the <code>int</code> for this <code>SetOverrideType</code> instance.
+ */
+ public int value() {
+ return _value;
+ }
+
+ /**
+ * Converts the given <code>int</code> to the corresponding
+ * <code>SetOverrideType</code> instance.
+ *
+ * @param i the <code>int</code> to convert; must be either
+ * <code>SetOverrideType._SET_OVERRIDE</code> or
+ * <code>SetOverrideType._ADD_OVERRIDE</code>
+ * @return the <code>SetOverrideType</code> instance whose value
+ * matches the given <code>int</code>
+ * @exception BAD_PARAM if the given <code>int</code> does not
+ * match the value of
+ * any <code>SetOverrideType</code> instance
+ */
+ public static SetOverrideType from_int(int i)
+ {
+ switch (i) {
+ case _SET_OVERRIDE:
+ return SET_OVERRIDE;
+ case _ADD_OVERRIDE:
+ return ADD_OVERRIDE;
+ default:
+ throw new org.omg.CORBA.BAD_PARAM();
+ }
+ }
+
+ /**
+ * Constructs a <code>SetOverrideType</code> instance from an
+ * <code>int</code>.
+ * @param _value must be either <code>SET_OVERRIDE</code> or
+ * <code>ADD_OVERRIDE</code>
+ */
+ protected SetOverrideType(int _value){
+ this._value = _value;
+ }
+
+ /**
+ * The field containing the value for this <code>SetOverrideType</code>
+ * object.
+ *
+ */
+ private int _value;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/SetOverrideTypeHelper.java b/src/java.corba/share/classes/org/omg/CORBA/SetOverrideTypeHelper.java
new file mode 100644
index 0000000..fa2c4a6
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/SetOverrideTypeHelper.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code SetOverrideType}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/SetOverrideTypeHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* 03 June 1999 11:52:03 o'clock GMT+00:00
+*/
+
+abstract public class SetOverrideTypeHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/SetOverrideType:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.SetOverrideType 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.SetOverrideType 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 (org.omg.CORBA.SetOverrideTypeHelper.id (), "SetOverrideType", new String[] { "SET_OVERRIDE", "ADD_OVERRIDE"} );
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.SetOverrideType read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return org.omg.CORBA.SetOverrideType.from_int (istream.read_long ());
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.SetOverrideType value)
+ {
+ ostream.write_long (value.value ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java b/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java
new file mode 100644
index 0000000..aa0cdb1
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ShortHolder.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 1995, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Holder for {@code Short}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.
+ * <P>A Holder class for a {@code short}
+ * that is used to store "out" and "inout" parameters in IDL operations.
+ * If an IDL operation signature has an IDL {@code short} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code ShortHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myShortHolder} is an instance of {@code ShortHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myShortHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class ShortHolder implements Streamable {
+
+ /**
+ * The {@code short} value held by this {@code ShortHolder}
+ * object.
+ */
+ public short value;
+
+ /**
+ * Constructs a new {@code ShortHolder} object with its
+ * {@code value} field initialized to {@code 0}.
+ */
+ public ShortHolder() {
+ }
+
+ /**
+ * Constructs a new {@code ShortHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code short}.
+ * @param initial the {@code short} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code ShortHolder} object
+ */
+ public ShortHolder(short initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads from {@code input} and initalizes the value in
+ * this {@code ShortHolder} object
+ * with the unmarshalled data.
+ *
+ * @param input the InputStream containing CDR formatted data from the wire.
+ */
+ public void _read(InputStream input) {
+ value = input.read_short();
+ }
+
+ /**
+ * Marshals to {@code output} the value in
+ * this {@code ShortHolder} object.
+ *
+ * @param output the OutputStream which will contain the CDR formatted data.
+ */
+ public void _write(OutputStream output) {
+ output.write_short(value);
+ }
+
+ /**
+ * Returns the TypeCode corresponding to the value held in
+ * this {@code ShortHolder} object.
+ *
+ * @return the TypeCode of the value held in
+ * this {@code ShortHolder} object
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_short);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHelper.java
new file mode 100644
index 0000000..6159d19
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code ShortSeqHelper}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/ShortSeqHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from streams.idl
+* 13 May 1999 22:41:36 o'clock GMT+00:00
+*
+* The class definition has been modified to conform to the following
+* OMG specifications :
+* <ul>
+* <li> ORB core as defined by CORBA 2.3.1
+* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+* </li>
+*
+* <li> IDL/Java Language Mapping as defined in
+* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+* </li>
+* </ul>
+*/
+
+public abstract class ShortSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ShortSeq: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 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_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.ShortSeqHelper.id (), "ShortSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static short[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ short value[] = null;
+ int _len0 = istream.read_long ();
+ value = new short[_len0];
+ istream.read_short_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, short[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_short_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHolder.java
new file mode 100644
index 0000000..ee4ddbf
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ShortSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Holder for {@code ShortSeq}. For more information on
+* Holder files, see <a href="doc-files/generatedfiles.html#holder">
+* "Generated Files: Holder Files"</a>.<P>
+* org/omg/CORBA/ShortSeqHolder.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from streams.idl
+* 13 May 1999 22:41:36 o'clock GMT+00:00
+*/
+
+public final class ShortSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public short value[] = null;
+
+ public ShortSeqHolder ()
+ {
+ }
+
+ public ShortSeqHolder (short[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.ShortSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.ShortSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.ShortSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/StringHolder.java b/src/java.corba/share/classes/org/omg/CORBA/StringHolder.java
new file mode 100644
index 0000000..a7c8b78
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/StringHolder.java
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 1995, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Holder for {@code String}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a {@code String}
+ * that is used to store "out" and "inout" parameters in IDL operations.
+ * If an IDL operation signature has an IDL {@code string} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code StringHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myStringHolder} is an instance of {@code StringHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myStringHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class StringHolder implements Streamable {
+
+ /**
+ * The {@code String} value held by this {@code StringHolder}
+ * object.
+ */
+ public String value;
+
+ /**
+ * Constructs a new {@code StringHolder} object with its
+ * {@code value} field initialized to {@code null}.
+ */
+ public StringHolder() {
+ }
+
+ /**
+ * Constructs a new {@code StringHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code String}.
+ * @param initial the {@code String} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code StringHolder} object
+ */
+ public StringHolder(String initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads the unmarshalled data from {@code input} and assigns it to
+ * the {@code value} field of this {@code StringHolder} object.
+ *
+ * @param input the InputStream containing CDR formatted data from the wire.
+ */
+ public void _read(InputStream input) {
+ value = input.read_string();
+ }
+
+ /**
+ * Marshals the value held by this {@code StringHolder} object
+ * to the output stream {@code output}.
+ *
+ * @param output the OutputStream which will contain the CDR formatted data.
+ */
+ public void _write(OutputStream output) {
+ output.write_string(value);
+ }
+
+ /**
+ * Retrieves the {@code TypeCode} object that corresponds to
+ * the value held in this {@code StringHolder} object.
+ *
+ * @return the type code of the value held in this {@code StringHolder}
+ * object
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_string);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/StringValueHelper.java b/src/java.corba/share/classes/org/omg/CORBA/StringValueHelper.java
new file mode 100644
index 0000000..d2f3c95
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/StringValueHelper.java
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA;
+
+/**
+* The Helper for {@code StringValue}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/StringValueHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from orb.idl
+* 31 May 1999 22:27:30 o'clock GMT+00:00
+*
+* The class definition has been modified to conform to the following
+* OMG specifications :
+* <ul>
+* <li> ORB core as defined by CORBA 2.3.1
+* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+* </li>
+*
+* <li> IDL/Java Language Mapping as defined in
+* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+* </li>
+* </ul>
+*/
+
+public class StringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/StringValue:1.0";
+
+ private static StringValueHelper _instance = new StringValueHelper ();
+
+ 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 ());
+ }
+
+ 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;
+ __typeCode = org.omg.CORBA.ORB.init ().create_string_tc (0);
+ __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, "StringValue", __typeCode);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {
+ throw new org.omg.CORBA.BAD_PARAM(); }
+ return (String) ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);
+ }
+
+ public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)
+ {
+ String tmp;
+ tmp = istream.read_string ();
+ return (java.io.Serializable) tmp;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {
+ throw new org.omg.CORBA.BAD_PARAM(); }
+ ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance);
+ }
+
+ public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)
+ {
+ if (!(value instanceof String)) {
+ throw new org.omg.CORBA.MARSHAL(); }
+ String valueType = (String) value;
+ ostream.write_string (valueType);
+ }
+
+ public String get_id ()
+ {
+ return _id;
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/StructMember.java b/src/java.corba/share/classes/org/omg/CORBA/StructMember.java
new file mode 100644
index 0000000..58a8e17
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/StructMember.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * File: ./org/omg/CORBA/StructMember.java
+ * From: ./ir.idl
+ * Date: Fri Aug 28 16:03:31 1998
+ * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Describes a member of an IDL <code>struct</code> in the
+ * Interface Repository, including
+ * the name of the <code>struct</code> member, the type of
+ * the <code>struct</code> member, and
+ * the typedef that represents the IDL type of the
+ * <code>struct</code> member
+ * described the <code>struct</code> member object.
+ */
+public final class StructMember implements org.omg.CORBA.portable.IDLEntity {
+
+ // instance variables
+
+ /**
+ * The name of the struct member described by
+ * this <code>StructMember</code> object.
+ * @serial
+ */
+ public String name;
+
+ /**
+ * The type of the struct member described by
+ * this <code>StructMember</code> object.
+ * @serial
+ */
+ public org.omg.CORBA.TypeCode type;
+
+ /**
+ * The typedef that represents the IDL type of the struct member described by
+ * this <code>StructMember</code> object.
+ * @serial
+ */
+ public org.omg.CORBA.IDLType type_def;
+ // constructors
+
+ /**
+ * Constructs a default <code>StructMember</code> object.
+ */
+ public StructMember() { }
+
+ /**
+ * Constructs a <code>StructMember</code> object initialized with the
+ * given values.
+ * @param __name a <code>String</code> object with the name of the struct
+ * member
+ * @param __type a <code>TypeCode</code> object describing the type of the struct
+ * member
+ * @param __type_def an <code>IDLType</code> object representing the IDL type
+ * of the struct member
+ */
+ public StructMember(String __name, org.omg.CORBA.TypeCode __type, org.omg.CORBA.IDLType __type_def) {
+ name = __name;
+ type = __type;
+ type_def = __type_def;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/StructMemberHelper.java b/src/java.corba/share/classes/org/omg/CORBA/StructMemberHelper.java
new file mode 100644
index 0000000..7141758
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/StructMemberHelper.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code StructMember}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/StructMemberHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ir.idl
+* 03 June 1999 11:33:43 o'clock GMT+00:00
+*/
+
+abstract public class StructMemberHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/StructMember:1.0";
+
+ 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 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 (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 = 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 (org.omg.CORBA.StructMemberHelper.id (), "StructMember", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.StructMember read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.StructMember value = new org.omg.CORBA.StructMember ();
+ value.name = istream.read_string ();
+ value.type = istream.read_TypeCode ();
+ value.type_def = org.omg.CORBA.IDLTypeHelper.read (istream);
+ return 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);
+ org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/SystemException.java b/src/java.corba/share/classes/org/omg/CORBA/SystemException.java
new file mode 100644
index 0000000..fa808c6
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/SystemException.java
@@ -0,0 +1,119 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import java.util.*;
+import org.omg.CORBA.OMGVMCID;
+import com.sun.corba.se.impl.util.SUNVMCID;
+
+/**
+ * The root class for all CORBA standard exceptions. These exceptions
+ * may be thrown as a result of any CORBA operation invocation and may
+ * also be returned by many standard CORBA API methods. The standard
+ * exceptions contain a minor code, allowing more detailed specification, and a
+ * completion status. This class is subclassed to
+ * generate each one of the set of standard ORB exceptions.
+ * <code>SystemException</code> extends
+ * <code>java.lang.RuntimeException</code>; thus none of the
+ * <code>SystemException</code> exceptions need to be
+ * declared in signatures of the Java methods mapped from operations in
+ * IDL interfaces.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public abstract class SystemException extends java.lang.RuntimeException {
+
+ /**
+ * The CORBA Exception minor code.
+ * @serial
+ */
+ public int minor;
+
+ /**
+ * The status of the operation that threw this exception.
+ * @serial
+ */
+ public CompletionStatus completed;
+
+ /**
+ * Constructs a <code>SystemException</code> exception with the specified detail
+ * message, minor code, and completion status.
+ * A detail message is a String that describes this particular exception.
+ * @param reason the String containing a detail message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ protected SystemException(String reason, int minor, CompletionStatus completed) {
+ super(reason);
+ this.minor = minor;
+ this.completed = completed;
+ }
+
+ /**
+ * Converts this exception to a representative string.
+ */
+ public String toString() {
+ // The fully qualified exception class name
+ String result = super.toString();
+
+ // The vmcid part
+ int vmcid = minor & 0xFFFFF000;
+ switch (vmcid) {
+ case OMGVMCID.value:
+ result += " vmcid: OMG";
+ break;
+ case SUNVMCID.value:
+ result += " vmcid: SUN";
+ break;
+ default:
+ result += " vmcid: 0x" + Integer.toHexString(vmcid);
+ break;
+ }
+
+ // The minor code part
+ int mc = minor & 0x00000FFF;
+ result += " minor code: " + mc;
+
+ // The completion status part
+ switch (completed.value()) {
+ case CompletionStatus._COMPLETED_YES:
+ result += " completed: Yes";
+ break;
+ case CompletionStatus._COMPLETED_NO:
+ result += " completed: No";
+ break;
+ case CompletionStatus._COMPLETED_MAYBE:
+ default:
+ result += " completed: Maybe";
+ break;
+ }
+ return result;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TCKind.java b/src/java.corba/share/classes/org/omg/CORBA/TCKind.java
new file mode 100644
index 0000000..60e89a8
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TCKind.java
@@ -0,0 +1,554 @@
+/*
+ * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+
+/**
+ * The Java mapping of the IDL enum <code>TCKind</code>, which
+ * specifies the kind of a <code>TypeCode</code> object. There is
+ * one kind for each primitive and essential IDL data type.
+ * <P>
+ * The class <code>TCKind</code> consists of:
+ * <UL>
+ * <LI>a set of <code>int</code> constants, one for each
+ * kind of IDL data type. These <code>int</code> constants
+ * make it possible to use a <code>switch</code> statement.
+ * <LI>a set of <code>TCKind</code> constants, one for each
+ * kind of IDL data type. The <code>value</code> field for
+ * each <code>TCKind</code> instance is initialized with
+ * the <code>int</code> constant that corresponds with
+ * the IDL data type that the instance represents.
+ * <LI>the method <code>from_int</code>for converting
+ * an <code>int</code> to its
+ * corresponding <code>TCKind</code> instance
+ * <P>Example:
+ * <PRE>
+ * org.omg.CORBA.TCKind k = org.omg.CORBA.TCKind.from_int(
+ * org.omg.CORBA.TCKind._tk_string);
+ * </PRE>
+ * The variable <code>k</code> represents the <code>TCKind</code>
+ * instance for the IDL type <code>string</code>, which is
+ * <code>tk_string</code>.
+ *
+ * <LI>the method <code>value</code> for accessing the
+ * <code>_value</code> field of a <code>TCKind</code> constant
+ * <P>Example:
+ * <PRE>
+ * int i = org.omg.CORBA.TCKind.tk_char.value();
+ * </PRE>
+ * The variable <code>i</code> represents 9, the value for the
+ * IDL data type <code>char</code>.
+ * </UL>
+ * <P>The <code>value</code> field of a <code>TCKind</code> instance
+ * is the CDR encoding used for a <code>TypeCode</code> object in
+ * an IIOP message.
+ */
+
+public class TCKind {
+
+ /**
+ * The <code>int</code> constant for a <code>null</code> IDL data type.
+ */
+ public static final int _tk_null = 0;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>void</code>.
+ */
+ public static final int _tk_void = 1;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>short</code>.
+ */
+ public static final int _tk_short = 2;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>long</code>.
+ */
+ public static final int _tk_long = 3;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>ushort</code>.
+ */
+ public static final int _tk_ushort = 4;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>ulong</code>.
+ */
+ public static final int _tk_ulong = 5;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>float</code>.
+ */
+ public static final int _tk_float = 6;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>double</code>.
+ */
+ public static final int _tk_double = 7;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>boolean</code>.
+ */
+ public static final int _tk_boolean = 8;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>char</code>.
+ */
+ public static final int _tk_char = 9;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>octet</code>.
+ */
+ public static final int _tk_octet = 10;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>any</code>.
+ */
+ public static final int _tk_any = 11;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>TypeCode</code>.
+ */
+ public static final int _tk_TypeCode = 12;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>Principal</code>.
+ */
+ public static final int _tk_Principal = 13;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>objref</code>.
+ */
+ public static final int _tk_objref = 14;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>struct</code>.
+ */
+ public static final int _tk_struct = 15;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>union</code>.
+ */
+ public static final int _tk_union = 16;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>enum</code>.
+ */
+ public static final int _tk_enum = 17;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>string</code>.
+ */
+ public static final int _tk_string = 18;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>sequence</code>.
+ */
+ public static final int _tk_sequence = 19;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>array</code>.
+ */
+ public static final int _tk_array = 20;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>alias</code>.
+ */
+ public static final int _tk_alias = 21;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>except</code>.
+ */
+ public static final int _tk_except = 22;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>longlong</code>.
+ */
+ public static final int _tk_longlong = 23;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>ulonglong</code>.
+ */
+ public static final int _tk_ulonglong = 24;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>longdouble</code>.
+ */
+ public static final int _tk_longdouble = 25;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>wchar</code>.
+ */
+ public static final int _tk_wchar = 26;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>wstring</code>.
+ */
+ public static final int _tk_wstring = 27;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>fixed</code>.
+ */
+ public static final int _tk_fixed = 28;
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>value</code>.
+ */
+ public static final int _tk_value = 29; // orbos 98-01-18: Objects By Value
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>value_box</code>.
+ */
+ public static final int _tk_value_box = 30; // orbos 98-01-18: Objects By Value
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>native</code>.
+ */
+ public static final int _tk_native = 31; // Verify
+
+ /**
+ * The <code>int</code> constant for the IDL data type <code>abstract interface</code>.
+ */
+ public static final int _tk_abstract_interface = 32;
+
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_null</code>.
+ */
+ public static final TCKind tk_null = new TCKind(_tk_null);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_void</code>.
+ */
+ public static final TCKind tk_void = new TCKind(_tk_void);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_short</code>.
+ */
+ public static final TCKind tk_short = new TCKind(_tk_short);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_long</code>.
+ */
+ public static final TCKind tk_long = new TCKind(_tk_long);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_ushort</code>.
+ */
+ public static final TCKind tk_ushort = new TCKind(_tk_ushort);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_ulong</code>.
+ */
+ public static final TCKind tk_ulong = new TCKind(_tk_ulong);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_float</code>.
+ */
+ public static final TCKind tk_float = new TCKind(_tk_float);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_double</code>.
+ */
+ public static final TCKind tk_double = new TCKind(_tk_double);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_boolean</code>.
+ */
+ public static final TCKind tk_boolean = new TCKind(_tk_boolean);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_char</code>.
+ */
+ public static final TCKind tk_char = new TCKind(_tk_char);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_octet</code>.
+ */
+ public static final TCKind tk_octet = new TCKind(_tk_octet);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_any</code>.
+ */
+ public static final TCKind tk_any = new TCKind(_tk_any);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_TypeCode</code>.
+ */
+ public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_Principal</code>.
+ */
+ public static final TCKind tk_Principal = new TCKind(_tk_Principal);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_objref</code>.
+ */
+ public static final TCKind tk_objref = new TCKind(_tk_objref);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_struct</code>.
+ */
+ public static final TCKind tk_struct = new TCKind(_tk_struct);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_union</code>.
+ */
+ public static final TCKind tk_union = new TCKind(_tk_union);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_enum</code>.
+ */
+ public static final TCKind tk_enum = new TCKind(_tk_enum);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_string</code>.
+ */
+ public static final TCKind tk_string = new TCKind(_tk_string);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_sequence</code>.
+ */
+ public static final TCKind tk_sequence = new TCKind(_tk_sequence);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_array</code>.
+ */
+ public static final TCKind tk_array = new TCKind(_tk_array);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_alias</code>.
+ */
+ public static final TCKind tk_alias = new TCKind(_tk_alias);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_except</code>.
+ */
+ public static final TCKind tk_except = new TCKind(_tk_except);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_longlong</code>.
+ */
+ public static final TCKind tk_longlong = new TCKind(_tk_longlong);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_ulonglong</code>.
+ */
+ public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_longdouble</code>.
+ */
+ public static final TCKind tk_longdouble = new TCKind(_tk_longdouble);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_wchar</code>.
+ */
+ public static final TCKind tk_wchar = new TCKind(_tk_wchar);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_wstring</code>.
+ */
+ public static final TCKind tk_wstring = new TCKind(_tk_wstring);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_fixed</code>.
+ */
+ public static final TCKind tk_fixed = new TCKind(_tk_fixed);
+
+ // orbos 98-01-18: Objects By Value -- begin
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_value</code>.
+ */
+ public static final TCKind tk_value = new TCKind(_tk_value);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_value_box</code>.
+ */
+ public static final TCKind tk_value_box = new TCKind(_tk_value_box);
+ // orbos 98-01-18: Objects By Value -- end
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_native</code>.
+ */
+ public static final TCKind tk_native = new TCKind(_tk_native);
+
+ /**
+ * The <code>TCKind</code> constant whose <code>value</code> field is
+ * initialized with <code>TCKind._tk_abstract_interface</code>.
+ */
+ public static final TCKind tk_abstract_interface = new TCKind(_tk_abstract_interface);
+
+
+
+
+ /**
+ * Retrieves the value of this <code>TCKind</code> instance.
+ *
+ * @return the <code>int</code> that represents the kind of
+ * IDL data type for this <code>TCKind</code> instance
+ */
+ public int value() {
+ return _value;
+ }
+
+ /**
+ * Converts the given <code>int</code> to the corresponding
+ * <code>TCKind</code> instance.
+ *
+ * @param i the <code>int</code> to convert. It must be one of
+ * the <code>int</code> constants in the class
+ * <code>TCKind</code>.
+ * @return the <code>TCKind</code> instance whose <code>value</code>
+ * field matches the given <code>int</code>
+ * @exception BAD_PARAM if the given <code>int</code> does not
+ * match the <code>_value</code> field of
+ * any <code>TCKind</code> instance
+ */
+ public static TCKind from_int(int i) {
+ switch (i) {
+ case _tk_null:
+ return tk_null;
+ case _tk_void:
+ return tk_void;
+ case _tk_short:
+ return tk_short;
+ case _tk_long:
+ return tk_long;
+ case _tk_ushort:
+ return tk_ushort;
+ case _tk_ulong:
+ return tk_ulong;
+ case _tk_float:
+ return tk_float;
+ case _tk_double:
+ return tk_double;
+ case _tk_boolean:
+ return tk_boolean;
+ case _tk_char:
+ return tk_char;
+ case _tk_octet:
+ return tk_octet;
+ case _tk_any:
+ return tk_any;
+ case _tk_TypeCode:
+ return tk_TypeCode;
+ case _tk_Principal:
+ return tk_Principal;
+ case _tk_objref:
+ return tk_objref;
+ case _tk_struct:
+ return tk_struct;
+ case _tk_union:
+ return tk_union;
+ case _tk_enum:
+ return tk_enum;
+ case _tk_string:
+ return tk_string;
+ case _tk_sequence:
+ return tk_sequence;
+ case _tk_array:
+ return tk_array;
+ case _tk_alias:
+ return tk_alias;
+ case _tk_except:
+ return tk_except;
+ case _tk_longlong:
+ return tk_longlong;
+ case _tk_ulonglong:
+ return tk_ulonglong;
+ case _tk_longdouble:
+ return tk_longdouble;
+ case _tk_wchar:
+ return tk_wchar;
+ case _tk_wstring:
+ return tk_wstring;
+ case _tk_fixed:
+ return tk_fixed;
+ case _tk_value: // orbos 98-01-18: Objects By Value
+ return tk_value;
+ case _tk_value_box: // orbos 98-01-18: Objects By Value
+ return tk_value_box;
+ case _tk_native:
+ return tk_native;
+ case _tk_abstract_interface:
+ return tk_abstract_interface;
+ default:
+ throw new org.omg.CORBA.BAD_PARAM();
+ }
+ }
+
+
+ /**
+ * Creates a new <code>TCKind</code> instance initialized with the given
+ * <code>int</code>.
+ * @deprecated Do not use this constructor as this method should be private
+ * according to the OMG specification. Use {@link #from_int(int)} instead.
+ *
+ * @param _value the <code>int</code> to convert. It must be one of
+ * the <code>int</code> constants in the class
+ * <code>TCKind</code>.
+ */
+ @Deprecated
+ protected TCKind(int _value){
+ this._value = _value;
+ }
+ private int _value;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TIMEOUT.java b/src/java.corba/share/classes/org/omg/CORBA/TIMEOUT.java
new file mode 100644
index 0000000..ed4a979
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TIMEOUT.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * <code>TIMEOUT</code> is raised when no delivery has been made and the
+ * specified time-to-live period has been exceeded. It is a standard system
+ * exception because time-to-live QoS can be applied to any invocation.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @since J2SE 1.5
+ */
+
+public final class TIMEOUT extends SystemException {
+
+ /**
+ * Constructs an <code>TIMEOUT</code> exception with
+ * minor code set to 0 and CompletionStatus set to COMPLETED_NO.
+ */
+ public TIMEOUT() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>TIMEOUT</code> exception with the
+ * specified message.
+ *
+ * @param detailMessage string containing a detailed message.
+ */
+ public TIMEOUT(String detailMessage) {
+ this(detailMessage, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>TIMEOUT</code> exception with the
+ * specified minor code and completion status.
+ *
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public TIMEOUT(int minorCode,
+ CompletionStatus completionStatus) {
+ this("", minorCode, completionStatus);
+ }
+
+ /**
+ * Constructs an <code>TIMEOUT</code> exception with the
+ * specified message, minor code, and completion status.
+ *
+ * @param detailMessage string containing a detailed message.
+ * @param minorCode minor code.
+ * @param completionStatus completion status.
+ */
+ public TIMEOUT(String detailMessage,
+ int minorCode,
+ CompletionStatus completionStatus) {
+ super(detailMessage, minorCode, completionStatus);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_MODE.java b/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_MODE.java
new file mode 100644
index 0000000..f4ce02c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_MODE.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The CORBA <code>TRANSACTION_MODE</code> exception is thrown
+ * by the client ORB if it detects a mismatch between the
+ * InvocationPolicy in the IOR and the chosen invocation path
+ * (i.e, direct or routed invocation).
+ * It contains a minor code, which gives information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * The OMG CORBA core 2.4 specification has details.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public final class TRANSACTION_MODE extends SystemException {
+ /**
+ * Constructs a <code>TRANSACTION_MODE</code> exception with a default
+ * minor code of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public TRANSACTION_MODE() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_MODE</code> exception with the specified
+ * description message, a minor code of 0, and a completion state of
+ * COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public TRANSACTION_MODE(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_MODE</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public TRANSACTION_MODE(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_MODE</code> exception with the specified
+ * description message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public TRANSACTION_MODE(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_REQUIRED.java b/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_REQUIRED.java
new file mode 100644
index 0000000..5f4d94e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_REQUIRED.java
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception indicates that the request carried a null transaction context,
+ * but an active transaction is required.<P>
+ * It contains a minor code, which gives information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * The OMG Transaction Service specfication has details.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public final class TRANSACTION_REQUIRED extends SystemException {
+ /**
+ * Constructs a <code>TRANSACTION_REQUIRED</code> exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public TRANSACTION_REQUIRED() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_REQUIRED</code> exception with the specified
+ * description message, a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public TRANSACTION_REQUIRED(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_REQUIRED</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public TRANSACTION_REQUIRED(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_REQUIRED</code> exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public TRANSACTION_REQUIRED(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java b/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java
new file mode 100644
index 0000000..52e597c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown when the transaction associated with the request has
+ * already been rolled back or marked to roll back. Thus, the requested
+ * operation either could not be performed or was not performed because
+ * further computation on behalf of the transaction would be fruitless.<P>
+ * See the OMG Transaction
+ * Service specification for details.
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public final class TRANSACTION_ROLLEDBACK extends SystemException {
+ /**
+ * Constructs a <code>TRANSACTION_ROLLEDBACK</code> exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public TRANSACTION_ROLLEDBACK() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_ROLLEDBACK</code> exception with the
+ * specified description message,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public TRANSACTION_ROLLEDBACK(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_ROLLEDBACK</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public TRANSACTION_ROLLEDBACK(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_ROLLEDBACK</code> exception with the
+ * specified description message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public TRANSACTION_ROLLEDBACK(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java b/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java
new file mode 100644
index 0000000..5870c44
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TRANSACTION_UNAVAILABLE.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The CORBA <code>TRANSACTION_UNAVAILABLE</code> exception is thrown
+ * by the ORB when it cannot process a transaction service context because
+ * its connection to the Transaction Service has been abnormally terminated.
+ *
+ * It contains a minor code, which gives information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * The OMG CORBA core 2.4 specification has details.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public final class TRANSACTION_UNAVAILABLE extends SystemException {
+ /**
+ * Constructs a <code>TRANSACTION_UNAVAILABLE</code> exception
+ * with a default minor code of 0, a completion state of
+ * CompletionStatus.COMPLETED_NO, and a null description.
+ */
+ public TRANSACTION_UNAVAILABLE() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_UNAVAILABLE</code> exception with the
+ * specifieddescription message, a minor code of 0, and a completion state
+ * of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public TRANSACTION_UNAVAILABLE(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_UNAVAILABLE</code> exception with the
+ * specified minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public TRANSACTION_UNAVAILABLE(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>TRANSACTION_UNAVAILABLE</code> exception with the
+ * specified description message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public TRANSACTION_UNAVAILABLE(String s, int minor,
+ CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TRANSIENT.java b/src/java.corba/share/classes/org/omg/CORBA/TRANSIENT.java
new file mode 100644
index 0000000..fc03856
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TRANSIENT.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Exception thrown when the ORB attempted to reach an object and failed.
+ * It is not an indication that an object does not exist. Instead, it simply
+ * means that no further determination of an object's status was possible
+ * because it could not be reached. This exception is raised if an attempt
+ * to establish a connection fails, for example, because the server or the
+ * implementation repository is down.<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public final class TRANSIENT extends SystemException {
+ /**
+ * Constructs a <code>TRANSIENT</code> exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public TRANSIENT() {
+ this("");
+ }
+
+ /**
+ * Constructs a <code>TRANSIENT</code> exception with the specified description message,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public TRANSIENT(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs a <code>TRANSIENT</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public TRANSIENT(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs a <code>TRANSIENT</code> exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public TRANSIENT(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java b/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java
new file mode 100644
index 0000000..8366a75
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TypeCode.java
@@ -0,0 +1,516 @@
+/*
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.TypeCodePackage.*;
+import org.omg.CORBA.portable.IDLEntity;
+
+/**
+ * A container for information about a specific CORBA data
+ * type.
+ * <P>
+ * <code>TypeCode</code> objects are used:
+ * <UL>
+ * <LI>in the Dynamic Invocation Interface -- to indicate the types
+ * of the actual arguments or the type of the return value. <BR>
+ * <code>NamedValue</code> objects are used to represent arguments and
+ * return values. One of their components is an <code>Any</code>
+ * object, which in turn has as one of its components a
+ * <code>TypeCode</code> object.
+ * <LI>by an Interface Repository to represent the type specifications
+ * that are part of many OMG IDL declarations
+ * </UL>
+ * <P>
+ * The representation of a <code>TypeCode</code> object is opaque,
+ * but abstractly, a <code>TypeCode</code> object consists of:
+ * <UL>
+ * <LI>a <code>kind</code> field, which is set to an instance
+ * of the class <code>TCKind</code>
+ * <LI>zero or more additional fields appropriate
+ * for the particular kind. For example, the
+ * <code>TypeCode</code> object
+ * describing the OMG IDL type <code>1ong</code> has kind
+ * <code>TCKind.tk_long</code> and no additional fields.
+ * The <code>TypeCode</code> describing OMG IDL type
+ * <code>sequence&lt;boolean, 10&gt;</code> has a <code>kind</code> field
+ * with the value
+ * <code>TCKind.tk_sequence</code> and also fields with the values
+ * <code>boolean</code> and <code>10</code> for the
+ * type of sequence elements and the length of the sequence.
+ * </UL>
+ *
+ * <code>TypeCode</code> objects can be obtained in various ways:
+ * <OL>
+ * <LI>from a call to the method <code>Any.insert_X</code>, where X is
+ * a basic IDL type. This method creates a <code>TypeCode</code> object
+ * for type X and assigns it to the <code>Any</code> object's
+ * <code>type</code> field.
+ * <LI>from invocations of methods in the ORB class
+ * <P>For example, the following creates a <code>TypeCode</code>
+ * object for a <code>string</code> with a maximum of 30 characters:
+ * <PRE>
+ * org.omg.CORBA.TypeCode tcString = orb.create_string_tc(30);
+ * </PRE>
+ * <P> The following creates a <code>TypeCode</code>
+ * object for an <code>array</code> of five <code>string</code>s:
+ * <PRE>
+ * org.omg.CORBA.TypeCode tcArray = orb.create_array_tc(
+ * 5, TCKind.tk_string);
+ * </PRE>
+ * <P> The following creates a <code>TypeCode</code>
+ * object for an interface named "Account":
+ * <PRE>
+ * org.omg.CORBA.TypeCode tcInterface = orb.create_interface_tc(
+ * "thisId", "Account");
+ * </PRE>
+ * <LI>as the return value from the <code>_type</code> method
+ * in <code>Holder</code> classes for user-defined
+ * IDL types. These <code>Holder</code> classes are generated
+ * by the <code>idltojava</code> compiler.
+ * <LI>from a CORBA Interface Repository
+ * </OL>
+ * <P>
+ * Most of the methods in the class <code>TypeCode</code>
+ * are accessors, and the information contained in a <code>TypeCode</code>
+ * object is specific to a particular type. Therefore, methods
+ * must be invoked
+ * only on the kind of type codes to which they apply. If an
+ * accessor method
+ * tries to access information from an inappropriate kind of
+ * type code, it will throw
+ * the exception <code>TypeCodePackage.BadKind</code>. For example,
+ * if the method <code>discriminator_type</code> is called on anything
+ * other than a <code>union</code>, it will throw <code>BadKind</code>
+ * because only <code>union</code>s have a discriminator.
+ * The following list shows which methods apply to which kinds of
+ * type codes:
+ * <P>
+ * These methods may be invoked on all <code>TypeCode</code> kinds:
+ * <UL>
+ * <LI><code>equal</code>
+ * <LI><code>kind</code>
+ * </UL>
+ * <P>
+ * These methods may be invoked on <code>objref</code>, <code>struct</code>,
+ * <code>union</code>, <code>enum</code>,
+ * <code>alias</code>, <code>exception</code>, <code>value</code>,
+ * <code>value_box</code>, <code>native</code>,
+ * and <code>abstract_interface</code>:
+ * <UL>
+ * <LI><code>id</code>
+ * <LI><code>name</code>
+ * </UL>
+ * <P>
+ * These methods may be invoked on <code>struct</code>,
+ * <code>union</code>, <code>enum</code>,
+ * and <code>exception</code>:
+ * <UL>
+ * <LI><code>member_count</code>
+ * <LI><code>member_name</code>
+ * </UL>
+ * <P>
+ * These methods may be invoked on <code>struct</code>,
+ * <code>union</code>, and <code>exception</code>:
+ * <UL>
+ * <LI><code>member_type(int index)</code>
+ * </UL>
+ * <P>
+ * These methods may be invoked on <code>union</code>:
+ * <UL>
+ * <LI><code>member_label</code>
+ * <LI><code>discriminator_type</code>
+ * <LI><code>default_index</code>
+ * </UL>
+ * <P>
+ * These methods may be invoked on <code>string</code>,
+ * <code>sequence</code>, and <code>array</code>:
+ * <UL>
+ * <LI><code>length</code>
+ * </UL>
+ * <P>
+ * These methods may be invoked on <code>alias</code>,
+ * <code>sequence</code>, <code>array</code>, and <code>value_box</code>:
+ * <UL>
+ * <LI><code>content_type</code>
+ * </UL>
+ * <P>
+ * Unlike other CORBA pseudo-objects, <code>TypeCode</code>
+ * objects can be passed as general IDL parameters. <p>
+ * The methods <code>parameter</code> and <code>param_count</code>,
+ * which are deprecated, are not mapped. <p>
+ *
+ * Java IDL extends the CORBA specification to allow all operations permitted
+ * on a <code>struct</code> <code>TypeCode</code> to be permitted
+ * on an <code>exception</code> <code>TypeCode</code> as well.
+ */
+public abstract class TypeCode implements IDLEntity {
+
+ /**
+ * Compares this <code>TypeCode</code> object with the given one,
+ * testing for equality. <code>TypeCode</code> objects are equal if
+ * they are interchangeable and give identical results when
+ * <code>TypeCode</code> operations are applied to them.
+ *
+ * @param tc the <code>TypeCode</code> object to compare against
+ * @return <code>true</code> if the type codes are equal;
+ * <code>false</code> otherwise
+ */
+ public abstract boolean equal(TypeCode tc);
+
+ /**
+ * Tests to see if the given <code>TypeCode</code> object is
+ * equivalent to this <code>TypeCode</code> object.
+ *
+ *
+ * @param tc the typecode to compare with this typecode
+ *
+ * @return <code>true</code> if the given typecode is equivalent to
+ * this typecode; <code>false</code> otherwise
+ *
+ */
+ public abstract boolean equivalent(TypeCode tc);
+
+ /**
+ * Strips out all optional name and member name fields,
+ * but leaves all alias typecodes intact.
+ * @return a <code>TypeCode</code> object with optional name and
+ * member name fields stripped out, except for alias typecodes,
+ * which are left intact
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ public abstract TypeCode get_compact_typecode();
+
+
+ /**
+ * Retrieves the kind of this <code>TypeCode</code> object.
+ * The kind of a type code determines which <code>TypeCode</code>
+ * methods may legally be invoked on it.
+ * <P>
+ * The method <code>kind</code> may be invoked on any
+ * <code>TypeCode</code> object.
+ *
+ * @return the <code>TCKind</code> instance indicating the
+ * value of the <code>kind</code> field of this
+ * <code>TypeCode</code> object
+ */
+ public abstract TCKind kind();
+
+ /**
+ * Retrieves the RepositoryId globally identifying the type
+ * of this <code>TypeCode</code> object.
+ * <P>
+ * The method <code>id</code> can be invoked on object reference,
+ * structure, union, enumeration, alias, exception, valuetype,
+ * boxed valuetype, native, and abstract interface type codes.
+ * Object reference, exception, valuetype, boxed valuetype,
+ * native, and abstract interface <code>TypeCode</code> objects
+ * always have a RepositoryId.
+ * Structure, union, enumeration, and alias <code>TypeCode</code> objects
+ * obtained from the Interface Repository or the method
+ * <code>ORB.create_operation_list</code>
+ * also always have a RepositoryId. If there is no RepositoryId, the
+ * method can return an empty string.
+ *
+ * @return the RepositoryId for this <code>TypeCode</code> object
+ * or an empty string if there is no RepositoryID
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
+ * is invoked on an inappropriate kind of<code>TypeCode</code>
+ * object
+ */
+ public abstract String id() throws BadKind;
+
+ /**
+ * Retrieves the simple name identifying this <code>TypeCode</code>
+ * object within its
+ * enclosing scope. Since names are local to a Repository, the
+ * name returned from a <code>TypeCode</code> object
+ * may not match the name of the
+ * type in any particular Repository, and may even be an empty
+ * string.
+ * <P>
+ * The method <code>name</code> can be invoked on object reference,
+ * structure, union, enumeration, alias, exception, valuetype,
+ * boxed valuetype, native, and abstract interface
+ * <code>TypeCode</code> objects.
+ *
+ * @return the name identifying this <code>TypeCode</code> object
+ * or an empty string
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
+ * is invoked on an inappropriate kind of<code>TypeCode</code>
+ * object
+ */
+ public abstract String name() throws BadKind;
+
+ /**
+ * Retrieves the number of members in the type described by
+ * this <code>TypeCode</code> object.
+ * <P>
+ * The method <code>member_count</code> can be invoked on
+ * structure, union, and enumeration <code>TypeCode</code> objects.
+ * Java IDL extends the CORBA specification to allow this method to
+ * operate on exceptions as well.
+ *
+ * @return the number of members constituting the type described
+ * by this <code>TypeCode</code> object
+ *
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
+ * is invoked on an inappropriate kind of <code>TypeCode</code>
+ * object
+ */
+ public abstract int member_count() throws BadKind;
+
+ /**
+ * Retrieves the simple name of the member identified by
+ * the given index. Since names are local to a
+ * Repository, the name returned from a <code>TypeCode</code> object
+ * may not match the name of the member in any particular
+ * Repository, and may even be an empty string.
+ * <P>
+ * The method <code>member_name</code> can be invoked on structure, union,
+ * and enumeration <code>TypeCode</code> objects.
+ * Java IDL extends the CORBA specification to allow this method to
+ * operate on exceptions as well.
+ *
+ * @param index index of the member for which a name is being reqested
+ * @return simple name of the member identified by the
+ * index or an empty string
+ * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is equal
+ * to or greater than
+ * the number of members constituting the type
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
+ * is invoked on an inappropriate kind of <code>TypeCode</code>
+ * object
+ */
+ public abstract String member_name(int index)
+ throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds;
+
+ /**
+ * Retrieves the <code>TypeCode</code> object describing the type
+ * of the member identified by the given index.
+ * <P>
+ * The method <code>member_type</code> can be invoked on structure
+ * and union <code>TypeCode</code> objects.
+ * Java IDL extends the CORBA specification to allow this method to
+ * operate on exceptions as well.
+ *
+ * @param index index of the member for which type information
+ * is begin requested
+ * @return the <code>TypeCode</code> object describing the
+ * member at the given index
+ * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is
+ * equal to or greater than
+ * the number of members constituting the type
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
+ * is invoked on an inappropriate kind of <code>TypeCode</code>
+ * object
+ */
+ public abstract TypeCode member_type(int index)
+ throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds;
+
+ /**
+ * Retrieves the label of the union member
+ * identified by the given index. For the default member,
+ * the label is the zero octet.
+ * <P>
+ * The method <code>member_label</code> can only be invoked on union
+ * <code>TypeCode</code> objects.
+ *
+ * @param index index of the union member for which the
+ * label is being requested
+ * @return an <code>Any</code> object describing the label of
+ * the requested union member or the zero octet for
+ * the default member
+ * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is
+ * equal to or greater than
+ * the number of members constituting the union
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
+ * is invoked on a non-union <code>TypeCode</code>
+ * object
+ */
+ public abstract Any member_label(int index)
+ throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds;
+
+ /**
+ * Returns a <code>TypeCode</code> object describing
+ * all non-default member labels.
+ * The method <code>discriminator_type</code> can be invoked only
+ * on union <code>TypeCode</code> objects.
+ *
+ * @return the <code>TypeCode</code> object describing
+ * the non-default member labels
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
+ * is invoked on a non-union <code>TypeCode</code>
+ * object
+ */
+ public abstract TypeCode discriminator_type()
+ throws BadKind;
+
+ /**
+ * Returns the index of the
+ * default member, or -1 if there is no default member.
+ * <P>
+ * The method <code>default_index</code> can be invoked only on union
+ * <code>TypeCode</code> objects.
+ *
+ * @return the index of the default member, or -1 if
+ * there is no default member
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
+ * is invoked on a non-union <code>TypeCode</code>
+ * object
+ */
+ public abstract int default_index() throws BadKind;
+
+ /**
+ * Returns the number of elements in the type described by
+ * this <code>TypeCode</code> object.
+ * For strings and sequences, it returns the
+ * bound, with zero indicating an unbounded string or sequence.
+ * For arrays, it returns the number of elements in the array.
+ * <P>
+ * The method <code>length</code> can be invoked on string, sequence, and
+ * array <code>TypeCode</code> objects.
+ *
+ * @return the bound for strings and sequences, or the
+ * number of elements for arrays
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
+ * is invoked on an inappropriate kind of <code>TypeCode</code>
+ * object
+ */
+ public abstract int length() throws BadKind;
+
+ /**
+ * Returns the <code>TypeCode</code> object representing the
+ * IDL type for the members of the object described by this
+ * <code>TypeCode</code> object.
+ * For sequences and arrays, it returns the
+ * element type. For aliases, it returns the original type. Note
+ * that multidimensional arrays are represented by nesting
+ * <code>TypeCode</code> objects, one per dimension.
+ * For boxed valuetypes, it returns the boxed type.
+ * <P>
+ * The method <code>content_type</code> can be invoked on sequence, array,
+ * alias, and boxed valuetype <code>TypeCode</code> objects.
+ *
+ * @return a <code>TypeCode</code> object representing
+ * the element type for sequences and arrays, the
+ * original type for aliases, or the
+ * boxed type for boxed valuetypes.
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if the method
+ * is invoked on an inappropriate kind of <code>TypeCode</code>
+ * object
+ */
+ public abstract TypeCode content_type() throws BadKind;
+
+
+ /**
+ * Returns the number of digits in the fixed type described by this
+ * <code>TypeCode</code> object. For example, the typecode for
+ * the number 3000.275d could be <code>fixed&lt;7,3&gt;</code>, where
+ * 7 is the precision and 3 is the scale.
+ *
+ * @return the total number of digits
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method
+ * is invoked on an inappropriate kind of <code>TypeCode</code>
+ * object
+ *
+ */
+ public abstract short fixed_digits() throws BadKind ;
+
+ /**
+ * Returns the scale of the fixed type described by this
+ * <code>TypeCode</code> object. A positive number indicates the
+ * number of digits to the right of the decimal point.
+ * For example, the number 3000d could have the
+ * typecode <code>fixed&lt;4,0&gt;</code>, where the first number is
+ * the precision and the second number is the scale.
+ * A negative number is also possible and adds zeroes to the
+ * left of the decimal point. In this case, <code>fixed&lt;1,-3&gt;</code>,
+ * could be the typecode for the number 3000d.
+ *
+ * @return the scale of the fixed type that this
+ * <code>TypeCode</code> object describes
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method
+ * is invoked on an inappropriate kind of <code>TypeCode</code>
+ * object
+ */
+ public abstract short fixed_scale() throws BadKind ;
+
+ /**
+ * Returns the constant that indicates the visibility of the member
+ * at the given index.
+ *
+ * This operation can only be invoked on non-boxed value
+ * <code>TypeCode</code> objects.
+ *
+ * @param index an <code>int</code> indicating the index into the
+ * value
+ * @return either <code>PRIVATE_MEMBER.value</code> or
+ * <code>PUBLIC_MEMBER.value</code>
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method
+ * is invoked on a non-value type <code>TypeCode</code>
+ * object
+ * @throws org.omg.CORBA.TypeCodePackage.Bounds
+ * if the given index is out of bounds
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ abstract public short member_visibility(int index)
+ throws BadKind, org.omg.CORBA.TypeCodePackage.Bounds ;
+
+ /**
+ * Returns a constant indicating the modifier of the value type
+ * that this <code>TypeCode</code> object describes. The constant
+ * returned must be one of the following: <code>VM_NONE.value</code>,
+ * <code>VM_ABSTRACT.value</code>, <code>VM_CUSTOM.value</code>,
+ * or <code>VM_TRUNCATABLE.value</code>,
+ *
+ * @return a constant describing the value type
+ * that this <code>TypeCode</code> object describes
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind
+ * if this method
+ * is invoked on a non-value type <code>TypeCode</code>
+ * object
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ abstract public short type_modifier() throws BadKind ;
+
+ /**
+ * Returns the <code>TypeCode</code> object that describes the concrete base type
+ * of the value type that this <code>TypeCode</code> object describes.
+ * Returns null if it doesn't have a concrete base type.
+ *
+ * @return the <code>TypeCode</code> object that describes the
+ * concrete base type of the value type
+ * that this <code>TypeCode</code> object describes
+ * @throws org.omg.CORBA.TypeCodePackage.BadKind if this method
+ * is invoked on a non-boxed value type <code>TypeCode</code> object
+ * @see <a href="package-summary.html#unimpl"><code>CORBA</code> package
+ * comments for unimplemented features</a>
+ */
+ abstract public TypeCode concrete_base_type() throws BadKind ;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TypeCodeHolder.java b/src/java.corba/share/classes/org/omg/CORBA/TypeCodeHolder.java
new file mode 100644
index 0000000..2fcde8b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TypeCodeHolder.java
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 1996, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Holder for {@code TypeCode}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a {@code TypeCode} object
+ * that is used to store "out" and "inout" parameters in IDL operations.
+ * If an IDL operation signature has an IDL {@code TypeCode} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code TypeCodeHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myTypeCodeHolder} is an instance of {@code TypeCodeHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myTypeCodeHolder.value}.
+ *
+ * @since JDK1.2
+ */
+public final class TypeCodeHolder implements Streamable {
+
+ /**
+ * The {@code TypeCode} value held by
+ * this {@code TypeCodeHolder} object.
+ */
+ public TypeCode value;
+
+ /**
+ * Constructs a new {@code TypeCodeHolder} object with its
+ * {@code value} field initialized to {@code null}.
+ */
+ public TypeCodeHolder() {
+ }
+
+ /**
+ * Constructs a new {@code TypeCodeHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code TypeCode} object.
+ * @param initial the {@code TypeCode} object with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code TypeCodeHolder} object
+ */
+ public TypeCodeHolder(TypeCode initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads from {@code input} and initalizes the value in
+ * this {@code TypeCodeHolder} object
+ * with the unmarshalled data.
+ *
+ * @param input the InputStream containing CDR formatted data from the wire
+ */
+ public void _read(InputStream input) {
+ value = input.read_TypeCode();
+ }
+
+ /**
+ * Marshals to {@code output} the value in
+ * this {@code TypeCodeHolder} object.
+ *
+ * @param output the OutputStream which will contain the CDR formatted data
+ */
+ public void _write(OutputStream output) {
+ output.write_TypeCode(value);
+ }
+
+ /**
+ * Returns the TypeCode corresponding to the value held in
+ * this {@code TypeCodeHolder} object.
+ *
+ * @return the TypeCode of the value held in
+ * this {@code TypeCodeHolder} object
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_TypeCode);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKind.java b/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKind.java
new file mode 100644
index 0000000..e139c2b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKind.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.TypeCodePackage;
+
+/**
+ * The exception <code>BadKind</code> is thrown when
+ * an inappropriate operation is invoked on a <code>TypeCode</code> object. For example,
+ * invoking the method <code>discriminator_type()</code> on an instance of
+ * <code>TypeCode</code> that does not represent an IDL union will cause the
+ * exception <code>BadKind</code> to be thrown.
+ *
+ * @see org.omg.CORBA.TypeCode
+ * @since JDK1.2
+ */
+
+public final class BadKind extends org.omg.CORBA.UserException {
+ /**
+ * Constructs a <code>BadKind</code> exception with no reason message.
+ */
+ public BadKind() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>BadKind</code> exception with the specified
+ * reason message.
+ * @param reason the String containing a reason message
+ */
+ public BadKind(String reason) {
+ super(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKindHelper.java b/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKindHelper.java
new file mode 100644
index 0000000..b9c1756
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BadKindHelper.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.TypeCodePackage;
+
+
+/**
+ * This Helper class is used to facilitate the marshalling of
+ * {@code TypeCodePackage/BadKind}.
+ * For more information on Helper files, see
+ * <a href="{@docRoot}/org/omg/CORBA/doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.
+ */
+
+abstract public class BadKindHelper
+{
+ private static String _id = "IDL:omg.org.CORBA/TypeCode/BadKind:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.TypeCodePackage.BadKind 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.TypeCodePackage.BadKind 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 [0];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.TypeCodePackage.BadKindHelper.id (), "BadKind", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.TypeCodePackage.BadKind read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.TypeCodePackage.BadKind value = new org.omg.CORBA.TypeCodePackage.BadKind ();
+ // read and discard the repository ID
+ istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.TypeCodePackage.BadKind value)
+ {
+ // write the repository ID
+ ostream.write_string (id ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/Bounds.java b/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/Bounds.java
new file mode 100644
index 0000000..059a3ab
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/Bounds.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.TypeCodePackage;
+
+/**
+ * Provides the <code>TypeCode</code> operations <code>member_name()</code>,
+ * <code>member_type()</code>, and <code>member_label</code>.
+ * These methods
+ * raise <code>Bounds</code> when the index parameter is greater than or equal
+ * to the number of members constituting the type.
+ *
+ * @since JDK1.2
+ */
+
+public final class Bounds extends org.omg.CORBA.UserException {
+
+ /**
+ * Constructs a <code>Bounds</code> exception with no reason message.
+ */
+ public Bounds() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>Bounds</code> exception with the specified
+ * reason message.
+ * @param reason the String containing a reason message
+ */
+ public Bounds(String reason) {
+ super(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BoundsHelper.java b/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BoundsHelper.java
new file mode 100644
index 0000000..5c1c89f
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/BoundsHelper.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.TypeCodePackage;
+
+
+/**
+ * This Helper class is used to facilitate the marshalling of
+ * {@code TypeCodePackage/Bounds}.
+ * For more information on Helper files, see
+ * <a href="{@docRoot}/org/omg/CORBA/doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.
+ */
+
+abstract public class BoundsHelper
+{
+ private static String _id = "IDL:omg.org.CORBA/TypeCode/Bounds:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.TypeCodePackage.Bounds 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.TypeCodePackage.Bounds 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 [0];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.TypeCodePackage.BoundsHelper.id (), "Bounds", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.TypeCodePackage.Bounds read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.TypeCodePackage.Bounds value = new org.omg.CORBA.TypeCodePackage.Bounds ();
+ // read and discard the repository ID
+ istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.TypeCodePackage.Bounds value)
+ {
+ // write the repository ID
+ ostream.write_string (id ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/package.html b/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/package.html
new file mode 100644
index 0000000..e69994d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/TypeCodePackage/package.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+/*
+* Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation. Oracle designates this
+* particular file as subject to the "Classpath" exception as provided
+* by Oracle in the LICENSE file that accompanied this code.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+-->
+</head>
+<body bgcolor="white">
+
+Provides the user-defined exceptions <code>BadKind</code>
+and <code>Bounds</code>, which are thrown by methods in
+in the class <code>TypeCode</code>.
+
+
+ <h2>Related Documentation</h2>
+
+For an overview, please see:
+<ul>
+ <li><a href="../package-summary.html#package_description">
+ comments on the <code>CORBA</code> package</a>
+
+ </ul>
+
+
+@since JDK1.2
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHelper.java
new file mode 100644
index 0000000..54376e8
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code ULongLongSeq}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/ULongLongSeqHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from streams.idl
+* 13 May 1999 22:41:37 o'clock GMT+00:00
+*
+* The class definition has been modified to conform to the following
+* OMG specifications :
+* <ul>
+* <li> ORB core as defined by CORBA 2.3.1
+* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+* </li>
+*
+* <li> IDL/Java Language Mapping as defined in
+* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+* </li>
+* </ul>
+*/
+
+public abstract class ULongLongSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ULongLongSeq:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, long[] 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 long[] 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_ulonglong);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.ULongLongSeqHelper.id (), "ULongLongSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static long[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ long value[] = null;
+ int _len0 = istream.read_long ();
+ value = new long[_len0];
+ istream.read_ulonglong_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, long[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_ulonglong_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHolder.java
new file mode 100644
index 0000000..a56e64b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ULongLongSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Holder for {@code ULongLongSeq}. For more information on
+* Holder files, see <a href="doc-files/generatedfiles.html#holder">
+* "Generated Files: Holder Files"</a>.<P>
+* org/omg/CORBA/ULongLongSeqHolder.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from streams.idl
+* 13 May 1999 22:41:37 o'clock GMT+00:00
+*/
+
+public final class ULongLongSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public long value[] = null;
+
+ public ULongLongSeqHolder ()
+ {
+ }
+
+ public ULongLongSeqHolder (long[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.ULongLongSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.ULongLongSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.ULongLongSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHelper.java
new file mode 100644
index 0000000..c89e7b7
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code ULongSeq}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/ULongSeqHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from streams.idl
+* 13 May 1999 22:41:36 o'clock GMT+00:00
+*
+* The class definition has been modified to conform to the following
+* OMG specifications :
+* <ul>
+* <li> ORB core as defined by CORBA 2.3.1
+* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+* </li>
+*
+* <li> IDL/Java Language Mapping as defined in
+* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+* </li>
+* </ul>
+*/
+
+public abstract class ULongSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ULongSeq:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, int[] 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 int[] 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_ulong);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.ULongSeqHelper.id (), "ULongSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static int[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ int value[] = null;
+ int _len0 = istream.read_long ();
+ value = new int[_len0];
+ istream.read_ulong_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, int[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_ulong_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHolder.java
new file mode 100644
index 0000000..0895bb4
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ULongSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Holder for {@code ULongSeq}. For more information on
+* Holder files, see <a href="doc-files/generatedfiles.html#holder">
+* "Generated Files: Holder Files"</a>.<P>
+* org/omg/CORBA/ULongSeqHolder.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from streams.idl
+* 13 May 1999 22:41:36 o'clock GMT+00:00
+*/
+
+public final class ULongSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public int value[] = null;
+
+ public ULongSeqHolder ()
+ {
+ }
+
+ public ULongSeqHolder (int[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.ULongSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.ULongSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.ULongSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UNKNOWN.java b/src/java.corba/share/classes/org/omg/CORBA/UNKNOWN.java
new file mode 100644
index 0000000..ba57f3e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UNKNOWN.java
@@ -0,0 +1,88 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * This exception is raised if an operation implementation
+ * throws a non-CORBA exception (such as an exception
+ * specific to the implementation's programming language),
+ * or if an operation raises a user exception that does not
+ * appear in the operation's raises expression. UNKNOWN is
+ * also raised if the server returns a system exception that
+ * is unknown to the client. (This can happen if the server
+ * uses a later version of CORBA than the client and new system
+ * exceptions have been added to the later version.)<P>
+ * It contains a minor code, which gives more detailed information about
+ * what caused the exception, and a completion status. It may also contain
+ * a string describing the exception.
+ * <P>
+ * See the section {@extLink jidlexception_minorcodes Minor Code Meaning}
+ * to see the minor codes for this exception.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public final class UNKNOWN extends SystemException {
+ /**
+ * Constructs an <code>UNKNOWN</code> exception with a default minor code
+ * of 0, a completion state of CompletionStatus.COMPLETED_NO,
+ * and a null description.
+ */
+ public UNKNOWN() {
+ this("");
+ }
+
+ /**
+ * Constructs an <code>UNKNOWN</code> exception with the specified description message,
+ * a minor code of 0, and a completion state of COMPLETED_NO.
+ * @param s the String containing a detail message
+ */
+ public UNKNOWN(String s) {
+ this(s, 0, CompletionStatus.COMPLETED_NO);
+ }
+
+ /**
+ * Constructs an <code>UNKNOWN</code> exception with the specified
+ * minor code and completion status.
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public UNKNOWN(int minor, CompletionStatus completed) {
+ this("", minor, completed);
+ }
+
+ /**
+ * Constructs an <code>UNKNOWN</code> exception with the specified description
+ * message, minor code, and completion status.
+ * @param s the String containing a description message
+ * @param minor the minor code
+ * @param completed the completion status
+ */
+ public UNKNOWN(String s, int minor, CompletionStatus completed) {
+ super(s, minor, completed);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY.java b/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY.java
new file mode 100644
index 0000000..fb6d960
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY.java
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * One of the {@code PolicyErrorCode}s which would be filled if
+ * the requested {@code Policy} is understood to be valid by the
+ * ORB, but is not currently supported.
+ *
+ * @author rip-dev
+ */
+public interface UNSUPPORTED_POLICY {
+ /**
+ * The Error code for PolicyError exception.
+ */
+ final short value = (short) (1L);
+};
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java b/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java
new file mode 100644
index 0000000..a070b9f
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UNSUPPORTED_POLICY_VALUE.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1998, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A {@code PolicyErrorCode} which would be filled if the value
+ * requested for the {@code Policy} is of a
+ * valid type and within the valid range for that type, but this valid value
+ * is not currently supported.
+ *
+ * @author rip-dev
+ */
+public interface UNSUPPORTED_POLICY_VALUE {
+ /**
+ * The Error code for PolicyError exception.
+ */
+ final short value = (short) (4L);
+};
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHelper.java
new file mode 100644
index 0000000..aa6f92f
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code UShortSeq}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/UShortSeqHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from streams.idl
+* 13 May 1999 22:41:36 o'clock GMT+00:00
+*
+* The class definition has been modified to conform to the following
+* OMG specifications :
+* <ul>
+* <li> ORB core as defined by CORBA 2.3.1
+* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+* </li>
+*
+* <li> IDL/Java Language Mapping as defined in
+* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+* </li>
+* </ul>
+*/
+
+public abstract class UShortSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/UShortSeq: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 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_ushort);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.UShortSeqHelper.id (), "UShortSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static short[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ short value[] = null;
+ int _len0 = istream.read_long ();
+ value = new short[_len0];
+ istream.read_ushort_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, short[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_ushort_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHolder.java
new file mode 100644
index 0000000..d9ab409
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UShortSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Holder for {@code UShortSeq}. For more information on
+* Holder files, see <a href="doc-files/generatedfiles.html#holder">
+* "Generated Files: Holder Files"</a>.<P>
+* org/omg/CORBA/UShortSeqHolder.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from streams.idl
+* 13 May 1999 22:41:36 o'clock GMT+00:00
+*/
+
+public final class UShortSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public short value[] = null;
+
+ public UShortSeqHolder ()
+ {
+ }
+
+ public UShortSeqHolder (short[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.UShortSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.UShortSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.UShortSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UnionMember.java b/src/java.corba/share/classes/org/omg/CORBA/UnionMember.java
new file mode 100644
index 0000000..61d2593
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UnionMember.java
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * File: ./org/omg/CORBA/UnionMember.java
+ * From: ./ir.idl
+ * Date: Fri Aug 28 16:03:31 1998
+ * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A description in the Interface Repository of a member of an IDL union.
+ */
+public final class UnionMember implements org.omg.CORBA.portable.IDLEntity {
+ // instance variables
+
+ /**
+ * The name of the union member described by this
+ * <code>UnionMember</code> object.
+ * @serial
+ */
+ public String name;
+
+ /**
+ * The label of the union member described by this
+ * <code>UnionMember</code> object.
+ * @serial
+ */
+ public org.omg.CORBA.Any label;
+
+ /**
+ * The type of the union member described by this
+ * <code>UnionMember</code> object.
+ * @serial
+ */
+ public org.omg.CORBA.TypeCode type;
+
+ /**
+ * The typedef that represents the IDL type of the union member described by this
+ * <code>UnionMember</code> object.
+ * @serial
+ */
+ public org.omg.CORBA.IDLType type_def;
+
+ // constructors
+
+ /**
+ * Constructs a new <code>UnionMember</code> object with its fields initialized
+ * to null.
+ */
+ public UnionMember() { }
+
+ /**
+ * Constructs a new <code>UnionMember</code> object with its fields initialized
+ * to the given values.
+ *
+ * @param __name a <code>String</code> object with the name of this
+ * <code>UnionMember</code> object
+ * @param __label an <code>Any</code> object with the label of this
+ * <code>UnionMember</code> object
+ * @param __type a <code>TypeCode</code> object describing the type of this
+ * <code>UnionMember</code> object
+ * @param __type_def an <code>IDLType</code> object that represents the
+ * IDL type of this <code>UnionMember</code> object
+ */
+ public UnionMember(String __name, org.omg.CORBA.Any __label, org.omg.CORBA.TypeCode __type, org.omg.CORBA.IDLType __type_def) {
+ name = __name;
+ label = __label;
+ type = __type;
+ type_def = __type_def;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UnionMemberHelper.java b/src/java.corba/share/classes/org/omg/CORBA/UnionMemberHelper.java
new file mode 100644
index 0000000..de52b23
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UnionMemberHelper.java
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code UnionMember}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/UnionMemberHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ir.idl
+* 03 June 1999 11:33:43 o'clock GMT+00:00
+*/
+
+abstract public class UnionMemberHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/UnionMember:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.UnionMember 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.UnionMember 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 (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_any);
+ _members0[1] = new org.omg.CORBA.StructMember (
+ "label",
+ _tcOf_members0,
+ null);
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_TypeCode);
+ _members0[2] = new org.omg.CORBA.StructMember (
+ "type",
+ _tcOf_members0,
+ null);
+ _tcOf_members0 = org.omg.CORBA.IDLTypeHelper.type ();
+ _members0[3] = new org.omg.CORBA.StructMember (
+ "type_def",
+ _tcOf_members0,
+ null);
+ __typeCode = org.omg.CORBA.ORB.init ().create_struct_tc (org.omg.CORBA.UnionMemberHelper.id (), "UnionMember", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.UnionMember read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.UnionMember value = new org.omg.CORBA.UnionMember ();
+ value.name = istream.read_string ();
+ value.label = istream.read_any ();
+ value.type = istream.read_TypeCode ();
+ value.type_def = org.omg.CORBA.IDLTypeHelper.read (istream);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.UnionMember value)
+ {
+ ostream.write_string (value.name);
+ ostream.write_any (value.label);
+ ostream.write_TypeCode (value.type);
+ org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UnknownUserException.java b/src/java.corba/share/classes/org/omg/CORBA/UnknownUserException.java
new file mode 100644
index 0000000..4a65b0a
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UnknownUserException.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A class that contains user exceptions returned by the server.
+ * When the client uses the DII to make an invocation, any user exception
+ * returned from the server is enclosed in an <code>Any</code> object contained in the
+ * <code>UnknownUserException</code> object. This is available from the
+ * <code>Environment</code> object returned by the method <code>Request.env</code>.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ * @see Request
+ */
+
+public final class UnknownUserException extends UserException {
+
+ /** The <code>Any</code> instance that contains the actual user exception thrown
+ * by the server.
+ * @serial
+ */
+ public Any except;
+
+ /**
+ * Constructs an <code>UnknownUserException</code> object.
+ */
+ public UnknownUserException() {
+ super();
+ }
+
+ /**
+ * Constructs an <code>UnknownUserException</code> object that contains the given
+ * <code>Any</code> object.
+ *
+ * @param a an <code>Any</code> object that contains a user exception returned
+ * by the server
+ */
+ public UnknownUserException(Any a) {
+ super();
+ except = a;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHelper.java b/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHelper.java
new file mode 100644
index 0000000..32ff8ee
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHelper.java
@@ -0,0 +1,106 @@
+/*
+ * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code UnknownUserException}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/UnknownUserExceptionHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from CORBA.idl
+* Thursday, August 24, 2000 5:52:22 PM PDT
+*/
+
+abstract public class UnknownUserExceptionHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/UnknownUserException:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.UnknownUserException 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.UnknownUserException 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 [1];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ _tcOf_members0 = org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_any);
+ _members0[0] = new org.omg.CORBA.StructMember (
+ "except",
+ _tcOf_members0,
+ null);
+ __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.UnknownUserExceptionHelper.id (), "UnknownUserException", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.UnknownUserException read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.UnknownUserException value = new org.omg.CORBA.UnknownUserException ();
+ // read and discard the repository ID
+ istream.read_string ();
+ value.except = istream.read_any ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.UnknownUserException value)
+ {
+ // write the repository ID
+ ostream.write_string (id ());
+ ostream.write_any (value.except);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHolder.java b/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHolder.java
new file mode 100644
index 0000000..ee5ccd9
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UnknownUserExceptionHolder.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+/**
+* The Holder for {@code UnknownUserException}. For more information on
+* Holder files, see <a href="doc-files/generatedfiles.html#holder">
+* "Generated Files: Holder Files"</a>.<P>
+* org/omg/CORBA/UnknownUserExceptionHolder.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from CORBA.idl
+* Thursday, August 24, 2000 5:52:22 PM PDT
+*/
+
+public final class UnknownUserExceptionHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.omg.CORBA.UnknownUserException value = null;
+
+ public UnknownUserExceptionHolder ()
+ {
+ }
+
+ public UnknownUserExceptionHolder (org.omg.CORBA.UnknownUserException initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.UnknownUserExceptionHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.UnknownUserExceptionHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.UnknownUserExceptionHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/UserException.java b/src/java.corba/share/classes/org/omg/CORBA/UserException.java
new file mode 100644
index 0000000..fa803d7
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/UserException.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The root class for CORBA IDL-defined user exceptions.
+ * All CORBA user exceptions are checked exceptions, which
+ * means that they need to
+ * be declared in method signatures.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+public abstract class UserException extends java.lang.Exception implements org.omg.CORBA.portable.IDLEntity {
+
+ /**
+ * Constructs a <code>UserException</code> object.
+ * This method is called only by subclasses.
+ */
+ protected UserException() {
+ super();
+ }
+
+ /**
+ * Constructs a <code>UserException</code> object with a
+ * detail message. This method is called only by subclasses.
+ *
+ * @param reason a <code>String</code> object giving the reason for this
+ * exception
+ */
+ protected UserException(String reason) {
+ super(reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/VM_ABSTRACT.java b/src/java.corba/share/classes/org/omg/CORBA/VM_ABSTRACT.java
new file mode 100644
index 0000000..8bbc8f7
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/VM_ABSTRACT.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/** Defines the code used to represent an Abstract interface in
+* a typecode.
+* This is one of the possible results of the <code>type_modified</code>
+* method on the <code>TypeCode</code> interface.
+* @see org.omg.CORBA.TypeCode
+*/
+public interface VM_ABSTRACT {
+ /** The value representing an abstract interface value type in
+ * a typecode.
+ */
+ final short value = (short) (2L);
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/VM_CUSTOM.java b/src/java.corba/share/classes/org/omg/CORBA/VM_CUSTOM.java
new file mode 100644
index 0000000..d9b4034
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/VM_CUSTOM.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/** Defines the code used to represent a custom marshalled value type in
+* a typecode.
+* This is one of the possible results of the <code>type_modifier</code>
+* method on the <code>TypeCode</code> interface.
+* @see org.omg.CORBA.TypeCode
+*/
+public interface VM_CUSTOM {
+ /** The value representing a custom marshalled value type in
+ * a typecode.
+ */
+ final short value = (short) (1L);
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/VM_NONE.java b/src/java.corba/share/classes/org/omg/CORBA/VM_NONE.java
new file mode 100644
index 0000000..ec0fac4
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/VM_NONE.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * Defines the code used to represent the one of the values of a value type
+ * in a typecode.
+ *
+ * @author OMG
+ * @see org.omg.CORBA.TypeCode
+ * @since JDK1.2
+ */
+
+
+public interface VM_NONE {
+ /**
+ * The value representing the value type in a typecode as per
+ * CORBA 2.3 spec.
+ */
+ final short value = (short) (0L);
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/VM_TRUNCATABLE.java b/src/java.corba/share/classes/org/omg/CORBA/VM_TRUNCATABLE.java
new file mode 100644
index 0000000..d2cee0b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/VM_TRUNCATABLE.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/** Defines the code used to represent a truncatable value type in
+* a typecode. A value type is truncatable if it inherits "safely"
+* from another value type, which means it can be cast to a more
+* general inherited type.
+* This is one of the possible results of the <code>type_modifier</code>
+* method on the <code>TypeCode</code> interface.
+* @see org.omg.CORBA.TypeCode
+*/
+public interface VM_TRUNCATABLE {
+ /** The value representing a truncatable value type in
+ * a typecode.
+ */
+ final short value = (short) (3L);
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHelper.java b/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHelper.java
new file mode 100644
index 0000000..68a1066
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHelper.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+ /**
+ * The Helper for {@code ValueBase}. For more information on
+ * Helper files, see <a href="doc-files/generatedfiles.html#helper">
+ * "Generated Files: Helper Files"</a>.<P>
+ */
+
+/*
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA;
+
+abstract public class ValueBaseHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ValueBase:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, java.io.Serializable 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 java.io.Serializable 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 (TCKind.tk_value);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static java.io.Serializable read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return ((org.omg.CORBA_2_3.portable.InputStream)istream).read_value ();
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)
+ {
+ ((org.omg.CORBA_2_3.portable.OutputStream)ostream).write_value (value);
+ }
+
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHolder.java b/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHolder.java
new file mode 100644
index 0000000..364aba7
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ValueBaseHolder.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+import org.omg.CORBA.portable.Streamable;
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+
+/**
+ * The Holder for {@code ValueBase}. For more information on
+ * Holder files, see <a href="doc-files/generatedfiles.html#holder">
+ * "Generated Files: Holder Files"</a>.<P>
+ * A Holder class for a {@code java.io.Serializable}
+ * that is used to store "out" and "inout" parameters in IDL methods.
+ * If an IDL method signature has an IDL {@code ValueBase} as an "out"
+ * or "inout" parameter, the programmer must pass an instance of
+ * {@code ValueBaseHolder} as the corresponding
+ * parameter in the method invocation; for "inout" parameters, the programmer
+ * must also fill the "in" value to be sent to the server.
+ * Before the method invocation returns, the ORB will fill in the
+ * value corresponding to the "out" value returned from the server.
+ * <P>
+ * If {@code myValueBaseHolder} is an instance of {@code ValueBaseHolder},
+ * the value stored in its {@code value} field can be accessed with
+ * {@code myValueBaseHolder.value}.
+ *
+ */
+public final class ValueBaseHolder implements Streamable {
+
+ /**
+ * The {@code java.io.Serializable} value held by this
+ * {@code ValueBaseHolder} object.
+ */
+ public java.io.Serializable value;
+
+ /**
+ * Constructs a new {@code ValueBaseHolder} object with its
+ * {@code value} field initialized to {@code 0}.
+ */
+ public ValueBaseHolder() {
+ }
+
+ /**
+ * Constructs a new {@code ValueBaseHolder} object with its
+ * {@code value} field initialized to the given
+ * {@code java.io.Serializable}.
+ * @param initial the {@code java.io.Serializable} with which to initialize
+ * the {@code value} field of the newly-created
+ * {@code ValueBaseHolder} object
+ */
+ public ValueBaseHolder(java.io.Serializable initial) {
+ value = initial;
+ }
+
+ /**
+ * Reads from {@code input} and initalizes the value in the Holder
+ * with the unmarshalled data.
+ *
+ * @param input the InputStream containing CDR formatted data from the wire
+ */
+ public void _read(InputStream input) {
+ value = ((org.omg.CORBA_2_3.portable.InputStream)input).read_value();
+ }
+
+ /**
+ * Marshals to {@code output} the value in the Holder.
+ *
+ * @param output the OutputStream which will contain the CDR formatted data
+ */
+ public void _write(OutputStream output) {
+ ((org.omg.CORBA_2_3.portable.OutputStream)output).write_value(value);
+ }
+
+ /**
+ * Returns the {@code TypeCode} object
+ * corresponding to the value held in the Holder.
+ *
+ * @return the TypeCode of the value held in the holder
+ */
+ public org.omg.CORBA.TypeCode _type() {
+ return ORB.init().get_primitive_tc(TCKind.tk_value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ValueMember.java b/src/java.corba/share/classes/org/omg/CORBA/ValueMember.java
new file mode 100644
index 0000000..6477938
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ValueMember.java
@@ -0,0 +1,121 @@
+/*
+ * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * File: ./org/omg/CORBA/ValueMember.java
+ * From: ./ir.idl
+ * Date: Fri Aug 28 16:03:31 1998
+ * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
+ */
+
+package org.omg.CORBA;
+
+/**
+ * A description in the Interface Repository of
+ * a member of a <code>value</code> object.
+ */
+public final class ValueMember implements org.omg.CORBA.portable.IDLEntity {
+
+ // instance variables
+
+ /**
+ * The name of the <code>value</code> member described by this
+ * <code>ValueMember</code> object.
+ * @serial
+ */
+ public String name;
+
+ /**
+ * The repository ID of the <code>value</code> member described by
+ * this <code>ValueMember</code> object;
+ * @serial
+ */
+ public String id;
+
+ /**
+ * The repository ID of the <code>value</code> in which this member
+ * is defined.
+ * @serial
+ */
+ public String defined_in;
+
+ /**
+ * The version of the <code>value</code> in which this member is defined.
+ * @serial
+ */
+ public String version;
+
+ /**
+ * The type of of this <code>value</code> member.
+ * @serial
+ */
+ public org.omg.CORBA.TypeCode type;
+
+ /**
+ * The typedef that represents the IDL type of the <code>value</code>
+ * member described by this <code>ValueMember</code> object.
+ * @serial
+ */
+ public org.omg.CORBA.IDLType type_def;
+
+ /**
+ * The type of access (public, private) for the <code>value</code>
+ * member described by this <code>ValueMember</code> object.
+ * @serial
+ */
+ public short access;
+ // constructors
+
+ /**
+ * Constructs a default <code>ValueMember</code> object.
+ */
+ public ValueMember() { }
+
+ /**
+ * Constructs a <code>ValueMember</code> object initialized with
+ * the given values.
+ *
+ *@param __name The name of the <code>value</code> member described by this
+ * <code>ValueMember</code> object.
+ *@param __id The repository ID of the <code>value</code> member described by
+ * this <code>ValueMember</code> object;
+ *@param __defined_in The repository ID of the <code>value</code> in which this member
+ * is defined.
+ *@param __version The version of the <code>value</code> in which this member is defined.
+ *@param __type The type of of this <code>value</code> member.
+ *@param __type_def The typedef that represents the IDL type of the <code>value</code>
+ * member described by this <code>ValueMember</code> object.
+ *@param __access The type of access (public, private) for the <code>value</code>
+ * member described by this <code>ValueMember</code> object.
+ */
+ public ValueMember(String __name, String __id, String __defined_in, String __version, org.omg.CORBA.TypeCode __type, org.omg.CORBA.IDLType __type_def, short __access) {
+ name = __name;
+ id = __id;
+ defined_in = __defined_in;
+ version = __version;
+ type = __type;
+ type_def = __type_def;
+ access = __access;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ValueMemberHelper.java b/src/java.corba/share/classes/org/omg/CORBA/ValueMemberHelper.java
new file mode 100644
index 0000000..ac3130c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ValueMemberHelper.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code ValueMember}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/ValueMemberHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ir.idl
+* 03 June 1999 11:33:44 o'clock GMT+00:00
+*/
+
+abstract public class ValueMemberHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/ValueMember:1.0";
+
+ 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 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 (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 (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 (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 (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 = 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 (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 (org.omg.CORBA.ValueMemberHelper.id (), "ValueMember", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.ValueMember read (org.omg.CORBA.portable.InputStream istream)
+ {
+ 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 = org.omg.CORBA.IDLTypeHelper.read (istream);
+ value.access = istream.read_short ();
+ return 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);
+ org.omg.CORBA.IDLTypeHelper.write (ostream, value.type_def);
+ ostream.write_short (value.access);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/VersionSpecHelper.java b/src/java.corba/share/classes/org/omg/CORBA/VersionSpecHelper.java
new file mode 100644
index 0000000..d4bf845
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/VersionSpecHelper.java
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code VersionSpec}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/VersionSpecHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ir.idl
+* 03 June 1999 11:33:43 o'clock GMT+00:00
+*/
+
+abstract public class VersionSpecHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/VersionSpec:1.0";
+
+ 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 ());
+ }
+
+ 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 (org.omg.CORBA.VersionSpecHelper.id (), "VersionSpec", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ String value = null;
+ value = istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ ostream.write_string (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/VisibilityHelper.java b/src/java.corba/share/classes/org/omg/CORBA/VisibilityHelper.java
new file mode 100644
index 0000000..5db6c4e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/VisibilityHelper.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code Visibility}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/VisibilityHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ir.idl
+* 03 June 1999 11:33:44 o'clock GMT+00:00
+*/
+
+
+// orbos 98-01-18: Objects By Value -- begin
+abstract public class VisibilityHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/Visibility: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 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 (org.omg.CORBA.VisibilityHelper.id (), "Visibility", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ 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 void write (org.omg.CORBA.portable.OutputStream ostream, short value)
+ {
+ ostream.write_short (value);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHelper.java b/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHelper.java
new file mode 100644
index 0000000..10d3d7c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHelper.java
@@ -0,0 +1,99 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Helper for {@code WCharSeq}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/WCharSeqHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from streams.idl
+* 13 May 1999 22:41:36 o'clock GMT+00:00
+*
+* The class definition has been modified to conform to the following
+* OMG specifications :
+* <ul>
+* <li> ORB core as defined by CORBA 2.3.1
+* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+* </li>
+*
+* <li> IDL/Java Language Mapping as defined in
+* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+* </li>
+* </ul>
+*/
+
+public abstract class WCharSeqHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/WCharSeq:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, char[] 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 char[] 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_wchar);
+ __typeCode = org.omg.CORBA.ORB.init ().create_sequence_tc (0, __typeCode);
+ __typeCode = org.omg.CORBA.ORB.init ().create_alias_tc (org.omg.CORBA.WCharSeqHelper.id (), "WCharSeq", __typeCode);
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static char[] read (org.omg.CORBA.portable.InputStream istream)
+ {
+ char value[] = null;
+ int _len0 = istream.read_long ();
+ value = new char[_len0];
+ istream.read_wchar_array (value, 0, _len0);
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, char[] value)
+ {
+ ostream.write_long (value.length);
+ ostream.write_wchar_array (value, 0, value.length);
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHolder.java b/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHolder.java
new file mode 100644
index 0000000..af9aac4
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/WCharSeqHolder.java
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Holder for {@code WCharSeq}. For more information on
+* Holder files, see <a href="doc-files/generatedfiles.html#holder">
+* "Generated Files: Holder Files"</a>.<P>
+* org/omg/CORBA/WCharSeqHolder.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from streams.idl
+* 13 May 1999 22:41:36 o'clock GMT+00:00
+*/
+
+public final class WCharSeqHolder implements org.omg.CORBA.portable.Streamable
+{
+ public char value[] = null;
+
+ public WCharSeqHolder ()
+ {
+ }
+
+ public WCharSeqHolder (char[] initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.WCharSeqHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.WCharSeqHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.WCharSeqHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/WStringValueHelper.java b/src/java.corba/share/classes/org/omg/CORBA/WStringValueHelper.java
new file mode 100644
index 0000000..fa14f5e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/WStringValueHelper.java
@@ -0,0 +1,142 @@
+/*
+ * Copyright (c) 1998, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+* The Helper for {@code WStringValue}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+*/
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA;
+
+/**
+* org/omg/CORBA/WStringValueHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from orb.idl
+* 31 May 1999 22:27:30 o'clock GMT+00:00
+*
+* The class definition has been modified to conform to the following
+* OMG specifications :
+* <ul>
+* <li> ORB core as defined by CORBA 2.3.1
+* (<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)
+* </li>
+*
+* <li> IDL/Java Language Mapping as defined in
+* <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>
+* </li>
+* </ul>
+*/
+
+public class WStringValueHelper implements org.omg.CORBA.portable.BoxedValueHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/WStringValue:1.0";
+
+ private static WStringValueHelper _instance = new WStringValueHelper ();
+
+ 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 ());
+ }
+
+ 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;
+ __typeCode = org.omg.CORBA.ORB.init ().create_wstring_tc (0);
+ __typeCode = org.omg.CORBA.ORB.init ().create_value_box_tc (_id, "WStringValue", __typeCode);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static String read (org.omg.CORBA.portable.InputStream istream)
+ {
+ if (!(istream instanceof org.omg.CORBA_2_3.portable.InputStream)) {
+ throw new org.omg.CORBA.BAD_PARAM(); }
+ return (String) ((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (_instance);
+ }
+
+ public java.io.Serializable read_value (org.omg.CORBA.portable.InputStream istream)
+ {
+ String tmp;
+ tmp = istream.read_wstring ();
+ return (java.io.Serializable) tmp;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, String value)
+ {
+ if (!(ostream instanceof org.omg.CORBA_2_3.portable.OutputStream)) {
+ throw new org.omg.CORBA.BAD_PARAM(); }
+ ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, _instance);
+ }
+
+ public void write_value (org.omg.CORBA.portable.OutputStream ostream, java.io.Serializable value)
+ {
+ if (!(value instanceof String)) {
+ throw new org.omg.CORBA.MARSHAL(); }
+ String valueType = (String) value;
+ ostream.write_wstring (valueType);
+ }
+
+ public String get_id ()
+ {
+ return _id;
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/WrongTransaction.java b/src/java.corba/share/classes/org/omg/CORBA/WrongTransaction.java
new file mode 100644
index 0000000..a9670d2
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/WrongTransaction.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA;
+
+/**
+ * The CORBA <code>WrongTransaction</code> user-defined exception.
+ * This exception is thrown only by the methods
+ * <code>Request.get_response</code>
+ * and <code>ORB.get_next_response</code> when they are invoked
+ * from a transaction scope that is different from the one in
+ * which the client originally sent the request.
+ * See the OMG Transaction Service Specification for details.
+ *
+ * <p>See also {@extLink jidlexception documentation on Java&nbsp;IDL exceptions}.
+ * </p>
+ */
+
+public final class WrongTransaction extends UserException {
+ /**
+ * Constructs a WrongTransaction object with an empty detail message.
+ */
+ public WrongTransaction() {
+ super(WrongTransactionHelper.id());
+ }
+
+ /**
+ * Constructs a WrongTransaction object with the given detail message.
+ * @param reason The detail message explaining what caused this exception to be thrown.
+ */
+ public WrongTransaction(String reason) {
+ super(WrongTransactionHelper.id() + " " + reason);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHelper.java b/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHelper.java
new file mode 100644
index 0000000..b87ed34
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHelper.java
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+/**
+* The Helper for {@code WrongTransaction}. For more information on
+* Helper files, see <a href="doc-files/generatedfiles.html#helper">
+* "Generated Files: Helper Files"</a>.<P>
+* org/omg/CORBA/WrongTransactionHelper.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from CORBA.idl
+* Thursday, August 24, 2000 5:32:50 PM PDT
+*/
+
+abstract public class WrongTransactionHelper
+{
+ private static String _id = "IDL:omg.org/CORBA/WrongTransaction:1.0";
+
+ public static void insert (org.omg.CORBA.Any a, org.omg.CORBA.WrongTransaction 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.WrongTransaction 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 [0];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ __typeCode = org.omg.CORBA.ORB.init ().create_exception_tc (org.omg.CORBA.WrongTransactionHelper.id (), "WrongTransaction", _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.CORBA.WrongTransaction read (org.omg.CORBA.portable.InputStream istream)
+ {
+ org.omg.CORBA.WrongTransaction value = new org.omg.CORBA.WrongTransaction ();
+ // read and discard the repository ID
+ istream.read_string ();
+ return value;
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, org.omg.CORBA.WrongTransaction value)
+ {
+ // write the repository ID
+ ostream.write_string (id ());
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHolder.java b/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHolder.java
new file mode 100644
index 0000000..d33ba97
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/WrongTransactionHolder.java
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+/**
+* The Holder for {@code WrongTransaction}. For more information on
+* Holder files, see <a href="doc-files/generatedfiles.html#holder">
+* "Generated Files: Holder Files"</a>.<P>
+* org/omg/CORBA/WrongTransactionHolder.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from CORBA.idl
+* Thursday, August 24, 2000 5:32:50 PM PDT
+*/
+
+public final class WrongTransactionHolder implements org.omg.CORBA.portable.Streamable
+{
+ public org.omg.CORBA.WrongTransaction value = null;
+
+ public WrongTransactionHolder ()
+ {
+ }
+
+ public WrongTransactionHolder (org.omg.CORBA.WrongTransaction initialValue)
+ {
+ value = initialValue;
+ }
+
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = org.omg.CORBA.WrongTransactionHelper.read (i);
+ }
+
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ org.omg.CORBA.WrongTransactionHelper.write (o, value);
+ }
+
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return org.omg.CORBA.WrongTransactionHelper.type ();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/_IDLTypeStub.java b/src/java.corba/share/classes/org/omg/CORBA/_IDLTypeStub.java
new file mode 100644
index 0000000..5607d70
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/_IDLTypeStub.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Stub for {@code IDLType}. For more information on
+* Stub files, see <a href="doc-files/generatedfiles.html#stub">
+* "Generated Files: Stubs"</a>.<P>
+* org/omg/CORBA/_IDLTypeStub.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ir.idl.
+* 03 June 1999 11:33:44 o'clock GMT+00:00
+*/
+
+public class _IDLTypeStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.IDLType
+{
+ /**
+ * Constructs a default {@code _IDLTypeStub} object.
+ * NOTE: If the default constructor is used, the
+ * object is useless until the method {@code _set_delegate}
+ * has been called.
+ */
+ // NOTE: This constructor is not required according to the spec. Only JCK expects it now.
+ public _IDLTypeStub ()
+ {
+ super ();
+ }
+
+ /**
+ * Constructs an {@code _IDLTypeStub} object initialized
+ * with the given {@code Delegate} object.
+ *
+ * @param delegate a Delegate object
+ */
+ // NOTE: This constructor is not required according to the spec. We keep it as a convenience method.
+ public _IDLTypeStub (org.omg.CORBA.portable.Delegate delegate)
+ {
+ super ();
+ _set_delegate (delegate);
+ }
+
+ 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 ();
+ return __result;
+ } catch (org.omg.CORBA.portable.ApplicationException _ex) {
+ _in = _ex.getInputStream ();
+ String _id = _ex.getId ();
+ throw new org.omg.CORBA.MARSHAL (_id);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return type ();
+ } finally {
+ _releaseReply (_in);
+ }
+ } // type
+
+
+ // read interface
+ 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.DefinitionKind __result = 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);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return def_kind ();
+ } finally {
+ _releaseReply (_in);
+ }
+ } // def_kind
+
+
+ // write interface
+ public void destroy ()
+ {
+ org.omg.CORBA.portable.InputStream _in = null;
+ try {
+ 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);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ destroy ();
+ } finally {
+ _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"};
+
+ 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 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/src/java.corba/share/classes/org/omg/CORBA/_PolicyStub.java b/src/java.corba/share/classes/org/omg/CORBA/_PolicyStub.java
new file mode 100644
index 0000000..4312fd7
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/_PolicyStub.java
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 1999, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA;
+
+
+/**
+* The Stub for {@code Policy}. For more information on
+* Stub files, see <a href="doc-files/generatedfiles.html#stub">
+* "Generated Files: Stubs"</a>.<P>
+* org/omg/CORBA/_PolicyStub.java
+* Generated by the IDL-to-Java compiler (portable), version "3.0"
+* from ../../../../../src/share/classes/org/omg/PortableServer/corba.idl.
+* Saturday, July 17, 1999 12:26:20 AM PDT
+*/
+
+public class _PolicyStub extends org.omg.CORBA.portable.ObjectImpl implements org.omg.CORBA.Policy
+{
+ /** Constructors
+ * NOTE: If the default constructor is used, the
+ * object is useless until _set_delegate (...)
+ * is called.
+ */
+ public _PolicyStub ()
+ {
+ super ();
+ }
+
+ /** Constructs a {@code _PolicyStub} object initialized
+ * with the given {@code Delegate} object.
+ *
+ * @param delegate a Delegate Object
+ */
+ public _PolicyStub (org.omg.CORBA.portable.Delegate delegate)
+ {
+ super ();
+ _set_delegate (delegate);
+ }
+
+
+ /** Returns the constant value that corresponds to the
+ * type of the policy object. The values of
+ * the polivy objectys are allocated by the OMG.
+ * New values for PolicyType should be obtained from the OMG by
+ * sending mail to request@omg.org. In general the constant
+ * values that are allocated are defined in conjunction with
+ * the definition of the corresponding policy object.
+ * @return the constant value that corresponds to the type of
+ * the policy object.
+ */
+ public int policy_type ()
+ {
+ org.omg.CORBA.portable.InputStream _in = null;
+ try {
+ org.omg.CORBA.portable.OutputStream _out = _request ("_get_policy_type", true);
+ _in = _invoke (_out);
+ int __result = org.omg.CORBA.PolicyTypeHelper.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);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return policy_type ();
+ } finally {
+ _releaseReply (_in);
+ }
+ } // policy_type
+
+
+ /** Copies the policy object. The copy does not retain any
+ * relationships that the policy had with any domain or object.
+ * @return the copy of the policy object.
+ */
+ public org.omg.CORBA.Policy copy ()
+ {
+ org.omg.CORBA.portable.InputStream _in = null;
+ try {
+ org.omg.CORBA.portable.OutputStream _out = _request ("copy", true);
+ _in = _invoke (_out);
+ org.omg.CORBA.Policy __result = org.omg.CORBA.PolicyHelper.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);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ return copy ();
+ } finally {
+ _releaseReply (_in);
+ }
+ } // copy
+
+
+ /** Destroys the policy object. It is the responsibility of
+ * the policy object to determine whether it can be destroyed.
+ */
+ public void destroy ()
+ {
+ org.omg.CORBA.portable.InputStream _in = null;
+ try {
+ 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);
+ } catch (org.omg.CORBA.portable.RemarshalException _rm) {
+ destroy ();
+ } finally {
+ _releaseReply (_in);
+ }
+ } // destroy
+
+ // Type-specific CORBA::Object operations
+ private static String[] __ids = {
+ "IDL:omg.org/CORBA/Policy:1.0"};
+
+ 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 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 _PolicyStub
diff --git a/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html b/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html
new file mode 100644
index 0000000..d78aa74
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/doc-files/compliance.html
@@ -0,0 +1,143 @@
+<!doctype html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html">
+ <title>Official Specifications for CORBA support in Java[tm] SE 6</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<h1>
+Official Specifications for CORBA support in Java[tm] SE 6</h1>
+
+<h2>
+Specification References</h2>
+The specifications with which the Java[tm] Platform, Standard Edition (Java SE) v.1.6.0
+ ORB complies are as follows. If these links do not take you to the referenced
+ specification, the OMG may have changed the URL, and you can link to <a
+href="http://www.omg.org/">www.omg.org</a> to search for the correct specification.
+<ul>
+<li>
+CORBA 2.3.1 (<a
+href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">formal/99-10-07</a>)</li>
+
+<li>
+IDL to Java language mapping (<a
+href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">ptc/00-01-08</a>)</li>
+
+<li>Revised IDL to Java language mapping (<a
+href="http://www.omg.org/cgi-bin/doc?ptc/00-11-03">ptc/00-11-03</a>)</li>
+
+<li>
+Java to IDL language mapping (<a
+href="http://www.omg.org/cgi-bin/doc?ptc/00-01-06">ptc/00-01-06</a>)</li>
+
+<li>
+Interoperable Naming Service (<a
+href="http://www.omg.org/cgi-bin/doc?ptc/00-08-07">ptc/00-08-07</a>)</li>
+
+<li>
+Portable Interceptors (<a
+href="http://www.omg.org/cgi-bin/doc?ptc/2001-03-04">ptc/2001-03-04</a>)</li>
+</ul>
+These are the only specifications referenced by this document.
+
+
+<h2>
+Supported Specification Details</h2>
+Not all of the above specifications are currently implemented in the ORB
+in Java[tm] SE 6. The precise list of supported sections is as follows:
+<ul>
+<li>
+CORBA 2.3.1 chapters 1-3 and 6-9</li>
+
+<li>Revised IDL to Java language mapping, section 1.21.8.2, the <code>orb.properties</code>
+file.</li>
+
+<li>
+CORBA 2.3.1 chapter 4 with the following replacements from the Portable
+Interceptors specification:
+ <ul>
+ <li>section 4.2.3.5 <code>destroy</code></li>
+ <li>section 4.5.2 <code>CodeFactory</code> and <code>PICurrent</code> are required</li>
+ <li>Section 4.5.3.4 as updated for <code>register_initial_reference</code></li>
+ </ul>
+</li>
+
+<li>
+CORBA 2.3.1 chapter 5 with the following update from the Portable Interceptors
+specification:
+ <ul>
+ <li>
+ 5.5.2 <code>StringSeq</code> and <code>WStringSeq</code> are required.
+ This adds the following classes to <code>org.omg.CORBA</code>:
+ <ul>
+ <li><code>StringSeqHolder</code></li>
+ <li><code>StringSeqHelper</code></li>
+ <li><code>WStringSeqHolder</code></li>
+ <li><code>WStringSeqHelper</code></li>
+ </ul>
+ </li>
+ </ul>
+</li>
+
+<li>
+CORBA 2.3.1 sections 10.6.1 and 10.6.2 are supported for repository IDs.</li>
+
+<li>
+CORBA 2.3.1 section 10.7 for <code>TypeCode</code> APIs.</li>
+
+<li>
+CORBA 2.3.1 chapter 11, Portable Object Adapter (POA),
+with the following updates from the Portable Interceptors specification:
+ <ul>
+ <li>Section 11.3.7 POAs must preserve all policies</li>
+ <li>Section 11.3.8.2 again states that POAs must preserve all policies</li>
+ <li>Section 11.3.8.26 <code>POA::id</code> is required.</li>
+ </ul>
+</li>
+
+<li>
+CORBA 2.3.1 chapters 13 and 15 define GIOP 1.0, 1.1, and 1.2. The Java SE 6
+ORB fully supports all versions of GIOP, with the exception that the bi-directional
+GIOP feature defined in sections 15.8 and 15.9 is not supported.</li>
+
+<li>
+All of the Interoperable Naming Service is supported.</li>
+
+<li>
+Portable Interceptors section 13.8 (the new
+<code>Coder</code>/<code>Decoder</code> interfaces)
+and all of chapter 21 (the interceptor specification).</li>
+
+<li>Section 1.21.8 of the Revised IDL to Java Language
+Mapping Specification (ptc/00-11-03)
+has been changed from the version in the
+IDL to Java Language Mapping Specification (ptc/00-01-08).</li>
+</ul>
+
+<h2>
+Tools</h2>
+
+<ul>
+<li>The IDL to Java compiler (<code>idlj</code>) complies with:
+ <ul>
+ <li>CORBA 2.3.1 chapter 3 (IDL definition)</li>
+ <li>CORBA 2.3.1 chapters 5 and 6 (semantics of Value types)</li>
+ <li>CORBA 2.3.1 section 10.6.5 (pragmas)</li>
+ <li>The IDL to Java mapping specification</li>
+ <li>The Revised IDL to Java language mapping specification section 1.12.1 "local interfaces"</li>
+ </ul>
+</li>
+
+<li>The Java to IDL compiler (the IIOP backend for <code>rmic</code>) complies with:
+ <ul>
+ <li>CORBA 2.3.1 chapters 5 and 6 (value types)</li>
+ <li>The Java to IDL language mapping. Note that this implicitly references
+ section 1.21 of the IDL to Java language mapping</li>
+ <li>IDL generated by the <code>-idl</code> flag complies with CORBA 2.3.1 chapter 3.</li>
+ </ul>
+</li>
+</ul>
+
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html b/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html
new file mode 100644
index 0000000..39aa884
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/doc-files/generatedfiles.html
@@ -0,0 +1,118 @@
+<!doctype html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html">
+ <title>IDL-to-Java Generated Files</title>
+</head>
+<body bgcolor="#FFFFFF">
+
+<H1>IDL-to-Java Generated Files</H1>
+
+<P>The files that are generated by the IDL-to-Java compiler, in accordance with
+the <em><a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">
+IDL-to-Java Language Mapping Specification</a></em>,
+which is implemented in Java<sup><font size="-2">TM</font></sup> SE 6
+according the <a href="compliance.html">compliance</a> document.
+
+
+<P>In general IDL names and identifiers are mapped to Java names
+and identifiers with no change. Because of the nature of the Java language,
+a single IDL construct may be mapped to several (differently named) Java constructs.
+The additional names are constructed by appending a descriptive suffix.
+For example, the IDL interface <code>foo</code> is mapped to the Java
+interfaces <code>foo</code> and <code>fooOperations</code>, and additional
+Java classes <code>fooHelper</code>, <code>fooHolder</code>, <code>fooPOA</code>,
+and optionally <code>fooPOATie</code>.
+
+
+
+<P>The mapping in effect reserves the use of several names for its own purposes. These are:
+<UL>
+<LI>The Java class <a href="#helper"><code>&lt;type&gt;Helper</code></a>,
+where <code>&lt;type&gt;</code> is the name of an IDL defined type.
+<LI>The Java class <a href="#holder"><code>&lt;type&gt;Holder</code></a>,
+where <code>&lt;type&gt;</code>
+is the name of an IDL defined type (with certain exceptions such as <code>typedef</code> aliases).
+<LI>The Java classes <code>&lt;basicJavaType&gt;Holder</code>, where <code>&lt;basicJavaType&gt;</code>
+is one of the Java primitive datatypes that is used by one of the IDL basic datatypes.
+<LI>The Java classes <a href="#operations"><code>&lt;interface&gt;Operations</code></a>, <code>&lt;interface&gt;POA</code>,
+and <code>&lt;interface&gt;POATie</code>, where <code>&lt;interface&gt;</code> is the name of an IDL interface type.
+<LI>The nested scope Java package name <code>&lt;interface&gt;Package</code>, where <code>&lt;interface&gt;</code>
+is the name of an IDL interface.
+</UL>
+
+
+<H2><a id="helper">Helper Files</a></H2>
+
+<P>Helper files supply several static methods needed to manipulate the type.
+These include <code>Any</code> insert and extract operations for the type,
+getting the repository id, getting the typecode, and reading
+and writing the type from and to a stream.
+
+<P>The helper class for a mapped IDL interface or abstract interface also
+include narrow operation(s). The static narrow method allows an <code>org.omg.CORBA.Object</code>
+to be narrowed to the object reference of a more specific type.
+The IDL exception <code>CORBA::BAD_PARAM</code> is thrown if the narrow fails because
+the object reference does not support the requested type. A different system exception
+is raised to indicate other kinds of errors. Trying to narrow
+a null will always succeed with a return value of null.
+
+<H2><a id="holder">Holder Files</a></H2>
+
+<P>Support for out and inout parameter passing modes requires the use of additional holder classes.
+These classes are available for all of the basic IDL datatypes in the <code>org.omg.CORBA</code> package
+and are generated for all named user defined IDL types except those defined by typedefs.
+(Note that in this context user defined includes types that are defined in OMG specifications
+such as those for the Interface Repository, and other OMG services.)
+
+<P>Each holder class has a constructor from an instance, a default constructor, and has
+a public instance member, <code>value</code> which is the typed value. The default constructor
+sets the value field to the default value for the type as defined by the Java language:
+false for boolean, 0 for numeric and char types, null for strings, null for object references.
+
+<P>To support portable stubs and skeletons, holder classes also implement
+the <code>org.omg.CORBA.portable.Streamable</code> interface.
+
+
+<H2><a id="operations">Operations Files</a></H2>
+
+<P>A non abstract IDL interface is mapped to two public Java interfaces:
+a <em>signature</em> interface and an <em>operations</em> interface.
+The signature interface, which extends <code>IDLEntity</code>, has the same
+name as the IDL interface name and is used
+as the signature type in method declarations
+when interfaces of the specified type are used in other interfaces.
+The operations interface has the same name as the IDL interface
+with the suffix <code>Operations</code>
+appended to the end and is used in the server-side mapping and as a mechanism
+for providing optimized calls for collocated client and servers.
+
+<P>The Java operations interface contains the mapped operation signatures.
+The Java signature interface extends the operations interface,
+the (mapped) base <code>org.omg.CORBA.Object</code>,
+as well as <code>org.omg.portable.IDLEntity</code>.
+Methods can be invoked on the signature interface. Interface inheritance
+expressed in IDL is reflected in both the Java signature
+interface and operations interface hierarchies.
+
+
+<H2><a id="stub">Stubs</a></H2>
+
+<P>For the mapping of a non-object-oriented language, there will be
+a programming interface to the stubs for each interface type. Generally, the stubs
+will present access to the OMG IDL-defined operations on an object in a way that is easy
+for programmers to predict once they are familiar with OMG IDL and the language mapping
+for the particular programming language. The stubs make calls on the rest of the ORB
+using interfaces that are private to, and presumably optimized for, the particular ORB Core.
+If more than one ORB is available, there may be different stubs
+corresponding to the different ORBs. In this case, it is necessary for
+the ORB and language mapping to cooperate to associate
+the correct stubs with the particular object reference.
+
+<P>Object-oriented programming languages, such as Java,
+C++, and Smalltalk, do not require stub interfaces.
+
+<BR><BR>
+
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/CORBA/ir.idl b/src/java.corba/share/classes/org/omg/CORBA/ir.idl
new file mode 100644
index 0000000..656d163
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/ir.idl
@@ -0,0 +1,793 @@
+/*
+ * Copyright (c) 1997, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * This file contains OMG IDL from CORBA V2.0, July 1995.
+ * It also contains the TypeCode creation APIs in CORBA::ORB
+ **/
+
+#pragma prefix "omg.org"
+//#pragma javaPackage org.omg
+
+module CORBA {
+ typedef string Identifier;
+ typedef string ScopedName;
+ typedef string RepositoryId;
+
+ enum DefinitionKind {
+ 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, // orbos 98-01-18: Objects By Value
+ dk_Native
+ };
+
+
+ interface IRObject
+ /**
+ An IRObject IDL interface represents the most generic interface
+ from which all other Interface Repository interfaces are derived,
+ even the Repository itself.
+ */
+ {
+ // read interface
+ readonly attribute DefinitionKind def_kind;
+
+ // write interface
+ void destroy ();
+ };
+
+
+
+ typedef string VersionSpec;
+
+ interface Contained;
+ interface Repository;
+ interface Container;
+
+ interface Contained : IRObject
+ /**
+ The Contained Interface is inherited by all Interface Repository
+ interfaces that are contained by other objects.
+ */
+ {
+ // read/write interface
+
+ attribute RepositoryId id;
+ attribute Identifier name;
+ attribute VersionSpec version;
+
+ // read interface
+
+ readonly attribute Container defined_in;
+ readonly attribute ScopedName absolute_name;
+ readonly attribute Repository containing_repository;
+
+ struct Description {
+ DefinitionKind kind;
+ any value;
+ };
+
+ Description describe ();
+
+ // write interface
+
+ void move (
+ in Container new_container,
+ in Identifier new_name,
+ in VersionSpec new_version
+ );
+ };
+
+
+ interface ModuleDef;
+ interface ConstantDef;
+ interface IDLType;
+ interface StructDef;
+ interface UnionDef;
+ interface EnumDef;
+ interface AliasDef;
+ interface InterfaceDef;
+ interface ExceptionDef;
+ interface ValueDef; // orbos 98-01-18: Objects By Value
+ interface ValueMemberDef; // orbos 98-01-18: Objects By Value
+ interface ValueBoxDef; // orbos 98-01-18: Objects By Value
+ interface NativeDef;
+
+
+ typedef sequence <InterfaceDef> InterfaceDefSeq;
+
+
+ typedef sequence <Contained> ContainedSeq;
+
+ struct StructMember {
+ Identifier name;
+ TypeCode type;
+ IDLType type_def;
+ };
+ typedef sequence <StructMember> StructMemberSeq;
+
+ struct UnionMember {
+ Identifier name;
+ any label;
+ TypeCode type;
+ IDLType type_def;
+ };
+ typedef sequence <UnionMember> UnionMemberSeq;
+
+
+ typedef sequence <Identifier> EnumMemberSeq;
+
+ // orbos 98-01-18: Objects By Value -- begin
+ typedef short Visibility;
+ const Visibility PRIVATE_MEMBER = 0;
+ const Visibility PUBLIC_MEMBER = 1;
+
+ struct ValueMember {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ IDLType type_def;
+ Visibility access;
+ };
+ typedef sequence <ValueMember> ValueMemberSeq;
+
+ struct Initializer {
+ StructMemberSeq members;
+ };
+ typedef sequence <Initializer> InitializerSeq;
+
+ typedef sequence <ValueDef> ValueDefSeq;
+
+ // orbos 98-01-18: Objects By Value -- end
+
+
+ interface Container : IRObject
+ /**
+ The Container interface is used to form a containment hierarchy
+ in the Interface Repository. A Container can contain any number
+ of objects derived from the Contained interface.
+ */
+ {
+ // read interface
+
+ Contained lookup ( in ScopedName search_name);
+
+ ContainedSeq contents (
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited
+ );
+
+ ContainedSeq lookup_name (
+ in Identifier search_name,
+ in long levels_to_search,
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited
+ );
+
+ struct Description {
+ Contained contained_object;
+ DefinitionKind kind;
+ any value;
+ };
+
+ typedef sequence<Description> DescriptionSeq;
+
+ DescriptionSeq describe_contents (
+ in DefinitionKind limit_type,
+ in boolean exclude_inherited,
+ in long max_returned_objs
+ );
+
+ // write interface
+
+ ModuleDef create_module (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version
+ );
+
+ ConstantDef create_constant (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in any value
+ );
+
+ StructDef create_struct (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in StructMemberSeq members
+ );
+
+ UnionDef create_union (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType discriminator_type,
+ in UnionMemberSeq members
+ );
+
+ EnumDef create_enum (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in EnumMemberSeq members
+ );
+
+ AliasDef create_alias (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType original_type
+ );
+
+ ExceptionDef create_exception (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in StructMemberSeq members
+ );
+
+
+ InterfaceDef create_interface (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_abstract,
+ in InterfaceDefSeq base_interfaces
+ );
+
+ // orbos 98-01-18: Objects By Value
+ ValueDef create_value(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in boolean is_custom,
+ in boolean is_abstract,
+ in octet flags, // must be 0
+ in ValueDef base_value,
+ in boolean has_safe_base,
+ in ValueDefSeq abstract_base_values,
+ in InterfaceDefSeq supported_interfaces,
+ in InitializerSeq initializers
+ );
+
+ // orbos 98-01-18: Objects By Value
+ ValueBoxDef create_value_box(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType original_type_def
+ );
+
+ NativeDef create_native(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version
+ );
+
+ };
+
+
+
+ interface IDLType : IRObject
+ /**
+ The IDLType interface is an abstract interface inherited by all
+ IR objects that represent the OMG IDL types. It provides access
+ to the TypeCode describing the type, and is used in defining the
+ other interfaces wherever definitions of IDLType must be referenced.
+ */
+ {
+ readonly attribute TypeCode type;
+ };
+
+
+
+ interface PrimitiveDef;
+ interface StringDef;
+ interface SequenceDef;
+ interface ArrayDef;
+
+ enum PrimitiveKind {
+ pk_null, pk_void, pk_short, pk_long, pk_ushort, pk_ulong,
+ pk_float, pk_double, pk_boolean, pk_char, pk_octet,
+ pk_any, pk_TypeCode, pk_Principal, pk_string, pk_objref
+ };
+
+ interface Repository : Container
+ /**
+ Repository is an interface that provides global access to the
+ Interface Repository. Repository objects can contain constants,
+ typedefs, exceptions, interfaces, and modules.
+ */
+ {
+ // read interface
+
+ Contained lookup_id (in RepositoryId search_id);
+
+ PrimitiveDef get_primitive (in PrimitiveKind kind);
+
+ // write interface
+
+ StringDef create_string (in unsigned long bound);
+
+ SequenceDef create_sequence (
+ in unsigned long bound,
+ in IDLType element_type
+ );
+
+ ArrayDef create_array (
+ in unsigned long length,
+ in IDLType element_type
+ );
+ };
+
+
+ interface ModuleDef : Container, Contained
+ /**
+ A ModuleDef can contain constants, typedefs, exceptions, interfaces,
+ and other module objects.
+ */
+ {
+ };
+
+ struct ModuleDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ };
+
+
+ interface ConstantDef : Contained
+ /**
+ A ConstantDef object defines a named constant.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute any value;
+ };
+
+ struct ConstantDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ any value;
+ };
+
+
+ interface TypedefDef : Contained, IDLType
+ /**
+ TypedefDef is an abstract interface used as a base interface for
+ all named non-object types(structures, unions, enumerations,
+ aliases). The TypedefDef interface is not inherited by the definition
+ objects for the primitive or anonymous types.
+ */
+ {
+ };
+
+ struct TypeDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ };
+
+
+ interface StructDef : TypedefDef, Container
+ /**
+ A StructDef represents an OMG IDL structure definition.
+ */
+ {
+ attribute StructMemberSeq members;
+ };
+
+
+ interface UnionDef : TypedefDef, Container
+ /**
+ A UnionDef represents an OMG IDL union definition.
+ */
+ {
+ readonly attribute TypeCode discriminator_type;
+ attribute IDLType discriminator_type_def;
+ attribute UnionMemberSeq members;
+ };
+
+
+ interface EnumDef : TypedefDef
+ /**
+ A EnumDef represents an OMG IDL enum definition.
+ */
+ {
+ attribute EnumMemberSeq members;
+ };
+
+
+ interface AliasDef : TypedefDef
+ /**
+ An AliasDef represents an OMG IDL typedef that aliases other
+ definition.
+ */
+ {
+ attribute IDLType original_type_def;
+ };
+
+
+ interface PrimitiveDef: IDLType
+ /**
+ A PrimitiveDef represents one of the IDL primitive types. As
+ primitive types are unnamed, this interface is not derived from
+ TypedefDef or Contained.
+ */
+ {
+ readonly attribute PrimitiveKind kind;
+ };
+
+
+ interface StringDef : IDLType
+ /**
+ A StringDef represents an OMG IDL string type. As string
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long bound;
+ };
+
+
+ interface SequenceDef : IDLType
+ /**
+ A SequenceDef represents an OMG IDL sequence type. As sequence
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long bound;
+ readonly attribute TypeCode element_type;
+ attribute IDLType element_type_def;
+ };
+
+ interface ArrayDef : IDLType
+ /**
+ An ArrayDef represents an OMG IDL array type. As array
+ types are anonymous, this interface is not derived from TypedefDef
+ or Contained.
+ */
+ {
+ attribute unsigned long length;
+ readonly attribute TypeCode element_type;
+ attribute IDLType element_type_def;
+ };
+
+
+ interface ExceptionDef : Contained, Container
+ /**
+ An ExceptionDef represents an exception definition.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute StructMemberSeq members;
+ };
+ struct ExceptionDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ };
+
+
+
+ enum AttributeMode {ATTR_NORMAL, ATTR_READONLY};
+
+ interface AttributeDef : Contained
+ /**
+ An AttributeDef represents the information that defines an
+ attribute of an interface.
+ */
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute AttributeMode mode;
+ };
+
+ struct AttributeDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode type;
+ AttributeMode mode;
+ };
+
+
+
+ enum OperationMode {OP_NORMAL, OP_ONEWAY};
+
+ enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT};
+ struct ParameterDescription {
+ Identifier name;
+ TypeCode type;
+ IDLType type_def;
+ ParameterMode mode;
+ };
+ typedef sequence <ParameterDescription> ParDescriptionSeq;
+
+ typedef Identifier ContextIdentifier;
+ typedef sequence <ContextIdentifier> ContextIdSeq;
+
+ typedef sequence <ExceptionDef> ExceptionDefSeq;
+ typedef sequence <ExceptionDescription> ExcDescriptionSeq;
+
+ interface OperationDef : Contained
+ /**
+ An OperationDef represents the information that defines an
+ operation of an interface.
+ */
+ {
+ readonly attribute TypeCode result;
+ attribute IDLType result_def;
+ attribute ParDescriptionSeq params;
+ attribute OperationMode mode;
+ attribute ContextIdSeq contexts;
+ attribute ExceptionDefSeq exceptions;
+ };
+
+ struct OperationDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ TypeCode result;
+ OperationMode mode;
+ ContextIdSeq contexts;
+ ParDescriptionSeq parameters;
+ ExcDescriptionSeq exceptions;
+ };
+
+
+
+ typedef sequence <RepositoryId> RepositoryIdSeq;
+ typedef sequence <OperationDescription> OpDescriptionSeq;
+ typedef sequence <AttributeDescription> AttrDescriptionSeq;
+
+ interface InterfaceDef : Container, Contained, IDLType
+ /**
+ An InterfaceDef object represents an interface definition. It can
+ contains constants, typedefs, exceptions, operations, and
+ attributes.
+ */
+ {
+ // read/write interface
+
+ attribute InterfaceDefSeq base_interfaces;
+ attribute boolean is_abstract;
+
+ // read interface
+
+ boolean is_a (in RepositoryId interface_id);
+
+ struct FullInterfaceDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ boolean is_abstract;
+ OpDescriptionSeq operations;
+ AttrDescriptionSeq attributes;
+ RepositoryIdSeq base_interfaces;
+ TypeCode type;
+ };
+
+ FullInterfaceDescription describe_interface();
+
+ // write interface
+
+ AttributeDef create_attribute (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode
+ );
+
+ OperationDef create_operation (
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType result,
+ in OperationMode mode,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions,
+ in ContextIdSeq contexts
+ );
+ };
+
+ struct InterfaceDescription {
+ Identifier name;
+ RepositoryId id;
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryIdSeq base_interfaces;
+ };
+
+
+ // orbos 98-01-18: Objects By Value -- begin
+
+ interface ValueMemberDef : Contained
+
+ /** A <code>ValueMemberDef</code> object represents the public
+ and private data member definition of a <code>Value</code> type
+ */
+
+ {
+ readonly attribute TypeCode type;
+ attribute IDLType type_def;
+ attribute Visibility access;
+ };
+
+ interface ValueDef : Container, Contained, IDLType
+ /**
+ A ValueDef object represents the definition of the
+ <code>Value</code> object used to pass the object state
+ between hosts
+ */
+
+ {
+ // read/write interface
+ attribute InterfaceDefSeq supported_interfaces;
+ attribute InitializerSeq initializers;
+ attribute ValueDef base_value;
+ attribute ValueDefSeq abstract_base_values;
+ attribute boolean is_abstract;
+ attribute boolean is_custom;
+ attribute octet flags; // always 0
+ attribute boolean has_safe_base;
+
+ // read interface
+ boolean is_a(in RepositoryId value_id);
+
+ struct FullValueDescription {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ octet flags; // always 0
+ RepositoryId defined_in;
+ VersionSpec version;
+ OpDescriptionSeq operations;
+ AttrDescriptionSeq attributes;
+ ValueMemberSeq members;
+ InitializerSeq initializers;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean has_safe_base;
+ RepositoryId base_value;
+ TypeCode type;
+ };
+
+ FullValueDescription describe_value();
+
+ // write interface
+
+ ValueMemberDef create_value_member(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type_def,
+ in Visibility access
+ );
+
+ AttributeDef create_attribute(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType type,
+ in AttributeMode mode
+ );
+
+ OperationDef create_operation(
+ in RepositoryId id,
+ in Identifier name,
+ in VersionSpec version,
+ in IDLType result,
+ in OperationMode mode,
+ in ParDescriptionSeq params,
+ in ExceptionDefSeq exceptions,
+ in ContextIdSeq contexts
+ );
+ };
+ struct ValueDescription {
+ Identifier name;
+ RepositoryId id;
+ boolean is_abstract;
+ boolean is_custom;
+ octet flags; // always 0
+ RepositoryId defined_in;
+ VersionSpec version;
+ RepositoryIdSeq supported_interfaces;
+ RepositoryIdSeq abstract_base_values;
+ boolean has_safe_base;
+ RepositoryId base_value;
+ };
+
+ interface ValueBoxDef : IDLType
+
+ /** ValueBoxDef is an interface that reresents a value type with
+ a single data member inside its state section and no
+ inheritance or methods. For example, when transmitting a
+ string or sequence as an actual parameter on an interface
+ operation or as a data member of a value type that is an
+ actual parameter, it may be important to preserve any sharing
+ of the string or sequence within the object graph being
+ transmitted. Because current IDL data types do not preserve
+ referential integrity in this way, this requirement is
+ conveniently handled by using a value type. Value types also
+ support the transmission of nulls (as a distinguished value),
+ whereas IDL data types such as string and sequence (which are
+ mapped to empty strings and sequences) do not. The Java to IDL
+ mapping requires both preservation of referential integrity
+ and transmission of nulls. Because it would be cumbersome to
+ require the full IDL syntax for a value type for this specific
+ usage, this shorthand notation is introduced to cover this use
+ of value types for simple containment of a single data member.
+ */
+
+ {
+ attribute IDLType original_type_def;
+ };
+
+ // orbos 98-01-18: Objects By Value -- end
+
+ enum TCKind {
+ tk_null, tk_void,
+ tk_short, tk_long, tk_ushort, tk_ulong,
+ tk_float, tk_double, tk_boolean, tk_char,
+ tk_octet, tk_any, tk_TypeCode, tk_Principal, tk_objref,
+ tk_struct, tk_union, tk_enum, tk_string,
+ tk_sequence, tk_array, tk_alias, tk_except,
+ tk_longlong, tk_ulonglong, tk_longdouble,
+ tk_wchar, tk_wstring, tk_fixed,
+ tk_value, tk_value_box,
+ tk_native,
+ tk_abstract_interface
+ };
+
+ interface NativeDef : TypedefDef {
+ };
+};
diff --git a/src/java.corba/share/classes/org/omg/CORBA/orb.idl b/src/java.corba/share/classes/org/omg/CORBA/orb.idl
new file mode 100644
index 0000000..bd6cb07
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/orb.idl
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// IDL not generated by rmic, do not edit
+// These are all in IDL module CORBA
+// The Java classes are in the package org.omg.CORBA
+// See ValueType Semantics:Standard Value Box Definitions (5.3) in CORBA 2.3 spec
+
+#ifndef __org_omg_CORBA__
+#define __org_omg_CORBA__
+
+#pragma prefix "omg.org"
+
+module CORBA{
+
+ valuetype StringValue string;
+ valuetype WStringValue wstring;
+
+};
+
+#include "ir.idl"
+
+#pragma prefix ""
+
+#endif
diff --git a/src/java.corba/share/classes/org/omg/CORBA/package.html b/src/java.corba/share/classes/org/omg/CORBA/package.html
new file mode 100644
index 0000000..d8eb990
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/package.html
@@ -0,0 +1,982 @@
+<!doctype html>
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <META NAME="GENERATOR" CONTENT="Mozilla/4.04 [en]C-gatewaynet (WinNT; U)
+[Netscape]">
+ <TITLE>package</TITLE>
+<!--
+/*
+* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation. Oracle designates this
+* particular file as subject to the "Classpath" exception as provided
+* by Oracle in the LICENSE file that accompanied this code.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+-->
+</HEAD>
+<BODY>
+Provides the mapping of the OMG CORBA APIs to the Java&trade;
+programming language, including the class <code>ORB</code>, which is implemented
+so that a programmer can use it as a fully-functional Object Request Broker
+(ORB).
+
+<P>For a precise list of supported sections of official CORBA specifications with which
+the Java[TM] Platform, Standard Edition 6 complies, see <A
+HREF="doc-files/compliance.html"><em>Official Specifications for CORBA support in
+Java[TM] SE 6</em></A>.
+
+
+<H1>General Information</H1>
+The information in this section is information relevant to someone who
+compiles Interface Definition Language (IDL) files and uses the
+ORB to write clients and servers.
+
+<P>The classes and interfaces described in this section can be put into
+four groups: <code>ORB classes</code>, Exceptions, <code>Helper</code> classes,
+and <code>Holder</code> classes.
+
+<H2>
+The <code>ORB</code> Class</H2>
+
+<P>An ORB handles (or brokers) method invocations between a client and
+the method's implementation on a server. Because the client and server
+may be anywhere on a network, and because the invocation and implementation
+may be written in different programming languages, an ORB does a great
+deal of work behind the scenes to accomplish this communication.
+
+<P>Most of what an ORB does is completely transparent to the user, and a major
+portion of the <code>CORBA</code> package consists of classes used by the ORB
+behind the scenes. The result is that most programmers will use only a
+small part of this package directly. In fact, most programmers will use
+only a few methods from the <code>ORB</code> class, some exceptions, and
+occasionally,
+a holder class.
+<H3>
+<code>ORB</code> Methods</H3>
+
+<P>Before an application can enter the CORBA environment, it must first:
+<UL>
+<LI>Be initialized into the ORB and possibly the object adapter (POA) environments.
+<LI>Get references to ORB object (for use in future ORB operations)
+and perhaps other objects (including the root POA or some Object Adapter objects).
+</UL>
+<P>The following operations are provided to initialize applications and obtain
+ the appropriate object references:
+ <UL>
+ <LI>Operations providing access to the ORB, which are discussed in this
+ section.
+ <LI>Operations providing access to Object Adapters, Interface Repository,
+ Naming Service, and other Object Services. These operations are described
+ in <a href="#adv"><em>Other Classes</em></a>.
+ </UL>
+ <P>
+When an application requires a CORBA environment it needs a mechanism to
+get an ORB object reference and possibly an OA object reference
+(such as the root POA). This serves two purposes. First, it initializes
+an application into the ORB and OA environments. Second, it returns the
+ORB object reference and the OA object reference to the application
+for use in future ORB and OA operations.
+
+<P>In order to obtain an ORB object reference, applications call
+the <code>ORB.init</code> operation. The parameters to the call can comprise an
+identifier for the ORB for which the object reference is required,
+ and an arg_list, which is used to allow environment-specific data to be
+ passed into the call.
+
+<P>These are the <code>ORB</code> methods
+ that provide access to the ORB:
+<UL>
+<LI>
+<code><b>init</b>()</code>
+
+<LI>
+<code><b>init</b>(String [] args, Properties props)</code>
+
+<LI>
+<code><b>init</b>(Applet app, Properties props)</code>
+</UL>
+
+<P>Using the <code>init()</code> method without parameters initiates
+a singleton ORB, which can only
+give typecode creation <code>any</code>s needed in code generated
+in Helper classes by <code>idlj</code>.
+
+<P>Applications require a portable means by which to obtain their
+initial object references. References are required for the root
+POA, POA Current, Interface Repository, and various Object Services
+instances. The functionality required by the application is similar
+ to that provided by the Naming Service. However, the OMG does not
+ want to mandate that the Naming Service be made available to all
+ applications in order that they may be portably initialized.
+ Consequently, the operations shown in this section provide a
+ simplified, local version of the Naming Service that applications
+ can use to obtain a small, defined set of object references which
+ are essential to its operation. Because only a small well-defined
+ set of objects are expected with this mechanism, the naming context
+ can be flattened to be a single-level name space. This simplification
+ results in only two operations being defined to achieve the functionality
+ required.
+
+<P>Initial references are obtained via two operations provided in
+the ORB object interface, providing facilities to list and
+resolve initial object references. These are:
+<UL>
+<LI>
+<code><b>resolve_initial_references</b>(String name)</code>
+<LI>
+<code><b>list_initial_services</b>()</code>
+<LI>
+<code><b>register_initial_reference</b>(String id, org.omg.CORBA.Object obj)</code>
+</UL>
+
+<P>An example that uses some of these methods is {@extLink idl_getting_started Getting Started with Java IDL}.
+
+<H2>
+Exceptions</H2>
+Exceptions in Java IDL are similar to those in any code written in the
+Java programming language. If a method is defined to throw an exception,
+then any code using that method must have a <code>try</code>/<code>catch</code>
+block and handle that exception when it is thrown.
+
+<P>The documentation on {@extLink jidlexception Java&nbsp;IDL exceptions }
+has more information and explains the difference between
+system exceptions and user-defined exceptions.
+
+<P>The following is a list of the system exceptions (which are unchecked
+exceptions inheriting through <code><a href="SystemException.html">
+org.omg.CORBA.SystemException</a></code> from
+<code>java.lang.RuntimeException</code>) that are defined in the package
+<code>org.omg.CORBA</code>:
+<PRE><code>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BAD_CONTEXT
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BAD_INV_ORDER
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BAD_OPERATION
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BAD_PARAM
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BAD_TYPECODE
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMM_FAILURE
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DATA_CONVERSION
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; FREE_MEM
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IMP_LIMIT
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INITIALIZE
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INTERNAL
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INTF_REPOS
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INVALID_TRANSACTION
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INV_FLAG
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INV_IDENT
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INV_OBJREF
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; INV_POLICY
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; MARSHAL
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <a href="#NO_IMPLEMENT">NO_IMPLEMENT</a>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NO_MEMORY
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NO_PERMISSION
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NO_RESOURCES
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; NO_RESPONSE
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OBJECT_NOT_EXIST
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OBJ_ADAPTER
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PERSIST_STORE
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRANSACTION_REQUIRED
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRANSACTION_ROLLEDBACK
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TRANSIENT
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UNKNOWN
+</code></PRE>
+<P>
+The following is a list of user-defined exceptions defined in the package
+<code>org.omg.CORBA</code>.
+<PRE><code>
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Bounds
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UnknownUserException
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; WrongTransaction&nbsp;
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PolicyError
+</code></PRE>
+
+ <H2>Subpackages</H2>
+There are some packages inside the <code>CORBA</code> package with
+"Package" as part of their names. These packages are generally quite small
+because all they do is provide exceptions or classes for use by interfaces
+and classes in the <code>CORBA</code> package.
+
+<P>For example, the package <code><a href="TypeCodePackage/package-summary.html">
+org.omg.CORBA.TypeCodePackage</a></code> contains
+two exceptions thrown by methods in the class <code>TypeCode</code>. These
+exceptions are:
+<UL>
+<LI>
+<code>BadKind</code>
+
+<LI>
+<code>Bounds</code>
+</UL>
+The package <code><a href="ORBPackage/package-summary.html">
+org.omg.CORBA.ORBPackage</a></code> contains two exceptions:
+<UL>
+<LI>
+<code>InvalidName</code>
+
+<LI>
+<code>InconsistentTypeCode</code>
+</UL>
+
+<P>Another package that is a subpackage of <code>CORBA</code> is the
+<code><a href="portable/package-summary.html">portable</a></code>
+package. It provides a set of ORB APIs that makes it
+possible for code generated by one vendor's IDL compiler to run
+on another vendor's ORB.
+
+
+
+
+<H2>
+Holder classes</H2>
+
+
+<P>Support for out and inout parameter passing modes requires the use of
+additional <em><a href="doc-files/generatedfiles.html#holder">holder
+classes</a></em>. Because the Java programming language does not support out or
+inout parameters, holder classes are needed as a means of passing a parameter
+that can be modified. To support portable stubs and skeletons,
+holder classes also implement the
+<code><a href="portable/Streamable.html">org.omg.CORBA.portable.Streamable</a></code>
+interface.
+
+ <P>Holder classes are named by appending "Holder" to the name of the type.
+ The name of the type refers to its name in the Java programming language. For
+ example, a holder class for the interface named <code>Account</code>
+ in the Java programming
+ language would be named <code>AccountHolder</code>.
+
+
+<P>Holder classes are available for all of the basic IDL
+ datatypes in the <code>org.omg.CORBA</code> package. So, for example,
+ there are already-defined classes for <code>LongHolder</code>, <code>ShortHolder</code>,
+ <code>FloatHolder</code>, and so on. Classes are also generated for
+ all named user-defined IDL types except those defined by <code>typedefs</code>.
+ (Note that in this context user defined includes types that are
+ defined in OMG specifications such as those for the Interface
+ Repository, and other OMG services.)
+
+
+<P>Each holder class has:
+<UL>
+<LI>a constructor from an instance
+<LI>a default constructor
+<LI>a public instance member, <code>value</code> which is the typed value.
+<LI>a method for reading an input stream and assigning the contents to the
+type's <code>value</code> field
+<LI>a method for writing the value of the <code>value</code> field to an output stream
+<LI>a method for getting the typecode of the type
+</UL>
+
+<P>The default constructor sets the value field to the default value for the
+type as defined by the Java language:
+<UL>
+<LI><code>false</code> for boolean
+<LI><code>0</code> for numeric and char types
+<LI><code>null</code> for strings and object references
+</UL>
+
+
+
+<P>
+As an example, if the interface <code>Account</code>, defined in OMG IDL,
+were mapped to the Java programming language, the following holder class
+would be generated:
+<PRE>
+public final class AccountHolder implements
+ org.omg.CORBA.portable.Streamable
+{
+ // field that holds an Account object
+ public Account value = null;
+
+ // default constructor
+ public AccountHolder ()
+ {
+ }
+
+ // creates a new AccountHolder from initialValue
+ public AccountHolder (Account initialValue)
+ {
+ value = initialValue;
+ }
+
+ // reads the contents of i and assigns the contents to value
+ public void _read (org.omg.CORBA.portable.InputStream i)
+ {
+ value = AccountHelper.read (i);
+ }
+
+ // writes value to o
+ public void _write (org.omg.CORBA.portable.OutputStream o)
+ {
+ AccountHelper.write (o, value);
+ }
+
+ // returns the typecode for Account
+ public org.omg.CORBA.TypeCode _type ()
+ {
+ return AccountHelper.type ();
+ }
+
+}
+</PRE>
+
+<P>For more information on Holder classes, see Chapter 1.4, <em>Mapping for
+Basic Types</em> in the <a href="http://www.omg.org/cgi-bin/doc?ptc/00-01-08">
+<em>OMG IDL to Java Language Mapping</em></a>. The Holder classes defined
+in the package <code>org.omg.CORBA</code> are:
+<PRE><code>
+&nbsp;&nbsp;&nbsp;&nbsp; AnyHolder
+&nbsp;&nbsp;&nbsp;&nbsp; AnySeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; BooleanHolder
+&nbsp;&nbsp;&nbsp;&nbsp; BooleanSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; ByteHolder
+&nbsp;&nbsp;&nbsp;&nbsp; CharHolder
+&nbsp;&nbsp;&nbsp;&nbsp; CharSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; CurrentHolder
+&nbsp;&nbsp;&nbsp;&nbsp; DoubleHolder
+&nbsp;&nbsp;&nbsp;&nbsp; DoubleSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; FixedHolder
+&nbsp;&nbsp;&nbsp;&nbsp; FloatHolder
+&nbsp;&nbsp;&nbsp;&nbsp; FloatSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; IntHolder
+&nbsp;&nbsp;&nbsp;&nbsp; LongHolder
+&nbsp;&nbsp;&nbsp;&nbsp; LongLongSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; LongSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; ObjectHolder
+&nbsp;&nbsp;&nbsp;&nbsp; OctetSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; ParameterModeHolder
+&nbsp;&nbsp;&nbsp;&nbsp; PolicyErrorHolder
+&nbsp;&nbsp;&nbsp;&nbsp; PolicyListHolder
+&nbsp;&nbsp;&nbsp;&nbsp; PrincipalHolder
+&nbsp;&nbsp;&nbsp;&nbsp; ServiceInformationHolder
+&nbsp;&nbsp;&nbsp;&nbsp; ShortHolder
+&nbsp;&nbsp;&nbsp;&nbsp; ShortSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; StringHolder
+&nbsp;&nbsp;&nbsp;&nbsp; StringSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; TypeCodeHolder
+&nbsp;&nbsp;&nbsp;&nbsp; ULongLongSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; ULongSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; UnknownUserExceptionHolder
+&nbsp;&nbsp;&nbsp;&nbsp; UShortSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; ValueBaseHolder
+&nbsp;&nbsp;&nbsp;&nbsp; WCharSeqHolder
+&nbsp;&nbsp;&nbsp;&nbsp; WrongTransactionHolder
+&nbsp;&nbsp;&nbsp;&nbsp; WStringSeqHolder
+</code></PRE>
+
+<h2>Helper Classes </h2>
+<P>Helper files supply several static methods needed to manipulate the type.
+ These include:
+ <UL>
+ <LI><code>Any</code> insert and extract operations for the type
+ <LI>getting the repository id
+ <LI>getting the typecode
+ <LI>reading and writing the type from and to a stream
+ <LI>implement the <code>ValueHelper</code> interface (if it is a user-defined
+ value type)
+ </UL>
+
+<P>The helper class for a mapped IDL interface or abstract interface
+also include narrow operation(s). The static narrow method allows
+an <code>org.omg.CORBA.Object</code> to be narrowed to the object reference
+of a more specific type. The IDL exception <code>CORBA.BAD_PARAM</code>
+is thrown if the narrow fails because the object reference does not
+support the requested type. A different system exception is raised
+to indicate other kinds of errors. Trying to narrow a <code>null</code> will always
+succeed with a return value of <code>null</code>.
+Generally, the only helper method an application programmer uses is
+the <code>narrow</code> method. The other methods are normally used behind
+the scenes and are transparent to the programmer.
+
+<P>Helper classes
+fall into two broad categories, <a href="#value">helpers for value types</a> and
+<a href="#basic">helpers for non value types</a>. Because all of the helper
+classes in one category
+provide the same methods, one generic explanation of each
+category of helper classes is presented here.
+
+<P>
+When OMG IDL is mapped to the Java programming language,
+a "helper" class is generated for each user-defined type.
+This generated class will have the name of the user-defined type with
+the suffix <code>Helper</code> appended. For example, if the
+interface <code>Account</code> is defined in OMG IDL, the
+<code>idlj</code> compiler will automatically generate a class named
+<code>AccountHelper</code>. The <code>AccountHelper</code> class
+will contain the static methods needed for manipulating instances of the type,
+in this case, <code>Account</code> objects.
+
+
+<a id="narrow"></a>
+<h3>The <code>narrow</code> Method</h3>
+When an object is the return value for a method, it is returned in the
+form of a generic object, either an <code>org.omg.CORBA.Object</code> object
+or a <code>java.lang.Object</code> object. This object must be cast to its
+more specific type before it can be operated on. For example, an
+<code>Account</code> object will be returned as a generic object and must
+be narrowed to an <code>Account</code> object so that <code>Account</code>
+methods may be called on it.
+<P>
+The <code>narrow</code> method has two forms, one that takes an
+<code>org.omg.CORBA.Object</code> object and one that takes a
+<code>java.lang.Object</code> object. Whether the interface is abstract or
+not determines which <code>narrow</code> method its helper class will provide.
+The helper class for an interface
+that is not abstract will have a <code>narrow</code> method that takes a CORBA
+object, whereas the <code>narrow</code> method for an interface that is abstract
+will take an object in the Java programming language. The helper class for a
+non-abstract interface that has at least one abstract base interface will provide
+both versions of the <code>narrow</code> method.
+<P>The {@extLink idl_guides Hello World tutorial}
+uses a <code>narrow</code> method that looks like this:
+<PRE>
+ // create and initialize the ORB
+ ORB orb = ORB.init(args, null);
+
+ // get the root naming context
+ org.omg.CORBA.Object objRef =
+ orb.resolve_initial_references("NameService");
+ // Use NamingContextExt instead of NamingContext. This is
+ // part of latest Inter-Operable naming Service.
+ NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
+
+ // resolve the Object Reference in Naming
+ String name = "Hello";
+ helloImpl = HelloHelper.narrow(ncRef.resolve_str(name));
+</PRE>
+
+<a id="basic"></a>
+<h3>Example of a Basic Helper Class</h3>
+A basic helper class, for purposes of this explanation, is one with
+the methods that are provided by every helper class, plus a <code>narrow</code>
+method if the type defined in OMG IDL maps to an interface in the Java
+programming language. Types that are not value types will have a basic
+helper class generated for them.
+<P>
+For example, assuming that the interface <code>Account</code> is not a
+value type IDL type and is also not an abstract interface and has no
+abstract base interfaces, its <code>AccountHelper</code> class will look
+like this:
+<PRE>
+abstract public class AccountHelper
+{
+ private static String _id = "IDL:Account:1.0";
+
+ // inserts an Account object into an Any object
+ public static void insert (org.omg.CORBA.Any a, Account 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 ());
+ }
+
+ // extracts an Account object from an Any object
+ public static Account extract (org.omg.CORBA.Any a)
+ {
+ return read (a.create_input_stream ());
+ }
+
+
+ private static org.omg.CORBA.TypeCode __typeCode = null;
+ // gets the typecode for this type
+ synchronized public static org.omg.CORBA.TypeCode type ()
+ {
+ if (__typeCode == null)
+ {
+ __typeCode = org.omg.CORBA.ORB.init ().create_interface_tc (AccountHelper.id (), "Account");
+ }
+ return __typeCode;
+ }
+
+ // gets the repository id for this type
+ public static String id ()
+ {
+ return _id;
+ }
+
+ // reads an Account object from an input stream
+ public static Account read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return narrow (istream.read_Object (_AccountStub.class));
+ }
+
+ // writes an Account object to an outputstream
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, Account value)
+ {
+ ostream.write_Object ((org.omg.CORBA.Object) value);
+ }
+
+ // converts (narrows) an Object to an Account object
+ public static Account narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof Account)
+ return (Account)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 ();
+ _AccountStub stub = new _AccountStub ();
+ stub._set_delegate(delegate);
+ return stub;
+ }
+ }
+
+}
+</PRE>
+
+<a id="value"></a>
+<h3>Value Type Helper Classes</h3>
+A helper class for a value type includes different renderings of
+the same methods generated for non-value type methods. The main difference
+ is that value types are types that can be
+passed by value as parameters or return values of a method, which means that
+they must be serializable.
+<P>Assuming that <code>Address</code> is a value type, the
+<code>AddressHelper</code> class will look like this:
+<pre>
+abstract public class AddressHelper
+{
+ private static String _id = "IDL:Address:1.0";
+
+ // same as for non-value type
+ public static void insert (org.omg.CORBA.Any a, Address 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 ());
+ }
+
+ // same as for non-value type
+ public static Address 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;
+
+ // getting the typecode for the type
+ 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.ValueMember[] _members0 = new org.omg.CORBA.ValueMember[0];
+ org.omg.CORBA.TypeCode _tcOf_members0 = null;
+ __typeCode = org.omg.CORBA.ORB.init ().create_value_tc (_id, "Address", org.omg.CORBA.VM_NONE.value, null, _members0);
+ __active = false;
+ }
+ }
+ }
+ return __typeCode;
+ }
+
+ // same as for non-value type
+ public static String id ()
+ {
+ return _id;
+ }
+
+ // reads a serializable instance of Address from the given input stream
+ public static Address read (org.omg.CORBA.portable.InputStream istream)
+ {
+ return (Address)((org.omg.CORBA_2_3.portable.InputStream) istream).read_value (id ());
+ }
+
+ // writes a serializable instance of Address to the given output stream
+ public static void write (org.omg.CORBA.portable.OutputStream ostream, Address value)
+ {
+ ((org.omg.CORBA_2_3.portable.OutputStream) ostream).write_value (value, id ());
+ }
+
+
+}
+</pre>
+
+<P>The Helper classes defined in the package <code>org.omg.CORBA</code> are:
+<PRE><code>
+&nbsp;&nbsp;&nbsp;&nbsp; AnySeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; BooleanSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; CharSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; CompletionStatusHelper
+&nbsp;&nbsp;&nbsp;&nbsp; CurrentHelper
+&nbsp;&nbsp;&nbsp;&nbsp; DefinitionKindHelper
+&nbsp;&nbsp;&nbsp;&nbsp; DoubleSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; FieldNameHelper
+&nbsp;&nbsp;&nbsp;&nbsp; FloatSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; IdentifierHelper
+&nbsp;&nbsp;&nbsp;&nbsp; IDLTypeHelper
+&nbsp;&nbsp;&nbsp;&nbsp; LongLongSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; LongSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; NameValuePairHelper
+&nbsp;&nbsp;&nbsp;&nbsp; ObjectHelper
+&nbsp;&nbsp;&nbsp;&nbsp; OctetSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; ParameterModeHelper
+&nbsp;&nbsp;&nbsp;&nbsp; PolicyErrorCodeHelper
+&nbsp;&nbsp;&nbsp;&nbsp; PolicyErrorHelper
+&nbsp;&nbsp;&nbsp;&nbsp; PolicyHelper
+&nbsp;&nbsp;&nbsp;&nbsp; PolicyListHelper
+&nbsp;&nbsp;&nbsp;&nbsp; PolicyTypeHelper
+&nbsp;&nbsp;&nbsp;&nbsp; RepositoryIdHelper
+&nbsp;&nbsp;&nbsp;&nbsp; ServiceDetailHelper
+&nbsp;&nbsp;&nbsp;&nbsp; ServiceInformationHelper
+&nbsp;&nbsp;&nbsp;&nbsp; SetOverrideTypeHelper
+&nbsp;&nbsp;&nbsp;&nbsp; ShortSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; StringSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; StringValueHelper
+&nbsp;&nbsp;&nbsp;&nbsp; StructMemberHelper
+&nbsp;&nbsp;&nbsp;&nbsp; ULongLongSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; ULongSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; UnionMemberHelper
+&nbsp;&nbsp;&nbsp;&nbsp; UnknownUserExceptionHelper
+&nbsp;&nbsp;&nbsp;&nbsp; UShortSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; ValueBaseHelper
+&nbsp;&nbsp;&nbsp;&nbsp; ValueMemberHelper
+&nbsp;&nbsp;&nbsp;&nbsp; VersionSpecHelper
+&nbsp;&nbsp;&nbsp;&nbsp; VisibilityHelper
+&nbsp;&nbsp;&nbsp;&nbsp; WCharSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; WrongTransactionHelper
+&nbsp;&nbsp;&nbsp;&nbsp; WStringSeqHelper
+&nbsp;&nbsp;&nbsp;&nbsp; WStringValueHelper
+</code></PRE>
+<a id="adv"></a>
+<H1>
+Other Classes</H1>
+The other classes and interfaces in the <code>CORBA</code> package, which are
+used behind the scenes, can be put into four groups. Three of the groups
+are used with requests in some capacity, and the fourth group, concerning
+the Interface Repository, is a category by itself.
+<H2>
+Classes Created by an ORB</H2>
+The first group contains classes that are created by an ORB and contain
+information used in request operations.
+<UL>
+<LI>
+<code>TCKind</code> -- indicates the kind (datatype) for a <code>TypeCode</code>
+object
+
+<LI>
+<code>TypeCode</code> -- indicates a datatype and possibly other information
+
+<LI>
+<code>Any</code> -- contains a value and its typecode
+
+<LI>
+<code>NamedValue</code> -- contains a name, an <code>Any</code> object, and an
+argument mode flag. <code>NamedValue</code> objects contain information about
+method arguments, method return values, or a context.
+
+<LI>
+<code>ContextList</code> -- a list of strings that describe the contexts that
+need to be resolved and sent with an invocation
+
+<LI>
+<code>ExceptionList</code> -- a list of <code>TypeCode</code>s for exceptions that
+may be thrown by a method
+
+<LI>
+<code>Environment</code> -- a container for the exception thrown during a method
+invocation
+
+<LI>
+<code>Context</code> -- a list of <code>NamedValue</code> objects used to pass
+auxiliary information from client to server
+
+<LI>
+<code>NVList</code> -- a list of <code>NamedValue</code> objects, used to pass
+arguments or get results
+</UL>
+
+<H2>
+Classes That Deal with Requests</H2>
+The second group of classes deals with requests:
+<UL>
+<LI>
+<code>Object</code> -- the base class for all CORBA object references
+
+<LI>
+<code>Request</code> -- the main class in the DII, which contains methods for
+adding arguments to the request, for accessing information about the method
+being invoked (the method name, its arguments, exceptions it throws, and
+so on), and for making invocations on the request
+
+<LI>
+<code>DynamicImplementation</code> -- the base class for server implementations
+using the DSI. It has the method <code>invoke</code>, which is used by an
+implementation
+of this class to determine the state of a <code>ServerRequest</code> object
+and to set its result or exception
+
+<LI>
+<code>ServerRequest</code> -- captures the explicit state of a request for
+the Dynamic Skeleton Interface
+</UL>
+
+<H2>
+Interfaces That Serve as Constants</H2>
+The third group contains interfaces that serve as constants. The IDL-to-Java
+mapping mandates that IDL enums are mapped to a Java class with the enumerated
+values represented as public static final fields in that class (e.g.
+DefinitionKind).
+On the other hand IDL constants defined outside of an IDL interface are
+mapped to a Java interface for each constant.
+
+<P>This is why several interfaces in the <code>org.omg.CORBA</code> package
+consist of a single field, <code>value</code>, which is a <code>short</code>. This
+field is a constant used for such things as an error code or value modifier.
+For example, the <code>value</code> field of the interface <code>BAD_POLICY</code>
+is one of the possible reasons for the exception <code>PolicyError</code> to
+be thrown. To specify this error code, you would use <code>BAD_POLICY.value</code>.
+
+<P>The exception <code>PolicyError</code> uses the <code>value</code> field of
+the following interfaces as its possible error codes.
+<UL>
+<LI>
+<code>BAD_POLICY</code>
+
+<LI>
+<code>BAD_POLICY_TYPE</code>
+
+<LI>
+<code>BAD_POLICY_VALUE</code>
+
+<LI>
+<code>UNSUPPORTED_POLICY</code>
+
+<LI>
+<code>UNSUPPORTED_POLICY_VALUE</code>
+</UL>
+The method <code>TypeCode.type_modifier</code> returns the <code>value</code> field
+of one of the following interfaces. The <code>VM</code> in the names of these
+interfaces stands for "value modifier."
+<UL>
+<LI>
+<code>VM_NONE</code>
+
+<LI>
+<code>VM_ABSTRACT</code>
+
+<LI>
+<code>VM_CUSTOM</code>
+
+<LI>
+<code>VM_TRUNCATABLE</code>
+</UL>
+The following constants are returned by a <code>ValueMember</code> object's
+access method to denote the visibility of the <code>ValueMember</code> object.
+<UL>
+<LI>
+<code>PRIVATE_MEMBER</code>
+
+<LI>
+<code>PUBLIC_MEMBER</code>
+</UL>
+These flags, used in <code>NamedValue</code> objects or as parameters to methods,
+are defined in the following interfaces:
+<UL>
+<LI>
+<code>ARG_IN</code>
+
+<LI>
+<code>ARG_INOUT</code>
+
+<LI>
+<code>ARG_OUT</code>
+
+<LI>
+<code>CTX_RESTRICT_SCOPE</code>
+</UL>
+
+<H2>
+Interface Repository Interfaces and Classes</H2>
+A fourth group contains the Interface Repository interfaces and classes,
+which are generated by the <code>idlj</code> compiler from the OMG IDL
+interface <code>ir.idl</code>. The purpose of the Interface Repository is to
+identify the interfaces stored in it so that they can be accessed by an
+ORB. Each module, type, interface, attribute, operation, parameter, exception,
+constant, and so on is described completely by the Interface Repository
+API.
+
+<P>An ORB does not require that there be an interface repository, and Java
+IDL does not include one. Even though this release does not include an
+implementation of an interface repository, the following IR classes and
+interfaces have been included for the purpose of creating typecodes (see
+create_value_tc, create_struct_tc, create_union_tc and create_exception_tc
+methods in interface org.omg.CORBA.ORB):
+<BR>&nbsp;
+<UL>
+<LI>
+IRObject
+
+<LI>
+IDLType
+
+<LI>
+DefinitionKind
+
+<LI>
+StructMember
+
+<LI>
+UnionMember
+
+<LI>
+ValueMember
+</UL>
+<!-- End Page Data -->
+<HR>
+<H1>
+Related Documentation</H1>
+For overviews, guides, and a tutorial, please see:
+<UL>
+<LI> {@extLink idl_guides Java&nbsp;IDL tutorial page}.</LI>
+<LI> {@extLink rmi_iiop_guides RMI-IIOP developer's guide}.</LI>
+</UL>
+
+
+
+
+<P><A id="unimpl"></A>
+<H1>
+CORBA Features Not Implemented in Java IDL</H1>
+
+<P>Some of the API included in <code>org.omg</code> subpackages is provided for
+conformance with the current OMG CORBA specification but is not implemented
+in Sun's release of the JDK&trade;. This enables
+other JDK licensees to provide implementations of this API in standard
+extensions and products.
+
+<P><A id="NO_IMPLEMENT"></A>
+<h2>Features That Throw NO_IMPLEMENT</h2>
+
+<P>Some of the API included in <code>org.omg</code> subpackages throw
+<code>NO_IMPLEMENT</code> exceptions for various reasons. Among these reasons
+are:
+ <UL>
+ <LI>In some cases, for example <code>LocalObject</code>, the complete
+ implementation according to the specification indicates that
+ these API should throw <code>NO_IMPLEMENT</code>.
+
+ <LI>In most cases, for example methods in <code>ORB.java</code>,
+ methods that throw
+ <code>NO_IMPLEMENT</code> are actually implemented in subclasses
+ elsewhere in the ORB code.
+
+ <LI>In some cases, for example <code>_get_interface_def()</code>
+ and <code>_get_interface</code>, API are really not yet implemented.
+ </UL>
+
+
+
+
+<H2>
+General Summary of Features or API Not Implemented in This Release:</H2>
+
+<UL>
+<LI>
+Interface Repository. An Interface Repository is not required for normal
+operation of Java IDL.
+
+<LI>
+Java IDL does not support <code>long double</code>.
+
+
+<LI>
+Policies (<code><a href="Policy.html">org.omg.CORBA.Policy</a></code>)
+and methods for getting them are not implemented.
+
+<LI>
+Domain managers (<code><a href="DomainManager.html">org.omg.CORBA.DomainManager</a></code>) and methods for
+getting them are not implemented.
+
+<LI>
+Service Information <code><a href="ServiceInformation.html">org.omg.CORBA.ServiceInformation</a></code>
+and ORB method
+<code>public boolean get_service_information(short service_type, ServiceInformationHolder service_info)</code>
+are not implemented.
+
+<LI>ORB methods for supporting single-threading
+(<code>perform_work</code>, <code>work_pending</code>) are not implemented.
+
+<LI>IDL contexts.
+</UL>
+
+<HR>
+<H2>
+Specific List of Unimplemented Features in Package <code>org.omg.CORBA</code></H2>
+
+
+<H3>
+Unimplemented Methods in package <code>org.omg.CORBA</code>:</H3>
+
+<UL>
+<LI>
+<code>ORB</code>
+
+<UL>
+<LI>
+<code>public org.omg.CORBA.Policy create_policy(int type, org.omg.CORBA.Any val)</code>
+
+
+
+<LI>
+<code>public void perform_work()</code>
+
+<LI>
+<code>public boolean work_pending()</code>
+
+<LI>
+<code>public org.omg.CORBA.Current get_current()</code>
+
+<LI>
+<code>create_operation_list</code>
+
+<LI>
+<code>get_default_context</code>
+
+<LI>
+<code>get_service_information</code>
+
+<LI>
+obsolete <code>DynAnys</code> (deprecated in favor of <code>DynamicAny</code> package)
+
+
+</UL>
+
+
+
+</UL>
+@since JDK1.2
+@serial exclude
+</BODY>
+</HTML>
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/ApplicationException.java b/src/java.corba/share/classes/org/omg/CORBA/portable/ApplicationException.java
new file mode 100644
index 0000000..f9cf860
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/ApplicationException.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.portable;
+
+/**
+This class is used for reporting application level exceptions between ORBs and stubs.
+*/
+
+public class ApplicationException extends Exception {
+ /**
+ * Constructs an ApplicationException from the CORBA repository ID of the exception
+ * and an input stream from which the exception data can be read as its parameters.
+ * @param id the repository id of the user exception
+ * @param ins the stream which contains the user exception data
+ */
+ public ApplicationException(String id,
+ InputStream ins) {
+ this.id = id;
+ this.ins = ins;
+ }
+
+ /**
+ * Returns the CORBA repository ID of the exception
+ * without removing it from the exceptions input stream.
+ * @return The CORBA repository ID of this exception
+ */
+ public String getId() {
+ return id;
+ }
+
+ /**
+ * Returns the input stream from which the exception data can be read as its parameters.
+ * @return The stream which contains the user exception data
+ */
+ public InputStream getInputStream() {
+ return ins;
+ }
+
+ private String id;
+ private InputStream ins;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/BoxedValueHelper.java b/src/java.corba/share/classes/org/omg/CORBA/portable/BoxedValueHelper.java
new file mode 100644
index 0000000..71ad68e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/BoxedValueHelper.java
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA.portable;
+import java.io.Serializable;
+
+public interface BoxedValueHelper {
+ Serializable read_value(InputStream is);
+ void write_value(OutputStream os, Serializable value);
+ String get_id();
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/CustomValue.java b/src/java.corba/share/classes/org/omg/CORBA/portable/CustomValue.java
new file mode 100644
index 0000000..9e785ba
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/CustomValue.java
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/**
+ * Defines the base interface for all custom value types
+ * generated from IDL.
+ *
+ * All value types implement ValueBase either directly
+ * or indirectly by implementing either the StreamableValue
+ * or CustomValue interface.
+ * @author OMG
+ */
+
+package org.omg.CORBA.portable;
+
+import org.omg.CORBA.CustomMarshal;
+/**
+ * An extension of <code>ValueBase</code> that is implemented by custom value
+ * types.
+ */
+public interface CustomValue extends ValueBase, CustomMarshal {
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/Delegate.java b/src/java.corba/share/classes/org/omg/CORBA/portable/Delegate.java
new file mode 100644
index 0000000..a0375fb
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/Delegate.java
@@ -0,0 +1,408 @@
+/*
+ * Copyright (c) 1997, 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA.portable;
+
+import org.omg.CORBA.Request;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.SystemException;
+
+/**
+ * Specifies a portable API for ORB-vendor-specific
+ * implementation of the org.omg.CORBA.Object methods.
+ *
+ * Each stub (proxy) contains a delegate
+ * object, to which all org.omg.CORBA.Object methods are forwarded.
+ * This allows a stub generated by one vendor's ORB to work with the delegate
+ * from another vendor's ORB.
+ *
+ * @see org.omg.CORBA.Object
+ * @author OMG
+ */
+
+public abstract class Delegate {
+
+ /**
+ * Return an InterfaceDef for the object reference provided.
+ * @param self The object reference whose InterfaceDef needs to be returned
+ * @return the InterfaceDef
+ */
+ public abstract org.omg.CORBA.Object get_interface_def(
+ org.omg.CORBA.Object self);
+
+ /**
+ * Returns a duplicate of the object reference provided.
+ * @param obj The object reference whose duplicate needs to be returned
+ * @return the duplicate object reference
+ */
+ public abstract org.omg.CORBA.Object duplicate(org.omg.CORBA.Object obj);
+
+ /**
+ * Releases resources associated with the object reference provided.
+ * @param obj The object reference whose resources need to be released
+ */
+ public abstract void release(org.omg.CORBA.Object obj);
+
+ /**
+ * Checks if the object reference is an instance of the given interface.
+ * @param obj The object reference to be checked.
+ * @param repository_id The repository identifier of the interface
+ * to check against.
+ * @return true if the object reference supports the interface
+ */
+ public abstract boolean is_a(org.omg.CORBA.Object obj, String repository_id);
+
+ /**
+ * Determines whether the server object for the object reference has been
+ * destroyed.
+ * @param obj The object reference which delegated to this delegate.
+ * @return true if the ORB knows authoritatively that the server object does
+ * not exist, false otherwise
+ */
+ public abstract boolean non_existent(org.omg.CORBA.Object obj);
+
+ /**
+ * Determines if the two object references are equivalent.
+ * @param obj The object reference which delegated to this delegate.
+ * @param other The object reference to check equivalence against.
+ * @return true if the objects are CORBA-equivalent.
+ */
+ public abstract boolean is_equivalent(org.omg.CORBA.Object obj,
+ org.omg.CORBA.Object other);
+
+ /**
+ * Returns an ORB-internal identifier (hashcode) for this object reference.
+ * @param obj The object reference which delegated to this delegate.
+ * @param max specifies an upper bound on the hash value returned by
+ * the ORB.
+ * @return ORB-internal hash identifier for object reference
+ */
+ public abstract int hash(org.omg.CORBA.Object obj, int max);
+
+ /**
+ * Creates a Request instance for use in the Dynamic Invocation Interface.
+ * @param obj The object reference which delegated to this delegate.
+ * @param operation The name of the operation to be invoked using the
+ * Request instance.
+ * @return the created Request instance
+ */
+ public abstract Request request(org.omg.CORBA.Object obj, String operation);
+
+ /**
+ * Creates a Request instance for use in the Dynamic Invocation Interface.
+ *
+ * @param obj The object reference which delegated to this delegate.
+ * @param ctx The context to be used.
+ * @param operation The name of the operation to be
+ * invoked.
+ * @param arg_list The arguments to the operation in the
+ * form of an NVList.
+ * @param result A container for the result as a NamedValue.
+ * @return The created Request object.
+ *
+ */
+ public abstract Request create_request(org.omg.CORBA.Object obj,
+ Context ctx,
+ String operation,
+ NVList arg_list,
+ NamedValue result);
+
+ /**
+ * Creates a Request instance for use in the Dynamic Invocation Interface.
+ *
+ * @param obj The object reference which delegated to this delegate.
+ * @param ctx The context to be used.
+ * @param operation The name of the operation to be
+ * invoked.
+ * @param arg_list The arguments to the operation in the
+ * form of an NVList.
+ * @param result A container for the result as a NamedValue.
+ * @param exclist A list of possible exceptions the
+ * operation can throw.
+ * @param ctxlist A list of context strings that need
+ * to be resolved and sent with the
+ * Request.
+ * @return The created Request object.
+ */
+ public abstract Request create_request(org.omg.CORBA.Object obj,
+ Context ctx,
+ String operation,
+ NVList arg_list,
+ NamedValue result,
+ ExceptionList exclist,
+ ContextList ctxlist);
+
+ /**
+ * Provides a reference to the orb associated with its parameter.
+ *
+ * @param obj the object reference which delegated to this delegate.
+ * @return the associated orb.
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.ORB orb(org.omg.CORBA.Object obj) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Returns the <code>Policy</code> object of the specified type
+ * which applies to this object.
+ *
+ * @param self The object reference which delegated to this delegate.
+ * @param policy_type The type of policy to be obtained.
+ * @return A <code>Policy</code> object of the type specified by
+ * the policy_type parameter.
+ * @exception org.omg.CORBA.BAD_PARAM raised when the value of policy type
+ * is not valid either because the specified type is not supported by this
+ * ORB or because a policy object of that type is not associated with this
+ * Object.
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.Policy get_policy(org.omg.CORBA.Object self,
+ int policy_type) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+ /**
+ * Retrieves the <code>DomainManagers</code> of this object.
+ * This allows administration services (and applications) to retrieve the
+ * domain managers, and hence the security and other policies applicable
+ * to individual objects that are members of the domain.
+ *
+ * @param self The object reference which delegated to this delegate.
+ * @return The list of immediately enclosing domain managers of this object.
+ * At least one domain manager is always returned in the list since by
+ * default each object is associated with at least one domain manager at
+ * creation.
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.DomainManager[] get_domain_managers(
+ org.omg.CORBA.Object
+ self) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+ /**
+ * Associates the policies passed in
+ * with a newly created object reference that it returns. Only certain
+ * policies that pertain to the invocation of an operation at the client
+ * end can be overridden using this operation. Attempts to override any
+ * other policy will result in the raising of the CORBA::NO_PERMISSION
+ * exception.
+ *
+ * @param self The object reference which delegated to this delegate.
+ * @param policies A sequence of references to Policy objects.
+ * @param set_add Indicates whether these policies should be added
+ * onto any otheroverrides that already exist (ADD_OVERRIDE) in
+ * the object reference, or they should be added to a clean
+ * override free object reference (SET_OVERRIDE).
+ * @return A new object reference with the new policies associated with it.
+ *
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self,
+ org.omg.CORBA.Policy[] policies,
+ org.omg.CORBA.SetOverrideType set_add) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+ /**
+ * Returns true if this object is implemented by a local servant.
+ *
+ * @param self The object reference which delegated to this delegate.
+ * @return true only if the servant incarnating this object is located in
+ * this Java VM. Return false if the servant is not local or the ORB
+ * does not support local stubs for this particular servant. The default
+ * behavior of is_local() is to return false.
+ */
+ public boolean is_local(org.omg.CORBA.Object self) {
+ return false;
+ }
+
+ /**
+ * 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. The ServantRequest object is valid for only one invocation,
+ * and cannot be used for more than one invocation.
+ *
+ * @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 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.
+ */
+ public ServantObject servant_preinvoke(org.omg.CORBA.Object self,
+ String operation,
+ Class expectedType) {
+ return null;
+ }
+
+ /**
+ * servant_postinvoke() is invoked by the local stub after the operation
+ * has been invoked on the local servant.
+ * This method must be called if servant_preinvoke() returned a non-null
+ * value, even if an exception was thrown by the servant's method.
+ * For this reason, the call to servant_postinvoke() should be placed
+ * in a Java finally clause.
+ *
+ * @param self The object reference which delegated to this delegate.
+ *
+ * @param servant the instance of the ServantObject returned from
+ * the servant_preinvoke() method.
+ */
+ public void servant_postinvoke(org.omg.CORBA.Object self,
+ ServantObject servant) {
+ }
+
+ /**
+ * request is called by a stub to obtain an OutputStream for
+ * marshaling arguments. The stub must supply the operation name,
+ * and indicate if a response is expected (i.e is this a oneway
+ * call).
+ *
+ * @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 responseExpected false if the operation is a one way operation,
+ * and true otherwise.
+ * @return OutputStream the OutputStream into which request arguments
+ * can be marshaled.
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public OutputStream request(org.omg.CORBA.Object self,
+ String operation,
+ boolean responseExpected) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * invoke is called by a stub to invoke an operation. The stub provides an
+ * OutputStream that was previously returned by a request()
+ * call. invoke returns an InputStream which contains the
+ * marshaled reply. If an exception occurs, invoke may throw an
+ * ApplicationException object which contains an InputStream from
+ * which the user exception state may be unmarshaled.
+ *
+ * @param self The object reference which delegated to this delegate.
+ * @param output the OutputStream which contains marshaled arguments
+ * @return input the InputStream from which reply parameters can be
+ * unmarshaled.
+ * @throws ApplicationException thrown when implementation throws
+ * (upon invocation) an exception defined as part of its remote method
+ * definition.
+ * @throws RemarshalException thrown when remarshalling fails.
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public InputStream invoke(org.omg.CORBA.Object self,
+ OutputStream output)
+ throws ApplicationException, RemarshalException {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * releaseReply may optionally be called by a stub to release a
+ * reply stream back to the ORB when the unmarshaling has
+ * completed. The stub passes the InputStream returned by
+ * invoke() or ApplicationException.getInputStream(). A null
+ * value may also be passed to releaseReply, in which case the
+ * method is a noop.
+ *
+ * @param self The object reference which delegated to this delegate.
+ * @param input the InputStream returned from invoke().
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public void releaseReply(org.omg.CORBA.Object self,
+ InputStream input) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Provides the implementation to override the toString() method
+ * of the delegating CORBA object.
+ *
+ * @param self the object reference that delegated to this delegate
+ * @return a <code>String</code> object that represents the object
+ * reference that delegated to this <code>Delegate</code>
+ * object
+ */
+
+ public String toString(org.omg.CORBA.Object self) {
+ return self.getClass().getName() + ":" + this.toString();
+ }
+
+ /**
+ * Provides the implementation to override the hashCode() method
+ * of the delegating CORBA object.
+ *
+ * @param self the object reference that delegated to this delegate
+ * @return an <code>int</code> that represents the hashcode for the
+ * object reference that delegated to this <code>Delegate</code>
+ * object
+ */
+ public int hashCode(org.omg.CORBA.Object self) {
+ return System.identityHashCode(self);
+ }
+
+ /**
+ * Provides the implementation to override the equals(java.lang.Object obj)
+ * method of the delegating CORBA object.
+ *
+ * @param self the object reference that delegated to this delegate
+ * @param obj the <code>Object</code> with which to compare
+ * @return <code>true</code> if <code>obj</code> equals <code>self</code>;
+ * <code>false</code> otherwise
+ */
+ public boolean equals(org.omg.CORBA.Object self, java.lang.Object obj) {
+ return (self == obj);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/IDLEntity.java b/src/java.corba/share/classes/org/omg/CORBA/portable/IDLEntity.java
new file mode 100644
index 0000000..867fdeb
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/IDLEntity.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.portable;
+
+/**
+ * An interface with no members whose only purpose is to serve as a marker
+ * indicating that an implementing class is a
+ * Java value type from IDL that has a corresponding Helper class.
+ * RMI IIOP serialization looks for such a marker to perform
+ * marshalling/unmarshalling.
+ **/
+public interface IDLEntity extends java.io.Serializable {
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/IndirectionException.java b/src/java.corba/share/classes/org/omg/CORBA/portable/IndirectionException.java
new file mode 100644
index 0000000..cdf73ac
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/IndirectionException.java
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA.portable;
+
+import org.omg.CORBA.SystemException;
+/**
+ * The Indirection exception is a Java specific system exception.
+ * It is thrown when the ORB's input stream is called to demarshal
+ * a value that is encoded as an indirection that is in the process
+ * of being demarshaled. This can occur when the ORB input stream
+ * calls the ValueHandler to demarshal an RMI value whose state
+ * contains a recursive reference to itself. Because the top-level
+ * ValueHandler.read_value() call has not yet returned a value,
+ * the ORB input stream's indirection table does not contain an entry
+ * for an object with the stream offset specified by the indirection
+ * tag. The stream offset is returned in the exception's offset field.
+ * @see org.omg.CORBA_2_3.portable.InputStream
+ * @see org.omg.CORBA_2_3.portable.OutputStream
+ */
+public class IndirectionException extends SystemException {
+
+ /**
+ * Points to the stream's offset.
+ */
+ public int offset;
+
+ /**
+ * Creates an IndirectionException with the right offset value.
+ * The stream offset is returned in the exception's offset field.
+ * This exception is constructed and thrown during reading
+ * recursively defined values off of a stream.
+ *
+ * @param offset the stream offset where recursion is detected.
+ */
+ public IndirectionException(int offset){
+ super("", 0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ this.offset = offset;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/InputStream.java b/src/java.corba/share/classes/org/omg/CORBA/portable/InputStream.java
new file mode 100644
index 0000000..e03578e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/InputStream.java
@@ -0,0 +1,320 @@
+/*
+ * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA.portable;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.Any;
+
+/**
+ * InputStream is the Java API for reading IDL types
+ * from CDR marshal streams. These methods are used by the ORB to
+ * unmarshal IDL types as well as to extract IDL types out of Anys.
+ * The <code>_array</code> versions of the methods can be directly
+ * used to read sequences and arrays of IDL types.
+ *
+ * @since JDK1.2
+ */
+
+public abstract class InputStream extends java.io.InputStream
+{
+ /**
+ * Reads a boolean value from this input stream.
+ *
+ * @return the <code>boolean</code> value read from this input stream
+ */
+ public abstract boolean read_boolean();
+ /**
+ * Reads a char value from this input stream.
+ *
+ * @return the <code>char</code> value read from this input stream
+ */
+ public abstract char read_char();
+ /**
+ * Reads a wide char value from this input stream.
+ *
+ * @return the <code>char</code> value read from this input stream
+ */
+ public abstract char read_wchar();
+ /**
+ * Reads an octet (that is, a byte) value from this input stream.
+ *
+ * @return the <code>byte</code> value read from this input stream
+ */
+ public abstract byte read_octet();
+ /**
+ * Reads a short value from this input stream.
+ *
+ * @return the <code>short</code> value read from this input stream
+ */
+ public abstract short read_short();
+ /**
+ * Reads a unsigned short value from this input stream.
+ *
+ * @return the <code>short</code> value read from this input stream
+ */
+ public abstract short read_ushort();
+ /**
+ * Reads a CORBA long (that is, Java int) value from this input stream.
+ *
+ * @return the <code>int</code> value read from this input stream
+ */
+ public abstract int read_long();
+ /**
+ * Reads an unsigned CORBA long (that is, Java int) value from this input
+stream.
+ *
+ * @return the <code>int</code> value read from this input stream
+ */
+ public abstract int read_ulong();
+ /**
+ * Reads a CORBA longlong (that is, Java long) value from this input stream.
+ *
+ * @return the <code>long</code> value read from this input stream
+ */
+ public abstract long read_longlong();
+ /**
+ * Reads a CORBA unsigned longlong (that is, Java long) value from this input
+stream.
+ *
+ * @return the <code>long</code> value read from this input stream
+ */
+ public abstract long read_ulonglong();
+ /**
+ * Reads a float value from this input stream.
+ *
+ * @return the <code>float</code> value read from this input stream
+ */
+ public abstract float read_float();
+ /**
+ * Reads a double value from this input stream.
+ *
+ * @return the <code>double</code> value read from this input stream
+ */
+ public abstract double read_double();
+ /**
+ * Reads a string value from this input stream.
+ *
+ * @return the <code>String</code> value read from this input stream
+ */
+ public abstract String read_string();
+ /**
+ * Reads a wide string value from this input stream.
+ *
+ * @return the <code>String</code> value read from this input stream
+ */
+ public abstract String read_wstring();
+
+ /**
+ * Reads an array of booleans from this input stream.
+ * @param value returned array of booleans.
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_boolean_array(boolean[] value, int offset, int
+length);
+ /**
+ * Reads an array of chars from this input stream.
+ * @param value returned array of chars.
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_char_array(char[] value, int offset, int
+length);
+ /**
+ * Reads an array of wide chars from this input stream.
+ * @param value returned array of wide chars.
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_wchar_array(char[] value, int offset, int
+length);
+ /**
+ * Reads an array of octets (that is, bytes) from this input stream.
+ * @param value returned array of octets (that is, bytes).
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_octet_array(byte[] value, int offset, int
+length);
+ /**
+ * Reads an array of shorts from this input stream.
+ * @param value returned array of shorts.
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_short_array(short[] value, int offset, int
+length);
+ /**
+ * Reads an array of unsigned shorts from this input stream.
+ * @param value returned array of shorts.
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_ushort_array(short[] value, int offset, int
+length);
+ /**
+ * Reads an array of CORBA longs (that is, Java ints) from this input stream.
+ * @param value returned array of CORBA longs (that is, Java ints).
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_long_array(int[] value, int offset, int
+length);
+ /**
+ * Reads an array of unsigned CORBA longs (that is, Java ints) from this input
+stream.
+ * @param value returned array of CORBA longs (that is, Java ints).
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_ulong_array(int[] value, int offset, int
+length);
+ /**
+ * Reads an array of CORBA longlongs (that is, Java longs) from this input
+stream.
+ * @param value returned array of CORBA longs (that is, Java longs).
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_longlong_array(long[] value, int offset, int
+length);
+ /**
+ * Reads an array of unsigned CORBA longlongs (that is, Java longs) from this
+input stream.
+ * @param value returned array of CORBA longs (that is, Java longs).
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_ulonglong_array(long[] value, int offset, int
+length);
+ /**
+ * Reads an array of floats from this input stream.
+ * @param value returned array of floats.
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_float_array(float[] value, int offset, int
+length);
+ /**
+ * Reads an array of doubles from this input stream.
+ * @param value returned array of doubles.
+ * @param offset offset on the stream.
+ * @param length length of buffer to read.
+ */
+ public abstract void read_double_array(double[] value, int offset, int
+length);
+
+ /**
+ * Reads a CORBA object from this input stream.
+ *
+ * @return the <code>Object</code> instance read from this input stream.
+ */
+ public abstract org.omg.CORBA.Object read_Object();
+ /**
+ * Reads a <code>TypeCode</code> from this input stream.
+ *
+ * @return the <code>TypeCode</code> instance read from this input stream.
+ */
+ public abstract TypeCode read_TypeCode();
+ /**
+ * Reads an Any from this input stream.
+ *
+ * @return the <code>Any</code> instance read from this input stream.
+ */
+ public abstract Any read_any();
+
+ /**
+ * Returns principal for invocation.
+ * @return Principal for invocation.
+ * @deprecated Deprecated by CORBA 2.2.
+ */
+ @Deprecated
+ public Principal read_Principal() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+ /**
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public int read() throws java.io.IOException {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Reads a BigDecimal number.
+ * @return a java.math.BigDecimal number
+ */
+ public java.math.BigDecimal read_fixed() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Reads a CORBA context from the stream.
+ * @return a CORBA context
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.Context read_Context() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+ /*
+ * The following methods were added by orbos/98-04-03: Java to IDL
+ * Mapping. These are used by RMI over IIOP.
+ */
+
+ /**
+ * Unmarshals an object and returns a CORBA Object,
+ * which is an instance of the class passed as its argument.
+ * This class is the stub class of the expected type.
+ *
+ * @param clz The Class object for the stub class which
+ * corresponds to the type that is statistically expected, or
+ * the Class object for the RMI/IDL interface type that
+ * is statistically expected.
+ * @return an Object instance of clz read from this stream
+ *
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.Object read_Object(java.lang.Class
+ clz) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Returns the ORB that created this InputStream.
+ *
+ * @return the <code>ORB</code> object that created this stream
+ *
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.ORB orb() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/InvokeHandler.java b/src/java.corba/share/classes/org/omg/CORBA/portable/InvokeHandler.java
new file mode 100644
index 0000000..b626a5c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/InvokeHandler.java
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1998, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA.portable;
+
+/**
+This interface provides a dispatching mechanism for an incoming call.
+It is invoked by the ORB to dispatch a request to a servant.
+*/
+
+public interface InvokeHandler {
+ /**
+ * Invoked by the ORB to dispatch a request to the servant.
+ *
+ * ORB passes the method name, an InputStream containing the
+ * marshalled arguments, and a ResponseHandler which the servant
+ * uses to construct a proper reply.
+ *
+ * Only CORBA SystemException may be thrown by this method.
+ *
+ * The method must return an OutputStream created by the
+ * ResponseHandler which contains the marshalled reply.
+ *
+ * A servant must not retain a reference to the ResponseHandler
+ * beyond the lifetime of a method invocation.
+ *
+ * Servant behaviour is defined as follows:
+ * <p>1. Determine correct method, and unmarshal parameters from
+ * InputStream.
+ * <p>2. Invoke method implementation.
+ * <p>3. If no user exception, create a normal reply using
+ * ResponseHandler.
+ * <p>4. If user exception occurred, create exception reply using
+ * ResponseHandler.
+ * <p>5. Marshal reply into OutputStream returned by
+ * ResponseHandler.
+ * <p>6. Return OutputStream to ORB.
+ *
+ * @param method The method name.
+ * @param input The <code>InputStream</code> containing the marshalled arguments.
+ * @param handler The <code>ResponseHandler</code> which the servant uses
+ * to construct a proper reply
+ * @return The <code>OutputStream</code> created by the
+ * ResponseHandler which contains the marshalled reply
+ * @throws SystemException is thrown when invocation fails due to a CORBA system exception.
+ */
+
+ OutputStream _invoke(String method, InputStream input,
+ ResponseHandler handler)
+ throws org.omg.CORBA.SystemException;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/ObjectImpl.java b/src/java.corba/share/classes/org/omg/CORBA/portable/ObjectImpl.java
new file mode 100644
index 0000000..3cd515d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/ObjectImpl.java
@@ -0,0 +1,534 @@
+/*
+ * Copyright (c) 1997, 2006, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA.portable;
+
+import org.omg.CORBA.Request;
+import org.omg.CORBA.NamedValue;
+import org.omg.CORBA.NVList;
+import org.omg.CORBA.ExceptionList;
+import org.omg.CORBA.ContextList;
+import org.omg.CORBA.Context;
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.BAD_OPERATION;
+import org.omg.CORBA.SystemException;
+
+
+/**
+ * The common base class for all stub classes; provides default implementations
+ * of the <code>org.omg.CORBA.Object</code> methods. All method implementations are
+ * forwarded to a <code>Delegate</code> object stored in the <code>ObjectImpl</code>
+ * instance. <code>ObjectImpl</code> allows for portable stubs because the
+ * <code>Delegate</code> can be implemented by a different vendor-specific ORB.
+ */
+
+abstract public class ObjectImpl implements org.omg.CORBA.Object
+{
+
+ /**
+ * The field that stores the <code>Delegate</code> instance for
+ * this <code>ObjectImpl</code> object. This <code>Delegate</code>
+ * instance can be implemented by a vendor-specific ORB. Stub classes,
+ * which are derived from this <code>ObjectImpl</code> class, can be
+ * portable because they delegate all of the methods called on them to this
+ * <code>Delegate</code> object.
+ */
+ private transient Delegate __delegate;
+
+
+ /**
+ * Retrieves the reference to the vendor-specific <code>Delegate</code>
+ * object to which this <code>ObjectImpl</code> object delegates all
+ * methods invoked on it.
+ *
+ * @return the Delegate contained in this ObjectImpl instance
+ * @throws BAD_OPERATION if the delegate has not been set
+ * @see #_set_delegate
+ */
+ public Delegate _get_delegate() {
+ if (__delegate == null)
+ throw new BAD_OPERATION("The delegate has not been set!");
+ return __delegate;
+ }
+
+
+ /**
+ * Sets the Delegate for this <code>ObjectImpl</code> instance to the given
+ * <code>Delegate</code> object. All method invocations on this
+ * <code>ObjectImpl</code> object will be forwarded to this delegate.
+ *
+ * @param delegate the <code>Delegate</code> instance to which
+ * all method calls on this <code>ObjectImpl</code> object
+ * will be delegated; may be implemented by a third-party ORB
+ * @see #_get_delegate
+ */
+ public void _set_delegate(Delegate delegate) {
+ __delegate = delegate;
+ }
+
+ /**
+ * Retrieves a string array containing the repository identifiers
+ * supported by this <code>ObjectImpl</code> object. For example,
+ * for a stub, this method returns information about all the
+ * interfaces supported by the stub.
+ *
+ * @return the array of all repository identifiers supported by this
+ * <code>ObjectImpl</code> instance
+ */
+ public abstract String[] _ids();
+
+
+ /**
+ * Returns a duplicate of this <code>ObjectImpl</code> object.
+ *
+ * @return an <code>orb.omg.CORBA.Object</code> object that is
+ * a duplicate of this object
+ */
+ public org.omg.CORBA.Object _duplicate() {
+ return _get_delegate().duplicate(this);
+ }
+
+ /**
+ * Releases the resources associated with this <code>ObjectImpl</code> object.
+ */
+ public void _release() {
+ _get_delegate().release(this);
+ }
+
+ /**
+ * Checks whether the object identified by the given repository
+ * identifier is an <code>ObjectImpl</code> object.
+ *
+ * @param repository_id a <code>String</code> object with the repository
+ * identifier to check
+ * @return <code>true</code> if the object identified by the given
+ * repository id is an instance of <code>ObjectImpl</code>;
+ * <code>false</code> otherwise
+ */
+ public boolean _is_a(String repository_id) {
+ return _get_delegate().is_a(this, repository_id);
+ }
+
+ /**
+ * Checks whether the the given <code>ObjectImpl</code> object is
+ * equivalent to this <code>ObjectImpl</code> object.
+ *
+ * @param that an instance of <code>ObjectImpl</code> to compare with
+ * this <code>ObjectImpl</code> object
+ * @return <code>true</code> if the given object is equivalent
+ * to this <code>ObjectImpl</code> object;
+ * <code>false</code> otherwise
+ */
+ public boolean _is_equivalent(org.omg.CORBA.Object that) {
+ return _get_delegate().is_equivalent(this, that);
+ }
+
+ /**
+ * Checks whether the server object for this <code>ObjectImpl</code>
+ * object has been destroyed.
+ *
+ * @return <code>true</code> if the ORB knows authoritatively that the
+ * server object does not exist; <code>false</code> otherwise
+ */
+ public boolean _non_existent() {
+ return _get_delegate().non_existent(this);
+ }
+
+ /**
+ * Retrieves the hash code that serves as an ORB-internal identifier for
+ * this <code>ObjectImpl</code> object.
+ *
+ * @param maximum an <code>int</code> indicating the upper bound on the hash
+ * value returned by the ORB
+ * @return an <code>int</code> representing the hash code for this
+ * <code>ObjectImpl</code> object
+ */
+ public int _hash(int maximum) {
+ return _get_delegate().hash(this, maximum);
+ }
+
+ /**
+ * Creates a <code>Request</code> object containing the given method
+ * that can be used with the Dynamic Invocation Interface.
+ *
+ * @param operation the method to be invoked by the new <code>Request</code>
+ * object
+ * @return a new <code>Request</code> object initialized with the
+ * given method
+ */
+ public Request _request(String operation) {
+ return _get_delegate().request(this, operation);
+ }
+
+ /**
+ * Creates a <code>Request</code> object that contains the given context,
+ * method, argument list, and container for the result.
+ *
+ * @param ctx the Context for the request
+ * @param operation the method that the new <code>Request</code>
+ * object will invoke
+ * @param arg_list the arguments for the method; an <code>NVList</code>
+ * in which each argument is a <code>NamedValue</code> object
+ * @param result a <code>NamedValue</code> object to be used for
+ * returning the result of executing the request's method
+ * @return a new <code>Request</code> object initialized with the
+ * given context, method, argument list, and container for the
+ * return value
+ */
+ public Request _create_request(Context ctx,
+ String operation,
+ NVList arg_list,
+ NamedValue result) {
+ return _get_delegate().create_request(this,
+ ctx,
+ operation,
+ arg_list,
+ result);
+ }
+
+ /**
+ * Creates a <code>Request</code> object that contains the given context,
+ * method, argument list, container for the result, exceptions, and
+ * list of property names to be used in resolving the context strings.
+ * This <code>Request</code> object is for use in the Dynamic
+ * Invocation Interface.
+ *
+ * @param ctx the <code>Context</code> object that contains the
+ * context strings that must be resolved before they are
+ * sent along with the request
+ * @param operation the method that the new <code>Request</code>
+ * object will invoke
+ * @param arg_list the arguments for the method; an <code>NVList</code>
+ * in which each argument is a <code>NamedValue</code> object
+ * @param result a <code>NamedValue</code> object to be used for
+ * returning the result of executing the request's method
+ * @param exceptions a list of the exceptions that the given method
+ * throws
+ * @param contexts a list of the properties that are needed to
+ * resolve the contexts in <i>ctx</i>; the strings in
+ * <i>contexts</i> are used as arguments to the method
+ * <code>Context.get_values</code>,
+ * which returns the value associated with the given property
+ * @return a new <code>Request</code> object initialized with the
+ * given context strings to resolve, method, argument list,
+ * container for the result, exceptions, and list of property
+ * names to be used in resolving the context strings
+ */
+ public Request _create_request(Context ctx,
+ String operation,
+ NVList arg_list,
+ NamedValue result,
+ ExceptionList exceptions,
+ ContextList contexts) {
+ return _get_delegate().create_request(this,
+ ctx,
+ operation,
+ arg_list,
+ result,
+ exceptions,
+ contexts);
+ }
+
+ /**
+ * Retrieves the interface definition for this <code>ObjectImpl</code>
+ * object.
+ *
+ * @return the <code>org.omg.CORBA.Object</code> instance that is the
+ * interface definition for this <code>ObjectImpl</code> object
+ */
+ public org.omg.CORBA.Object _get_interface_def()
+ {
+ // First try to call the delegate implementation class's
+ // "Object get_interface_def(..)" method (will work for JDK1.2 ORBs).
+ // Else call the delegate implementation class's
+ // "InterfaceDef get_interface(..)" method using reflection
+ // (will work for pre-JDK1.2 ORBs).
+
+ org.omg.CORBA.portable.Delegate delegate = _get_delegate();
+ try {
+ // If the ORB's delegate class does not implement
+ // "Object get_interface_def(..)", this will call
+ // get_interface_def(..) on portable.Delegate.
+ return delegate.get_interface_def(this);
+ }
+ catch( org.omg.CORBA.NO_IMPLEMENT ex ) {
+ // Call "InterfaceDef get_interface(..)" method using reflection.
+ try {
+ Class[] argc = { org.omg.CORBA.Object.class };
+ java.lang.reflect.Method meth =
+ delegate.getClass().getMethod("get_interface", argc);
+ Object[] argx = { this };
+ return (org.omg.CORBA.Object)meth.invoke(delegate, argx);
+ }
+ catch( java.lang.reflect.InvocationTargetException exs ) {
+ Throwable t = exs.getTargetException();
+ if (t instanceof Error) {
+ throw (Error) t;
+ }
+ else if (t instanceof RuntimeException) {
+ throw (RuntimeException) t;
+ }
+ else {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+ } catch( RuntimeException rex ) {
+ throw rex;
+ } catch( Exception exr ) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+ }
+ }
+
+ /**
+ * Returns a reference to the ORB associated with this object and
+ * its delegate. This is the <code>ORB</code> object that created
+ * the delegate.
+ *
+ * @return the <code>ORB</code> instance that created the
+ * <code>Delegate</code> object contained in this
+ * <code>ObjectImpl</code> object
+ */
+ public org.omg.CORBA.ORB _orb() {
+ return _get_delegate().orb(this);
+ }
+
+
+ /**
+ * Retrieves the <code>Policy</code> object for this
+ * <code>ObjectImpl</code> object that has the given
+ * policy type.
+ *
+ * @param policy_type an int indicating the policy type
+ * @return the <code>Policy</code> object that is the specified policy type
+ * and that applies to this <code>ObjectImpl</code> object
+ * @see org.omg.CORBA.PolicyOperations#policy_type
+ */
+ public org.omg.CORBA.Policy _get_policy(int policy_type) {
+ return _get_delegate().get_policy(this, policy_type);
+ }
+
+ /**
+ * Retrieves a list of the domain managers for this
+ * <code>ObjectImpl</code> object.
+ *
+ * @return an array containing the <code>DomainManager</code>
+ * objects for this instance of <code>ObjectImpl</code>
+ */
+ public org.omg.CORBA.DomainManager[] _get_domain_managers() {
+ return _get_delegate().get_domain_managers(this);
+ }
+
+ /**
+ * Sets this <code>ObjectImpl</code> object's override type for
+ * the given policies to the given instance of
+ * <code>SetOverrideType</code>.
+ *
+ * @param policies an array of <code>Policy</code> objects with the
+ * policies that will replace the current policies or be
+ * added to the current policies
+ * @param set_add either <code>SetOverrideType.SET_OVERRIDE</code>,
+ * indicating that the given policies will replace any existing
+ * ones, or <code>SetOverrideType.ADD_OVERRIDE</code>, indicating
+ * that the given policies should be added to any existing ones
+ * @return an <code>Object</code> with the given policies replacing or
+ * added to its previous policies
+ */
+ public org.omg.CORBA.Object
+ _set_policy_override(org.omg.CORBA.Policy[] policies,
+ org.omg.CORBA.SetOverrideType set_add) {
+ return _get_delegate().set_policy_override(this, policies,
+ set_add);
+ }
+
+ /**
+ * Checks whether this <code>ObjectImpl</code> object is implemented
+ * by a local servant. If so, local invocation API's may be used.
+ *
+ * @return <code>true</code> if this object is implemented by a local
+ * servant; <code>false</code> otherwise
+ */
+ public boolean _is_local() {
+ return _get_delegate().is_local(this);
+ }
+
+ /**
+ * Returns a Java reference to the local servant that should be used for sending
+ * a request for the method specified. If this <code>ObjectImpl</code>
+ * object is a local stub, it will invoke the <code>_servant_preinvoke</code>
+ * method before sending a request in order to obtain the
+ * <code>ServantObject</code> instance to use.
+ * <P>
+ * If a <code>ServantObject</code> object is returned, its <code>servant</code>
+ * 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. The <code>ServantRequest</code> object is valid for only one
+ * invocation and cannot be used for more than one invocation.
+ *
+ * @param operation a <code>String</code> containing the name of the method
+ * to be invoked. This name should correspond to the method name as
+ * it would be encoded in a GIOP request.
+ *
+ * @param expectedType a <code>Class</code> object representing the
+ * expected type of the servant that is returned. This expected
+ * type is the <code>Class</code> object associated with the
+ * operations class for the stub's interface. For example, a
+ * stub for an interface <code>Foo</code> would pass the
+ * <code>Class</code> object for the <code>FooOperations</code>
+ * interface.
+ *
+ * @return (1) a <code>ServantObject</code> object, which may or may
+ * not be the actual servant instance, or (2) <code>null</code> if
+ * (a) the servant is not local or (b) the servant has ceased to
+ * be local due to a ForwardRequest from a POA ServantManager
+ * @throws org.omg.CORBA.BAD_PARAM if the servant is not the expected type
+ */
+ public ServantObject _servant_preinvoke(String operation,
+ Class expectedType) {
+ return _get_delegate().servant_preinvoke(this, operation,
+ expectedType);
+ }
+
+ /**
+ * Is called by the local stub after it has invoked an operation
+ * on the local servant that was previously retrieved from a
+ * call to the method <code>_servant_preinvoke</code>.
+ * The <code>_servant_postinvoke</code> method must be called
+ * if the <code>_servant_preinvoke</code>
+ * method returned a non-null value, even if an exception was thrown
+ * by the method invoked by the servant. For this reason, the call
+ * to the method <code>_servant_postinvoke</code> should be placed
+ * in a Java <code>finally</code> clause.
+ *
+ * @param servant the instance of the <code>ServantObject</code>
+ * returned by the <code>_servant_preinvoke</code> method
+ */
+ public void _servant_postinvoke(ServantObject servant) {
+ _get_delegate().servant_postinvoke(this, servant);
+ }
+
+ /*
+ * The following methods were added by orbos/98-04-03: Java to IDL
+ * Mapping. These are used by RMI over IIOP.
+ */
+
+ /**
+ * Returns an <code>OutputStream</code> object to use for marshalling
+ * the arguments of the given method. This method is called by a stub,
+ * which must indicate if a response is expected, that is, whether or not
+ * the call is oneway.
+ *
+ * @param operation a String giving the name of the method.
+ * @param responseExpected a boolean -- <code>true</code> if the
+ * request is not one way, that is, a response is expected
+ * @return an <code>OutputStream</code> object for dispatching the request
+ */
+ public OutputStream _request(String operation,
+ boolean responseExpected) {
+ return _get_delegate().request(this, operation, responseExpected);
+ }
+
+ /**
+ * Invokes an operation and returns an <code>InputStream</code>
+ * object for reading the response. The stub provides the
+ * <code>OutputStream</code> object that was previously returned by a
+ * call to the <code>_request</code> method. The method specified
+ * as an argument to <code>_request</code> when it was
+ * called previously is the method that this method invokes.
+ * <P>
+ * If an exception occurs, the <code>_invoke</code> method may throw an
+ * <code>ApplicationException</code> object that contains an InputStream from
+ * which the user exception state may be unmarshalled.
+ *
+ * @param output an OutputStream object for dispatching the request
+ * @return an <code>InputStream</code> object containing the marshalled
+ * response to the method invoked
+ * @throws ApplicationException if the invocation
+ * meets application-defined exception
+ * @throws RemarshalException if the invocation leads
+ * to a remarshalling error
+ * @see #_request
+ */
+ public InputStream _invoke(OutputStream output)
+ throws ApplicationException, RemarshalException {
+ return _get_delegate().invoke(this, output);
+ }
+
+ /**
+ * Releases the given
+ * reply stream back to the ORB when unmarshalling has
+ * completed after a call to the method <code>_invoke</code>.
+ * Calling this method is optional for the stub.
+ *
+ * @param input the <code>InputStream</code> object that was returned
+ * by the <code>_invoke</code> method or the
+ * <code>ApplicationException.getInputStream</code> method;
+ * may be <code>null</code>, in which case this method does
+ * nothing
+ * @see #_invoke
+ */
+ public void _releaseReply(InputStream input) {
+ _get_delegate().releaseReply(this, input);
+ }
+
+ /**
+ * Returns a <code>String</code> object that represents this
+ * <code>ObjectImpl</code> object.
+ *
+ * @return the <code>String</code> representation of this object
+ */
+ public String toString() {
+ if ( __delegate != null )
+ return __delegate.toString(this);
+ else
+ return getClass().getName() + ": no delegate set";
+ }
+
+ /**
+ * Returns the hash code for this <code>ObjectImpl</code> object.
+ *
+ * @return the hash code for this object
+ */
+ public int hashCode() {
+ if ( __delegate != null )
+ return __delegate.hashCode(this);
+ else
+ return super.hashCode();
+ }
+
+ /**
+ * Compares this <code>ObjectImpl</code> object with the given one
+ * for equality.
+ *
+ *@param obj the object with which to compare this object
+ *@return <code>true</code> if the two objects are equal;
+ * <code>false</code> otherwise
+ */
+ public boolean equals(java.lang.Object obj) {
+ if ( __delegate != null )
+ return __delegate.equals(this, obj);
+ else
+ return (this==obj);
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/OutputStream.java b/src/java.corba/share/classes/org/omg/CORBA/portable/OutputStream.java
new file mode 100644
index 0000000..9dab5ae
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/OutputStream.java
@@ -0,0 +1,287 @@
+/*
+ * Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA.portable;
+
+import org.omg.CORBA.TypeCode;
+import org.omg.CORBA.Principal;
+import org.omg.CORBA.Any;
+
+/**
+ * OuputStream is the Java API for writing IDL types
+ * to CDR marshal streams. These methods are used by the ORB to
+ * marshal IDL types as well as to insert IDL types into Anys.
+ * The <code>_array</code> versions of the methods can be directly
+ * used to write sequences and arrays of IDL types.
+ *
+ * @since JDK1.2
+ */
+
+
+public abstract class OutputStream extends java.io.OutputStream
+{
+ /**
+ * Returns an input stream with the same buffer.
+ *@return an input stream with the same buffer.
+ */
+ public abstract InputStream create_input_stream();
+
+ /**
+ * Writes a boolean value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_boolean(boolean value);
+ /**
+ * Writes a char value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_char(char value);
+ /**
+ * Writes a wide char value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_wchar(char value);
+ /**
+ * Writes a CORBA octet (i.e. byte) value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_octet(byte value);
+ /**
+ * Writes a short value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_short(short value);
+ /**
+ * Writes an unsigned short value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_ushort(short value);
+ /**
+ * Writes a CORBA long (i.e. Java int) value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_long(int value);
+ /**
+ * Writes an unsigned CORBA long (i.e. Java int) value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_ulong(int value);
+ /**
+ * Writes a CORBA longlong (i.e. Java long) value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_longlong(long value);
+ /**
+ * Writes an unsigned CORBA longlong (i.e. Java long) value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_ulonglong(long value);
+ /**
+ * Writes a float value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_float(float value);
+ /**
+ * Writes a double value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_double(double value);
+ /**
+ * Writes a string value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_string(String value);
+ /**
+ * Writes a wide string value to this stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_wstring(String value);
+
+ /**
+ * Writes an array of booleans on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_boolean_array(boolean[] value, int offset,
+ int length);
+ /**
+ * Writes an array of chars on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_char_array(char[] value, int offset,
+ int length);
+ /**
+ * Writes an array of wide chars on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_wchar_array(char[] value, int offset,
+ int length);
+ /**
+ * Writes an array of CORBA octets (bytes) on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_octet_array(byte[] value, int offset,
+ int length);
+ /**
+ * Writes an array of shorts on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_short_array(short[] value, int offset,
+ int length);
+ /**
+ * Writes an array of unsigned shorts on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_ushort_array(short[] value, int offset,
+ int length);
+ /**
+ * Writes an array of CORBA longs (i.e. Java ints) on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_long_array(int[] value, int offset,
+ int length);
+ /**
+ * Writes an array of unsigned CORBA longs (i.e. Java ints) on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_ulong_array(int[] value, int offset,
+ int length);
+ /**
+ * Writes an array of CORBA longlongs (i.e. Java longs) on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_longlong_array(long[] value, int offset,
+ int length);
+ /**
+ * Writes an array of unsigned CORBA longlongs (i.e. Java ints) on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_ulonglong_array(long[] value, int offset,
+ int length);
+ /**
+ * Writes an array of floats on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_float_array(float[] value, int offset,
+ int length);
+ /**
+ * Writes an array of doubles on this output stream.
+ * @param value the array to be written.
+ * @param offset offset on the stream.
+ * @param length length of buffer to write.
+ */
+ public abstract void write_double_array(double[] value, int offset,
+ int length);
+ /**
+ * Writes a CORBA Object on this output stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_Object(org.omg.CORBA.Object value);
+ /**
+ * Writes a TypeCode on this output stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_TypeCode(TypeCode value);
+ /**
+ * Writes an Any on this output stream.
+ * @param value the value to be written.
+ */
+ public abstract void write_any(Any value);
+
+ /**
+ * Writes a Principle on this output stream.
+ * @param value the value to be written.
+ * @deprecated Deprecated by CORBA 2.2.
+ */
+ @Deprecated
+ public void write_Principal(Principal value) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Writes an integer (length of arrays) onto this stream.
+ * @param b the value to be written.
+ * @throws java.io.IOException if there is an input/output error
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public void write(int b) throws java.io.IOException {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Writes a BigDecimal number.
+ * @param value a BidDecimal--value to be written.
+ */
+ public void write_fixed(java.math.BigDecimal value) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Writes a CORBA context on this stream. The
+ * Context is marshaled as a sequence of strings.
+ * Only those Context values specified in the contexts
+ * parameter are actually written.
+ * @param ctx a CORBA context
+ * @param contexts a <code>ContextList</code> object containing the list of contexts
+ * to be written
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public void write_Context(org.omg.CORBA.Context ctx,
+ org.omg.CORBA.ContextList contexts) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Returns the ORB that created this OutputStream.
+ * @return the ORB that created this OutputStream
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ public org.omg.CORBA.ORB orb() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/RemarshalException.java b/src/java.corba/share/classes/org/omg/CORBA/portable/RemarshalException.java
new file mode 100644
index 0000000..b0a6800
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/RemarshalException.java
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA.portable;
+
+/**
+This class is used for reporting locate forward exceptions and object forward
+GIOP messages back to the ORB. In this case the ORB must remarshal the request
+before trying again.
+Stubs which use the stream-based model shall catch the <code>RemarshalException</code>
+which is potentially thrown from the <code>_invoke()</code> method of <code>ObjectImpl</code>.
+Upon catching the exception, the stub shall immediately remarshal the request by calling
+<code>_request()</code>, marshalling the arguments (if any), and then calling
+<code>_invoke()</code>. The stub shall repeat this process until <code>_invoke()</code>
+returns normally or raises some exception other than <code>RemarshalException</code>.
+*/
+
+public final class RemarshalException extends Exception {
+ /**
+ * Constructs a RemarshalException.
+ */
+ public RemarshalException() {
+ super();
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/ResponseHandler.java b/src/java.corba/share/classes/org/omg/CORBA/portable/ResponseHandler.java
new file mode 100644
index 0000000..09a73cd
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/ResponseHandler.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA.portable;
+
+/**
+This interface is supplied by an ORB to a servant at invocation time and allows
+the servant to later retrieve an OutputStream for returning the invocation results.
+*/
+
+public interface ResponseHandler {
+ /**
+ * Called by the servant during a method invocation. The servant
+ * should call this method to create a reply marshal buffer if no
+ * exception occurred.
+ *
+ * @return an OutputStream suitable for marshalling the reply.
+ *
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ OutputStream createReply();
+
+ /**
+ * Called by the servant during a method invocation. The servant
+ * should call this method to create a reply marshal buffer if a
+ * user exception occurred.
+ *
+ * @return an OutputStream suitable for marshalling the exception
+ * ID and the user exception body.
+ */
+ OutputStream createExceptionReply();
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/ServantObject.java b/src/java.corba/share/classes/org/omg/CORBA/portable/ServantObject.java
new file mode 100644
index 0000000..2735927
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/ServantObject.java
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1998, 2010, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA.portable;
+
+/**
+ This class is part of the local stub API, the purpose of which is to provide
+ high performance calls for collocated clients and servers
+ (i.e. clients and servers residing in the same Java VM).
+ The local stub API is supported via three additional methods on
+ <code>ObjectImpl</code> and <code>Delegate</code>.
+ ORB vendors may subclass this class to return additional
+ request state that may be required by their implementations.
+ @see ObjectImpl
+ @see Delegate
+*/
+
+public class ServantObject
+{
+ /** The real servant. The local stub may cast this field to the expected type, and then
+ * invoke the operation directly. Note, the object may or may not be the actual servant
+ * instance.
+ */
+ public java.lang.Object servant;
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/Streamable.java b/src/java.corba/share/classes/org/omg/CORBA/portable/Streamable.java
new file mode 100644
index 0000000..45f29e0
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/Streamable.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1997, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.CORBA.portable;
+
+import org.omg.CORBA.TypeCode;
+
+/**
+ * The base class for the Holder classess of all complex
+ * IDL types. The ORB treats all generated Holders as Streamable to invoke
+ * the methods for marshalling and unmarshalling.
+ *
+ * @since JDK1.2
+ */
+
+public interface Streamable {
+ /**
+ * Reads data from <code>istream</code> and initalizes the
+ * <code>value</code> field of the Holder with the unmarshalled data.
+ *
+ * @param istream the InputStream that represents the CDR data from the wire.
+ */
+ void _read(InputStream istream);
+ /**
+ * Marshals to <code>ostream</code> the value in the
+ * <code>value</code> field of the Holder.
+ *
+ * @param ostream the CDR OutputStream
+ */
+ void _write(OutputStream ostream);
+
+ /**
+ * Retrieves the <code>TypeCode</code> object corresponding to the value
+ * in the <code>value</code> field of the Holder.
+ *
+ * @return the <code>TypeCode</code> object for the value held in the holder
+ */
+ TypeCode _type();
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/StreamableValue.java b/src/java.corba/share/classes/org/omg/CORBA/portable/StreamableValue.java
new file mode 100644
index 0000000..7155eed
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/StreamableValue.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+package org.omg.CORBA.portable;
+
+/**
+ * Defines the base type for all non-boxed IDL valuetypes
+ * that are not custom marshaled.
+ *
+ * All value types implement ValueBase either directly or
+ * indirectly by implementing either the
+ * StreamableValue or CustomValue interface.
+ *
+ * @author OMG
+ */
+public interface StreamableValue extends Streamable, ValueBase {
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/UnknownException.java b/src/java.corba/share/classes/org/omg/CORBA/portable/UnknownException.java
new file mode 100644
index 0000000..725ca7c
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/UnknownException.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA.portable;
+/**
+ * The org.omg.CORBA.portable.UnknownException is used for reporting
+ * unknown exceptions between ties and ORBs and between ORBs and stubs.
+ * It provides a Java representation of an UNKNOWN system exception
+ * that has an UnknownExceptionInfo service context.
+ * If the CORBA system exception org.omg.CORBA.portable.UnknownException
+ * is thrown, then the stub does one of the following:
+ * (1) Translates it to org.omg.CORBA.UNKNOWN.
+ * (2) Translates it to the nested exception that the UnknownException contains.
+ * (3) Passes it on directly to the user.
+ */
+public class UnknownException extends org.omg.CORBA.SystemException {
+ /**
+ * A throwable--the original exception that was wrapped in a CORBA
+ * UnknownException.
+ */
+ public Throwable originalEx;
+ /**
+ * Constructs an UnknownException object.
+ * @param ex a Throwable object--to be wrapped in this exception.
+ */
+ public UnknownException(Throwable ex) {
+ super("", 0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ originalEx = ex;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/ValueBase.java b/src/java.corba/share/classes/org/omg/CORBA/portable/ValueBase.java
new file mode 100644
index 0000000..926e728
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/ValueBase.java
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA.portable;
+/**
+ * The generated Java classes corresponding to valuetype IDL types
+ * implement this interface. In other words, the Java mapping of
+ * valuetype objects implement the ValueBase interface. The generated
+ * Java class for valuetype's shall provide an implementation of the
+ * ValueBase interface for the corresponding value type.
+ * For value types that are streamable (i.e. non-custom),
+ * the generated Java class shall also provide an implementation
+ * for the org.omg.CORBA.portable.Streamable interface.
+ * (CORBA::ValueBase is mapped to java.io.Serializable.)
+ */
+public interface ValueBase extends IDLEntity {
+ /**
+ * Provides truncatable repository ids.
+ * @return a String array--list of truncatable repository ids.
+ */
+ String[] _truncatable_ids();
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/ValueFactory.java b/src/java.corba/share/classes/org/omg/CORBA/portable/ValueFactory.java
new file mode 100644
index 0000000..355104b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/ValueFactory.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA.portable;
+import java.io.Serializable;
+
+/**
+ * The ValueFactory interface is the native mapping for the IDL
+ * type CORBA::ValueFactory. The read_value() method is called by
+ * the ORB runtime while in the process of unmarshaling a value type.
+ * A user shall implement this method as part of implementing a type
+ * specific value factory. In the implementation, the user shall call
+ * is.read_value(java.io.Serializable) with a uninitialized valuetype
+ * to use for unmarshaling. The value returned by the stream is
+ * the same value passed in, with all the data unmarshaled.
+ * @see org.omg.CORBA_2_3.ORB
+ */
+
+public interface ValueFactory {
+ /**
+ * Is called by
+ * the ORB runtime while in the process of unmarshaling a value type.
+ * A user shall implement this method as part of implementing a type
+ * specific value factory.
+ * @param is an InputStream object--from which the value will be read.
+ * @return a Serializable object--the value read off of "is" Input stream.
+ */
+ Serializable read_value(org.omg.CORBA_2_3.portable.InputStream is);
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/ValueInputStream.java b/src/java.corba/share/classes/org/omg/CORBA/portable/ValueInputStream.java
new file mode 100644
index 0000000..9ce5169
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/ValueInputStream.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.portable;
+
+/**
+ * Java to IDL ptc 02-01-12 1.5.1.4
+ *
+ * ValueInputStream is used for implementing RMI-IIOP
+ * stream format version 2.
+ */
+public interface ValueInputStream {
+
+ /**
+ * The start_value method reads a valuetype
+ * header for a nested custom valuetype and
+ * increments the valuetype nesting depth.
+ */
+ void start_value();
+
+ /**
+ * The end_value method reads the end tag
+ * for the nested custom valuetype (after
+ * skipping any data that precedes the end
+ * tag) and decrements the valuetype nesting
+ * depth.
+ */
+ void end_value();
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/ValueOutputStream.java b/src/java.corba/share/classes/org/omg/CORBA/portable/ValueOutputStream.java
new file mode 100644
index 0000000..3d6e0bd
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/ValueOutputStream.java
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.CORBA.portable;
+
+/**
+ * Java to IDL ptc 02-01-12 1.5.1.3
+ *
+ * ValueOutputStream is used for implementing RMI-IIOP
+ * stream format version 2.
+ */
+public interface ValueOutputStream {
+ /**
+ * The start_value method ends any currently open chunk,
+ * writes a valuetype header for a nested custom valuetype
+ * (with a null codebase and the specified repository ID),
+ * and increments the valuetype nesting depth.
+ */
+ void start_value(java.lang.String rep_id);
+
+ /**
+ * The end_value method ends any currently open chunk,
+ * writes the end tag for the nested custom valuetype,
+ * and decrements the valuetype nesting depth.
+ */
+ void end_value();
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA/portable/package.html b/src/java.corba/share/classes/org/omg/CORBA/portable/package.html
new file mode 100644
index 0000000..e0f5cbb
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA/portable/package.html
@@ -0,0 +1,96 @@
+<!doctype html>
+<html>
+<head>
+<!--
+Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+-->
+</head>
+<body>
+
+Provides a portability layer, that is, a set of ORB APIs
+that makes it possible for code generated
+by one vendor to run on another vendor's ORB.
+Stubs and other code, generated either from IDL or
+interfaces written in the Java programming language,
+can call into these ORB APIs.
+
+
+
+<p>
+<a id="unimpl"></a>
+<hr>
+<h1>CORBA Features Throwing NO_IMPLEMENT() Exceptions</h1>
+<hr>
+Some methods throw NO_IMPLEMENT() exceptions by default, but ORB vendors
+can override them to provide real implementations. The ORB included in
+Sun's release of the Java[tm] Platform, Standard Edition 6, includes
+implementations for the following methods.
+
+<h2>List of Unimplemented Features in Package
+<code>org.omg.CORBA.portable</code></h2>
+
+<h3>Unimplemented Interfaces in package <code>org.omg.CORBA.portable</code></h3>
+ <ul>
+ <li><code>InvokeHandler</code>
+ <li><code>ResponseHandler</code>
+ </ul>
+
+<h3>Unimplemented Methods in package <code>org.omg.CORBA.portable</code></h3>
+<ul>
+<li><code>InputStream</code>
+ <ul>
+ <li><code>public int read()</code>
+ <li><code>public.math.BigDecimal read_fixed()</code>
+ <li><code>public org.omg.CORBA.Context read_Context()</code>
+ <li><code>public org.omg.CORBA.Object read_Object(java.lang.Class clz)</code>
+ <li><code>public org.omg.CORBA.ORB orb()</code>
+ </ul>
+<li><code>OutputStream</code>
+ <ul>
+ <li><code>public org.omg.CORBA.ORB orb()</code>
+ <li><code>public void write_Context(org.omg.CORBA.Context ctx,
+ org.omg.CORBA.ContextList contexts)</code>
+ <li><code>public void write_fixed(java.math.BigDecimal value)</code>
+ <li><code>public void write(int b)</code>
+ </ul>
+<li><code>Delegate</code>
+ <ul>
+ <li><code>public void releaseReply(org.omg.CORBA.Object self, InputStream input)</code>
+ <li><code>public InputStream invoke(org.omgl.CORBA.Object self, OutputStream output)</code>
+ <li><code>public OutputStream request(org.omg.CORBA.Object self, String operation,
+ boolean responseExpected)</code>
+ <li><code>public org.omg.CORBA.Object set_policy_override(org.omg.CORBA.Object self,
+ org.omg.CORBA.Policy[] policies,
+ org.omg.CORBA.SetOverrideType set_add)</code>
+ <li><code>public org.omg.CORBA.DomainManager[] get_domain_managers(
+ org.omg.CORBA.Objectself)</code>
+ <li><code>public org.omg.CORBA.Policy get_policy(org.omg.CORBA.Object self,
+ int policy_type)</code>
+ </ul>
+</ul>
+
+@since JDK1.2
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/CORBA_2_3/ORB.java b/src/java.corba/share/classes/org/omg/CORBA_2_3/ORB.java
new file mode 100644
index 0000000..fc203c3
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA_2_3/ORB.java
@@ -0,0 +1,89 @@
+/*
+ * Copyright (c) 1998, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA_2_3;
+
+/**
+ * A class extending <code>org.omg.CORBA.ORB</code> to make the ORB
+ * portable under the OMG CORBA version 2.3 specification.
+ */
+public abstract class ORB extends org.omg.CORBA.ORB {
+
+/**
+ *
+ */
+ public org.omg.CORBA.portable.ValueFactory register_value_factory(String id,
+ org.omg.CORBA.portable.ValueFactory factory)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+/**
+ *
+ */
+ public void unregister_value_factory(String id)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+/**
+ *
+ */
+ public org.omg.CORBA.portable.ValueFactory lookup_value_factory(String id)
+ {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+/**
+ * @see <a href="package-summary.html#unimpl"><code>CORBA_2_3</code> package
+ * comments for unimplemented features</a>
+ */
+ // always return a ValueDef or throw BAD_PARAM if
+ // <em>repid</em> does not represent a valuetype
+ public org.omg.CORBA.Object get_value_def(String repid)
+ throws org.omg.CORBA.BAD_PARAM {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+/**
+ * @see <a href="package-summary.html#unimpl"><code>CORBA_2_3</code> package
+ * comments for unimplemented features</a>
+ */
+ public void set_delegate(java.lang.Object wrapper) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html b/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html
new file mode 100644
index 0000000..7a82edb
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA_2_3/package.html
@@ -0,0 +1,67 @@
+<!doctype html>
+<html>
+<head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+ <meta name="GENERATOR" content="Mozilla/4.5 [en] (WinNT; I) [Netscape]">
+ <title>package</title>
+<!--
+/*
+* Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation. Oracle designates this
+* particular file as subject to the "Classpath" exception as provided
+* by Oracle in the LICENSE file that accompanied this code.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+-->
+</head>
+<body>
+The CORBA_2_3 package defines additions to existing CORBA interfaces
+in the Java[tm] Standard Edition 6.&nbsp;&nbsp; These changes occurred in recent
+revisions to the CORBA API defined by the OMG.&nbsp; The new methods were
+added to&nbsp; interfaces derived from the corresponding interfaces in
+the CORBA package.&nbsp; This provides backward compatibility and avoids
+breaking the JCK tests.
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6, ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+<P>
+<a id="unimpl"></a>
+The following methods in the abstract class
+<code>org.omg.CORBA_2_3.ORB</code> are unimplemented:
+<UL>
+ <LI><code>public org.omg.CORBA.portable.ValueFactory
+ <b>register_value_factory(String id, org.omg.CORBA.portable.ValueFactory
+ factory)</b></code>
+ <LI><code>public void <b>unregister_value_factory(String id)</b></code>
+ <LI><code>public org.omg.CORBA.portable.ValueFactory
+ <b>lookup_value_factory(String id)</b></code>
+ <LI><code>public org.omg.CORBA.Object <b>get_value_def(String repid)</b></code>
+ <LI><code>public void <b>set_delegate(java.lang.Object wrapper)</b></code>
+</UL>
+@since JDK 1.3
+<br>
+@serial exclude
+
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/Delegate.java b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/Delegate.java
new file mode 100644
index 0000000..a158ae9
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/Delegate.java
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA_2_3.portable;
+
+/**
+ * Delegate class provides the ORB vendor specific implementation
+ * of CORBA object. It extends org.omg.CORBA.portable.Delegate and
+ * provides new methods that were defined by CORBA 2.3.
+ *
+ * @see org.omg.CORBA.portable.Delegate
+ * @author OMG
+ * @since JDK1.2
+ */
+
+public abstract class Delegate extends org.omg.CORBA.portable.Delegate {
+
+ /** 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.
+ */
+ public java.lang.String get_codebase(org.omg.CORBA.Object self) {
+ return null;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java
new file mode 100644
index 0000000..1913538
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/InputStream.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA_2_3.portable;
+
+import java.io.SerializablePermission;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * InputStream provides for the reading of all of the mapped IDL types
+ * from the stream. It extends org.omg.CORBA.portable.InputStream. This
+ * class defines new methods that were added for CORBA 2.3.
+ *
+ * @see org.omg.CORBA.portable.InputStream
+ * @author OMG
+ * @since JDK1.2
+ */
+
+public abstract class InputStream extends org.omg.CORBA.portable.InputStream {
+
+
+ private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowInputStreamSubclass";
+
+ private static final boolean allowSubclass = AccessController.doPrivileged(
+ new PrivilegedAction<Boolean>() {
+ @Override
+ public Boolean run() {
+ String prop = System.getProperty(ALLOW_SUBCLASS_PROP);
+ return prop == null ? false :
+ (prop.equalsIgnoreCase("false") ? false : true);
+ }
+ });
+
+ private static Void checkPermission() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ if (!allowSubclass)
+ sm.checkPermission(new
+ SerializablePermission("enableSubclassImplementation"));
+ }
+ return null;
+ }
+
+ private InputStream(Void ignore) { }
+
+ /**
+ * Create a new instance of this class.
+ *
+ * @implNote
+ * Throws SecurityException if SecurityManager is installed and
+ * enableSubclassImplementation SerializablePermission
+ * is not granted or jdk.corba.allowInputStreamSubclass system
+ * property is either not set or is set to 'false'.
+ */
+ public InputStream() {
+ this(checkPermission());
+ }
+
+ /**
+ * Unmarshalls a value type from the input stream.
+ * @return the value type unmarshalled from the input stream
+ */
+ public java.io.Serializable read_value() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Unmarshalls a value type from the input stream.
+ * @param clz is the declared type of the value to be unmarshalled
+ * @return the value unmarshalled from the input stream
+ */
+ public java.io.Serializable read_value(java.lang.Class clz) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Unmarshalls a value type from the input stream.
+ * @param factory is the instance fo the helper to be used for
+ * unmarshalling the value type
+ * @return the value unmarshalled from the input stream
+ */
+ public java.io.Serializable read_value(org.omg.CORBA.portable.BoxedValueHelper factory) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Unmarshalls a value type from the input stream.
+ * @param rep_id identifies the type of the value to be unmarshalled
+ * @return value type unmarshalled from the input stream
+ */
+ public java.io.Serializable read_value(java.lang.String rep_id) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Unmarshalls a value type from the input stream.
+ * @param value is an uninitialized value which is added to the orb's
+ * indirection table before calling Streamable._read() or
+ * CustomMarshal.unmarshal() to unmarshal the value.
+ * @return value type unmarshalled from the input stream
+ */
+ public java.io.Serializable read_value(java.io.Serializable value) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Unmarshal the value object or a suitable stub object.
+ * @return ORB runtime returns the value object or a suitable stub object.
+ */
+ public java.lang.Object read_abstract_interface() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Unmarshal the class object or the stub class corresponding to the passed type.
+ * @param clz is the Class object for the stub class which corresponds to
+ * the type that is statically expected.
+ * @return ORB runtime returns the value object or a suitable stub object.
+ */
+ public java.lang.Object read_abstract_interface(java.lang.Class clz) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/ObjectImpl.java b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/ObjectImpl.java
new file mode 100644
index 0000000..6fbfabe
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/ObjectImpl.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA_2_3.portable;
+
+import org.omg.CORBA_2_3.portable.Delegate;
+
+/**
+ * ObjectImpl class is the base class for all stubs. It provides the
+ * basic delegation mechanism. It extends org.omg.CORBA.portable.ObjectImpl
+ * and provides new methods defined by CORBA 2.3.
+ *
+ * @see org.omg.CORBA.portable.ObjectImpl
+ * @author OMG
+ * @since JDK1.2
+ */
+
+
+public abstract class ObjectImpl extends org.omg.CORBA.portable.ObjectImpl {
+
+ /** Returns the codebase for this object reference.
+ * @return the codebase as a space delimited list of url strings or
+ * null if none.
+ */
+ public java.lang.String _get_codebase() {
+ org.omg.CORBA.portable.Delegate delegate = _get_delegate();
+ if (delegate instanceof Delegate)
+ return ((Delegate) delegate).get_codebase(this);
+ return null;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java
new file mode 100644
index 0000000..00955b3
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/OutputStream.java
@@ -0,0 +1,130 @@
+/*
+ * Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.CORBA_2_3.portable;
+
+import java.io.SerializablePermission;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+/**
+ * OutputStream provides interface for writing of all of the mapped IDL type
+ * to the stream. It extends org.omg.CORBA.portable.OutputStream, and defines
+ * new methods defined by CORBA 2.3.
+ *
+ * @see org.omg.CORBA.portable.OutputStream
+ * @author OMG
+ * @since JDK1.2
+ */
+
+public abstract class OutputStream extends org.omg.CORBA.portable.OutputStream {
+
+ private static final String ALLOW_SUBCLASS_PROP = "jdk.corba.allowOutputStreamSubclass";
+ private static final boolean allowSubclass = AccessController.doPrivileged(
+ new PrivilegedAction<Boolean>() {
+ @Override
+ public Boolean run() {
+ String prop = System.getProperty(ALLOW_SUBCLASS_PROP);
+ return prop == null ? false :
+ (prop.equalsIgnoreCase("false") ? false : true);
+ }
+ });
+
+ private static Void checkPermission() {
+ SecurityManager sm = System.getSecurityManager();
+ if (sm != null) {
+ if (!allowSubclass)
+ sm.checkPermission(new
+ SerializablePermission("enableSubclassImplementation"));
+ }
+ return null;
+ }
+ private OutputStream(Void ignore) { }
+
+ /**
+ * Create a new instance of this class.
+ *
+ * @implNote
+ * Throws SecurityException if SecurityManager is installed and
+ * enableSubclassImplementation SerializablePermission
+ * is not granted or jdk.corba.allowOutputStreamSubclass system
+ * property is either not set or is set to 'false'.
+ */
+ public OutputStream() {
+ this(checkPermission());
+ }
+
+ /**
+ * Marshals a value type to the output stream.
+ * @param value is the acutal value to write
+ */
+ public void write_value(java.io.Serializable value) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Marshals a value type to the output stream.
+ * @param value is the acutal value to write
+ * @param clz is the declared type of the value to be marshaled
+ */
+ public void write_value(java.io.Serializable value, java.lang.Class clz) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Marshals a value type to the output stream.
+ * @param value is the acutal value to write
+ * @param repository_id identifies the type of the value type to
+ * be marshaled
+ */
+ public void write_value(java.io.Serializable value, String repository_id) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Marshals a value type to the output stream.
+ * @param value is the acutal value to write
+ * @param factory is the instance of the helper to be used for marshaling
+ * the boxed value
+ */
+ public void write_value(java.io.Serializable value, org.omg.CORBA.portable.BoxedValueHelper factory) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ /**
+ * Marshals a value object or a stub object.
+ * @param obj the actual value object to marshal or the stub to be marshalled
+ */
+ public void write_abstract_interface(java.lang.Object obj) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/package.html b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/package.html
new file mode 100644
index 0000000..6b3f430
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CORBA_2_3/portable/package.html
@@ -0,0 +1,40 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+/*
+* Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation. Oracle designates this
+* particular file as subject to the "Classpath" exception as provided
+* by Oracle in the LICENSE file that accompanied this code.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+-->
+
+</head>
+<body bgcolor="white">
+
+ Provides methods for the input and output of value types, and contains
+ other updates to the <code>org/omg/CORBA/portable</code> package.
+
+@since 1.3
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html b/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html
new file mode 100644
index 0000000..9636d1d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CosNaming/NamingContextExtPackage/package.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+/*
+* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation. Oracle designates this
+* particular file as subject to the "Classpath" exception as provided
+* by Oracle in the LICENSE file that accompanied this code.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+-->
+
+</head>
+<body bgcolor="white">
+<P>This package contains the following classes, which are used in
+<code>org.omg.CosNaming.NamingContextExt</code>:
+<UL>
+ <LI><code>AddressHelper</code>
+ <LI><code>StringNameHelper</code>
+ <LI><code>URLStringHelper</code>
+ <LI><code>InvalidAddress</code>
+</UL>
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html b/src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html
new file mode 100644
index 0000000..b97eafd
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CosNaming/NamingContextPackage/package.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+/*
+* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation. Oracle designates this
+* particular file as subject to the "Classpath" exception as provided
+* by Oracle in the LICENSE file that accompanied this code.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+-->
+
+</head>
+<body bgcolor="white">
+<P>This package contains Exception classes for the <code>org.omg.CosNaming</code>
+ package. The list of exception classes are:
+ <UL>
+ <LI><code>AlreadyBound</code>
+ <LI><code>CannotProceed</code>
+ <LI><code>InvalidName</code>
+ <LI><code>NotEmpty</code>
+ <LI><code>NotFound</code>
+ <LI><code>NotFoundReason</code>
+ </UL>
+
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/CosNaming/_BindingIteratorImplBase.java b/src/java.corba/share/classes/org/omg/CosNaming/_BindingIteratorImplBase.java
new file mode 100644
index 0000000..9b43349
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CosNaming/_BindingIteratorImplBase.java
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * File: ./org/omg/CosNaming/_BindingIteratorImplBase.java
+ * From: nameservice.idl
+ * Date: Tue Aug 11 03:12:09 1998
+ * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
+ * @deprecated Deprecated in JDK 1.4.
+ */
+
+package org.omg.CosNaming;
+public abstract class _BindingIteratorImplBase extends org.omg.CORBA.DynamicImplementation implements org.omg.CosNaming.BindingIterator {
+ // Constructor
+ public _BindingIteratorImplBase() {
+ super();
+ }
+ // Type strings for this class and its superclases
+ private static final String _type_ids[] = {
+ "IDL:omg.org/CosNaming/BindingIterator:1.0"
+ };
+
+ public String[] _ids() { return (String[]) _type_ids.clone(); }
+
+ private static java.util.Dictionary _methods = new java.util.Hashtable();
+ static {
+ _methods.put("next_one", new java.lang.Integer(0));
+ _methods.put("next_n", new java.lang.Integer(1));
+ _methods.put("destroy", new java.lang.Integer(2));
+ }
+ // DSI Dispatch call
+ public void invoke(org.omg.CORBA.ServerRequest r) {
+ switch (((java.lang.Integer) _methods.get(r.op_name())).intValue()) {
+ case 0: // org.omg.CosNaming.BindingIterator.next_one
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ org.omg.CORBA.Any _b = _orb().create_any();
+ _b.type(org.omg.CosNaming.BindingHelper.type());
+ _list.add_value("b", _b, org.omg.CORBA.ARG_OUT.value);
+ r.params(_list);
+ org.omg.CosNaming.BindingHolder b;
+ b = new org.omg.CosNaming.BindingHolder();
+ boolean ___result;
+ ___result = this.next_one(b);
+ org.omg.CosNaming.BindingHelper.insert(_b, b.value);
+ org.omg.CORBA.Any __result = _orb().create_any();
+ __result.insert_boolean(___result);
+ r.result(__result);
+ }
+ break;
+ case 1: // org.omg.CosNaming.BindingIterator.next_n
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ org.omg.CORBA.Any _how_many = _orb().create_any();
+ _how_many.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong));
+ _list.add_value("how_many", _how_many, org.omg.CORBA.ARG_IN.value);
+ org.omg.CORBA.Any _bl = _orb().create_any();
+ _bl.type(org.omg.CosNaming.BindingListHelper.type());
+ _list.add_value("bl", _bl, org.omg.CORBA.ARG_OUT.value);
+ r.params(_list);
+ int how_many;
+ how_many = _how_many.extract_ulong();
+ org.omg.CosNaming.BindingListHolder bl;
+ bl = new org.omg.CosNaming.BindingListHolder();
+ boolean ___result;
+ ___result = this.next_n(how_many, bl);
+ org.omg.CosNaming.BindingListHelper.insert(_bl, bl.value);
+ org.omg.CORBA.Any __result = _orb().create_any();
+ __result.insert_boolean(___result);
+ r.result(__result);
+ }
+ break;
+ case 2: // org.omg.CosNaming.BindingIterator.destroy
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ r.params(_list);
+ this.destroy();
+ org.omg.CORBA.Any __return = _orb().create_any();
+ __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
+ r.result(__return);
+ }
+ break;
+ default:
+ throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CosNaming/_NamingContextImplBase.java b/src/java.corba/share/classes/org/omg/CosNaming/_NamingContextImplBase.java
new file mode 100644
index 0000000..ece23c2
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CosNaming/_NamingContextImplBase.java
@@ -0,0 +1,407 @@
+/*
+ * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * File: ./org/omg/CosNaming/_NamingContextImplBase.java
+ * From: nameservice.idl
+ * Date: Tue Aug 11 03:12:09 1998
+ * By: idltojava Java IDL 1.2 Aug 11 1998 02:00:18
+ * @deprecated Deprecated in JDK 1.4.
+ */
+
+package org.omg.CosNaming;
+public abstract class _NamingContextImplBase extends org.omg.CORBA.DynamicImplementation implements org.omg.CosNaming.NamingContext {
+ // Constructor
+ public _NamingContextImplBase() {
+ super();
+ }
+ // Type strings for this class and its superclases
+ private static final String _type_ids[] = {
+ "IDL:omg.org/CosNaming/NamingContext:1.0"
+ };
+
+ public String[] _ids() { return (String[]) _type_ids.clone(); }
+
+ private static java.util.Dictionary _methods = new java.util.Hashtable();
+ static {
+ _methods.put("bind", new java.lang.Integer(0));
+ _methods.put("bind_context", new java.lang.Integer(1));
+ _methods.put("rebind", new java.lang.Integer(2));
+ _methods.put("rebind_context", new java.lang.Integer(3));
+ _methods.put("resolve", new java.lang.Integer(4));
+ _methods.put("unbind", new java.lang.Integer(5));
+ _methods.put("list", new java.lang.Integer(6));
+ _methods.put("new_context", new java.lang.Integer(7));
+ _methods.put("bind_new_context", new java.lang.Integer(8));
+ _methods.put("destroy", new java.lang.Integer(9));
+ }
+ // DSI Dispatch call
+ public void invoke(org.omg.CORBA.ServerRequest r) {
+ switch (((java.lang.Integer) _methods.get(r.op_name())).intValue()) {
+ case 0: // org.omg.CosNaming.NamingContext.bind
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ org.omg.CORBA.Any _n = _orb().create_any();
+ _n.type(org.omg.CosNaming.NameHelper.type());
+ _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
+ org.omg.CORBA.Any _obj = _orb().create_any();
+ _obj.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_objref));
+ _list.add_value("obj", _obj, org.omg.CORBA.ARG_IN.value);
+ r.params(_list);
+ org.omg.CosNaming.NameComponent[] n;
+ n = org.omg.CosNaming.NameHelper.extract(_n);
+ org.omg.CORBA.Object obj;
+ obj = _obj.extract_Object();
+ try {
+ this.bind(n, obj);
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e3) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.insert(_except, e3);
+ r.except(_except);
+ return;
+ }
+ org.omg.CORBA.Any __return = _orb().create_any();
+ __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
+ r.result(__return);
+ }
+ break;
+ case 1: // org.omg.CosNaming.NamingContext.bind_context
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ org.omg.CORBA.Any _n = _orb().create_any();
+ _n.type(org.omg.CosNaming.NameHelper.type());
+ _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
+ org.omg.CORBA.Any _nc = _orb().create_any();
+ _nc.type(org.omg.CosNaming.NamingContextHelper.type());
+ _list.add_value("nc", _nc, org.omg.CORBA.ARG_IN.value);
+ r.params(_list);
+ org.omg.CosNaming.NameComponent[] n;
+ n = org.omg.CosNaming.NameHelper.extract(_n);
+ org.omg.CosNaming.NamingContext nc;
+ nc = org.omg.CosNaming.NamingContextHelper.extract(_nc);
+ try {
+ this.bind_context(n, nc);
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e3) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.insert(_except, e3);
+ r.except(_except);
+ return;
+ }
+ org.omg.CORBA.Any __return = _orb().create_any();
+ __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
+ r.result(__return);
+ }
+ break;
+ case 2: // org.omg.CosNaming.NamingContext.rebind
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ org.omg.CORBA.Any _n = _orb().create_any();
+ _n.type(org.omg.CosNaming.NameHelper.type());
+ _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
+ org.omg.CORBA.Any _obj = _orb().create_any();
+ _obj.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_objref));
+ _list.add_value("obj", _obj, org.omg.CORBA.ARG_IN.value);
+ r.params(_list);
+ org.omg.CosNaming.NameComponent[] n;
+ n = org.omg.CosNaming.NameHelper.extract(_n);
+ org.omg.CORBA.Object obj;
+ obj = _obj.extract_Object();
+ try {
+ this.rebind(n, obj);
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
+ r.except(_except);
+ return;
+ }
+ org.omg.CORBA.Any __return = _orb().create_any();
+ __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
+ r.result(__return);
+ }
+ break;
+ case 3: // org.omg.CosNaming.NamingContext.rebind_context
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ org.omg.CORBA.Any _n = _orb().create_any();
+ _n.type(org.omg.CosNaming.NameHelper.type());
+ _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
+ org.omg.CORBA.Any _nc = _orb().create_any();
+ _nc.type(org.omg.CosNaming.NamingContextHelper.type());
+ _list.add_value("nc", _nc, org.omg.CORBA.ARG_IN.value);
+ r.params(_list);
+ org.omg.CosNaming.NameComponent[] n;
+ n = org.omg.CosNaming.NameHelper.extract(_n);
+ org.omg.CosNaming.NamingContext nc;
+ nc = org.omg.CosNaming.NamingContextHelper.extract(_nc);
+ try {
+ this.rebind_context(n, nc);
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
+ r.except(_except);
+ return;
+ }
+ org.omg.CORBA.Any __return = _orb().create_any();
+ __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
+ r.result(__return);
+ }
+ break;
+ case 4: // org.omg.CosNaming.NamingContext.resolve
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ org.omg.CORBA.Any _n = _orb().create_any();
+ _n.type(org.omg.CosNaming.NameHelper.type());
+ _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
+ r.params(_list);
+ org.omg.CosNaming.NameComponent[] n;
+ n = org.omg.CosNaming.NameHelper.extract(_n);
+ org.omg.CORBA.Object ___result;
+ try {
+ ___result = this.resolve(n);
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
+ r.except(_except);
+ return;
+ }
+ org.omg.CORBA.Any __result = _orb().create_any();
+ __result.insert_Object(___result);
+ r.result(__result);
+ }
+ break;
+ case 5: // org.omg.CosNaming.NamingContext.unbind
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ org.omg.CORBA.Any _n = _orb().create_any();
+ _n.type(org.omg.CosNaming.NameHelper.type());
+ _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
+ r.params(_list);
+ org.omg.CosNaming.NameComponent[] n;
+ n = org.omg.CosNaming.NameHelper.extract(_n);
+ try {
+ this.unbind(n);
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e1) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e1);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.InvalidName e2) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e2);
+ r.except(_except);
+ return;
+ }
+ org.omg.CORBA.Any __return = _orb().create_any();
+ __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
+ r.result(__return);
+ }
+ break;
+ case 6: // org.omg.CosNaming.NamingContext.list
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ org.omg.CORBA.Any _how_many = _orb().create_any();
+ _how_many.type(org.omg.CORBA.ORB.init().get_primitive_tc(org.omg.CORBA.TCKind.tk_ulong));
+ _list.add_value("how_many", _how_many, org.omg.CORBA.ARG_IN.value);
+ org.omg.CORBA.Any _bl = _orb().create_any();
+ _bl.type(org.omg.CosNaming.BindingListHelper.type());
+ _list.add_value("bl", _bl, org.omg.CORBA.ARG_OUT.value);
+ org.omg.CORBA.Any _bi = _orb().create_any();
+ _bi.type(org.omg.CosNaming.BindingIteratorHelper.type());
+ _list.add_value("bi", _bi, org.omg.CORBA.ARG_OUT.value);
+ r.params(_list);
+ int how_many;
+ how_many = _how_many.extract_ulong();
+ org.omg.CosNaming.BindingListHolder bl;
+ bl = new org.omg.CosNaming.BindingListHolder();
+ org.omg.CosNaming.BindingIteratorHolder bi;
+ bi = new org.omg.CosNaming.BindingIteratorHolder();
+ this.list(how_many, bl, bi);
+ org.omg.CosNaming.BindingListHelper.insert(_bl, bl.value);
+ org.omg.CosNaming.BindingIteratorHelper.insert(_bi, bi.value);
+ org.omg.CORBA.Any __return = _orb().create_any();
+ __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
+ r.result(__return);
+ }
+ break;
+ case 7: // org.omg.CosNaming.NamingContext.new_context
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ r.params(_list);
+ org.omg.CosNaming.NamingContext ___result;
+ ___result = this.new_context();
+ org.omg.CORBA.Any __result = _orb().create_any();
+ org.omg.CosNaming.NamingContextHelper.insert(__result, ___result);
+ r.result(__result);
+ }
+ break;
+ case 8: // org.omg.CosNaming.NamingContext.bind_new_context
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ org.omg.CORBA.Any _n = _orb().create_any();
+ _n.type(org.omg.CosNaming.NameHelper.type());
+ _list.add_value("n", _n, org.omg.CORBA.ARG_IN.value);
+ r.params(_list);
+ org.omg.CosNaming.NameComponent[] n;
+ n = org.omg.CosNaming.NameHelper.extract(_n);
+ org.omg.CosNaming.NamingContext ___result;
+ try {
+ ___result = this.bind_new_context(n);
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.NotFound e0) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.NotFoundHelper.insert(_except, e0);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.AlreadyBound e1) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.AlreadyBoundHelper.insert(_except, e1);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.CannotProceed e2) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.insert(_except, e2);
+ r.except(_except);
+ return;
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.InvalidName e3) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.insert(_except, e3);
+ r.except(_except);
+ return;
+ }
+ org.omg.CORBA.Any __result = _orb().create_any();
+ org.omg.CosNaming.NamingContextHelper.insert(__result, ___result);
+ r.result(__result);
+ }
+ break;
+ case 9: // org.omg.CosNaming.NamingContext.destroy
+ {
+ org.omg.CORBA.NVList _list = _orb().create_list(0);
+ r.params(_list);
+ try {
+ this.destroy();
+ }
+ catch (org.omg.CosNaming.NamingContextPackage.NotEmpty e0) {
+ org.omg.CORBA.Any _except = _orb().create_any();
+ org.omg.CosNaming.NamingContextPackage.NotEmptyHelper.insert(_except, e0);
+ r.except(_except);
+ return;
+ }
+ org.omg.CORBA.Any __return = _orb().create_any();
+ __return.type(_orb().get_primitive_tc(org.omg.CORBA.TCKind.tk_void));
+ r.result(__return);
+ }
+ break;
+ default:
+ throw new org.omg.CORBA.BAD_OPERATION(0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);
+ }
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl b/src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl
new file mode 100644
index 0000000..ae276b0
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CosNaming/nameservice.idl
@@ -0,0 +1,509 @@
+/*
+ * Copyright (c) 1996, 2015, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// name.idl - Naming service interface
+#pragma prefix "omg.org"
+
+
+/**
+ * The CORBA COS Naming Service provides the ability to bind a name
+ * to an object relative to a naming context. A naming context is an
+ * object that contains a set of name bindings in which each name is unique.
+ * To resolve a name is to determine the object associated with the name in
+ * a given context. <p>
+ *
+ * See http://www.omg.org/technology/documents/formal/naming_service.htm
+ * for the complete CORBA
+ * COS Naming Specification. <p>
+ */
+module CosNaming
+{
+ typedef string Istring;
+
+ /**
+ * Many of the operations defined on a naming context take names as
+ * parameters. Names have structure. A name is an ordered sequence of
+ * components. <p>
+ *
+ * A name with a single component is called a simple name; a name with
+ * multiple components is called a compound name. Each component except
+ * the last is used to name a context; the last component denotes the
+ * bound object. <p>
+ *
+ * A name component consists of two attributes: the identifier
+ * attribute and the kind attribute. Both the identifier attribute and the
+ * kind attribute are represented as IDL strings. The kind attribute adds
+ * descriptive power to names in a syntax-independent way. Examples of the
+ * value of the kind attribute include c_source, object_code, executable,
+ * postscript, or " ".
+ */
+ struct NameComponent
+ {
+ Istring id;
+ Istring kind;
+ };
+
+ /**
+ * A name is a sequence of name components.
+ */
+ typedef sequence <NameComponent> Name;
+
+ /**
+ * Specifies whether the given binding is for a object (that is not a
+ * naming context) or for a naming context.
+ */
+ enum BindingType
+ {
+ nobject, // name is bound to an object
+ ncontext // name is bound to a naming context
+ };
+
+ /**
+ * A name-to-object association is called a Binding.
+ */
+ struct Binding
+ {
+ Name binding_name; // name
+ BindingType binding_type; // whether name is bound to an object
+ // or a naming context
+ };
+
+ /**
+ * List of Bindings.
+ */
+ typedef sequence <Binding> BindingList;
+
+ /**
+ * The BindingIterator interface allows a client to iterate through
+ * the bindings using the next_one or next_n operations.
+ *
+ * The bindings iterator is obtained by using the <code>list</code>
+ * method on the <code>NamingContext</code>.
+ * @see org.omg.CosNaming.NamingContext#list
+ */
+ interface BindingIterator
+ {
+ /**
+ * This operation returns the next binding. If there are no more
+ * bindings, false is returned.
+ *
+ * @param b the returned binding
+ */
+ boolean next_one(out Binding b);
+
+ /**
+ * This operation returns at most the requested number of bindings.
+ *
+ * @param how_many the maximum number of bindings to return
+ *
+ * @param bl the returned bindings
+ */
+ boolean next_n(in unsigned long how_many,
+ out BindingList bl);
+
+ // Destroy binding iterator
+ /**
+ * This operation destroys the iterator.
+ */
+ void destroy();
+ };
+
+/**
+ * A naming context is an object that contains a set of name bindings in
+ * which each name is unique. Different names can be bound to an object
+ * in the same or different contexts at the same time. <p>
+ *
+ * See <a href="http://www.omg.org/technology/documents/formal/naming_service.htm">
+ * CORBA COS
+ * Naming Specification.</a>
+ */
+ interface NamingContext
+ {
+ // Declare exceptions
+ /**
+ * Indicates the reason for not able to resolve.
+ */
+ enum NotFoundReason
+ {
+ missing_node,
+ not_context,
+ not_object
+ };
+
+/**
+ * Indicates the name does not identify a binding.
+ */
+ exception NotFound
+ {
+ NotFoundReason why;
+ Name rest_of_name;
+ };
+
+/**
+ * Indicates that the implementation has given up for some reason.
+ * The client, however, may be able to continue the operation at the
+ * returned naming context.
+ */
+ exception CannotProceed
+ {
+ NamingContext cxt;
+ Name rest_of_name;
+ };
+
+/**
+ * Indicates the name is invalid.
+ */
+ exception InvalidName
+ {};
+
+/**
+ * Indicates an object is already bound to the specified name. Only
+ * one object can be bound to a particular name in a context.
+ */
+ exception AlreadyBound
+ {};
+
+/**
+ * Indicates that the Naming Context contains bindings.
+ */
+ exception NotEmpty
+ {};
+
+/**
+ * Creates a binding of a name and an object in the naming context.
+ * Naming contexts that are bound using bind do not participate in name
+ * resolution when compound names are passed to be resolved.
+ *
+ * @param n Name of the object.
+ *
+ * @param obj The Object to bind with the given name.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates
+ * the name does not identify a binding.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
+ * Indicates that the implementation has given up for some reason.
+ * The client, however, may be able to continue the operation
+ * at the returned naming context.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName
+ * Indicates that the name is invalid.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
+ * Indicates an object is already bound to the specified name.
+ */
+ void bind(in Name n,
+ in Object obj)
+ raises(NotFound,
+ CannotProceed,
+ InvalidName,
+ AlreadyBound);
+
+/**
+ * Names an object that is a naming context. Naming contexts that
+ * are bound using bind_context() participate in name resolution
+ * when compound names are passed to be resolved.
+ *
+ * @param n Name of the object.
+ *
+ * @param nc NamingContect object to bind with the given name.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
+ * given up for some reason. The client, however, may be able to
+ * continue the operation at the returned naming context.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound Indicates an object is already
+ * bound to the specified name.
+ */
+ void bind_context(in Name n,
+ in NamingContext nc)
+ raises(NotFound,
+ CannotProceed,
+ InvalidName,
+ AlreadyBound);
+
+/**
+ * Creates a binding of a name and an object in the naming context
+ * even if the name is already bound in the context. Naming contexts
+ * that are bound using rebind do not participate in name resolution
+ * when compound names are passed to be resolved.
+ *
+ * @param n Name of the object.
+ *
+ * @param obj The Object to rebind with the given name.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
+ * given up for some reason. The client, however, may be able to
+ * continue the operation at the returned naming context.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
+ */
+ void rebind(in Name n,
+ in Object obj)
+ raises(NotFound,
+ CannotProceed,
+ InvalidName);
+
+/**
+ * Creates a binding of a name and a naming context in the naming
+ * context even if the name is already bound in the context. Naming
+ * contexts that are bound using rebind_context() participate in name
+ * resolution when compound names are passed to be resolved.
+ *
+ * @param n Name of the object.
+ *
+ * @param nc NamingContect object to rebind with the given name.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
+ * given up for some reason. The client, however, may be able to
+ * continue the operation at the returned naming context.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
+ */
+ void rebind_context(in Name n,
+ in NamingContext nc)
+ raises(NotFound,
+ CannotProceed,
+ InvalidName);
+
+/**
+ * The resolve operation is the process of retrieving an object
+ * bound to a name in a given context. The given name must exactly
+ * match the bound name. The naming service does not return the type
+ * of the object. Clients are responsible for "narrowing" the object
+ * to the appropriate type. That is, clients typically cast the returned
+ * object from Object to a more specialized interface.
+ *
+ * @param n Name of the object.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
+ * given up for some reason. The client, however, may be able to
+ * continue the operation at the returned naming context.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
+ */
+ Object resolve(in Name n)
+ raises(NotFound,
+ CannotProceed,
+ InvalidName);
+
+/**
+ * The unbind operation removes a name binding from a context.
+ *
+ * @param n Name of the object.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
+ * given up for some reason. The client, however, may be able to
+ * continue the operation at the returned naming context.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
+ */
+ void unbind(in Name n)
+ raises(NotFound,
+ CannotProceed,
+ InvalidName);
+
+/**
+ * The list operation allows a client to iterate through a set of
+ * bindings in a naming context. <p>
+ *
+ * The list operation returns at most the requested number of
+ * bindings in BindingList bl.
+ * <ul>
+ * <li>If the naming context contains additional
+ * bindings, the list operation returns a BindingIterator with the
+ * additional bindings.
+ * <li>If the naming context does not contain additional
+ * bindings, the binding iterator is a nil object reference.
+ * </ul>
+ *
+ * @param how_many the maximum number of bindings to return.
+ *
+ * @param bl the returned list of bindings.
+ *
+ * @param bi the returned binding iterator.
+ */
+ void list(in unsigned long how_many,
+ out BindingList bl,
+ out BindingIterator bi);
+
+/**
+ * This operation returns a naming context implemented by the same
+ * naming server as the context on which the operation was invoked.
+ * The new context is not bound to any name.
+ */
+ NamingContext new_context();
+
+/**
+ * This operation creates a new context and binds it to the name
+ * supplied as an argument. The newly-created context is implemented
+ * by the same naming server as the context in which it was bound (that
+ * is, the naming server that implements the context denoted by the
+ * name argument excluding the last component).
+ *
+ * @param n Name of the object.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates the name does not identify a binding.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound Indicates an object is already
+ * bound to the specified name.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the implementation has
+ * given up for some reason. The client, however, may be able to
+ * continue the operation at the returned naming context.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidName Indicates that the name is invalid.
+ */
+ NamingContext bind_new_context(in Name n)
+ raises(NotFound,
+ AlreadyBound,
+ CannotProceed,
+ InvalidName);
+
+/**
+ * The destroy operation deletes a naming context. If the naming
+ * context contains bindings, the NotEmpty exception is raised.
+ *
+ * @exception org.omg.CosNaming.NamingContextPackage.NotEmpty Indicates that the Naming Context contains bindings.
+ */
+ void destroy()
+ raises(NotEmpty);
+
+ };
+
+
+/**
+ * <code>NamingContextExt</code> is the extension of <code>NamingContext</code>
+ * which
+ * contains a set of name bindings in which each name is unique and is
+ * part of Interoperable Naming Service.
+ * Different names can be bound to an object in the same or different
+ * contexts at the same time. Using <code>NamingContextExt</code>, you can use
+ * URL-based names to bind and resolve.
+ *
+ * See <a href="http://www.omg.org/technology/documents/formal/naming_service.htm">
+ * CORBA COS
+ * Naming Specification.</a>
+ */
+ interface NamingContextExt: NamingContext
+ {
+/**
+ * StringName is the Stringified Name, Array of Name Components
+ * represented as a String.
+ */
+ typedef string StringName;
+
+/**
+ * Address is the Host and Port information represented as a String.
+ */
+ typedef string Address;
+
+/**
+ * URLString is the URL address (corbaloc: or corbaname:) represented as
+ * a String.
+ */
+ typedef string URLString;
+
+/**
+ * This operation creates a stringified name from the array of Name
+ * components.
+ *
+ * @param n Name of the object.
+ *
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ *
+ */
+ StringName to_string( in Name n ) raises (InvalidName);
+
+/**
+ * This operation converts a Stringified Name into an equivalent array
+ * of Name Components.
+ *
+ * @param sn Stringified Name of the object.
+ *
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ *
+ */
+ Name to_name( in StringName sn ) raises (InvalidName);
+
+
+/**
+ * Indicates the invalid Stringified name for the object, The
+ * reason could be invalid syntax.
+ */
+ exception InvalidAddress
+ { };
+
+/**
+ * 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.
+ *
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
+ * Indicates the internet based address of the host machine is incorrect
+ */
+ URLString to_url( in Address addr, in StringName sn )
+ raises( InvalidAddress, InvalidName );
+
+
+/**
+ * This operation resolves the Stringified name into the object
+ * reference.
+ *
+ * @param sn Stringified Name of the 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.
+ * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
+ * Indicates the name does not identify a binding.
+ *
+ */
+ Object resolve_str( in StringName sn)
+ raises( NotFound, CannotProceed,
+ InvalidName);
+
+ };
+
+};
diff --git a/src/java.corba/share/classes/org/omg/CosNaming/package.html b/src/java.corba/share/classes/org/omg/CosNaming/package.html
new file mode 100644
index 0000000..2654854
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/CosNaming/package.html
@@ -0,0 +1,351 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+/*
+* Copyright (c) 1998, 2017, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation. Oracle designates this
+* particular file as subject to the "Classpath" exception as provided
+* by Oracle in the LICENSE file that accompanied this code.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+-->
+</head>
+<body bgcolor="white">
+
+ Provides a naming service for Java&nbsp;IDL. The Object Request Broker Daemon
+ (ORBD) also includes both a transient and persistent naming service.
+
+
+ <P>
+ The package and all its classes and interfaces
+ were generated by running the tool <code>idlj</code> on the file
+ <code>nameservice.idl</code>, which is a module written in OMG IDL.
+
+ <H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6, ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+ <H2>Interfaces</H2>
+ The package <code>org.omg.CosNaming</code> contains two public interfaces
+ and several auxiliary classes.
+ <P>
+ The interfaces are:
+ <UL>
+ <LI><code>NamingContext</code>
+ <LI><code>BindingIterator</code>
+ </UL>
+ <P>
+ These two interfaces provide the means to bind/unbind names and object
+ references, to retrieve bound object references, and
+ to iterate through a list of bindings. The <code>NamingContext</code>
+ interface supplies the main functionality for the naming service, and
+ <code>BindingIterator</code> provides a means of iterating through a list
+ of name/object reference bindings.
+
+ <H2>Auxiliary Classes</H2>
+ In order to map an OMG IDL interface to the Java programming language,
+ the idlj compiler creates Java classes that can be thought of
+ as auxiliary classes.
+ Comments for the generated auxiliary classes
+ used by the interfaces <code>NamingContext</code> and
+ <code>BindingIterator</code> are included here.
+
+ <H3>Classes Used by <code>NamingContext</code> and
+ <code>BindingIterator</code></H3>
+ The following are classes used by
+ the naming service. (Helper and holder classes, which are
+ generated for each of the classes listed here, are discussed below.)
+
+ <UL>
+ <LI><code>public final class <B>NameComponent</B></code> --
+ a building block for names. (Names are bound to object references
+ in a naming context.)
+ <P>A name is an array of one or more <code>NameComponent</code> objects.
+ A name with a single <code>NameComponent</code> is called
+ a <I>simple name</I>; a name with multiple <code>NameComponent</code>
+ objects is called a <I>compound name</I>.
+ <P>
+ A <code><B>NameComponent</B></code> object consists of two fields:
+ <OL>
+ <LI><code><B>id</B></code> -- a <code>String</code> used as an identifier
+ <LI><code><B>kind</B></code> -- a <code>String</code> that can be used for any
+ descriptive purpose. Its importance is that it
+ can be used to describe an object without affecting syntax.
+ The C programming language, for example, uses the the syntactic convention
+ of appending the extension ".c" to a file name to indicate that it is
+ a source code file. In a <code>NameComponent</code> object,
+ the <code>kind</code> field can be used to describe the type of object
+ rather than a file extension or some other syntactic convention.
+ Examples of the value of the <code>kind</code> field include the strings
+ <code>"c_source"</code>, <code>"object_code"</code>,
+ <code>"executable"</code>,
+ <code>"postscript"</code>, and <code>""</code>. It is not unusual
+ for the <code>kind</code> field to be the empty string.
+ </OL>
+ <P>
+ In a name, each <code>NameComponent</code> object except the last denotes
+ a <code>NamingContext</code> object; the last <code>NameComponent</code>
+ object denotes the bound object reference.
+ This is similar to a path name, in which the last name is the
+ file name, and all names before it are directory names.
+
+ <LI><code>public final class <B>Binding</B></code> --
+ an object that associates a name with an object reference or a
+ naming context.
+ A <code>Binding</code> object has two fields:
+ <OL>
+ <LI><code><B>binding_name</B></code> - an array of one or more
+ <code>NameComponent</code> objects that represents the bound name
+ <LI><code><B>binding_type</B></code> - a <code>BindingType</code> object
+ indicating whether the binding is between a name and an object
+ reference or between a name and a naming context
+ </OL>
+ <P>
+ The interface <code>NamingContext</code> has methods for
+ binding/unbinding names with object references or naming contexts,
+ for listing bindings,
+ and for resolving bindings (given a name, the method
+ <code>resolve</code> returns the object reference bound to it).
+
+ <LI><code>public final class <B>BindingType</B></code> --
+ an object that specifies whether the given <code>Binding</code>
+ object is a binding between a name and an object reference (that is,
+ not a naming context) or between a name and a naming context.
+ <P>
+ The class<code>BindingType</code> consists of two methods and
+ four constants. Two of these constants are
+ <code>BindingType</code> objects, and two are <code>int</code>s.
+ <P>
+ The <code>BindingType</code> objects
+ can be passed to the constructor for the class
+ <code>Binding</code> or used as parameters or return values. These
+ <code>BindingType</code> objects are:
+ <UL>
+ <LI><code>public static final BindingType <B>nobject</B></code> --
+ to indicate that the binding is with an object reference
+ <LI><code>public static final BindingType <B>ncontext</B></code> --
+ to indicate that the binding is with a naming context
+ </UL>
+ <P>
+ The <code>int</code> constants can be supplied to the method
+ <code>from_int</code> to create <code>BindingType</code> objects,
+ or they can be return values for the method <code>value</code>.
+ These constants are:
+ <UL>
+ <LI><code>public static final int <B>_nobject</B></code>
+ <LI><code>public static final int <B>_ncontext</B></code>
+ </UL>
+ If the method <code>from_int</code> is supplied with anything other
+ than <code>_nobject</code>
+ or <code>_ncontext</code>, it will throw
+ the exception <code>org.omg.CORBA.BAD_PARAM</code>.
+ <P>Usage is as follows:
+ <PRE>
+ BindingType btObject = from_int(_nobject);
+ BindingType btContext = from_int(_ncontext);
+ </PRE>
+ The variable <code>btObject</code> refers to a <code>BindingType</code>
+ object initialized to represent a binding with an object reference.
+ The variable <code>btContext</code> refers to a <code>BindingType</code>
+ object initialized to represent a binding with a
+ <code>NamingContex</code> object.
+ <P>
+ The method <code>value</code> returns either
+ <code>_nobject</code> or <code>_ncontext</code>, so
+ in the following line of code, the variable <code>bt</code>
+ will contain <code>_nobject</code> or <code>_ncontext</code>:
+ <PRE>
+ int bt = BindingType.value();
+ </PRE>
+ </UL>
+
+ <H3>Holder Classes</H3>
+
+ OMG IDL uses OUT and INOUT parameters for returning values from operations.
+ The mapping to the Java programming language, which does not have OUT
+ and INOUT parameters, creates a special class for each type, called
+ a holder class.
+ An instance of a holder class can be passed to a
+ Java method as a parameter, and
+ a value can be assigned to its <code>value</code> field. This allows
+ it to perform the function of an OUT or INOUT parameter.
+ <P>The following holder classes are generated for the package
+ <code>org.omg.CosNaming</code>:
+ <UL>
+ <LI><code>NamingContextHolder</code>
+ <LI><code>BindingIteratorHolder</code>
+ <LI><code>BindingHolder</code>
+ <LI><code>BindingListHolder</code>
+ <LI><code>BindingTypeHolder</code>
+ <LI><code>NameComponentHolder</code>
+ <LI><code>NameHolder</code>
+ </UL>
+ <P>
+ Note that in the <code>org.omg.CORBA</code> package,
+ there is a holder class for each of the basic Java types:
+ <code>IntHolder</code>, <code>ShortHolder</code>,
+ <code>StringHolder</code>, and so on.
+ <P>
+ Note also that there is a <code>NameHolder</code> class even though
+ there is no <code>Name</code> class; similarly, there is a
+ <code>BindingListHolder</code> class even though there is no
+ <code>BindingList</code> class. This is true because in the OMG IDL
+ interface, <code>Name</code> and <code>BindingList</code> are
+ <code>typedef</code>s. There is no mapping from an IDL
+ <code>typedef</code> to a Java construct, but holder classes
+ are generated if the <code>typedef</code> is for a sequence or
+ an array. As mapped to the
+ Java programming language, <code>Name</code> is an array of
+ <code>NameComponent</code> objects, and a <code>BindingList</code>
+ is an array of <code>Binding</code> objects.
+
+ All holder classes have at least two constructors and one field:
+ <UL>
+ <LI><code><B>value</B></code> field -- an instance of the type being used as
+ an OUT or INOUT parameter. For example, the <code>value</code> field of a
+ <code>NamingContextHolder</code> will be a <code>NamingContext</code>
+ object.
+ <LI>default constructor -- a constructor that creates a new holder object
+ initialized with the default value for the type. For example, a new
+ <code>BindingHolder</code> object created with the default constructor
+ will have its <code>value</code> field set to <code>null</code> because
+ that is the default value for an object. Other defaults are
+ <code>false</code> for <code>boolean</code>,
+ <code>0</code> for numeric and char types, and
+ <code>null</code> for object references.
+ <LI>constructor from an instance -- a constructor that creates a new
+ holder object whose <code>value</code> field is
+ initialized with the instance supplied
+ </UL>
+ <P>
+ A holder class for a user-defined type (a Java class) has three more
+ methods, but application developers do not use them directly.
+
+ <H3>Helper Classes</H3>
+ Helper classes, which are generated for all user-defined types
+ in an OMG IDL interface, supply static methods needed to manipulate
+ those types.
+ <P>
+ There is only one method in a helper class that an
+ application programmer uses: the
+ method <code>narrow</code>. Only Java interfaces mapped from IDL
+ interfaces will have a helper class that includes a <code>narrow</code>
+ method, so in the <code>CosNaming</code> package, only the classes
+ <code>NamingContextHelper</code> and <code>BindingIteratorHelper</code>
+ have a <code>narrow</code> method.
+ <UL>
+ <LI><code>public static NamingContext
+ <B>narrow</B>(org.omg.CORBA.Object obj)</code> -- converts the given
+ CORBA object to a <code>NamingContext</code> object
+ <LI><code>public static BindingIterator
+ <B>narrow</B>(org.omg.CORBA.Object obj)</code> -- converts the given
+ CORBA object to a <code>BindingIterator</code> object
+ </UL>
+<H2>Package <code>org.omg.CosNaming.NamingContextPackage</code></H2>
+This package supplies Helper and Holder classes for the exceptions used
+in the package <code>org.omg.CosNaming</code> and also for the class
+<code>NotFoundReason</code>, which supplies a reason for the exception
+<code>NotFound</code>.
+<P>
+There are Helper and Holder classes for the following exceptions:
+<UL>
+<LI><code>AlreadyBound</code>
+<LI><code>CannotProceed</code>
+<LI><code>InvalidName</code>
+<LI><code>NotEmpty</code>
+<LI><code>NotFound</code>
+</UL>
+
+<h2>Naming Service Compatibility</h2>
+
+Sun's implementation of the <code>CosNaming</code> package complies
+with the OMG <code>COSNaming</code> specification. In other words,
+the APIs in Sun's naming service are implemented according to the
+guidelines for a naming service provided by OMG. Therefore, if a
+third-party vendor has implemented a naming service that is OMG
+compliant, it is possible to switch between Sun's implementation of
+<code>CosNaming</code> and the third-party vendor's implementation.
+However, it is important to understand that there can be minor
+variations in the way different vendors implement the naming service,
+such as differences in the exception strings.
+
+<h3>Instructions for Using a Third Party's Naming Service</h3>
+Although we encourage using an ORB and ORB services that are both
+from one vendor, it is possible to plug in a third party's
+<code>COSNaming</code> implementation with Sun's RMI-IIOP ORB.
+Here are the steps to follow:
+<OL>
+ <LI>Create a properties file for the Bootstrap server and give it
+ two entries. For example, you could call this properties file
+ <code>/tmp/services</code> and put the following in it:
+ <code>NameService, &lt;Stringified IOR of the Root Naming Context&gt;</code>.
+ <P>
+ This associates <code>NameService</code> with the Root Naming
+ Context of the <code>CosNaming</code> implementation that you
+ want to use.
+ <LI>Start the standalone Bootstrap server using the following command:
+ <pre>
+ <code>
+ java -classpath $(CLASSPATH)
+ com.sun.corba.ee.internal.CosNaming.BootstrapServer -InitialServicesFile
+ "/tmp/services" [-ORBInitialPort port]
+ </code>
+ </pre>
+ <P>
+ Note that the square brackets at the end of the command indicate that
+ specifying a port number is optional.
+</OL>
+<P>
+Now when an application calls the method
+<code>org.omg.CORBA.ORB.resolve_initial_references</code>, CORBA
+processes will contact the Bootstrap Server to get the Root Naming
+Context.
+
+<h2>Package Specification</h2>
+
+<ul>
+ <li>Interoperable Naming Service (<a
+href="http://www.omg.org/cgi-bin/doc?ptc/00-08-07">ptc/00-08-07</a>)
+</ul>
+
+<h2>Related Documentation</h2>
+
+For an overview and examples of how to use the
+<code>CosNaming</code> API, please see:
+<ul>
+ <li>{@extLink tnameserv NamingService}
+</ul>
+<p>
+For an overview of Java&nbsp;IDL, please see:
+<ul>
+ <li>{@extLink idl_guides Java&nbsp;IDL developer's home page}
+</ul>
+
+@since JDK1.3
+
+
+
+</body>
+</html>
+
diff --git a/src/java.corba/share/classes/org/omg/Dynamic/package.html b/src/java.corba/share/classes/org/omg/Dynamic/package.html
new file mode 100644
index 0000000..345b0a3
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/Dynamic/package.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+/*
+* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation. Oracle designates this
+* particular file as subject to the "Classpath" exception as provided
+* by Oracle in the LICENSE file that accompanied this code.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+-->
+
+</head>
+<body bgcolor="white">
+<P>This package contains the <code>Dynamic</code> module specified in the OMG Portable
+Interceptor specification,
+<a href="http://www.omg.org/cgi-bin/doc?ptc/2000-08-06">
+ptc/2000-08-06</a>, section 21.9. Please
+refer to that OMG specification for further details.
+
+
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html b/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html
new file mode 100644
index 0000000..50669f1
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyFactoryPackage/package.html
@@ -0,0 +1,56 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+/*
+* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+*
+* This code is free software; you can redistribute it and/or modify it
+* under the terms of the GNU General Public License version 2 only, as
+* published by the Free Software Foundation. Oracle designates this
+* particular file as subject to the "Classpath" exception as provided
+* by Oracle in the LICENSE file that accompanied this code.
+*
+* This code is distributed in the hope that it will be useful, but WITHOUT
+* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+* version 2 for more details (a copy is included in the LICENSE file that
+* accompanied this code).
+*
+* You should have received a copy of the GNU General Public License version
+* 2 along with this work; if not, write to the Free Software Foundation,
+* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+*
+* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+* or visit www.oracle.com if you need additional information or have any
+* questions.
+*/
+
+-->
+
+</head>
+<body bgcolor="white">
+<P>
+
+This package contains classes and exceptions from the <code>DynAnyFactory</code>
+interface of the
+<code>DynamicAny</code> module
+specified in the OMG <em>The Common Object Request Broker: Architecture and
+Specification</em>,
+<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">
+formal/99-10-07</a>, section 9.2.2. Please
+refer to that OMG specification for further details.
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html b/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html
new file mode 100644
index 0000000..a00125d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/DynamicAny/DynAnyPackage/package.html
@@ -0,0 +1,54 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+-->
+
+</head>
+<body bgcolor="white">
+<P>This package contains classes and exceptions from the <code>DynAny</code>
+ interface of the <code>DynamicAny</code> module
+specified in the OMG <em>The Common Object Request Broker: Architecture and
+Specification</em>,
+<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">
+formal/99-10-07</a>, section 9.2. Please
+refer to that OMG specification for further details.
+
+
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/DynamicAny/DynamicAny.idl b/src/java.corba/share/classes/org/omg/DynamicAny/DynamicAny.idl
new file mode 100644
index 0000000..63e451d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/DynamicAny/DynamicAny.idl
@@ -0,0 +1,1280 @@
+/*
+ * Copyright (c) 2000, 2009, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+// IDL
+// File: DynamicAny.idl
+
+#ifndef _DYNAMIC_ANY_IDL_
+#define _DYNAMIC_ANY_IDL_
+
+#pragma prefix "omg.org"
+#include <orb.idl>
+
+/**
+* An any can be passed to a program that doesn't have any static information for the
+type of the any (code generated for the type by an IDL compiler has not been
+compiled with the object implementation). As a result, the object receiving the any
+does not have a portable method of using it.
+<P>DynAnys enable traversal of the data value associated with an any at
+runtime and extraction of the primitive constituents of the data value. This is especially
+helpful for writing powerful generic servers (bridges, event channels supporting
+filtering).
+<P>Similarly, this facility enables the construction of an any at runtime, without having
+static knowledge of its type. This is especially helpful for writing generic clients
+(bridges, browsers, debuggers, user interface tools).
+*/
+module DynamicAny {
+ /**
+ * Any values can be dynamically interpreted (traversed) and constructed through DynAny objects.
+ * A DynAny object is associated with a data value which corresponds to a copy of the value
+ * inserted into an any.
+ * <P>A DynAny object may be viewed as an ordered collection of component DynAnys.
+ * For DynAnys representing a basic type, such as long, or a type without components,
+ * such as an empty exception, the ordered collection of components is empty.
+ * Each DynAny object maintains the notion of a current position into its collection
+ * of component DynAnys. The current position is identified by an index value that runs
+ * from 0 to n-1, where n is the number of components.
+ * The special index value -1 indicates a current position that points nowhere.
+ * For values that cannot have a current position (such as an empty exception),
+ * the index value is fixed at -1.
+ * If a DynAny is initialized with a value that has components, the index is initialized to 0.
+ * After creation of an uninitialized DynAny (that is, a DynAny that has no value but a TypeCode
+ * that permits components), the current position depends on the type of value represented by
+ * the DynAny. (The current position is set to 0 or -1, depending on whether the new DynAny
+ * gets default values for its components.)
+ * <P>The iteration operations rewind, seek, and next can be used to change the current position
+ * and the current_component operation returns the component at the current position.
+ * The component_count operation returns the number of components of a DynAny.
+ * Collectively, these operations enable iteration over the components of a DynAny, for example,
+ * to (recursively) examine its contents.
+ * <P>A constructed DynAny object is a DynAny object associated with a constructed type.
+ * There is a different interface, inheriting from the DynAny interface, associated with
+ * each kind of constructed type in IDL (fixed, enum, struct, sequence, union, array,
+ * exception, and value type).
+ * <P>A constructed DynAny object exports operations that enable the creation of new DynAny objects,
+ * each of them associated with a component of the constructed data value.
+ * As an example, a DynStruct is associated with a struct value. This means that the DynStruct
+ * may be seen as owning an ordered collection of components, one for each structure member.
+ * The DynStruct object exports operations that enable the creation of new DynAny objects,
+ * each of them associated with a member of the struct.
+ * <P>If a DynAny object has been obtained from another (constructed) DynAny object,
+ * such as a DynAny representing a structure member that was created from a DynStruct,
+ * the member DynAny is logically contained in the DynStruct.
+ * Calling an insert or get operation leaves the current position unchanged.
+ * Destroying a top-level DynAny object (one that was not obtained as a component of another DynAny)
+ * also destroys any component DynAny objects obtained from it.
+ * Destroying a non-top level DynAny object does nothing.
+ * Invoking operations on a destroyed top-level DynAny or any of its descendants raises OBJECT_NOT_EXIST.
+ * If the programmer wants to destroy a DynAny object but still wants to manipulate some component
+ * of the data value associated with it, then he or she should first create a DynAny for the component
+ * and, after that, make a copy of the created DynAny object.
+ * <P>The behavior of DynAny objects has been defined in order to enable efficient implementations
+ * in terms of allocated memory space and speed of access. DynAny objects are intended to be used
+ * for traversing values extracted from anys or constructing values of anys at runtime.
+ * Their use for other purposes is not recommended.
+ * <P>Insert and get operations are necessary to handle basic DynAny objects
+ * but are also helpful to handle constructed DynAny objects.
+ * Inserting a basic data type value into a constructed DynAny object
+ * implies initializing the current component of the constructed data value
+ * associated with the DynAny object. For example, invoking insert_boolean on a
+ * DynStruct implies inserting a boolean data value at the current position
+ * of the associated struct data value.
+ * A type is consistent for inserting or extracting a value if its TypeCode is equivalent to
+ * the TypeCode contained in the DynAny or, if the DynAny has components, is equivalent to the TypeCode
+ * of the DynAny at the current position.
+ * <P>DynAny and DynAnyFactory objects are intended to be local to the process in which they are
+ * created and used. This means that references to DynAny and DynAnyFactory objects cannot be exported
+ * to other processes, or externalized with ORB.object_to_string().
+ * If any attempt is made to do so, the offending operation will raise a MARSHAL system exception.
+ * Since their interfaces are specified in IDL, DynAny objects export operations defined in the standard
+ * org.omg.CORBA.Object interface. However, any attempt to invoke operations exported through the Object
+ * interface may raise the standard NO_IMPLEMENT exception.
+ * An attempt to use a DynAny object with the DII may raise the NO_IMPLEMENT exception.
+ */
+ interface DynAny {
+ #pragma sun_localservant DynAny ""
+ exception InvalidValue {};
+ exception TypeMismatch {};
+
+ /**
+ * Returns the TypeCode associated with this DynAny object.
+ * A DynAny object is created with a TypeCode value assigned to it.
+ * This TypeCode value determines the type of the value handled through the DynAny object.
+ * Note that the TypeCode associated with a DynAny object is initialized at the time the
+ * DynAny is created and cannot be changed during lifetime of the DynAny object.
+ *
+ * @return The TypeCode associated with this DynAny object
+ */
+ CORBA::TypeCode type();
+
+ /**
+ * Initializes the value associated with a DynAny object with the value
+ * associated with another DynAny object.
+ * The current position of the target DynAny is set to zero for values that have components
+ * and to -1 for values that do not have components.
+ *
+ * @param dyn_any
+ * @exception TypeMismatch if the type of the passed DynAny is not equivalent to the type of target DynAny
+ */
+ void assign(in DynAny dyn_any)
+ raises(TypeMismatch);
+
+ /**
+ * Initializes the value associated with a DynAny object with the value contained in an any.
+ * The current position of the target DynAny is set to zero for values that have components
+ * and to -1 for values that do not have components.
+ *
+ * @exception TypeMismatch if the type of the passed Any is not equivalent to the type of target DynAny
+ * @exception InvalidValue if the passed Any does not contain a legal value (such as a null string)
+ */
+ void from_any(in any value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Creates an any value from a DynAny object.
+ * A copy of the TypeCode associated with the DynAny object is assigned to the resulting any.
+ * The value associated with the DynAny object is copied into the any.
+ *
+ * @return a new Any object with the same value and TypeCode
+ */
+ any to_any();
+
+ /**
+ * Compares two DynAny values for equality.
+ * Two DynAny values are equal if their TypeCodes are equivalent and, recursively, all component DynAnys
+ * have equal values.
+ * The current position of the two DynAnys being compared has no effect on the result of equal.
+ *
+ * @return true of the DynAnys are equal, false otherwise
+ */
+ boolean equal(in DynAny dyn_any);
+
+ /**
+ * Destroys a DynAny object.
+ * This operation frees any resources used to represent the data value associated with a DynAny object.
+ * It must be invoked on references obtained from one of the creation operations on the ORB interface
+ * or on a reference returned by DynAny.copy() to avoid resource leaks.
+ * Invoking destroy on component DynAny objects (for example, on objects returned by the
+ * current_component operation) does nothing.
+ * Destruction of a DynAny object implies destruction of all DynAny objects obtained from it.
+ * That is, references to components of a destroyed DynAny become invalid.
+ * Invocations on such references raise OBJECT_NOT_EXIST.
+ * It is possible to manipulate a component of a DynAny beyond the life time of the DynAny
+ * from which the component was obtained by making a copy of the component with the copy operation
+ * before destroying the DynAny from which the component was obtained.
+ */
+ void destroy();
+
+ /**
+ * Creates a new DynAny object whose value is a deep copy of the DynAny on which it is invoked.
+ * The operation is polymorphic, that is, invoking it on one of the types derived from DynAny,
+ * such as DynStruct, creates the derived type but returns its reference as the DynAny base type.
+ *
+ * @return a deep copy of the DynAny object
+ */
+ DynAny copy();
+
+ /**
+ * Inserts a boolean value into the DynAny.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_boolean(in boolean value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a byte value into the DynAny. The IDL octet data type is mapped to the Java byte data type.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_octet(in octet value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a char value into the DynAny.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_char(in char value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a short value into the DynAny.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_short(in short value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a short value into the DynAny. The IDL ushort data type is mapped to the Java short data type.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_ushort(in unsigned short value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts an integer value into the DynAny. The IDL long data type is mapped to the Java int data type.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_long(in long value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts an integer value into the DynAny. The IDL ulong data type is mapped to the Java int data type.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_ulong(in unsigned long value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a float value into the DynAny.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_float(in float value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a double value into the DynAny.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_double(in double value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a string value into the DynAny.
+ * Both bounded and unbounded strings are inserted using this method.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception InvalidValue if the string inserted is longer than the bound of a bounded string
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_string(in string value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a reference to a CORBA object into the DynAny.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_reference(in Object value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a TypeCode object into the DynAny.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_typecode(in CORBA::TypeCode value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a long value into the DynAny. The IDL long long data type is mapped to the Java long data type.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_longlong(in long long value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a long value into the DynAny.
+ * The IDL unsigned long long data type is mapped to the Java long data type.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_ulonglong(in unsigned long long value)
+ raises(TypeMismatch, InvalidValue);
+
+// void insert_longdouble(in long double value)
+// raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a char value into the DynAny. The IDL wchar data type is mapped to the Java char data type.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_wchar(in wchar value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a string value into the DynAny.
+ * Both bounded and unbounded strings are inserted using this method.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception InvalidValue if the string inserted is longer than the bound of a bounded string
+ */
+ void insert_wstring(in wstring value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts an Any value into the Any represented by this DynAny.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_any(in any value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts the Any value contained in the parameter DynAny into the Any represented by this DynAny.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_dyn_any(in DynAny value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Inserts a reference to a Serializable object into this DynAny.
+ * The IDL ValueBase type is mapped to the Java Serializable type.
+ *
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ void insert_val(in ValueBase value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the boolean value from this DynAny.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ boolean get_boolean()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the byte value from this DynAny. The IDL octet data type is mapped to the Java byte data type.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ octet get_octet()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the char value from this DynAny.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ char get_char()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the short value from this DynAny.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ short get_short()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the short value from this DynAny. The IDL ushort data type is mapped to the Java short data type.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ unsigned short get_ushort()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the integer value from this DynAny. The IDL long data type is mapped to the Java int data type.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ long get_long()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the integer value from this DynAny. The IDL ulong data type is mapped to the Java int data type.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ unsigned long get_ulong()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the float value from this DynAny.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ float get_float()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the double value from this DynAny.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ double get_double()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the string value from this DynAny.
+ * Both bounded and unbounded strings are extracted using this method.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ string get_string()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the reference to a CORBA Object from this DynAny.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ Object get_reference()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the TypeCode object from this DynAny.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ CORBA::TypeCode get_typecode()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the long value from this DynAny. The IDL long long data type is mapped to the Java long data type.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ long long get_longlong()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the long value from this DynAny.
+ * The IDL unsigned long long data type is mapped to the Java long data type.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ unsigned long long get_ulonglong()
+ raises(TypeMismatch, InvalidValue);
+// long double get_longdouble()
+// raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the long value from this DynAny. The IDL wchar data type is mapped to the Java char data type.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ wchar get_wchar()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the string value from this DynAny.
+ * Both bounded and unbounded strings are extracted using this method.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ */
+ wstring get_wstring()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts an Any value contained in the Any represented by this DynAny.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ any get_any()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts the Any value contained in the Any represented by this DynAny and returns it wrapped
+ * into a new DynAny.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ DynAny get_dyn_any()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Extracts a Serializable object from this DynAny.
+ * The IDL ValueBase type is mapped to the Java Serializable type.
+ *
+ * @exception TypeMismatch if the accessed component in the DynAny is of a type
+ * that is not equivalent to the requested type.
+ * @exception TypeMismatch if called on a DynAny whose current component itself has components
+ * @exception InvalidValue if this DynAny has components but has a current position of -1
+ */
+ ValueBase get_val()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Sets the current position to index. The current position is indexed 0 to n-1, that is,
+ * index zero corresponds to the first component. The operation returns true if the resulting
+ * current position indicates a component of the DynAny and false if index indicates
+ * a position that does not correspond to a component.
+ * Calling seek with a negative index is legal. It sets the current position to -1 to indicate
+ * no component and returns false. Passing a non-negative index value for a DynAny that does not
+ * have a component at the corresponding position sets the current position to -1 and returns false.
+ */
+ boolean seek(in long index);
+
+ /**
+ * Is equivalent to seek(0).
+ */
+ void rewind();
+
+ /**
+ * Advances the current position to the next component.
+ * The operation returns true while the resulting current position indicates a component, false otherwise.
+ * A false return value leaves the current position at -1.
+ * Invoking next on a DynAny without components leaves the current position at -1 and returns false.
+ */
+ boolean next();
+
+ /**
+ * Returns the number of components of a DynAny.
+ * For a DynAny without components, it returns zero.
+ * The operation only counts the components at the top level.
+ * For example, if component_count is invoked on a DynStruct with a single member,
+ * the return value is 1, irrespective of the type of the member.
+ * <UL>
+ * <LI>For sequences, the operation returns the current number of elements.
+ * <LI>For structures, exceptions, and value types, the operation returns the number of members.
+ * <LI>For arrays, the operation returns the number of elements.
+ * <LI>For unions, the operation returns 2 if the discriminator indicates that a named member is active,
+ * otherwise, it returns 1.
+ * <LI>For DynFixed and DynEnum, the operation returns zero.
+ * </UL>
+ */
+ unsigned long component_count();
+
+ /**
+ * Returns the DynAny for the component at the current position.
+ * It does not advance the current position, so repeated calls to current_component
+ * without an intervening call to rewind, next, or seek return the same component.
+ * The returned DynAny object reference can be used to get/set the value of the current component.
+ * If the current component represents a complex type, the returned reference can be narrowed
+ * based on the TypeCode to get the interface corresponding to the to the complex type.
+ * Calling current_component on a DynAny that cannot have components,
+ * such as a DynEnum or an empty exception, raises TypeMismatch.
+ * Calling current_component on a DynAny whose current position is -1 returns a nil reference.
+ * The iteration operations, together with current_component, can be used
+ * to dynamically compose an any value. After creating a dynamic any, such as a DynStruct,
+ * current_component and next can be used to initialize all the components of the value.
+ * Once the dynamic value is completely initialized, to_any creates the corresponding any value.
+ *
+ * @exception TypeMismatch If called on a DynAny that cannot have components,
+ * such as a DynEnum or an empty exception
+ */
+ DynAny current_component()
+ raises(TypeMismatch);
+ };
+
+ /**
+ * DynFixed objects support the manipulation of IDL fixed values.
+ * Because IDL does not have a generic type that can represent fixed types with arbitrary
+ * number of digits and arbitrary scale, the operations use the IDL string type.
+ */
+ interface DynFixed : DynAny {
+ #pragma sun_localservant DynFixed ""
+
+ /**
+ * Returns the value of a DynFixed.
+ */
+ string get_value();
+
+ /**
+ * Sets the value of the DynFixed.
+ * The val string must contain a fixed string constant in the same format as used for IDL fixed-point literals.
+ * However, the trailing d or D is optional. The return value is true if val can be represented as the DynFixed
+ * without loss of precision. If val has more fractional digits than can be represented in the DynFixed,
+ * fractional digits are truncated and the return value is false.
+ *
+ * @exception TypeMismatch If val does not contain a valid fixed-point literal or contains extraneous
+ * characters other than leading or trailing white space
+ * @exception InvalidValue If val contains a value whose scale exceeds that of the DynFixed
+ * or is not initialized
+ */
+ boolean set_value(in string val)
+ raises(TypeMismatch, InvalidValue);
+ };
+
+ /**
+ * DynEnum objects support the manipulation of IDL enumerated values.
+ * The current position of a DynEnum is always -1.
+ */
+ interface DynEnum : DynAny {
+ #pragma sun_localservant DynEnum ""
+
+ /**
+ * Returns the value of the DynEnum as an IDL identifier.
+ */
+ string get_as_string();
+
+ /**
+ * Sets the value of the DynEnum to the enumerated value whose IDL identifier is passed in the value parameter.
+ *
+ * @exception InvalidValue If value contains a string that is not a valid IDL identifier
+ * for the corresponding enumerated type
+ */
+ void set_as_string(in string value)
+ raises(InvalidValue);
+
+ /**
+ * Returns the value of the DynEnum as the enumerated value's ordinal value.
+ * Enumerators have ordinal values 0 to n-1, as they appear from left to right
+ * in the corresponding IDL definition.
+ */
+ unsigned long get_as_ulong();
+
+ /**
+ * Sets the value of the DynEnum as the enumerated value's ordinal value.
+ *
+ * @exception InvalidValue If value contains a value that is outside the range of ordinal values
+ * for the corresponding enumerated type
+ */
+ void set_as_ulong(in unsigned long value)
+ raises(InvalidValue);
+ };
+
+ typedef string FieldName;
+
+ /**
+ * NameValuePairs associate a name with an Any object.
+ */
+ struct NameValuePair {
+ /**
+ * The name associated with the Any.
+ */
+ FieldName id;
+ /**
+ * The Any value associated with the name.
+ */
+ any value;
+ };
+ typedef sequence<NameValuePair> NameValuePairSeq;
+
+ /**
+ * NameDynAnyPairs associate a name with an DynAny object.
+ */
+ struct NameDynAnyPair {
+ /**
+ * The name associated with the DynAny.
+ */
+ FieldName id;
+ /**
+ * The DynAny value associated with the name.
+ */
+ DynAny value;
+ };
+ typedef sequence<NameDynAnyPair> NameDynAnyPairSeq;
+
+ /**
+ * DynStruct objects support the manipulation of IDL struct and exception values.
+ * Members of the exceptions are handled in the same way as members of a struct.
+ */
+ interface DynStruct : DynAny {
+ #pragma sun_localservant DynStruct ""
+
+ /**
+ * Returns the name of the member at the current position.
+ * This operation may return an empty string since the TypeCode of the value being
+ * manipulated may not contain the names of members.
+ *
+ * @exception TypeMismatch if the DynStruct represents an empty exception.
+ * @exception InvalidValue if the current position does not indicate a member
+ */
+ FieldName current_member_name()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Returns the TCKind associated with the member at the current position.
+ *
+ * @exception TypeMismatch if the DynStruct represents an empty exception.
+ * @exception InvalidValue if the current position does not indicate a member
+ */
+ CORBA::TCKind current_member_kind()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Returns a sequence of NameValuePairs describing the name and the value of each member
+ * in the struct associated with a DynStruct object.
+ * The sequence contains members in the same order as the declaration order of members
+ * as indicated by the DynStruct's TypeCode. The current position is not affected.
+ * The member names in the returned sequence will be empty strings if the DynStruct's TypeCode
+ * does not contain member names.
+ */
+ NameValuePairSeq get_members();
+
+ /**
+ * Initializes the struct data value associated with a DynStruct object from a sequence of NameValuePairs.
+ * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise,
+ * if an empty sequence is passed, the current position is set to -1.
+ * <P>Members must appear in the NameValuePairs in the order in which they appear in the IDL specification
+ * of the struct as indicated by the DynStruct's TypeCode or they must be empty strings.
+ * The operation makes no attempt to assign member values based on member names.
+ *
+ * @exception TypeMismatch if the member names supplied in the passed sequence do not match the
+ * corresponding member name in the DynStruct's TypeCode and they are not empty strings
+ * @exception InvalidValue if the passed sequence has a number of elements that disagrees
+ * with the number of members as indicated by the DynStruct's TypeCode
+ */
+ void set_members(in NameValuePairSeq value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Returns a sequence of NameDynAnyPairs describing the name and the value of each member
+ * in the struct associated with a DynStruct object.
+ * The sequence contains members in the same order as the declaration order of members
+ * as indicated by the DynStruct's TypeCode. The current position is not affected.
+ * The member names in the returned sequence will be empty strings if the DynStruct's TypeCode
+ * does not contain member names.
+ */
+ NameDynAnyPairSeq get_members_as_dyn_any();
+
+ /**
+ * Initializes the struct data value associated with a DynStruct object from a sequence of NameDynAnyPairs.
+ * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise,
+ * if an empty sequence is passed, the current position is set to -1.
+ * <P>Members must appear in the NameDynAnyPairs in the order in which they appear in the IDL specification
+ * of the struct as indicated by the DynStruct's TypeCode or they must be empty strings.
+ * The operation makes no attempt to assign member values based on member names.
+ *
+ * @exception TypeMismatch if the member names supplied in the passed sequence do not match the
+ * corresponding member name in the DynStruct's TypeCode and they are not empty strings
+ * @exception InvalidValue if the passed sequence has a number of elements that disagrees
+ * with the number of members as indicated by the DynStruct's TypeCode
+ */
+ void set_members_as_dyn_any(in NameDynAnyPairSeq value)
+ raises(TypeMismatch, InvalidValue);
+ };
+
+ /**
+ * DynUnion objects support the manipulation of IDL unions.
+ * A union can have only two valid current positions:
+ * <UL>
+ * <LI>zero, which denotes the discriminator
+ * <LI>one, which denotes the active member
+ * </UL>
+ * The component_count value for a union depends on the current discriminator:
+ * it is 2 for a union whose discriminator indicates a named member, and 1 otherwise.
+ */
+ interface DynUnion : DynAny {
+ #pragma sun_localservant DynUnion ""
+
+ /**
+ * Returns the current discriminator value.
+ */
+ DynAny get_discriminator();
+
+ /**
+ * Sets the discriminator of the DynUnion to the specified value.
+ * Setting the discriminator to a value that is consistent with the currently active union member
+ * does not affect the currently active member. Setting the discriminator to a value that is inconsistent
+ * with the currently active member deactivates the member and activates the member that is consistent
+ * with the new discriminator value (if there is a member for that value) by initializing the member
+ * to its default value.
+ * Setting the discriminator of a union sets the current position to 0 if the discriminator value
+ * indicates a non-existent union member (has_no_active_member returns true in this case).
+ * Otherwise, if the discriminator value indicates a named union member, the current position is set to 1
+ * (has_no_active_member returns false and component_count returns 2 in this case).
+ *
+ * @exception TypeMismatch if the TypeCode of the parameter is not equivalent to the TypeCode
+ * of the union's discriminator
+ */
+ void set_discriminator(in DynAny d)
+ raises(TypeMismatch);
+
+ /**
+ * Sets the discriminator to a value that is consistent with the value of the default case of a union.
+ * It sets the current position to zero and causes component_count to return 2.
+ *
+ * @exception TypeMismatch if the union does not have an explicit default case
+ */
+ void set_to_default_member()
+ raises(TypeMismatch);
+
+ /**
+ * Sets the discriminator to a value that does not correspond to any of the unions case labels.
+ * It sets the current position to zero and causes component_count to return 1.
+ *
+ * @exception TypeMismatch if the union has an explicit default case or if it uses the entire range
+ * of discriminator values for explicit case labels
+ */
+ void set_to_no_active_member()
+ raises(TypeMismatch);
+
+ /**
+ * Returns true if the union has no active member, that is, the unions value consists solely
+ * of its discriminator because the discriminator has a value that is not listed as an explicit case label.
+ * Calling this operation on a union that has a default case returns false.
+ * Calling this operation on a union that uses the entire range of discriminator values
+ * for explicit case labels returns false.
+ */
+ boolean has_no_active_member();
+
+ /**
+ * Returns the TCKind value of the discriminators TypeCode.
+ */
+ CORBA::TCKind discriminator_kind();
+
+ /**
+ * Returns the TCKind value of the currently active members TypeCode.
+ *
+ * @exception InvalidValue if the union does not have a currently active member
+ */
+ CORBA::TCKind member_kind()
+ raises(InvalidValue);
+
+ /**
+ * Returns the currently active member. Note that the returned reference remains valid only
+ * for as long as the currently active member does not change. Using the returned reference
+ * beyond the life time of the currently active member raises OBJECT_NOT_EXIST.
+ *
+ * @exception InvalidValue if the union has no active member
+ */
+ DynAny member()
+ raises(InvalidValue);
+
+ /**
+ * Returns the name of the currently active member. If the unions TypeCode does not contain
+ * a member name for the currently active member, the operation returns an empty string.
+ *
+ * @exception InvalidValue if the union has no active member
+ */
+ FieldName member_name()
+ raises(InvalidValue);
+ };
+
+ typedef sequence<any> AnySeq;
+ typedef sequence<DynAny> DynAnySeq;
+
+ /**
+ * DynSequence objects support the manipulation of IDL sequences.
+ */
+ interface DynSequence : DynAny {
+ #pragma sun_localservant DynSequence ""
+
+ /**
+ * Returns the current length of the sequence.
+ */
+ unsigned long get_length();
+
+ /**
+ * Sets the length of the sequence.
+ * Increasing the length of a sequence adds new elements at the tail without affecting the values
+ * of already existing elements. Newly added elements are default-initialized.
+ * Increasing the length of a sequence sets the current position to the first newly-added element
+ * if the previous current position was -1. Otherwise, if the previous current position was not -1,
+ * the current position is not affected.
+ * Decreasing the length of a sequence removes elements from the tail without affecting the value
+ * of those elements that remain. The new current position after decreasing the length of a sequence
+ * is determined as follows:
+ * <UL>
+ * <LI>If the length of the sequence is set to zero, the current position is set to -1.
+ * <LI>If the current position is -1 before decreasing the length, it remains at -1.
+ * <LI>If the current position indicates a valid element and that element is not removed when the length
+ * is decreased, the current position remains unaffected.
+ * <LI>If the current position indicates a valid element and that element is removed,
+ * the current position is set to -1.
+ * </UL>
+ *
+ * @exception InvalidValue if this is a bounded sequence and len is larger than the bound
+ */
+ void set_length(in unsigned long len)
+ raises(InvalidValue);
+
+ /**
+ * Returns the elements of the sequence.
+ */
+ AnySeq get_elements();
+
+ /**
+ * Sets the elements of a sequence.
+ * The length of the DynSequence is set to the length of value. The current position is set to zero
+ * if value has non-zero length and to -1 if value is a zero-length sequence.
+ *
+ * @exception TypeMismatch if value contains one or more elements whose TypeCode is not equivalent
+ * to the element TypeCode of the DynSequence
+ * @exception InvalidValue if the length of value exceeds the bound of a bounded sequence
+ */
+ void set_elements(in AnySeq value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Returns the DynAnys representing the elements of the sequence.
+ */
+ DynAnySeq get_elements_as_dyn_any();
+
+ /**
+ * Sets the elements of a sequence using DynAnys.
+ * The length of the DynSequence is set to the length of value. The current position is set to zero
+ * if value has non-zero length and to -1 if value is a zero-length sequence.
+ *
+ * @exception TypeMismatch if value contains one or more elements whose TypeCode is not equivalent
+ * to the element TypeCode of the DynSequence
+ * @exception InvalidValue if the length of value exceeds the bound of a bounded sequence
+ */
+ void set_elements_as_dyn_any(in DynAnySeq value)
+ raises(TypeMismatch, InvalidValue);
+ };
+
+ /**
+ * DynArray objects support the manipulation of IDL arrays.
+ * Note that the dimension of the array is contained in the TypeCode which is accessible
+ * through the type attribute. It can also be obtained by calling the component_count operation.
+ */
+ interface DynArray : DynAny {
+ #pragma sun_localservant DynArray ""
+
+ /**
+ * Returns the elements of the DynArray.
+ */
+ AnySeq get_elements();
+
+ /**
+ * Sets the DynArray to contain the passed elements.
+ *
+ * @exception TypeMismatch if one or more elements have a type that is inconsistent with the DynArrays TypeCode
+ * @exception InvalidValue if the sequence does not contain the same number of elements as the array dimension
+ */
+ void set_elements(in AnySeq value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Returns the elements of the DynArray as DynAnys.
+ */
+ DynAnySeq get_elements_as_dyn_any();
+
+ /**
+ * Sets the DynArray to contain the passed elements.
+ *
+ * @exception TypeMismatch if one or more elements have a type that is inconsistent with the DynArrays TypeCode
+ * @exception InvalidValue if the sequence does not contain the same number of elements as the array dimension
+ */
+ void set_elements_as_dyn_any(in DynAnySeq value)
+ raises(TypeMismatch, InvalidValue);
+ };
+
+ /**
+ * DynValueCommon provides operations supported by both the DynValue and DynValueBox interfaces.
+ */
+ interface DynValueCommon : DynAny {
+ /**
+ * Returns true if the DynValueCommon represents a null value type.
+ */
+ boolean is_null();
+
+ /**
+ * Changes the representation of a DynValueCommon to a null value type.
+ */
+ void set_to_null();
+
+ /**
+ * Replaces a null value type with a newly constructed value. Its components are initialized
+ * to default values as in DynAnyFactory.create_dyn_any_from_type_code.
+ * If the DynValueCommon represents a non-null value type, then this operation has no effect.
+ */
+ void set_to_value();
+ };
+
+ /**
+ * DynValue objects support the manipulation of IDL non-boxed value types.
+ * The DynValue interface can represent both null and non-null value types.
+ * For a DynValue representing a non-null value type, the DynValue's components comprise
+ * the public and private members of the value type, including those inherited from concrete base value types,
+ * in the order of definition. A DynValue representing a null value type has no components
+ * and a current position of -1.
+ * <P>Warning: Indiscriminantly changing the contents of private value type members can cause the value type
+ * implementation to break by violating internal constraints. Access to private members is provided to support
+ * such activities as ORB bridging and debugging and should not be used to arbitrarily violate
+ * the encapsulation of the value type.
+ */
+ interface DynValue : DynValueCommon {
+ #pragma sun_localservant DynValue ""
+
+ /**
+ * Returns the name of the member at the current position.
+ * This operation may return an empty string since the TypeCode of the value being
+ * manipulated may not contain the names of members.
+ *
+ * @exception TypeMismatch if the DynValue represents a null value type.
+ * @exception InvalidValue if the current position does not indicate a member
+ */
+ FieldName current_member_name()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Returns the TCKind associated with the member at the current position.
+ *
+ * @exception TypeMismatch if the DynValue represents a null value type.
+ * @exception InvalidValue if the current position does not indicate a member
+ */
+ CORBA::TCKind current_member_kind()
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Returns a sequence of NameValuePairs describing the name and the value of each member
+ * in the value type.
+ * The sequence contains members in the same order as the declaration order of members
+ * as indicated by the DynValue's TypeCode. The current position is not affected.
+ * The member names in the returned sequence will be empty strings if the DynValue's TypeCode
+ * does not contain member names.
+ *
+ * @exception InvalidValue if this object represents a null value type
+ */
+ NameValuePairSeq get_members()
+ raises(InvalidValue);
+
+ /**
+ * Initializes the value type's members from a sequence of NameValuePairs.
+ * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise,
+ * if an empty sequence is passed, the current position is set to -1.
+ * A null value type can be initialized to a non-null value type using this method.
+ * <P>Members must appear in the NameValuePairs in the order in which they appear in the IDL specification
+ * of the value type as indicated by the DynValue's TypeCode or they must be empty strings.
+ * The operation makes no attempt to assign member values based on member names.
+ *
+ * @exception TypeMismatch if the member names supplied in the passed sequence do not match the
+ * corresponding member name in the DynValue's TypeCode and they are not empty strings
+ * @exception InvalidValue if the passed sequence has a number of elements that disagrees
+ * with the number of members as indicated by the DynValue's TypeCode
+ */
+ void set_members(in NameValuePairSeq value)
+ raises(TypeMismatch, InvalidValue);
+
+ /**
+ * Returns a sequence of NameDynAnyPairs describing the name and the value of each member
+ * in the value type.
+ * The sequence contains members in the same order as the declaration order of members
+ * as indicated by the DynValue's TypeCode. The current position is not affected.
+ * The member names in the returned sequence will be empty strings if the DynValue's TypeCode
+ * does not contain member names.
+ *
+ * @exception InvalidValue if this object represents a null value type
+ */
+ NameDynAnyPairSeq get_members_as_dyn_any()
+ raises(InvalidValue);
+
+ /**
+ * Initializes the value type's members from a sequence of NameDynAnyPairs.
+ * The operation sets the current position to zero if the passed sequences has non-zero length. Otherwise,
+ * if an empty sequence is passed, the current position is set to -1.
+ * A null value type can be initialized to a non-null value type using this method.
+ * <P>Members must appear in the NameDynAnyPairs in the order in which they appear in the IDL specification
+ * of the value type as indicated by the DynValue's TypeCode or they must be empty strings.
+ * The operation makes no attempt to assign member values based on member names.
+ *
+ * @exception TypeMismatch if the member names supplied in the passed sequence do not match the
+ * corresponding member name in the DynValue's TypeCode and they are not empty strings
+ * @exception InvalidValue if the passed sequence has a number of elements that disagrees
+ * with the number of members as indicated by the DynValue's TypeCode
+ */
+ void set_members_as_dyn_any(in NameDynAnyPairSeq value)
+ raises(TypeMismatch, InvalidValue);
+ };
+
+ /**
+ * DynValueBox objects support the manipulation of IDL boxed value types.
+ * The DynValueBox interface can represent both null and non-null value types.
+ * For a DynValueBox representing a non-null value type, the DynValueBox has a single component
+ * of the boxed type. A DynValueBox representing a null value type has no components
+ * and a current position of -1.
+ */
+ interface DynValueBox : DynValueCommon {
+
+ /**
+ * Returns the boxed value as an Any.
+ *
+ * @exception InvalidValue if this object represents a null value box type
+ */
+ any get_boxed_value()
+ raises(InvalidValue);
+
+ /**
+ * Replaces the boxed value with the specified value.
+ * If the DynBoxedValue represents a null valuetype, it is converted to a non-null value.
+ *
+ * @exception TypeMismatch if this object represents a non-null value box type and the type
+ * of the parameter is not matching the current boxed value type.
+ */
+ void set_boxed_value(in any boxed)
+ raises(TypeMismatch);
+
+ /**
+ * Returns the boxed value as a DynAny.
+ *
+ * @exception InvalidValue if this object represents a null value box type
+ */
+ DynAny get_boxed_value_as_dyn_any()
+ raises(InvalidValue);
+
+ /**
+ * Replaces the boxed value with the value contained in the parameter.
+ * If the DynBoxedValue represents a null valuetype, it is converted to a non-null value.
+ *
+ * @exception TypeMismatch if this object represents a non-null value box type and the type
+ * of the parameter is not matching the current boxed value type.
+ */
+ void set_boxed_value_as_dyn_any(in DynAny boxed)
+ raises(TypeMismatch);
+ };
+
+ /**
+ * DynAny objects can be created by invoking operations on the DynAnyFactory object.
+ * Generally there are only two ways to create a DynAny object:
+ * <UL>
+ * <LI>invoking an operation on an existing DynAny object
+ * <LI>invoking an operation on a DynAnyFactory object
+ * </UL>
+ * A constructed DynAny object supports operations that enable the creation of new DynAny
+ * objects encapsulating access to the value of some constituent.
+ * DynAny objects also support the copy operation for creating new DynAny objects.
+ * A reference to the DynAnyFactory object is obtained by calling ORB.resolve_initial_references()
+ * with the identifier parameter set to the string constant "DynAnyFactory".
+ * <P>Dynamic interpretation of an any usually involves creating a DynAny object using create_dyn_any()
+ * as the first step. Depending on the type of the any, the resulting DynAny object reference can be narrowed
+ * to a DynFixed, DynStruct, DynSequence, DynArray, DynUnion, DynEnum, or DynValue object reference.
+ * <P>Dynamic creation of an any involves creating a DynAny object using create_dyn_any_from_type_code(),
+ * passing the TypeCode associated with the value to be created. The returned reference is narrowed to one of
+ * the complex types, such as DynStruct, if appropriate. Then, the value can be initialized by means of
+ * invoking operations on the resulting object. Finally, the to_any operation can be invoked
+ * to create an any value from the constructed DynAny.
+ */
+ interface DynAnyFactory {
+ #pragma sun_localservant DynAnyFactory ""
+ exception InconsistentTypeCode {};
+
+ /**
+ * Creates a new DynAny object from an any value.
+ * A copy of the TypeCode associated with the any value is assigned to the resulting DynAny object.
+ * The value associated with the DynAny object is a copy of the value in the original any.
+ * The current position of the created DynAny is set to zero if the passed value has components,
+ * to -1 otherwise
+ *
+ * @exception InconsistentTypeCode if value has a TypeCode with a TCKind of tk_Principal,
+ * tk_native, or tk_abstract_interface
+ */
+ DynAny create_dyn_any(in any value)
+ raises(InconsistentTypeCode);
+
+ /**
+ * Creates a DynAny from a TypeCode. Depending on the TypeCode, the created object may be of type DynAny,
+ * or one of its derived types, such as DynStruct. The returned reference can be narrowed to the derived type.
+ * In all cases, a DynAny constructed from a TypeCode has an initial default value.
+ * The default values of basic types are:
+ * <UL>
+ * <LI>false for boolean
+ * <LI>zero for numeric types
+ * <LI>zero for types octet, char, and wchar
+ * <LI>the empty string for string and wstring
+ * <LI>null for object references
+ * <LI>a type code with a TCKind value of tk_null for type codes
+ * <LI>for any values, an any containing a type code with a TCKind value of tk_null type and no value
+ * </UL>
+ * For complex types, creation of the corresponding DynAny assigns a default value as follows:
+ * <UL>
+ * <LI>For DynSequence it sets the current position to -1 and creates an empty sequence.
+ * <LI>For DynEnum it sets the current position to -1 and sets the value of the enumerator
+ * to the first enumerator value indicated by the TypeCode.
+ * <LI>For DynFixed it sets the current position to -1 and sets the value zero.
+ * <LI>For DynStruct it sets the current position to -1 for empty exceptions
+ * and to zero for all other TypeCodes. The members (if any) are (recursively) initialized
+ * to their default values.
+ * <LI>For DynArray sets the current position to zero and (recursively) initializes elements
+ * to their default value.
+ * <LI>For DynUnion sets the current position to zero. 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.
+ * <LI>For DynValue and DynValueBox it initializes to a null value.
+ * </UL>
+ */
+ DynAny create_dyn_any_from_type_code(in CORBA::TypeCode type)
+ raises(InconsistentTypeCode);
+ };
+}; // module DynamicAny
+
+#endif // _DYNAMIC_ANY_IDL_
diff --git a/src/java.corba/share/classes/org/omg/DynamicAny/package.html b/src/java.corba/share/classes/org/omg/DynamicAny/package.html
new file mode 100644
index 0000000..81c39b3
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/DynamicAny/package.html
@@ -0,0 +1,211 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+-->
+
+</head>
+<body bgcolor="white">
+<P>Provides classes and interfaces that enable traversal of the data value
+ associated with an <code>any</code> at
+runtime, and extraction of the primitive constituents of the data value.
+
+
+<P>An <code>any</code> can be passed to a program that doesn't have any static information
+for the type of the <code>any</code> (code generated for the type by an IDL compiler has not
+been compiled with the object implementation). As a result, the object receiving the
+<code>any</code> does not have a portable method of using it.
+
+<P><code>DynAny</code>s enable traversal of the data value associated with an
+<code>any</code> at runtime, and extraction of the primitive constituents of the data value.
+This is especially helpful for writing powerful generic servers (bridges, event channels
+supporting filtering). Similarly, this facility enables the construction of an
+<code>any</code> at runtime, without having static knowledge of its type. This is especially
+helpful for writing generic clients (bridges, browsers, debuggers, user interface tools).
+
+<P><code>Any</code> values can be dynamically interpreted (traversed) and constructed through
+<code>DynAny</code> objects. A <code>DynAny</code> object is associated with a data
+value which corresponds to a copy of the value inserted into an <code>Any</code>. A
+<code>DynAny</code> object may be viewed as an ordered collection of component
+<code>DynAny</code>s. For <code>DynAny</code>s representing a basic type, such as <code>long</code>,
+or a type without components, such as an empty exception, the ordered collection of
+components is empty.
+
+<P>Each <code>DynAny</code> object maintains the notion of a current position into its collection
+of component <code>DynAny</code>s. The current position is identified by an index value that runs
+from 0 to n-1, where <em>n</em> is the number of components. The special index value -1
+indicates a current position that points nowhere.
+ For values that cannot have a current position (such as an empty exception),
+ the index value is fixed at -1.
+ If a <code>DynAny</code> is initialized with a value that has components, the index is
+initialized to 0.
+ After creation of an uninitialized <code>DynAny</code> (that is, a <code>DynAny</code> that
+has no value but a <code>TypeCode</code>
+ that permits components), the current position depends on the type of value represented by
+ the <code>DynAny</code>. (The current position is set to 0 or -1, depending on whether the
+new <code>DynAny</code>
+ gets default values for its components.)
+
+
+<P>The iteration operations <code>rewind</code>, <code>seek</code>, and <code>next</code>
+can be used to change the current position
+ and the <code>current_component</code> operation returns the component at the current
+position.
+ The <code>component_count</code> operation returns the number of components of a
+<code>DynAny</code>.
+ Collectively, these operations enable iteration over the components of a
+<code>DynAny</code>, for example,
+ to (recursively) examine its contents.
+
+
+ <P>A constructed <code>DynAny</code> object is a <code>DynAny</code> object associated with
+a constructed type.
+ There is a different interface, inheriting from the <code>DynAny</code> interface,
+associated with
+ each kind of constructed type in IDL (fixed, enum, struct, sequence, union, array,
+ exception, and value type). A constructed <code>DynAny</code> object exports operations
+that enable the creation of new <code>DynAny</code> objects,
+ each of them associated with a component of the constructed data value.
+ As an example, a <code>DynStruct</code> is associated with a <code>struct</code> value. This
+means that the <code>DynStruct</code>
+ may be seen as owning an ordered collection of components, one for each structure member.
+ The <code>DynStruct</code> object exports operations that enable the creation of new
+<code>DynAny</code> objects,
+ each of them associated with a member of the <code>struct</code>.
+
+
+<P>If a <code>DynAny</code> object has been obtained from another (constructed)
+<code>DynAny</code> object,
+ such as a <code>DynAny</code> representing a structure member that was created from a
+<code>DynStruct</code>,
+ the member <code>DynAny</code> is logically contained in the <code>DynStruct</code>.
+ Calling an <code>insert</code> or <code>get</code> operation leaves the current position
+unchanged.
+ Destroying a top-level <code>DynAny</code> object (one that was not obtained as a component
+of another <code>DynAny</code>)
+ also destroys any component <code>DynAny</code> objects obtained from it.
+ Destroying a non-top level <code>DynAny</code> object does nothing.
+ Invoking operations on a destroyed top-level <code>DynAny</code> or any of its descendants
+raises OBJECT_NOT_EXIST.
+ If the programmer wants to destroy a <code>DynAny</code> object but still wants to
+manipulate some component
+ of the data value associated with it, then he or she should first create a
+<code>DynAny</code> for the component
+ and, after that, make a copy of the created <code>DynAny</code> object.
+
+
+<P>The behavior of <code>DynAny</code> objects has been defined in order to enable efficient
+implementations
+in terms of allocated memory space and speed of access. <code>DynAny</code> objects are
+intended to be used
+for traversing values extracted from <code>any</code>s or constructing values of
+<code>any</code>s at runtime.
+Their use for other purposes is not recommended.
+
+
+
+ <H2>Handling DynAny objects</H2>
+
+<P><code>Insert</code> and <code>get</code> operations are necessary to handle basic
+<code>DynAny</code> objects
+ but are also helpful to handle constructed <code>DynAny</code> objects.
+ Inserting a basic data type value into a constructed <code>DynAny</code> object
+ implies initializing the current component of the constructed data value
+ associated with the <code>DynAny</code> object. For example, invoking
+<code>insert_boolean</code> on a
+ <code>DynStruct</code> implies inserting a <code>boolean</code> data value at the current
+position
+ of the associated <code>struct</code> data value.
+ A type is consistent for inserting or extracting a value if its <code>TypeCode</code> is
+equivalent to
+ the <code>TypeCode</code> contained in the <code>DynAny</code> or, if the
+<code>DynAny</code> has components, is equivalent to the <code>TypeCode</code>
+ of the <code>DynAny</code> at the current position.
+
+ <P>Basic operations include:
+ <UL>
+ <LI>insert_boolean, get_boolean
+ <LI>insert_char, get_char
+ <LI>insert_short, get_short
+ <LI>insert_ushort, get_ushort
+ <LI>insert_long, get_long
+ <LI>insert_ulong, get_ulong
+ <LI>insert_double, get_double
+ <LI>insert_string, get_string
+ <LI>insert_reference, get_reference
+ <LI>insert_typecode, get_typecode
+ <LI>insert_longlong, get_longlong
+ <LI>insert_ulonglong, get_ulonglong
+ <LI>insert_longdouble, get_longdouble
+ <LI>insert_wchar, get_wchar
+ <LI>insert_wstring, get_wstring
+ <LI>insert_any, get_any
+ <LI>insert_dyn_any, get_dyn_any
+ <LI>insert_val, get_val
+ <LI>insert_octet, get_octet
+ <LI>insert_float, get_float
+ <LI>get_value
+ <LI>get_as_string
+ <LI>get_as_ulong
+ <LI>get_members
+ <LI>get_members_as_dyn_any
+ <LI>get_discriminator
+ <LI>get_length
+ <LI>get_elements
+ <LI>get_elements_as_dyn_any
+ <LI>get_boxed_value
+ <LI>get_boxed_value_as_dyn_any
+ </UL>
+
+
+ <P><code>DynAny</code> and <code>DynAnyFactory</code> objects are intended to be local to
+the process in which they are
+ created and used. This means that references to <code>DynAny</code> and
+<code>DynAnyFactory</code> objects cannot be exported
+ to other processes, or externalized with <code>ORB.object_to_string()</code>.
+ If any attempt is made to do so, the offending operation will raise a MARSHAL system
+exception.
+ Since their interfaces are specified in IDL, <code>DynAny</code> objects export operations
+defined in the standard
+ <code>org.omg.CORBA.Object</code> interface. However, any attempt to invoke operations
+exported through the <code>Object</code>
+ interface may raise the standard NO_IMPLEMENT exception.
+ An attempt to use a <code>DynAny</code> object with the DII may raise the NO_IMPLEMENT
+exception.
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/IOP/CodecFactoryPackage/package.html b/src/java.corba/share/classes/org/omg/IOP/CodecFactoryPackage/package.html
new file mode 100644
index 0000000..6962336
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/IOP/CodecFactoryPackage/package.html
@@ -0,0 +1,50 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+
+-->
+
+</head>
+<body bgcolor="white">
+<P>This package contains the exceptions
+specified in the IOP::CodeFactory interface (as part of the Portable
+ Interceptors spec).
+
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/IOP/CodecPackage/package.html b/src/java.corba/share/classes/org/omg/IOP/CodecPackage/package.html
new file mode 100644
index 0000000..d86dfb1
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/IOP/CodecPackage/package.html
@@ -0,0 +1,53 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+
+-->
+
+</head>
+<body bgcolor="white">
+<P>This package is generated from the IOP::Codec IDL interface
+definition. It contains the Java representations of the IDL exceptions
+specified in IOP::Codec (as part of the Portable Interceptors
+specification).
+ Please
+refer to that OMG specification for further details.
+
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/IOP/package.html b/src/java.corba/share/classes/org/omg/IOP/package.html
new file mode 100644
index 0000000..dce0d26
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/IOP/package.html
@@ -0,0 +1,60 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+-->
+
+</head>
+<body bgcolor="white">
+<P>This package contains the <code>IOP</code> module specified in the OMG document
+<em>The Common
+Object Request Broker: Architecture and Specification</em>,
+<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">
+formal/99-10-07</a>, section 13.6. Please
+refer to that OMG specification for further details.
+
+<P>Please note that we do not provide all parts of the <code>IOP</code> module from
+the specification. We only provide those parts that are referenced as
+return values or parameter types in public APIs, most notably,
+Portable Interceptors.
+
+
+
+
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/Messaging/package.html b/src/java.corba/share/classes/org/omg/Messaging/package.html
new file mode 100644
index 0000000..05ead25
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/Messaging/package.html
@@ -0,0 +1,55 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+-->
+
+</head>
+<body bgcolor="white">
+<P>This package contains the <code>Messaging</code> module specified in the OMG CORBA
+Messaging specification,
+<a href="http://www.omg.org/cgi-bin/doc?formal/99-10-07">
+formal/99-10-07</a>. Please refer to that OMG
+specification for further details.
+
+<P>Please note that we do not provide all parts of the <code>Messaging</code> module from
+the specification. We only provide those parts that are referenced as
+return values or parameter types in public APIs, most notably,
+Portable Interceptors.
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/PortableInterceptor/CORBAX.idl b/src/java.corba/share/classes/org/omg/PortableInterceptor/CORBAX.idl
new file mode 100644
index 0000000..dd12081
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableInterceptor/CORBAX.idl
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _CORBAX_IDL_
+#define _CORBAX_IDL_
+
+#pragma prefix "omg.org"
+
+module CORBA {
+ /**
+ * Enumeration of parameter modes for Parameter. Possible vaues:
+ * <ul>
+ * <li>PARAM_IN - Represents an "in" parameter.</li>
+ * <li>PARAM_OUT - Represents an "out" parameter.</li>
+ * <li>PARAM_INOUT - Represents an "inout" parameter.</li>
+ * </ul>
+ */
+ enum ParameterMode {PARAM_IN, PARAM_OUT, PARAM_INOUT};
+
+ /** An array of Strings */
+ typedef sequence <string> StringSeq;
+
+ /** An array of WStrings */
+ typedef sequence <wstring> WStringSeq;
+
+ /** A byte array */
+ typedef sequence <octet> OctetSeq;
+
+ /** Repository ID, represented as a String */
+ typedef string RepositoryId;
+
+ /**
+ * Encapsulates a reason a Policy may be invalid.
+ *
+ * @see PolicyError
+ */
+ typedef short PolicyErrorCode;
+
+ /**
+ * Thrown to indicate problems with parameter values passed to the
+ * <code>ORB.create_policy</code> operation.
+ */
+ exception PolicyError { PolicyErrorCode reason; };
+};
+
+
+#endif // _CORBAX_IDL_
diff --git a/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl b/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl
new file mode 100644
index 0000000..3dc071d
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableInterceptor/IOP.idl
@@ -0,0 +1,617 @@
+/*
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _IOP_IDL_
+#define _IOP_IDL_
+
+#include "CORBAX.idl"
+
+#pragma prefix "omg.org"
+
+#ifndef CORBA3
+#define local
+#endif
+
+module IOP {
+ //
+ // Standard Protocol Profile tag values
+ //
+ /** Profile ID */
+ typedef unsigned long ProfileId;
+
+ /**
+ * Identifies profiles that
+ * support the Internet Inter-ORB Protocol. The <code>ProfileBody</code>
+ * of this profile contains a CDR encapsulation of a structure
+ * containing addressing and object identification information used by
+ * IIOP. Version 1.1 of the <code>TAG_INTERNET_IOP</code> profile
+ * also includes an array of TaggedComponent objects that can
+ * contain additional information supporting optional IIOP features,
+ * ORB services such as security, and future protocol extensions.
+ * <p>
+ * Protocols other than IIOP (such as ESIOPs and other GIOPs) can share
+ * profile information (such as object identity or security
+ * information) with IIOP by encoding their additional profile information
+ * as components in the <code>TAG_INTERNET_IOP</code> profile. All
+ * <code>TAG_INTERNET_IOP</code> profiles support IIOP, regardless of
+ * whether they also support additional protocols. Interoperable
+ * ORBs are not required to create or understand any other profile,
+ * nor are they required to create or understand any of the components
+ * defined for other protocols that might share the
+ * <code>TAG_INTERNET_IOP</code> profile with IIOP.
+ * <p>
+ * The <code>profile_data</code> for the <code>TAG_INTERNET_IOP</code>
+ * profile is a CDR encapsulation of the <code>IIOP.ProfileBody_1_1</code>
+ * type.
+ */
+ const ProfileId TAG_INTERNET_IOP = 0;
+
+ /**
+ * Indicates that the value encapsulated is of type
+ * <code>MultipleComponentProfile</code>. In this case, the profile
+ * consists of a list of protocol components, the use of which must
+ * be specified by the protocol using this profile. This profile may
+ * be used to carry IOR components.
+ * <p>
+ * The <code>profile_data</code> for the
+ * <code>TAG_MULTIPLE_COMPONENTS</code> profile is a CDR encapsulation
+ * of the <code>MultipleComponentProfile</code> type shown above.
+ */
+ const ProfileId TAG_MULTIPLE_COMPONENTS = 1;
+
+ /**
+ * Object references have at least one tagged profile. Each profile
+ * supports one or more protocols and encapsulates all the basic
+ * information the protocols it supports need to identify an object.
+ * Any single profile holds enough information to drive a complete
+ * invocation using any of the protocols it supports; the content
+ * and structure of those profile entries are wholly specified by
+ * these protocols.
+ */
+ struct TaggedProfile {
+ /** The tag, represented as a profile id. */
+ ProfileId tag;
+
+ /** The associated profile data. */
+ sequence <octet> profile_data;
+ };
+
+ /**
+ * Captures information about a object references, such as whether the
+ * object is null, what type it is, what protocols are supported, and what
+ * ORB services are available.
+ * <p>
+ * This data structure need not be used internally to any given ORB,
+ * and is not intended to be visible to application-level ORB programmers.
+ * It should be used only when crossing object reference domain
+ * boundaries, within bridges.
+ * <p>
+ * This data structure is designed to be efficient in typical
+ * single-protocol configurations, while not penalizing multiprotocol ones.
+ * <p>
+ * Object references have at least one tagged profile. Each profile
+ * supports one or more protocols and encapsulates all the basic
+ * information the protocols it supports need to identify an object.
+ * Any single profile holds enough information to drive a complete
+ * invocation using any of the protocols it supports; the content
+ * and structure of those profile entries are wholly specified by
+ * these protocols. A bridge between two domains may need to know the
+ * detailed content of the profile for those domains' profiles,
+ * depending on the technique it uses to bridge the domains.
+ * <p>
+ * Each profile has a unique numeric tag, assigned by the OMG.
+ * Profile tags in the range 0x80000000 through 0xffffffff are reserved
+ * for future use, and are not currently available for assignment.
+ * <p>
+ * Null object references are indicated by an empty set of profiles,
+ * and by a "Null" type ID (a string which contains only a single
+ * terminating character). A Null <code>TypeID</code> is the only
+ * mechanism that can be used to represent the type
+ * <code>CORBA.Object</code>. Type IDs may only be "Null" in any message,
+ * requiring the client to use existing knowledge or to consult the
+ * object, to determine interface types supported. The type ID
+ * is a Repository ID identifying the interface type, and is provided
+ * to allow ORBs to preserve strong typing. This identifier is agreed
+ * on within the bridge and, for reasons outside the scope of the
+ * interoperability specification, needs to have a much broader scope to
+ * address various problems in system evolution and maintenance.
+ * Type IDs support detection of type equivalence, and in conjunction
+ * with an Interface Repository, allow processes to reason about the
+ * relationship of the type of the object referred to and any other type.
+ * <p>
+ * The type ID, if provided by the server, indicates the most derived
+ * type that the server wishes to publish, at the time the reference
+ * is generated. The object's actual most derived type may later change
+ * to a more derived type. Therefore, the type ID in the IOR can only
+ * be interpreted by the client as a hint that the object supports at
+ * least the indicated interface. The client can succeed in narrowing
+ * the reference to the indicated interface, or to one of its base
+ * interfaces, based solely on the type ID in the IOR, but must not fail
+ * to narrow the reference without consulting the object via the
+ * "_is_a" or "_get_interface" pseudo-operations.
+ */
+ struct IOR {
+ /** The type id, represented as a String. */
+ string type_id;
+
+ /**
+ * An array of tagged profiles associated with this
+ * object reference.
+ */
+ sequence <TaggedProfile> profiles;
+ };
+
+ /**
+ * Standard way of representing multicomponent profiles.
+ * This would be encapsulated in a TaggedProfile.
+ */
+ typedef unsigned long ComponentId;
+
+ /**
+ * <code>TaggedComponents</code> contained in
+ * <code>TAG_INTERNET_IOP</code> and
+ * <code>TAG_MULTIPLE_COMPONENTS</code> profiles are identified by
+ * unique numeric tags using a namespace distinct form that is used for
+ * profile tags. Component tags are assigned by the OMG.
+ * <p>
+ * Specifications of components must include the following information:
+ * <ul>
+ * <li><i>Component ID</i>: The compound tag that is obtained
+ * from OMG.</li>
+ * <li><i>Structure and encoding</i>: The syntax of the component
+ * data and the encoding rules. If the component value is
+ * encoded as a CDR encapsulation, the IDL type that is
+ * encapsulated and the GIOP version which is used for encoding
+ * the value, if different than GIOP 1.0, must be specified as
+ * part of the component definition.</li>
+ * <li><i>Semantics</i>: How the component data is intended to be
+ * used.</li>
+ * <li><i>Protocols</i>: The protocol for which the component is
+ * defined, and whether it is intended that the component be
+ * usable by other protocols.</li>
+ * <li><i>At most once</i>: whether more than one instance of this
+ * component can be included in a profile.</li>
+ * </ul>
+ * Specification of protocols must describe how the components affect
+ * the protocol. The following should be specified in any protocol
+ * definition for each <code>TaggedComponent</code> that the protocol uses:
+ * <ul>
+ * <li><i>Mandatory presence</i>: Whether inclusion of the component
+ * in profiles supporting the protocol is required (MANDATORY
+ * PRESENCE) or not required (OPTIONAL PRESENCE).</li>
+ * <li><i>Droppable</i>: For optional presence component, whether
+ * component, if present, must be retained or may be dropped.</li>
+ * </ul>
+ */
+ struct TaggedComponent {
+ /** The tag, represented as a component id. */
+ ComponentId tag;
+
+ /** The component data associated with the component id. */
+ sequence <octet> component_data;
+ };
+
+ /**
+ * It is often useful in the real world to be able to identify the
+ * particular kind of ORB an object reference is coming from, to work
+ * around problems with that particular ORB, or exploit shared
+ * efficiencies.
+ * <p>
+ * The <code>TAG_ORB_TYPE</code> component has an associated value of
+ * type unsigned long (Java long), encoded as a CDR encapsulation,
+ * designating an ORB type ID allocated by the OMG for the ORB type of the
+ * originating ORB. Anyone may register any ORB types by submitting
+ * a short (one-paragraph) description of the ORB type to the OMG,
+ * and will receive a new ORB type ID in return. A list of ORB type
+ * descriptions and values will be made available on the OMG web server.
+ * <p>
+ * The <code>TAG_ORB_TYPE</code> component can appear at most once in
+ * any IOR profile. For profiles supporting IIOP 1.1 or greater, it
+ * is optionally present.
+ */
+ const ComponentId TAG_ORB_TYPE = 0 ;
+
+ /**
+ * The code set component of the IOR multi-component profile structure
+ * contains:
+ * <ul>
+ * <li>server's native char code set and conversion code sets, and</li>
+ * <li>server's native wchar code set and conversion code sets.</li>
+ * </ul>
+ * Both char and wchar conversion code sets are listed in order of
+ * preference.
+ */
+ const ComponentId TAG_CODE_SETS = 1 ;
+
+ /**
+ * A profile component containing the sequence of QoS policies exported
+ * with the object reference by an object adapter.
+ */
+ const ComponentId TAG_POLICIES = 2 ;
+
+ /**
+ * In cases where the same object key is used for more than one
+ * internet location, the following standard IOR Component is defined
+ * for support in IIOP version 1.2.
+ * <p>
+ * The <code>TAG_ALTERNATE_IIOP_ADDRESS</code> component has an
+ * associated value of type:
+ * <pre>
+ * <code>
+ * struct {
+ * string HostID,
+ * short Port
+ * };
+ * </code>
+ * </pre>
+ * encoded as a CDR encapsulation.
+ * <p>
+ * Zero or more instances of the <code>TAG_ALTERNATE_IIOP_ADDRESS</code>
+ * component type may be included in a version 1.2
+ * <code>TAG_INTERNET_IOP</code> Profile. Each of these alternative
+ * addresses may be used by the client orb, in addition to the host
+ * and port address expressed in the body of the Profile. In cases
+ * where one or more <code>TAG_ALTERNATE_IIOP_ADDRESS</code> components
+ * are present in a <code>TAG_INTERNET_IOP</code> Profile, no order of
+ * use is prescribed by Version 1.2 of IIOP.
+ */
+ const ComponentId TAG_ALTERNATE_IIOP_ADDRESS = 3 ;
+
+ /**
+ * Class downloading is supported for stubs, ties, values, and
+ * value helpers. The specification allows transmission of codebase
+ * information on the wire for stubs and ties, and enables usage of
+ * pre-existing ClassLoaders when relevant.
+ * <p>
+ * For values and value helpers, the codebase is transmitted after the
+ * value tag. For stubs and ties, the codebase is transmitted as
+ * the TaggedComponent <code>TAG_JAVA_CODEBASE</code> in the IOR
+ * profile, where the <code>component_data</code> is a CDR encapsulation
+ * of the codebase written as an IDL string. The codebase is a
+ * space-separated list of one or more URLs.
+ */
+ const ComponentId TAG_JAVA_CODEBASE = 25 ;
+
+ /**
+ * RMI-IIOP has multiple stream format versions. A server
+ * can specify its maximum version by including the
+ * TAG_RMI_CUSTOM_MAX_STREAM_FORMAT tagged component or
+ * rely on the default of version 1 for GIOP 1.2 and less
+ * and version 2 for GIOP 1.3 and higher.
+ *
+ * See Java to IDL ptc/02-01-12 1.4.11.
+ */
+ const ComponentId TAG_RMI_CUSTOM_MAX_STREAM_FORMAT = 38 ;
+
+ /** An array of tagged components, forming a multiple component profile. */
+ typedef sequence <TaggedComponent> MultipleComponentProfile;
+
+ /** A service id, represented as an int */
+ typedef unsigned long ServiceId;
+
+ /**
+ * Service-specific information to be passed implicitly with requests
+ * and replies. Service contexts are composed of service ids and
+ * associated data.
+ */
+ struct ServiceContext {
+ /** The service context id */
+ ServiceId context_id;
+
+ /** The data associated with this service context */
+ sequence <octet> context_data;
+ };
+
+ /** An array of service contexts, forming a service context list. */
+ typedef sequence <ServiceContext>ServiceContextList;
+
+ /**
+ * Identifies a CDR encapsulation of the
+ * <code>CosTSInteroperation.PropogationContext</code> defined in
+ * <i>CORBAservices: Common Object Services Specifications.</i>
+ */
+ const ServiceId TransactionService = 0;
+
+ /**
+ * Identifies a CDR encapsulation of the
+ * <code>CONV_FRAME.CodeSetContext</code> defined in
+ * Section 13.10.2.5, "GIOP Code Set Service Context," on page 13-43.
+ */
+ const ServiceId CodeSets = 1;
+
+ /**
+ * Identifies a CDR encapsulation of the RMICustomMaxStreamFormat
+ * service context which contains a single byte specifying
+ * the client's maximum RMI-IIOP stream format version.
+ *
+ * See Java to IDL ptc/02-01-12 1.4.12.
+ */
+ const ServiceId RMICustomMaxStreamFormat = 17 ;
+
+ /**
+ * DCOM-CORBA Interworking uses three service contexts as defined in
+ * "DCOM-CORBA Interworking" in the "Interoperability with non-CORBA
+ * Systems" chapter.
+ * <p>
+ * <code>ChainBypassCheck</code> carries a CDR encapsulation of the
+ * <code>struct CosBridging.ChainBypassCheck</code>. This is carried
+ * only in a Request message as described in Section 20.9.1, "CORBA
+ * Chain Bypass," on page 20-19.
+ */
+ const ServiceId ChainBypassCheck = 2;
+
+ /**
+ * DCOM-CORBA Interworking uses three service contexts as defined in
+ * "DCOM-CORBA Interworking" in the "Interoperability with non-CORBA
+ * Systems" chapter.
+ * <p>
+ * <code>ChainBypassInfo</code> carries a CDR encapsulation of the
+ * <code>struct CosBridging.ChainBypassInfo</code>. This is carried
+ * only in a Reply message as described in Section 20.9.1, "CORBA Chain
+ * Bypass," on page 20-19.
+ */
+ const ServiceId ChainBypassInfo = 3;
+
+ /**
+ * DCOM-CORBA Interworking uses three service contexts as defined in
+ * "DCOM-CORBA Interworking" in the "Interoperability with non-CORBA
+ * Systems" chapter.
+ * <p>
+ * <code>LogicalThreadId</code>, carries a CDR encapsulation of
+ * the <code>struct CosBridging.LogicalThreadId</code> as described
+ * in Section 20.10, "Thread Identification," on page 20-21.
+ */
+ const ServiceId LogicalThreadId = 4;
+
+ /**
+ * Identifies a CDR encapsulation of the
+ * <code>IIOP.BiDirIIOPServiceContext</code> defined in Section 15.8,
+ * "Bi-Directional GIOP," on page 15-55.
+ */
+ const ServiceId BI_DIR_IIOP = 5;
+
+ /**
+ * Identifies a CDR encapsulation of the IOR of the
+ * <code>SendingContext.RunTime</code> object (see Section 5.6, "Access
+ * to the Sending Context Run Time," on page 5-15).
+ */
+ const ServiceId SendingContextRunTime = 6;
+
+ /**
+ * For information on <code>INVOCATION_POLICIES</code> refer to the
+ * Asynchronous Messaging specification - orbos/98-05-05.
+ */
+ const ServiceId INVOCATION_POLICIES = 7;
+
+ /**
+ * For information on <code>FORWARDED_IDENTITY</code> refer to the
+ * Firewall specification - orbos/98-05-04.
+ */
+ const ServiceId FORWARDED_IDENTITY = 8;
+
+ /**
+ * Identifies a CDR encapsulation of a marshaled instance of a
+ * java.lang.Throwable or one of its subclasses as described in Java
+ * to IDL Language Mapping, Section 1.4.8.1, "Mapping of
+ * UnknownExceptionInfo Service Context," on page 1-32.
+ */
+ const ServiceId UnknownExceptionInfo = 9;
+
+ /**
+ * CORBA formal/02-06-01: 13.7.1:
+ * ExceptionDetailMessage identifies a CDR encapsulation of a wstring,
+ * encoded using GIOP 1.2 with a TCS-W of UTF-16. This service context
+ * may be sent on Reply messages with a reply_status of SYSTEM_EXCEPTION
+ * or USER_EXCEPTION. The usage of this service context is defined
+ * by language mappings. <br> <br>
+ *
+ * IDL/Java: ptc/02-01-22: 1.15.2:
+ * When a System Exception is marshaled, its GIOP Reply message shall
+ * include an associated ExceptionDetailMessage service context. The
+ * callee's stack trace is often very valuable debugging information but
+ * may contain sensitive or unwanted information. The wstring within the
+ * service context will therefore contain additional information relating
+ * to the exception, for example the result of calling either
+ * printStackTrace(PrintWriter) or getMessage() on the exception. When
+ * unmarshaling a System Exception on the client side, the wstring from
+ * any ExceptionDetailMessage service context shall become the Java error
+ * message in the unmarshaled exception object.
+ */
+ const ServiceId ExceptionDetailMessage = 14;
+
+
+ // BEGIN part which lived in Interceptors.idl.
+
+ /**
+ * An array of <code>TaggedComponent</code> objects.
+ */
+ typedef sequence<IOP::TaggedComponent> TaggedComponentSeq;
+
+ /**
+ * The formats of IOR components and service context data used by ORB
+ * services are often defined as CDR encapsulations encoding instances
+ * of IDL defined data types. The <code>Codec</code> provides a mechanism
+ * to transfer these components between their IDL data types and their CDR
+ * encapsulation representations.
+ * <p>
+ * A <code>Codec</code> is obtained from the <code>CodecFactory</code>.
+ * The <code>CodecFactory</code> is obtained through a call to
+ * <code>ORB.resolve_initial_references( "CodecFactory" )</code>.
+ */
+ local interface Codec {
+
+ /**
+ * This exception is thrown by <code>Codec.encode</code> or
+ * <code>Codec.encode_value</code> when the type is invalid for the
+ * encoding. For example, this exception is thrown if the encoding is
+ * <code>ENCODING_CDR_ENCAPS</code> version 1.0 and a type
+ * that does not exist in that version, such as <code>wstring</code>,
+ * is passed to the operation.
+ */
+ exception InvalidTypeForEncoding {};
+
+ /**
+ * This exception is thrown by <code>Codec.decode</code> or
+ * <code>Codec.decode_value</code> when the data in the byte array
+ * cannot be decoded into an Any.
+ */
+ exception FormatMismatch {};
+
+ /**
+ * This exception is thrown by <code>decode_value</code> when the given
+ * <code>TypeCode</code> does not match the given byte array.
+ */
+ exception TypeMismatch {};
+
+ /**
+ * Converts the given any into a byte array based on the encoding
+ * format effective for this <code>Codec</code>.
+ *
+ * @param data The data, in the form of an any, to be encoded into
+ * a byte array.
+ * @return A byte array containing the encoded Any. This byte array
+ * contains both the <code>TypeCode</code> and the data of the type.
+ * @exception InvalidTypeForEncoding thrown if the type is not valid for
+ * the encoding format effective for this <code>Codec</code>.
+ */
+ CORBA::OctetSeq encode (in any data)
+ raises (InvalidTypeForEncoding);
+
+ /**
+ * Decodes the given byte array into an Any based on the encoding
+ * format effective for this <code>Codec</code>.
+ *
+ * @param data The data, in the form of a byte array, to be decoded into
+ * an Any.
+ * @return An Any containing the data from the decoded byte array.
+ * @exception FormatMismatch is thrown if the byte array cannot be
+ * decoded into an Any.
+ */
+ any decode (in CORBA::OctetSeq data) raises (FormatMismatch);
+
+ /**
+ * Converts the given any into a byte array based on the encoding
+ * format effective for this Codec. Only the data from the Any is
+ * encoded, not the <code>TypeCode</code>.
+ *
+ * @param data The data, in the form of an Any, to be encoded into
+ * a byte array.
+ * @return A byte array containing the data from the encoded any.
+ * @exception InvalidTypeForEncoding thrown if the type is not valid for
+ * the encoding format effective for this <code>Codec</code>.
+ */
+ CORBA::OctetSeq encode_value (in any data)
+ raises (InvalidTypeForEncoding);
+
+ /**
+ * Decodes the given byte array into an Any based on the given
+ * <code>TypeCode</code> and the encoding format effective for
+ * this <code>Codec</code>.
+ *
+ * @param data The data, in the form of a byte array, to be decoded
+ * into an Any.
+ * @param tc The TypeCode to be used to decode the data.
+ * @return An Any containing the data from the decoded byte array.
+ * @exception FormatMismatch thrown if the byte array cannot be
+ * decoded into an Any.
+ */
+ any decode_value (in CORBA::OctetSeq data, in CORBA::TypeCode tc)
+ raises (FormatMismatch, TypeMismatch);
+ };
+
+ /**
+ * Defines an encoding format of a <code>Codec</code>, such as
+ * CDR Encapsulation (<code>ENCODING_CDR_ENCAPS</code>).
+ */
+ typedef short EncodingFormat;
+
+ /**
+ * The CDR Encapsulation encoding.
+ * @see CodecFactory
+ */
+ const EncodingFormat ENCODING_CDR_ENCAPS = 0;
+
+ /**
+ * Defines the encoding format of a <code>Codec</code>. This class
+ * details the encoding format, such as CDR Encapsulation encoding, and
+ * the major and minor versions of that format.
+ * <p>
+ * The encodings currently supported are:
+ * <ul>
+ * <li><code>ENCODING_CDR_ENCAPS</code>, version 1.0;</li>
+ * <li><code>ENCODING_CDR_ENCAPS</code>, version 1.1;</li>
+ * <li><code>ENCODING_CDR_ENCAPS</code>, version 1.2;</li>
+ * <li><code>ENCODING_CDR_ENCAPS</code> for all future versions of GIOP as
+ * they arise.</li>
+ * </ul>
+ * Vendors are free to support additional encodings.
+ *
+ * @see ENCODING_CDR_ENCAPS
+ */
+ struct Encoding {
+ /**
+ * The encoding format.
+ */
+ EncodingFormat format;
+
+ /**
+ * The major version of this Encoding format.
+ */
+ octet major_version;
+
+ /**
+ * The minor version of this Encoding format.
+ */
+ octet minor_version;
+ };
+
+ /**
+ * <code>Codecs</code> are obtained from the <code>CodecFactory</code>.
+ * The <code>CodecFactory</code> is obtained through a call to
+ * <code>ORB.resolve_initial_references( "CodecFactory" )</code>.
+ */
+ local interface CodecFactory {
+ /**
+ * This exception is thrown by <code>CodecFactory.create_codec</code> when
+ * the factory cannot create a <code>Codec</code> for a given encoding.
+ */
+ exception UnknownEncoding {};
+
+ /**
+ * Create a <code>Codec</code> of the given encoding.
+ *
+ * @param enc The encoding for which to create a <code>Codec</code>.
+ * @return A <code>Codec</code> obtained with the given encoding.
+ * @exception UnknownEncoding thrown if this factory cannot create a
+ * <code>Codec</code> of the given encoding.
+ */
+ Codec create_codec (in Encoding enc) raises (UnknownEncoding);
+ };
+
+ // END part which lived in Interceptors.idl.
+
+};
+
+#endif // _IOP_IDL_
diff --git a/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl b/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl
new file mode 100644
index 0000000..ca2612e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableInterceptor/Interceptors.idl
@@ -0,0 +1,2214 @@
+/*
+ * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Differences from original:
+ *
+ * - do not include orb.idl
+ * - include IOP.idl, Messaging.idl and CORBAX.idl
+ * - renamed component parameter names to tagged_component (so that they
+ * do not conflict with the CORBA 3.0 "component" keyword).
+ * - javadocs added (synchronized with orbos/00-08-06)
+ *
+ * NOTE: After compilation of this IDL file, all Helper and Holder classes
+ * that are not needed are removed.
+ */
+#include "IOP.idl"
+#include "Messaging.idl"
+#include "CORBAX.idl"
+#include "corba.idl"
+
+#pragma prefix "omg.org"
+
+#ifndef CORBA3
+#define local
+#endif
+
+module Dynamic {
+
+ /**
+ * <code>NVList</code> PIDL represented by <code>ParameterList</code> IDL.
+ * This exists in order to keep the Portable Interceptor IDL from becoming
+ * PIDL.
+ */
+ struct Parameter {
+ any argument;
+ CORBA::ParameterMode mode;
+ };
+
+ /**
+ * <code>NVList</code> PIDL represented by <code>ParameterList</code> IDL.
+ * This exists in order to keep the Portable Interceptor IDL from becoming
+ * PIDL.
+ */
+ typedef sequence<Parameter> ParameterList;
+
+ /**
+ * <code>ContextList</code> PIDL represented by <code>ContextList</code>
+ * IDL. This exists in order to keep the Portable Interceptor IDL from
+ * becoming PIDL.
+ */
+ typedef CORBA::StringSeq ContextList;
+
+ /**
+ * <code>ExceptionList</code> PIDL represented by <code>ExceptionList</code>
+ * IDL. This exists in order to keep the Portable Interceptor IDL from
+ * becoming PIDL.
+ */
+ typedef sequence<CORBA::TypeCode> ExceptionList;
+
+ /**
+ * <code>Context</code> PIDL represented by <code>RequestContext</code>
+ * IDL. This exists in order to keep the Portable Interceptor IDL from o
+ * becoming PIDL.
+ * <p>
+ * <code>Context</code> objects are encoded as <code>String[]</code>. The
+ * <code>Strings</code> occur in pairs. The first <code>String</code> in
+ * each pair is the context property name and the second <code>String</code>
+ * in each pair is the associated value.
+ */
+ typedef CORBA::StringSeq RequestContext;
+};
+
+module PortableInterceptor {
+ /**
+ * All Portable Interceptors implement Interceptor.
+ */
+ local interface Interceptor {
+ /**
+ * Returns the name of the interceptor.
+ * <p>
+ * Each Interceptor may have a name that may be used administratively
+ * to order the lists of Interceptors. Only one Interceptor of a given
+ * name can be registered with the ORB for each Interceptor type. An
+ * Interceptor may be anonymous, i.e., have an empty string as the name
+ * attribute. Any number of anonymous Interceptors may be registered with
+ * the ORB.
+ *
+ * @return the name of the interceptor.
+ */
+ readonly attribute string name;
+
+ // Added in ptc/00-08-06
+ /**
+ * Provides an opportunity to destroy this interceptor.
+ * The destroy method is called during <code>ORB.destroy</code>. When an
+ * application calls <code>ORB.destroy</code>, the ORB:
+ * <ol>
+ * <li>waits for all requests in progress to complete</li>
+ * <li>calls the <code>Interceptor.destroy</code> operation for each
+ * interceptor</li>
+ * <li>completes destruction of the ORB</li>
+ * </ol>
+ * Method invocations from within <code>Interceptor.destroy</code> on
+ * object references for objects implemented on the ORB being destroyed
+ * result in undefined behavior. However, method invocations on objects
+ * implemented on an ORB other than the one being destroyed are
+ * permitted. (This means that the ORB being destroyed is still capable
+ * of acting as a client, but not as a server.)
+ */
+ void destroy();
+ };
+
+
+ /**
+ * The <code>ForwardRequest</code> exception is the means by which an
+ * Interceptor can indicate to the ORB that a retry of the request should
+ * occur with the new object given in the exception. This behavior of
+ * causing a retry only occurs if the ORB receives a ForwardRequest from
+ * an interceptor. If <code>ForwardRequest</code> is thrown anywhere else
+ * it is passed through the ORB as is normal for a user exception.
+ * <p>
+ * If an Interceptor throws a <code>ForwardRequest</code> exception in
+ * response to a call of an interceptor, no other Interceptors are called
+ * for that interception point. The remaining Interceptors in the Flow Stack
+ * shall have their appropriate ending interception point called:
+ * <code>receive_other</code> on the client, or <code>send_other</code> on
+ * the server. The <code>reply_status</code> in the
+ * <code>receive_other</code> or <code>send_other</code> would be
+ * <code>LOCATION_FORWARD</code>.
+ */
+ exception ForwardRequest {
+ /**
+ * The new object to forward the request to.
+ */
+ Object forward;
+// Change in ptc/00-08-06
+// boolean permanent;
+ };
+
+ /** Reply status, represented as an int */
+ typedef short ReplyStatus;
+
+ // Valid reply_status values:
+
+ /**
+ * Indicates a successful Reply Status. One possible value for
+ * <code>RequestInfo.reply_status</code>.
+ * @see RequestInfo#reply_status
+ * @see SYSTEM_EXCEPTION
+ * @see USER_EXCEPTION
+ * @see LOCATION_FORWARD
+ * @see TRANSPORT_RETRY
+ */
+ const ReplyStatus SUCCESSFUL = 0;
+
+ /**
+ * Indicates a SystemException reply status. One possible value for
+ * <code>RequestInfo.reply_status</code>.
+ * @see RequestInfo#reply_status
+ * @see SUCCESSFUL
+ * @see USER_EXCEPTION
+ * @see LOCATION_FORWARD
+ * @see TRANSPORT_RETRY
+ */
+ const ReplyStatus SYSTEM_EXCEPTION = 1;
+
+ /**
+ * Indicates a UserException reply status. One possible value for
+ * <code>RequestInfo.reply_status</code>.
+ * @see RequestInfo#reply_status
+ * @see SUCCESSFUL
+ * @see SYSTEM_EXCEPTION
+ * @see LOCATION_FORWARD
+ * @see TRANSPORT_RETRY
+ */
+ const ReplyStatus USER_EXCEPTION = 2;
+
+ /**
+ * Indicates a LocationForward reply status. One possible value for
+ * <code>RequestInfo.reply_status</code>.
+ * @see RequestInfo#reply_status
+ * @see SUCCESSFUL
+ * @see SYSTEM_EXCEPTION
+ * @see USER_EXCEPTION
+ * @see TRANSPORT_RETRY
+ */
+ const ReplyStatus LOCATION_FORWARD = 3;
+
+// Changes in ptc/00-08-06
+// const ReplyStatus LOCATION_FORWARD_PERMANENT = 4;
+
+ /**
+ * Indicates a Transport Retry reply status. One possible value for
+ * <code>RequestInfo.reply_status</code>.
+ * @see RequestInfo#reply_status
+ * @see SUCCESSFUL
+ * @see SYSTEM_EXCEPTION
+ * @see USER_EXCEPTION
+ * @see LOCATION_FORWARD
+ */
+ const ReplyStatus TRANSPORT_RETRY = 4;
+
+ /**
+ * XXX
+ */
+ const ReplyStatus UNKNOWN = 5;
+
+ /** Slot id, represented as an int */
+ typedef unsigned long SlotId;
+
+ /**
+ * This exception is thrown when <code>get_slot</code> or
+ * <code>set_slot</code> is called on a slot that has not been allocated.
+ */
+ exception InvalidSlot {};
+
+ /**
+ * Portable Interceptors Current (also known as <code>PICurrent</code>)
+ * is merely a slot table, the slots of which are used by each service to
+ * transfer their context data between their context and the request's or
+ * reply's service context. Each service which wishes to use PICurrent
+ * reserves a slot or slots at initialization time and uses those slots
+ * during the processing of requests and replies.
+ * <p>
+ * Before an invocation is made, PICurrent is obtained via a call to
+ * <code>ORB.resolve_initial_references( "PICurrent" )</code>. From within
+ * the interception points, the data on PICurrent that has moved from the
+ * thread scope to the request scope is available via the
+ * <code>get_slot</code> operation on the <code>RequestInfo</code> object.
+ * A PICurrent can still be obtained via
+ * <code>resolve_initial_references</code>, but that is the Interceptor's
+ * thread scope PICurrent.
+ */
+ local interface Current : CORBA::Current {
+
+ /**
+ * Retrieves the slot data the application set in PICurrent via
+ * <code>get_slot</code>. The data is in the form of an Any.
+ * <p>
+ * If the given slot has not been set, an Any containing a type code
+ * with a <code>TCKind</code> value of <code>tk_null</code> and no value
+ * is returned.
+ *
+ * @param id The <code>SlotId</code> of the slot from which the data will
+ * be returned.
+ * @return The data, in the form of an Any, of the given slot identifier.
+ * @exception InvalidSlot thrown if get_slot is called on a slot that
+ * has not been allocated.
+ * @exception BAD_INV_ORDER thrown if <code>get_slot</code> is called
+ * from within an ORB initializer
+ */
+ any get_slot (in SlotId id) raises (InvalidSlot);
+
+ /**
+ * Sets data in a slot. The data is in the form of an Any. If data
+ * already exists in that slot, it is overridden.
+ *
+ * @param id The <code>SlotId</code> of the slot to which the data will
+ * be set.
+ * @param data The data, in the form of an Any, which will be set
+ * to the identified slot.
+ * @exception InvalidSlot thrown if <code>set_slot</code> is called on
+ * a slot that has not been allocated.
+ * @exception BAD_INV_ORDER thrown if <code>set_slot</code> is called
+ * from within an ORB initializer.
+ */
+ void set_slot (in SlotId id, in any data) raises (InvalidSlot);
+ };
+
+ /**
+ * Request Information, accessible to Interceptors.
+ * <p>
+ * Each interception point is given an object through which the
+ * Interceptor can access request information. Client-side and server-side
+ * interception points are concerned with different information, so there
+ * are two information objects: <code>ClientRequestInfo</code> is passed
+ * to the client-side interception points and <code>ServerRequestInfo</code>
+ * is passed to the server-side interception points. But there is
+ * information that is common to both, so they both inherit from a common
+ * interface: <code>RequestInfo</code>.
+ *
+ * @see ClientRequestInfo
+ * @see ServerRequestInfo
+ */
+ local interface RequestInfo {
+ /**
+ * Returns an id that uniquely identifies an active request/reply
+ * sequence. Once a request/reply sequence is concluded this ID may be
+ * reused. Note that this id is not the same as the GIOP
+ * <code>request_id</code>. If GIOP is the transport mechanism used,
+ * then these IDs may very well be the same, but this is not guaranteed
+ * nor required.
+ */
+ readonly attribute unsigned long request_id;
+
+ /**
+ * Returns the name of the operation being invoked.
+ */
+ readonly attribute string operation;
+
+ /**
+ * Returns an array of <code>Parameter</code> objects, containing the
+ * arguments on the operation being invoked. If there are no arguments,
+ * this attribute will be a zero length array.
+ * <p>
+ * Not all environments provide access to the arguments. With the Java
+ * portable bindings, for example, the arguments are not available.
+ * In these environments, when this attribute is accessed,
+ * <code>NO_RESOURCES</code> will be thrown with a standard minor code
+ * of 1.
+ * <p>
+ * <i>Note: Arguments are available for DSI/DII calls.</i>
+ *
+ * @exception NO_RESOURCES thrown if arguments are not available.
+ * @see <a href="package-summary.html#unimpl">
+ * <code>PortableInterceptor</code> package comments for
+ * limitations / unimplemented features</a>
+ */
+ readonly attribute Dynamic::ParameterList arguments;
+
+ /**
+ * Returns an array of <code>TypeCode</code> objects describing the
+ * <code>TypeCode</code>s of the user exceptions that this operation
+ * invocation may throw. If there are no user exceptions, this
+ * will return a zero length array.
+ * <p>
+ * Not all environments provide access to the exception list. With
+ * the Java portable bindings, for example, the exception list is
+ * not available. In these environments, when this attribute is
+ * accessed, <code>NO_RESOURCES</code> will be thrown with a
+ * standard minor code of 1.
+ * <p>
+ * <i>Note: Exceptions are available for DSI/DII calls.</i>
+ *
+ * @exception NO_RESOURCES thrown if exceptions are not available.
+ * @see <a href="package-summary.html#unimpl">
+ * <code>PortableInterceptor</code> package comments for
+ * limitations / unimplemented features</a>
+ */
+ readonly attribute Dynamic::ExceptionList exceptions;
+
+ /**
+ * Returns an array of <code>String</code> objects describing the
+ * contexts that may be passed on this operation invocation. If there
+ * are no contexts, this will return a zero length array.
+ * <p>
+ * Not all environments provide access to the context list. With the
+ * Java portable bindings, for example, the context list is not
+ * available. In these environments, when this attribute is accessed,
+ * <code>NO_RESOURCES</code> will be thrown with a standard minor code
+ * of 1.
+ * <p>
+ * <i>Note: Contexts are available for DSI/DII calls.</i>
+ *
+ * @exception NO_RESOURCES thrown if contexts are not available.
+ * @see <a href="package-summary.html#unimpl">
+ * <code>PortableInterceptor</code> package comments for
+ * limitations / unimplemented features</a>
+ */
+ readonly attribute Dynamic::ContextList contexts;
+
+ /**
+ * Returns an array of <code>String</code> objects containing the
+ * contexts being sent on the request.
+ * <p>
+ * Not all environments provide access to the context. With the Java
+ * portable bindings, for example, the context is not available. In
+ * these environments, when this attribute is accessed, NO_RESOURCES will
+ * be thrown with standard minor code of 1.
+ * <p>
+ * <i>Note: <code>operation_context</code> is available for
+ * DSI/DII calls.</i>
+ *
+ * @exception NO_RESOURCES thrown if operation context is not available.
+ * @see <a href="package-summary.html#unimpl">
+ * <code>PortableInterceptor</code> package comments for
+ * limitations / unimplemented features</a>
+ */
+ readonly attribute Dynamic::RequestContext operation_context;
+
+ /**
+ * Returns an any containing the result of the operation invocation.
+ * If the operation return type is void, this attribute will be an any
+ * containing a type code with a <code>TCKind</code> value of
+ * <code>tk_void</code> and no value.
+ * <p>
+ * Not all environments provide access to the result. With the Java
+ * portable bindings, for example, the result is not available. In
+ * these environments, when this attribute is accessed,
+ * <code>NO_RESOURCES</code> will be thrown with a standard minor code of
+ * 1.
+ * <p>
+ * <i>Note: Result is available for DSI/DII calls.</i>
+ *
+ * @exception NO_RESOURCES thrown if result is not available.
+ * @see <a href="package-summary.html#unimpl">
+ * <code>PortableInterceptor</code> package comments for
+ * limitations / unimplemented features</a>
+ */
+ readonly attribute any result;
+
+ /**
+ * Indicates whether a response is expected.
+ * <p>
+ * On the client, a reply is not returned when
+ * <code>response_expected</code> is false, so <code>receive_reply</code>
+ * cannot be called. <code>receive_other</code> is called unless an
+ * exception occurs, in which case <code>receive_exception</code> is
+ * called.
+ * <p>
+ * On the client, within <code>send_poll</code>, this attribute is true.
+ */
+ readonly attribute boolean response_expected;
+
+ /**
+ * Defines how far the request shall progress before control is returned
+ * to the client. This is defined in the Messaging specification, and
+ * is pertinent only when <code>response_expected</code> is false. If
+ * <code>response_expected</code> is true, the value of
+ * <code>sync_scope</code> is undefined. This attribute may have one of
+ * the following values:
+ * <ul>
+ * <li><code>Messaging.SYNC_NONE</code></li>
+ * <li><code>Messaging.SYNC_WITH_TRANSPORT</code></li>
+ * <li><code>Messaging.SYNC_WITH_SERVER</code></li>
+ * <li><code>Messaging.SYNC_WITH_TARGET</code></li>
+ * </ul>
+ * On the server, for all scopes, a reply will be created from the
+ * return of the target operation call, but the reply will not return
+ * to the client. Although it does not return to the client, it does
+ * occur, so the normal server-side interception points are
+ * followed (i.e., <code>receive_request_service_contexts</code>,
+ * <code>receive_request</code>, <code>send_reply</code> or
+ * <code>send_exception</code>).
+ * <p>
+ * For <code>SYNC_WITH_SERVER</code> and <code>SYNC_WITH_TARGET</code>,
+ * the server does send an empty reply back to the client before the
+ * target is invoked. This reply is not intercepted by server-side
+ * Interceptors.
+ *
+ * @see <a href="package-summary.html#unimpl">
+ * <code>PortableInterceptor</code> package comments for
+ * limitations / unimplemented features</a>
+ */
+ readonly attribute Messaging::SyncScope sync_scope;
+
+ /**
+ * Describes the state of the result of the operation invocation. The
+ * return value can be one of the following:
+ * <ul>
+ * <li><code>PortableInterceptor.SUCCESSFUL</code></li>
+ * <li><code>PortableInterceptor.SYSTEM_EXCEPTION</code></li>
+ * <li><code>PortableInterceptor.USER_EXCEPTION</code></li>
+ * <li><code>PortableInterceptor.LOCATION_FORWARD</code></li>
+ * <li><code>PortableInterceptor.TRANSPORT_RETRY</code></li>
+ * </ul>
+ * On the client:
+ * <ul>
+ * <li>Within the <code>receive_reply</code> interception point, this
+ * will only return <code>SUCCESSFUL</code>.</li>
+ * <li>Within the <code>receive_exception</code> interception point,
+ * this will be either <code>SYSTEM_EXCEPTION</code> or
+ * <code>USER_EXCEPTION</code>.</li>
+ * <li>Within the <code>receive_other</code> interception point, this
+ * will be any of: <code>SUCCESSFUL</code>,
+ * <code>LOCATION_FORWARD</code>, or <code>TRANSPORT_RETRY</code>.
+ * <code>SUCCESSFUL</code> means an asynchronous request returned
+ * successfully. <code>LOCATION_FORWARD</code> means that a reply
+ * came back with <code>LOCATION_FORWARD</code> as its status.
+ * <code>TRANSPORT_RETRY</code> means that the transport
+ * mechanism indicated a retry - a GIOP reply with a status of
+ * <code>NEEDS_ADDRESSING_MODE</code>, for instance. </li>
+ * </ul>
+ * On the server:
+ * <ul>
+ * <li>Within the <code>send_reply</code> interception point, this
+ * will only be <code>SUCCESSFUL</code>.</li>
+ * <li>Within the <code>send_exception</code> interception point,
+ * this will be either <code>SYSTEM_EXCEPTION</code> or
+ * <code>USER_EXCEPTION</code>.</li>
+ * <li>Within the <code>send_other</code> interception point, this
+ * attribute will be any of: <code>SUCCESSFUL</code>, or
+ * <code>LOCATION_FORWARD</code>. <code>SUCCESSFUL</code> means
+ * an asynchronous request returned successfully.
+ * <code>LOCATION_FORWARD</code> means that a reply came back
+ * with <code>LOCATION_FORWARD</code> as its status.</li>
+ * </ul>
+ *
+ * @see SUCCESSFUL
+ * @see SYSTEM_EXCEPTION
+ * @see USER_EXCEPTION
+ * @see LOCATION_FORWARD
+ * @see TRANSPORT_RETRY
+ */
+ readonly attribute ReplyStatus reply_status;
+
+ /**
+ * Contains the object to which the request will be forwarded, if the
+ * <code>reply_status</code> attribute is <code>LOCATION_FORWARD</code>.
+ * It is indeterminate whether a forwarded request will actually occur.
+ */
+ readonly attribute Object forward_reference;
+
+ /**
+ * Returns the data from the given slot of the
+ * <code>PortableInterceptor.Current</code> that is in the scope of
+ * the request.
+ * <p>
+ * If the given slot has not been set, then an any containing a
+ * type code with a <code>TCKind</code> value of <code>tk_null</code> is
+ * returned.
+ *
+ * @param id The <code>SlotId</code> of the slot which is to be
+ * returned.
+ * @return The slot data, in the form of an any, obtained with the
+ * given identifier.
+ * @exception InvalidSlot thrown if the ID does not define an
+ * allocated slot.
+ * @see Current
+ */
+ any get_slot (in SlotId id) raises (InvalidSlot);
+
+ /**
+ * Returns a copy of the service context with the given ID that
+ * is associated with the request.
+ *
+ * @param id The <code>IOP.ServiceId</code> of the service context
+ * which is to be returned.
+ * @return The <code>IOP.ServiceContext</code> obtained with the
+ * given identifier.
+ * @exception BAD_PARAM thrown with a standard minor code of 26, if the
+ * request's service context does not contain an entry for that ID.
+ */
+ IOP::ServiceContext get_request_service_context
+ (in IOP::ServiceId id);
+
+ /**
+ * Returns a copy of the service context with the given ID that
+ * is associated with the reply.
+ *
+ * @param id The <code>IOP.ServiceId</code> of the service context
+ * which is to be returned.
+ * @return The <code>IOP.ServiceContext</code> obtained with the given
+ * identifier.
+ * @exception BAD_PARAM thrown with a standard minor code of 26 if the
+ * request's service context does not contain an entry for that ID.
+ */
+ IOP::ServiceContext get_reply_service_context
+ (in IOP::ServiceId id);
+ };
+
+ /**
+ * Request Information, accessible to client-side request interceptors.
+ * <p>
+ * Some attributes and operations on <code>ClientRequestInfo</code> are
+ * not valid at all interception points. The following table shows the
+ * validity of each attribute or operation. If it is not valid, attempting
+ * to access it will result in a <code>BAD_INV_ORDER</code> being thrown
+ * with a standard minor code of 14.
+ *
+ * <table class="plain">
+ * <caption style="display:none">Shows the validity of each attribute or operation</caption>
+ * <thead>
+ * <tr>
+ * <th>&nbsp;</th>
+ * <th id="send_req">send_request</th>
+ * <th id="send_poll">send_poll</th>
+ * <th id="rec_reply">receive_reply</th>
+ * <th id="rec_ex">receive_exception</th>
+ * <th id="rec_oth">receive_other</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ *
+ * <tr>
+ * <td id="ri" colspan=6><i>Inherited from RequestInfo:</i></td>
+ * </tr>
+ *
+ * <tr><th id="req_id"><p style="text-align:left">request_id</p></th>
+ * <td headers="ri req_id send_req">yes</td>
+ * <td headers="ri req_id send_poll">yes</td>
+ * <td headers="ri req_id rec_reply">yes</td>
+ * <td headers="ri req_id rec_ex">yes</td>
+ * <td headers="ri req_id rec_oth">yes</td></tr>
+ *
+ * <tr><th id="op"><p style="text-align:left">operation</p></th>
+ * <td headers="ri op send_req">yes</td>
+ * <td headers="ri op send_poll">yes</td>
+ * <td headers="ri op rec_reply">yes</td>
+ * <td headers="ri op rec_ex">yes</td>
+ * <td headers="ri op rec_oth">yes</td></tr>
+ *
+ * <tr><th id="arg"><p style="text-align:left">arguments</p></th>
+ * <td headers="ri arg send_req">yes<sub>1</sub></td>
+ * <td headers="ri arg send_poll">no </td>
+ * <td headers="ri arg rec_reply">yes</td>
+ * <td headers="ri arg rec_ex">no </td>
+ * <td headers="ri arg rec_oth">no </td></tr>
+ *
+ * <tr><th id="exc"><p style="text-align:left">exceptions</p></th>
+ * <td headers="ri exc send_req">yes</td>
+ * <td headers="ri exc send_poll">no </td>
+ * <td headers="ri exc rec_reply">yes</td>
+ * <td headers="ri exc rec_ex">yes</td>
+ * <td headers="ri exc rec_oth">yes</td></tr>
+ *
+ * <tr><th id="con"><p style="text-align:left">contexts</p></th>
+ * <td headers="ri con send_req">yes</td>
+ * <td headers="ri con send_poll">no </td>
+ * <td headers="ri con rec_reply">yes</td>
+ * <td headers="ri con rec_ex">yes</td>
+ * <td headers="ri con rec_oth">yes</td></tr>
+ *
+ * <tr><th id="op_con"><p style="text-align:left">operation_context</p></th>
+ * <td headers="ri op_con send_req">yes</td>
+ * <td headers="ri op_con send_poll">no </td>
+ * <td headers="ri op_con rec_reply">yes</td>
+ * <td headers="ri op_con rec_ex">yes</td>
+ * <td headers="ri op_con rec_oth">yes</td>
+ * </tr>
+ *
+ * <tr><th id="result"><p style="text-align:left">result</p></th>
+ * <td headers="ri result send_req">no </td>
+ * <td headers="ri result send_poll">no </td>
+ * <td headers="ri result rec_reply">yes</td>
+ * <td headers="ri result rec_ex">no </td>
+ * <td headers="ri result rec_oth">no </td>
+ * </tr>
+ *
+ * <tr><th id="res_exp"><p style="text-align:left">response_expected</p></th>
+ * <td headers="ri res_exp send_req">yes</td>
+ * <td headers="ri res_exp send_poll">yes</td>
+ * <td headers="ri res_exp rec_reply">yes</td>
+ * <td headers="ri res_exp rec_ex">yes</td>
+ * <td headers="ri res_exp rec_oth">yes</td></tr>
+ *
+ * <tr><th id="sync_sco"><p style="text-align:left">sync_scope</p></th>
+ * <td headers="ri sync_sco send_req">yes</td>
+ * <td headers="ri sync_sco send_poll">no </td>
+ * <td headers="ri sync_sco rec_reply">yes</td>
+ * <td headers="ri sync_sco rec_ex">yes</td>
+ * <td headers="ri sync_sco rec_oth">yes</td>
+ * </tr>
+ *
+ * <tr><th id="rep_stat"><p style="text-align:left">reply_status</p></th>
+ * <td headers="ri rep_stat send_req">no </td>
+ * <td headers="ri rep_stat send_poll">no </td>
+ * <td headers="ri rep_stat rec_reply">yes</td>
+ * <td headers="ri rep_stat rec_ex">yes</td>
+ * <td headers="ri rep_stat rec_oth">yes</td></tr>
+ *
+ * <tr><th id="for_ref"><p style="text-align:left">forward_reference</p></th>
+ * <td headers="ri for_ref send_req">no </td>
+ * <td headers="ri for_ref send_poll">no </td>
+ * <td headers="ri for_ref rec_reply">no </td>
+ * <td headers="ri for_ref rec_ex">no </td>
+ * <td headers="ri for_ref rec_oth">yes<sub>2</sub>
+ * </td></tr>
+ *
+ * <tr><th id="get_slot"><p style="text-align:left">get_slot</p></th>
+ * <td headers="ri get_slot send_req">yes</td>
+ * <td headers="ri get_slot send_poll">yes</td>
+ * <td headers="ri get_slot rec_reply">yes</td>
+ * <td headers="ri get_slot rec_ex">yes</td>
+ * <td headers="ri get_slot rec_oth">yes</td></tr>
+ *
+ * <tr><th id="grsc"><p style="text-align:left">get_request_service_context</p></th>
+ * <td headers="ri grsc send_req">yes</td>
+ * <td headers="ri grsc send_poll">no </td>
+ * <td headers="ri grsc rec_reply">yes</td>
+ * <td headers="ri grsc rec_ex">yes</td>
+ * <td headers="ri grsc rec_oth">yes</td></tr>
+ *
+ * <tr><th id="gpsc"><p style="text-align:left">get_reply_service_context</p></th>
+ * <td headers="ri gpsc send_req">no </td>
+ * <td headers="ri gpsc send_poll">no </td>
+ * <td headers="ri gpsc rec_reply">yes</td>
+ * <td headers="ri gpsc rec_ex">yes</td>
+ * <td headers="ri gpsc rec_oth">yes</td>
+ * </tr>
+ *
+ * <tr>
+ * <td id="cri" colspan=6><i>ClientRequestInfo-specific:</i></td>
+ * </tr>
+ *
+ * <tr><th id="target"><p style="text-align:left">target</p></th>
+ * <td headers="cri target send_req">yes</td>
+ * <td headers="cri target send_poll">yes</td>
+ * <td headers="cri target rec_reply">yes</td>
+ * <td headers="cri target rec_ex">yes</td>
+ * <td headers="cri target rec_oth">yes</td></tr>
+ *
+ * <tr><th id="eftarget"><p style="text-align:left">effective_target</p></th>
+ * <td headers="cri eftarget send_req">yes</td>
+ * <td headers="cri eftarget send_poll">yes</td>
+ * <td headers="cri eftarget rec_reply">yes</td>
+ * <td headers="cri eftarget rec_ex">yes</td>
+ * <td headers="cri eftarget rec_oth">yes</td>
+ * </tr>
+ *
+ * <tr><th id="efprof"><p style="text-align:left">effective_profile</p></th>
+ * <td headers="cri efprof send_req">yes</td>
+ * <td headers="cri efprof send_poll">yes</td>
+ * <td headers="cri efprof rec_reply">yes</td>
+ * <td headers="cri efprof rec_ex">yes</td>
+ * <td headers="cri efprof rec_oth">yes</td></tr>
+ *
+ * <tr><th id="rxp"><p style="text-align:left">received_exception</p></th>
+ * <td headers="cri rxp send_req">no </td>
+ * <td headers="cri rxp send_poll">no </td>
+ * <td headers="cri rxp rec_reply">no </td>
+ * <td headers="cri rxp rec_ex">yes</td>
+ * <td headers="cri rxp rec_oth">no </td></tr>
+ *
+ * <tr><th id="rei"><p style="text-align:left">received_exception_id</p></th>
+ * <td headers="cri rei send_req">no </td>
+ * <td headers="cri rei send_poll">no </td>
+ * <td headers="cri rei rec_reply">no </td>
+ * <td headers="cri rei rec_ex">yes</td>
+ * <td headers="cri rei rec_oth">no </td></tr>
+ *
+ * <tr><th id="gec"><p style="text-align:left">get_effective_component</p></th>
+ * <td headers="cri gec send_req">yes</td>
+ * <td headers="cri gec send_poll">no </td>
+ * <td headers="cri gec rec_reply">yes</td>
+ * <td headers="cri gec rec_ex">yes</td>
+ * <td headers="cri gec rec_oth">yes</td></tr>
+ *
+ * <tr><th id="gecs"><p style="text-align:left">get_effective_components</p></th>
+ * <td headers="cri gecs send_req">yes</td>
+ * <td headers="cri gecs send_poll">no </td>
+ * <td headers="cri gecs rec_reply">yes</td>
+ * <td headers="cri gecs rec_ex">yes</td>
+ * <td headers="cri gecs rec_oth">yes</td></tr>
+ *
+ * <tr><th id="grpcy"><p style="text-align:left">get_request_policy</p></th>
+ * <td headers="cri grpcy send_req">yes</td>
+ * <td headers="cri grpcy send_poll">no </td>
+ * <td headers="cri grpcy rec_reply">yes</td>
+ * <td headers="cri grpcy rec_ex">yes</td>
+ * <td headers="cri grpcy rec_oth">yes</td></tr>
+ *
+ * <tr><th id="arsc"><p style="text-align:left">add_request_service_context</p></th>
+ * <td headers="cri arsc send_req">yes</td>
+ * <td headers="cri arsc send_poll">no </td>
+ * <td headers="cri arsc rec_reply">no </td>
+ * <td headers="cri arsc rec_ex">no </td>
+ * <td headers="cri arsc rec_oth">no </td></tr>
+ *
+ * </tbody>
+ * </table>
+ *
+ * <ol>
+ * <li>When <code>ClientRequestInfo</code> is passed to
+ * <code>send_request</code>, there is an entry in the list for every
+ * argument, whether in, inout, or out. But only the in and inout
+ * arguments will be available.</li>
+ * <li>If the <code>reply_status</code> atribute is not
+ * <code>LOCATION_FORWARD</code>, accessing this attribute will
+ * throw <code>BAD_INV_ORDER</code> with a standard minor code of
+ * 14.</li>
+ * </ol>
+ *
+ * @see ClientRequestInterceptor
+ */
+ local interface ClientRequestInfo : RequestInfo {
+
+ /**
+ * Returns the object which the client called to perform the
+ * operation.
+ *
+ * @see #effective_target
+ */
+ readonly attribute Object target;
+
+ /**
+ * Returns the actual object on which the operation will be invoked.
+ * If the <code>reply_status</code> is <code>LOCATION_FORWARD</code>,
+ * then on subsequent requests, <code>effective_target</code> will
+ * contain the forwarded IOR while target will remain unchanged.
+ *
+ * @see #target
+ */
+ readonly attribute Object effective_target;
+
+ /**
+ * Returns 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 changed accordingly, then this profile will
+ * be that located profile.
+ */
+ readonly attribute IOP::TaggedProfile effective_profile;
+
+ /**
+ * Returns an any which contains the exception to be returned to
+ * the client.
+ * <p>
+ * If the exception is a user exception which cannot be inserted
+ * into an any (e.g., it is unknown or the bindings don t provide
+ * the <code>TypeCode</code>), then this attribute will be an any
+ * containing the system exception <code>UNKNOWN</code> with a
+ * standard minor code of 1. However, the repository id of
+ * the exception is available in the <code>received_exception_id</code>
+ * attribute.
+ *
+ * @see #received_exception_id
+ */
+ readonly attribute any received_exception;
+
+ /**
+ * Returns the repository id of the exception to be returned to
+ * the client.
+ *
+ * @see #received_exception
+ * @see <a href="package-summary.html#unimpl">
+ * <code>PortableInterceptor</code> package comments for
+ * limitations / unimplemented features</a>
+ */
+ readonly attribute CORBA::RepositoryId received_exception_id;
+
+ /**
+ * Returns the <code>IOP.TaggedComponent</code> with the given ID from
+ * the profile selected for this request.
+ * <p>
+ * If there is more than one component for a given component ID, it
+ * is undefined which component this operation returns. If there is
+ * more than one component for a given component ID,
+ * <code>get_effective_components</code> should be called instead.
+ *
+ * @param id The component id of the component which
+ * is to be returned.
+ * @return The <code>IOP.TaggedComponent</code> obtained with the
+ * given identifier.
+ * @exception BAD_PARAM thrown, with a standard minor code of 28, if
+ * no component exists for the given component ID.
+ * @see #get_effective_components
+ */
+ IOP::TaggedComponent get_effective_component
+ (in IOP::ComponentId id);
+
+ /**
+ * Returns an array of all tagged components with the given ID from the
+ * profile selected for this request.
+ *
+ * @param id The component id of the components which are to be returned.
+ * @return An array of <code>TaggedComponent</code> objects, each of
+ * which contains the given identifier.
+ * @exception BAD_PARAM thrown, with a standard minor code of 28, if
+ * no component exists for the given component ID.
+ * @see #get_effective_component
+ */
+ IOP::TaggedComponentSeq get_effective_components
+ (in IOP::ComponentId id);
+
+ /**
+ * Returns the given policy in effect for this operation.
+ *
+ * @exception INV_POLICY thrown, with a standard minor code of 1, if the
+ * policy type is not valid either because the specified type is
+ * not supported by this ORB or because a policy object of that type
+ * is not associated with this Object
+ * @param type The policy type which specifies the policy to be
+ * returned.
+ * @return The <code>CORBA.Policy</code> obtained with the given type.
+ * @see <a href="package-summary.html#unimpl">
+ * <code>PortableInterceptor</code> package comments for
+ * limitations / unimplemented features</a>
+ */
+ CORBA::Policy get_request_policy
+ (in CORBA::PolicyType type);
+
+ /**
+ * Allows Interceptors to add service contexts to the request.
+ * <p>
+ * There is no declaration of the order of the service contexts.
+ * They may or may not appear in the order that they are added.
+ *
+ * @param service_context The <code>IOP.ServiceContext</code> to be
+ * added to the request.
+ * @param replace Indicates the behavior of this operation when a
+ * service context already exists with the given ID. If false,
+ * then <code>BAD_INV_ORDER</code> with a standard minor code of 15
+ * is thrown. If true, then the existing service context is
+ * replaced by the new one.
+ */
+ void add_request_service_context (
+ in IOP::ServiceContext service_context,
+ in boolean replace);
+ };
+
+ // Should be type string
+ typedef string ServerId ;
+
+ // This should actually be the CORBA::ORBid type once that is available
+ typedef string ORBId ;
+
+ /** The name of an object adapter. This is unique only within
+ * the scope of the ORB that created the object adapter.
+ */
+ typedef org::omg::CORBA::StringSeq AdapterName ;
+
+ /** Type of an object id. This provides the identity of a particular
+ * object that was created by an object adapter.
+ */
+ typedef org::omg::CORBA::OctetSeq ObjectId ;
+
+ /**
+ * Request Information, accessible to server-side request interceptors.
+ * <p>
+ * Some attributes and operations on <code>ServerRequestInfo</code> are not
+ * valid at all interception points. The following table shows the validity
+ * of each attribute or operation. If it is not valid, attempting to access
+ * it will result in a <code>BAD_INV_ORDER</code> being thrown with a
+ * standard minor code of 14.
+ *
+ *
+ * <table class="plain">
+ * <caption style="display:none">Shows the validity of each attribute or operation</caption>
+ * <thead>
+ * <tr>
+ * <th>&nbsp;</th>
+ * <th id="rec_req_ser_con" valign="bottom">receive_request_<br>service_contexts</th>
+ * <th id="rec_req" valign="bottom">receive_request</th>
+ * <th id="send_rep" valign="bottom">send_reply</th>
+ * <th id="send_exc" valign="bottom">send_exception</th>
+ * <th id="send_oth" valign="bottom">send_other</th>
+ * </tr>
+ * </thead>
+ * <tbody>
+ *
+ *
+ * <tr>
+ * <td id="ri" colspan=6><i>Inherited from RequestInfo:</i></td>
+ * </tr>
+ *
+ * <tr><th id="req_id"><p style="text-align:left">request_id</p></th>
+ * <td headers="ri req_id rec_req_ser_con">yes</td>
+ * <td headers="ri req_id rec_req">yes</td>
+ * <td headers="ri req_id send_rep">yes</td>
+ * <td headers="ri req_id send_exc">yes</td>
+ * <td headers="ri req_id send_oth">yes</td></tr>
+ *
+ * <tr><th id="op"><p style="text-align:left">operation</p></th>
+ * <td headers="ri op rec_req_ser_con">yes</td>
+ * <td headers="ri op rec_req">yes</td>
+ * <td headers="ri op send_rep">yes</td>
+ * <td headers="ri op send_exc">yes</td>
+ * <td headers="ri op send_oth">yes</td></tr>
+ *
+ * <tr><th id="args"><p style="text-align:left">arguments</p></th>
+ * <td headers="ri args rec_req_ser_con">no </td>
+ * <td headers="ri args rec_req">yes<sub>1</sub></td>
+ * <td headers="ri args send_rep">yes</td>
+ * <td headers="ri args send_exc">no<sub>2</sub></td>
+ * <td headers="ri args send_oth">no<sub>2</sub>
+ * </td></tr>
+ *
+ * <tr><th id="exps"><p style="text-align:left">exceptions</p></th>
+ * <td headers="ri exps rec_req_ser_con">no </td>
+ * <td headers="ri exps rec_req">yes</td>
+ * <td headers="ri exps send_rep">yes</td>
+ * <td headers="ri exps send_exc">yes</td>
+ * <td headers="ri exps send_oth">yes</td></tr>
+ *
+ * <tr><th id="contexts"><p style="text-align:left">contexts</p></th>
+ * <td headers="ri contexts rec_req_ser_con">no </td>
+ * <td headers="ri contexts rec_req">yes</td>
+ * <td headers="ri contexts send_rep">yes</td>
+ * <td headers="ri contexts send_exc">yes</td>
+ * <td headers="ri contexts send_oth">yes</td></tr>
+ *
+ * <tr><th id="op_con"><p style="text-align:left">operation_context</p></th>
+ * <td headers="ri op_con rec_req_ser_con">no </td>
+ * <td headers="ri op_con rec_req">yes</td>
+ * <td headers="ri op_con send_rep">yes</td>
+ * <td headers="ri op_con send_exc">no </td>
+ * <td headers="ri op_con send_oth">no </td>
+ * </tr>
+ *
+ * <tr><th id="result"><p style="text-align:left">result</p></th>
+ * <td headers="ri result rec_req_ser_con">no </td>
+ * <td headers="ri result rec_req">no </td>
+ * <td headers="ri result send_rep">yes</td>
+ * <td headers="ri result send_exc">no </td>
+ * <td headers="ri result send_oth">no </td>
+ * </tr>
+ *
+ * <tr><th id="res_ex"><p style="text-align:left">response_expected</p></th>
+ * <td headers="ri res_ex rec_req_ser_con">yes</td>
+ * <td headers="ri res_ex rec_req">yes</td>
+ * <td headers="ri res_ex send_rep">yes</td>
+ * <td headers="ri res_ex send_exc">yes</td>
+ * <td headers="ri res_ex send_oth">yes</td></tr>
+ *
+ * <tr><th id="syn_scp"><p style="text-align:left">sync_scope</p></th>
+ * <td headers="ri syn_scp rec_req_ser_con">yes</td>
+ * <td headers="ri syn_scp rec_req">yes</td>
+ * <td headers="ri syn_scp send_rep">yes</td>
+ * <td headers="ri syn_scp send_exc">yes</td>
+ * <td headers="ri syn_scp send_oth">yes</td></tr>
+ *
+ * <tr><td><b>request_id</b></td>
+ * <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>operation</b></td>
+ * <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>arguments</b></td>
+ * <td>no </td> <td>yes<sub>1</sub></td>
+ * <td>yes</td> <td>no<sub>2</sub></td>
+ * <td>no<sub>2</sub>
+ * </td></tr>
+ *
+ * <tr><td><b>exceptions</b></td>
+ * <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>contexts</b></td>
+ * <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>operation_context</b></td>
+ * <td>no </td> <td>yes</td> <td>yes</td> <td>no </td> <td>no </td></tr>
+ *
+ * <tr><td><b>result</b></td>
+ * <td>no </td> <td>no </td> <td>yes</td> <td>no </td> <td>no </td></tr>
+ *
+ * <tr><td><b>response_expected</b></td>
+ * <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>sync_scope</b></td>
+ * <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>reply_status</b></td>
+ * <td>no </td> <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>forward_reference</b></td>
+ * <td>no </td> <td>no </td> <td>no </td> <td>no </td> <td>yes<sub>2</sub>
+ * </td></tr>
+ *
+ * <tr><td><b>get_slot</b></td>
+ * <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>get_request_service_context</b></td>
+ * <td>yes</td> <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>get_reply_service_context</b></td>
+ * <td>no </td> <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr>
+ * <td colspan=6><i>ServerRequestInfo-specific:</i></td>
+ * </tr>
+ *
+ * <tr><td><b>sending_exception</b></td>
+ * <td>no </td> <td>no </td> <td>no </td> <td>yes</td> <td>no </td></tr>
+ *
+ * <tr><td><b>object_id</b></td>
+ * <td>no </td> <td>yes</td> <td>yes</td> <td>yes<sub>3</sub></td>
+ * <td>yes<sub>3</sub>
+ * </td></tr>
+ *
+ * <tr><td><b>adapter_id</b></td>
+ * <td>no </td> <td>yes</td> <td>yes</td> <td>yes<sub>3</sub></td>
+ * <td>yes<sub>3</sub>
+ * </td></tr>
+ *
+ * <tr><td><b>server_id</b></td>
+ * <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>orb_id</b></td>
+ * <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>adapter_name</b></td>
+ * <td>no </td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>target_most_derived_interface</b></td>
+ * <td>no </td> <td>yes</td> <td>no<sub>4</sub></td>
+ * <td>no<sub>4</sub></td>
+ * <td>no<sub>4</sub>
+ * </td></tr>
+ *
+ * <tr><td><b>get_server_policy</b></td>
+ * <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>set_slot</b></td>
+ * <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ *
+ * <tr><td><b>target_is_a</b></td>
+ * <td>no </td> <td>yes</td> <td>no<sub>4</sub></td>
+ * <td>no<sub>4</sub></td>
+ * <td>no<sub>4</sub>
+ * </td></tr>
+ *
+ * <tr><td><b>add_reply_service_context</b></td>
+ * <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td> <td>yes</td></tr>
+ * </tbody>
+ * </table>
+ *
+ * <ol>
+ * <li>When <code>ServerRequestInfo</code> is passed to
+ * <code>receive_request</code>, there is an entry in the list for
+ * every argument, whether in, inout, or out. But only the in and
+ * inout arguments will be available.</li>
+ * <li>If the <code>reply_status</code> attribute is not
+ * <code>LOCATION_FORWARD</code>, accessing this attribute will throw
+ * <code>BAD_INV_ORDER</code> with a standard minor code of 14.</li>
+ * <li>If the servant locator caused a location forward, or thrown an
+ * exception, this attribute/operation may not be available in this
+ * interception point. <code>NO_RESOURCES</code> with a standard minor
+ * code of 1 will be thrown if it is not available.</li>
+ * <li>The operation is not available in this interception point because
+ * the necessary information requires access to the target object's
+ * servant, which may no longer be available to the ORB. For example,
+ * if the object's adapter is a POA that uses a
+ * <code>ServantLocator</code>, then the ORB invokes the interception
+ * point after it calls <code>ServantLocator.postinvoke()</code>.</li>
+ * </ol>
+ *
+ * @see ServerRequestInterceptor
+ */
+ local interface ServerRequestInfo : RequestInfo {
+
+ /**
+ * Returns an any which contains the exception to be returned to
+ * the client.
+ * <p>
+ * If the exception is a user exception which cannot be inserted into
+ * an any (e.g., it is unknown or the bindings don't provide the
+ * <code>TypeCode</code>), then this attribute will be an any
+ * containing the system exception <code>UNKNOWN</code> with a
+ * standard minor code of 1.
+ *
+ * @see <a href="package-summary.html#unimpl">
+ * <code>PortableInterceptor</code> package comments for
+ * limitations / unimplemented features</a>
+ */
+ readonly attribute any sending_exception;
+
+ /**
+ * Returns the opaque <code>object_id</code> describing the target of
+ * the operation invocation.
+ */
+ readonly attribute ObjectId object_id;
+
+ /**
+ * Returns the opaque identifier for the object adapter.
+ */
+ readonly attribute CORBA::OctetSeq adapter_id;
+
+ /**
+ * Returns the server ID that was specified on ORB::init using the -ORBServerId
+ * argument.
+ */
+ readonly attribute ServerId server_id ;
+
+ /**
+ * Returns the ID that was used to create the ORB.
+ */
+ readonly attribute ORBId orb_id ;
+
+ /**
+ * Returns the sequence of strings that identifies the object
+ * adapter instance that is handling this request.
+ */
+ readonly attribute AdapterName adapter_name ;
+
+ /**
+ * Returns the repository id for the most derived interface of the
+ * servant.
+ */
+ readonly attribute CORBA::RepositoryId
+ target_most_derived_interface;
+
+ /**
+ * Returns the policy in effect for this operation for the given
+ * policy type. The returned <code>CORBA.Policy</code> object shall
+ * only be a policy whose type was registered via
+ * <code>register_policy_factory</code>.
+ *
+ * @param type The <code>CORBA.PolicyType</code> which specifies the
+ * policy to be returned.
+ * @return The <code>CORBA.Policy</code> obtained with the given
+ * policy type.
+ * @exception INV_POLICY thrown, with a standard minor code of 2, if
+ * a policy for the given type was not registered via
+ * <code>register_policy_factory</code>.
+ * @see ORBInitInfo#register_policy_factory
+ */
+ CORBA::Policy get_server_policy
+ (in CORBA::PolicyType type);
+
+ /**
+ * Allows an Interceptor to set a slot in the
+ * <code>PortableInterceptor.Current</code> that is in the scope of
+ * the request. If data already exists in that slot, it will be
+ * overwritten.
+ *
+ * @param id The id of the slot.
+ * @param data The data, in the form of an any, to store in that slot.
+ * @exception InvalidSlot thrown if the ID does not define an allocated
+ * slot.
+ * @see Current
+ */
+ void set_slot (in SlotId id, in any data) raises (InvalidSlot);
+
+ /**
+ * Returns true if the servant is the given repository id,
+ * false if it is not.
+ *
+ * @param id The caller wants to know if the servant is this
+ * repository id.
+ * @return Is the servant the given RepositoryId?
+ */
+ boolean target_is_a (in CORBA::RepositoryId id);
+
+ /**
+ * Allows Interceptors to add service contexts to the request.
+ * <p>
+ * There is no declaration of the order of the service contexts.
+ * They may or may not appear in the order that they are added.
+ *
+ * @param service_context The <code>IOP.ServiceContext</code> to add to
+ * the reply.
+ * @param replace Indicates the behavior of this operation when a
+ * service context already exists with the given ID. If false,
+ * then <code>BAD_INV_ORDER</code> with a standard minor code of 15
+ * is thrown. If true, then the existing service context is
+ * replaced by the new one.
+ * @exception BAD_INV_ORDER thrown, with a standard minor code of 15, if
+ * replace is false and a service context already exists with the
+ * given ID.
+ */
+ void add_reply_service_context (
+ in IOP::ServiceContext service_context,
+ in boolean replace);
+ };
+
+ /**
+ * Client-side request interceptor.
+ * <p>
+ * A request Interceptor is designed to intercept the flow of a
+ * request/reply sequence through the ORB at specific points so that
+ * services can query the request information and manipulate the service
+ * contexts which are propagated between clients and servers. The primary
+ * use of request Interceptors is to enable ORB services to transfer
+ * context information between clients and servers. There are two types
+ * of request Interceptors: client-side and server-side.
+ * <p>
+ * To write a client-side Interceptor, implement the
+ * <code>ClientRequestInterceptor</code> interface.
+ *
+ * @see ClientRequestInfo
+ */
+ local interface ClientRequestInterceptor : Interceptor {
+ /**
+ * Allows an Interceptor to query request information and modify the
+ * service context before the request is sent to the server.
+ * <p>
+ * This interception point may throw a system exception. If it does,
+ * no other Interceptors' <code>send_request</code> operations are called.
+ * Those Interceptors on the Flow Stack are popped and their
+ * <code>receive_exception</code> interception points are called. This
+ * interception point may also throw a <code>ForwardRequest</code>
+ * exception. If an Interceptor throws this exception, no other
+ * Interceptors' <code>send_request</code> operations are
+ * called. Those Interceptors on the Flow Stack are popped and their
+ * <code>receive_other</code> interception points are called.
+ * <p>
+ * Compliant Interceptors shall properly follow completion_status
+ * semantics if they throw a system exception from this interception
+ * point. The <code>completion_status</code> shall be
+ * <code>COMPLETED_NO</code>.
+ *
+ * @param ri Information about the current request being intercepted.
+ * @exception ForwardRequest If thrown, indicates to the ORB that a
+ * retry of the request should occur with the new object given in
+ * the exception.
+ */
+ void send_request (in ClientRequestInfo ri) raises (ForwardRequest);
+
+ /**
+ * Allows an Interceptor to query information during a Time-Independent
+ * Invocation (TII) polling get reply sequence.
+ * <p>
+ * With TII, an application may poll for a response to a request sent
+ * previously by the polling client or some other client. This poll is
+ * reported to Interceptors through the <code>send_poll</code>
+ * interception point and the response is returned through the
+ * <code>receive_reply</code> or <code>receive_exception</code>
+ * interception points. If the response is not available before the
+ * poll time-out expires, the system exception <code>TIMEOUT</code> is
+ * thrown and <code>receive_exception</code> is called with this
+ * exception.
+ * <p>
+ * This interception point may throw a system exception. If it does,
+ * no other Interceptors' <code>send_poll</code> operations are
+ * called. Those Interceptors on the Flow Stack are popped and their
+ * <code>receive_exception</code> interception points are called.
+ * <p>
+ * Compliant Interceptors shall properly follow
+ * <code>completion_status</code> semantics if they throw a system
+ * exception from this interception point. The completion_status shall be
+ * <code>COMPLETED_NO</code>.
+ *
+ * @param ri Information about the current request being intercepted.
+ * @exception TIMEOUT thrown if the response is not available before
+ * the poll time-out expires
+ */
+ void send_poll (in ClientRequestInfo ri);
+
+ /**
+ * Allows an Interceptor to query the information on a reply after it
+ * is returned from the server and before control is returned to the
+ * client.
+ * <p>
+ * This interception point may throw a system exception. If it does,
+ * no other Interceptors' <code>receive_reply</code> operations are
+ * called. The remaining Interceptors in the Flow Stack shall have
+ * their <code>receive_exception</code> interception point called.
+ * <p>
+ * Compliant Interceptors shall properly follow
+ * <code>completion_status</code> semantics if they throw a system
+ * exception from this interception point. The
+ * <code>completion_status</code> shall be <code>COMPLETED_YES</code>.
+ *
+ * @param ri Information about the current request being intercepted.
+ */
+ void receive_reply (in ClientRequestInfo ri);
+
+ /**
+ * Indicates to the interceptor that an exception occurred. Allows
+ * an Interceptor to query the exception's information before it is
+ * thrown to the client.
+ * <p>
+ * This interception point may throw a system exception. This has the
+ * effect of changing the exception which successive Interceptors
+ * popped from the Flow Stack receive on their calls to
+ * <code>receive_exception</code>. The exception thrown to the client
+ * will be the last exception thrown by an Interceptor, or the original
+ * exception if no Interceptor changes the exception.
+ * <p>
+ * This interception point may also throw a <code>ForwardRequest</code>
+ * exception. If an Interceptor throws this exception, no other
+ * Interceptors' <code>receive_exception</code> operations are called.
+ * The remaining Interceptors in the Flow Stack are popped and have their
+ * <code>receive_other</code> interception point called.
+ * <p>
+ * If the <code>completion_status</code> of the exception is not
+ * <code>COMPLETED_NO</code>, then it is inappropriate for this
+ * interception point to throw a <code>ForwardRequest</code> exception.
+ * The request s at-most-once semantics would be lost.
+ * <p>
+ * Compliant Interceptors shall properly follow
+ * <code>completion_status</code> semantics if they throw a system
+ * exception from this interception point. If the original exception is
+ * a system exception, the <code>completion_status</code> of the new
+ * exception shall be the same as on the original. If the original
+ * exception is a user exception, then the <code>completion_status</code>
+ * of the new exception shall be <code>COMPLETED_YES</code>.
+ * <p>
+ * Under some conditions, depending on what policies are in effect, an
+ * exception (such as <code>COMM_FAILURE</code>) may result in a retry
+ * of the request. While this retry is a new request with respect to
+ * Interceptors, there is one point of correlation between the original
+ * request and the retry: because control has not returned to the
+ * client, the <code>PortableInterceptor.Current</code> for both the
+ * original request and the retrying request is the same.
+ *
+ * @param ri Information about the current request being intercepted.
+ * @exception ForwardRequest If thrown, indicates to the ORB that a
+ * retry of the request should occur with the new object given in
+ * the exception.
+ */
+ void receive_exception (in ClientRequestInfo ri) raises (ForwardRequest);
+
+ /**
+ * Allows an Interceptor to query the information available when a
+ * request results in something other than a normal reply or an
+ * exception. For example, a request could result in a retry
+ * (e.g., a GIOP Reply with a <code>LOCATION_FORWARD</code> status was
+ * received); or on asynchronous calls, the reply does not immediately
+ * follow the request, but control shall return to the client and an
+ * ending interception point shall be called.
+ * <p>
+ * For retries, depending on the policies in effect, a new request may or
+ * may not follow when a retry has been indicated. If a new request does
+ * follow, while this request is a new request, with respect to
+ * Interceptors, there is one point of correlation between the original
+ * request and the retry: because control has not returned to the client,
+ * the request scoped <code>PortableInterceptor.Current</code> for both
+ * the original request and the retrying request is the same.
+ * <p>
+ * This interception point may throw a system exception. If it does, no
+ * other Interceptors' <code>receive_other</code> operations are called.
+ * The remaining Interceptors in the Flow Stack are popped and have
+ * their <code>receive_exception</code> interception point called.
+ * <p>
+ * This interception point may also throw a <code>ForwardRequest</code>
+ * exception. If an Interceptor throws this exception, successive
+ * Interceptors' <code>receive_other</code> operations are called with
+ * the new information provided by the <code>ForwardRequest</code>
+ * exception.
+ * <p>
+ * Compliant Interceptors shall properly follow
+ * <code>completion_status</code> semantics if they throw a system
+ * exception from this interception point. The
+ * <code>completion_status</code> shall be <code>COMPLETED_NO</code>.
+ * If the target invocation had completed, this interception point
+ * would not be called.
+ *
+ * @param ri Information about the current request being intercepted.
+ * @exception ForwardRequest If thrown, indicates to the ORB that a
+ * retry of the request should occur with the new object given in
+ * the exception.
+ */
+ void receive_other (in ClientRequestInfo ri) raises (ForwardRequest);
+ };
+
+ /**
+ * Server-side request interceptor.
+ * <p>
+ * A request Interceptor is designed to intercept the flow of a
+ * request/reply sequence through the ORB at specific points so that
+ * services can query the request information and manipulate the service
+ * contexts which are propagated between clients and servers. The primary
+ * use of request Interceptors is to enable ORB services to transfer
+ * context information between clients and servers. There are two types
+ * of request Interceptors: client-side and server-side.
+ * <p>
+ * To write a server-side Interceptor, implement the
+ * ServerRequestInterceptor interface.
+ *
+ * @see ServerRequestInfo
+ */
+ local interface ServerRequestInterceptor : Interceptor {
+ /**
+ * Allows the interceptor to process service context information.
+ * <p>
+ * At this interception point, Interceptors must get their service
+ * context information from the incoming request transfer it to
+ * <code>PortableInterceptor.Current</code>'s slots.
+ * <p>
+ * This interception point is called before the servant manager is called.
+ * Operation parameters are not yet available at this point. This
+ * interception point may or may not execute in the same thread as
+ * the target invocation.
+ * <p>
+ * This interception point may throw a system exception. If it does,
+ * no other Interceptors' <code>receive_request_service_contexts</code>
+ * operations are called. Those Interceptors on the Flow Stack are
+ * popped and their <code>send_exception</code> interception points are
+ * called.
+ * <p>
+ * This interception point may also throw a <code>ForwardRequest</code>
+ * exception. If an Interceptor throws this exception, no other
+ * Interceptors' <code>receive_request_service_contexts</code> operations
+ * are called. Those Interceptors on the Flow Stack are popped and
+ * their <code>send_other</code> interception points are called.
+ * <p>
+ * Compliant Interceptors shall properly follow
+ * <code>completion_status</code> semantics if they throw a system
+ * exception from this interception point. The
+ * <code>completion_status</code> shall be COMPLETED_NO.
+ *
+ * @param ri Information about the current request being intercepted.
+ * @exception ForwardRequest If thrown, indicates to the ORB that a
+ * retry of the request should occur with the new object given in
+ * the exception.
+ */
+ void receive_request_service_contexts (in ServerRequestInfo ri)
+ raises (ForwardRequest);
+
+ /**
+ * Allows an Interceptor to query request information after all the
+ * information, including operation parameters, are available. This
+ * interception point shall execute in the same thread as the target
+ * invocation.
+ * <p>
+ * In the DSI model, since the parameters are first available when
+ * the user code calls <code>arguments</code>, <code>receive_request</code>
+ * is called from within <code>arguments</code>. It is possible that
+ * <code>arguments</code> is not called in the DSI model. The target
+ * may call <code>set_exception</code> before calling
+ * <code>arguments</code>. The ORB shall guarantee that
+ * <code>receive_request</code> is called once, either through
+ * <code>arguments</code> or through <code>set_exception</code>. If it
+ * is called through <code>set_exception</code>, requesting the
+ * arguments will result in <code>NO_RESOURCES</code> being thrown with
+ * a standard minor code of 1.
+ * <p>
+ * This interception point may throw a system exception. If it does, no
+ * other Interceptors' <code>receive_request</code> operations are
+ * called. Those Interceptors on the Flow Stack are popped and their
+ * <code>send_exception</code> interception points are called.
+ * <p>
+ * This interception point may also throw a <code>ForwardRequest</code>
+ * exception. If an Interceptor throws this exception, no other
+ * Interceptors' <code>receive_request</code> operations are called.
+ * Those Interceptors on the Flow Stack are popped and their
+ * <code>send_other</code> interception points are called.
+ * <p>
+ * Compliant Interceptors shall properly follow
+ * <code>completion_status</code> semantics if they throw a system
+ * exception from this interception point. The
+ * <code>completion_status</code> shall be <code>COMPLETED_NO</code>.
+ *
+ * @param ri Information about the current request being intercepted.
+ * @exception ForwardRequest If thrown, indicates to the ORB that a
+ * retry of the request should occur with the new object given in
+ * the exception.
+ */
+ void receive_request (in ServerRequestInfo ri) raises (ForwardRequest);
+
+ /**
+ * Allows an Interceptor to query reply information and modify the
+ * reply service context after the target operation has been invoked
+ * and before the reply is returned to the client. This interception
+ * point shall execute in the same thread as the target invocation.
+ * <p>
+ * This interception point may throw a system exception. If it does,
+ * no other Interceptors' <code>send_reply</code> operations are called.
+ * The remaining Interceptors in the Flow Stack shall have their
+ * <code>send_exception</code> interception point called.
+ * <p>
+ * Compliant Interceptors shall properly follow
+ * <code>completion_status</code> semantics if they throw a
+ * system exception from this interception point. The
+ * <code>completion_status</code> shall be <code>COMPLETED_YES</code>.
+ *
+ * @param ri Information about the current request being intercepted.
+ */
+ void send_reply (in ServerRequestInfo ri);
+
+ /**
+ * Allows an Interceptor to query the exception information and modify
+ * the reply service context before the exception is thrown to the client.
+ * When an exception occurs, this interception point is called. This
+ * interception point shall execute in the same thread as the target
+ * invocation.
+ * <p>
+ * This interception point may throw a system exception. This has the
+ * effect of changing the exception which successive Interceptors
+ * popped from the Flow Stack receive on their calls to
+ * <code>send_exception</code>. The exception thrown to the client will
+ * be the last exception thrown by an Interceptor, or the original
+ * exception if no Interceptor changes the exception.
+ * <p>
+ * This interception point may also throw a <code>ForwardRequest</code>
+ * exception. If an Interceptor throws this exception, no other
+ * Interceptors' <code>send_exception</code> operations are called. The
+ * remaining Interceptors in the Flow Stack shall have their
+ * <code>send_other</code> interception points called.
+ * <p>
+ * If the <code>completion_status</code> of the exception is not
+ * <code>COMPLETED_NO</code>, then it is inappropriate for this
+ * interception point to throw a <code>ForwardRequest</code> exception.
+ * The request's at-most-once semantics would be lost.
+ * <p>
+ * Compliant Interceptors shall properly follow
+ * <code>completion_status</code> semantics if they throw a system
+ * exception from this interception point. If the original exception
+ * is a system exception, the <code>completion_status</code> of the new
+ * exception shall be the same as on the original. If the original
+ * exception is a user exception, then the <code>completion_status</code>
+ * of the new exception shall be <code>COMPLETED_YES</code>.
+ *
+ * @param ri Information about the current request being intercepted.
+ * @exception ForwardRequest If thrown, indicates to the ORB that a
+ * retry of the request should occur with the new object given in
+ * the exception.
+ */
+ void send_exception (in ServerRequestInfo ri) raises (ForwardRequest);
+
+ /**
+ * Allows an Interceptor to query the information available when a
+ * request results in something other than a normal reply or an
+ * exception. For example, a request could result in a retry
+ * (e.g., a GIOP Reply with a <code>LOCATION_FORWARD</code> status was
+ * received). This interception point shall execute in the same thread
+ * as the target invocation.
+ * <p>
+ * This interception point may throw a system exception. If it does,
+ * no other Interceptors' <code>send_other</code> operations are called.
+ * The remaining Interceptors in the Flow Stack shall have their
+ * <code>send_exception</code> interception points called.
+ * <p>
+ * This interception point may also throw a <code>ForwardRequest</code>
+ * exception. If an Interceptor throws this exception, successive
+ * Interceptors' <code>send_other</code> operations are called with
+ * the new information provided by the <code>ForwardRequest</code>
+ * exception.
+ * <p>
+ * Compliant Interceptors shall properly follow
+ * <code>completion_status</code> semantics if they throw a system
+ * exception from this interception point. The
+ * <code>completion_status</code> shall be <code>COMPLETED_NO</code>.
+ *
+ * @param ri Information about the current request being intercepted.
+ * @exception ForwardRequest If thrown, indicates to the ORB that a
+ * retry of the request should occur with the new object given in
+ * the exception.
+ */
+ void send_other (in ServerRequestInfo ri) raises (ForwardRequest);
+ };
+
+ /** The object reference factory. This provides the capability of
+ * creating an object reference.
+ */
+ abstract valuetype ObjectReferenceFactory {
+ /** make_object creates a CORBA object reference according
+ * to the data in this template, with the given repository ID and
+ * object ID.
+ */
+ Object make_object( in string repositoryId, in ObjectId object_id ) ;
+ } ;
+
+ /** The object reference template. An instance of this must
+ * exist for each object adapter created in an ORB. The server_id,
+ * orb_id, and adapter_name attributes uniquely identify this template
+ * within the scope of an IMR. Note that adapter_id is similarly unique
+ * within the same scope, but it is opaque, and less useful in many
+ * cases.
+ */
+ abstract valuetype ObjectReferenceTemplate : ObjectReferenceFactory {
+
+ readonly attribute ServerId server_id ;
+
+ readonly attribute ORBId orb_id ;
+
+ readonly attribute AdapterName adapter_name ;
+ } ;
+
+ /** Sequence of object reference templates is used for reporting state
+ * changes that do not occur on the adapter manager.
+ */
+ typedef sequence<ObjectReferenceTemplate> ObjectReferenceTemplateSeq ;
+
+ /** Adapter manager identifier. Every object adapter has an adapter manager,
+ * indicated in this API only through the ID. A group of object adapter
+ * instances may share the same adapter manager, in which case state transitions
+ * reported for the adapter manager are observed by all object adapters with the
+ * same adapter manager ID.
+ */
+ typedef long AdapterManagerId ;
+
+ /** Type of object adapter state. State changes are reported either to
+ * the object adapter or to the adapter manager.
+ */
+ typedef short AdapterState ;
+
+ /** Object adapter state that holds requests temporarily until the
+ * state is changed.
+ */
+ const AdapterState HOLDING = 0 ;
+
+ /** Object adapter state that indicates normal request processing.
+ */
+ const AdapterState ACTIVE = 1 ;
+
+ /** Object adapter state that causes all requests to be discarded.
+ */
+ const AdapterState DISCARDING = 2 ;
+
+ /** Object adapter state that causes all requests to be discarded.
+ * This state indicates that the adapter is shutting down.
+ */
+ const AdapterState INACTIVE = 3 ;
+
+ /** Object adapter state indicating that the adapter has been destroyed.
+ */
+ const AdapterState NON_EXISTENT = 4 ;
+
+ /**
+ * Provides the server-side ORB service with access to the applicable
+ * policies during IOR construction and the ability to add components.
+ * The ORB passes an instance of its implementation of this interface as
+ * a parameter to <code>IORInterceptor.establish_components</code>.
+ *
+ * @see IORInterceptor
+ */
+ local interface IORInfo {
+
+ /**
+ * Allows an ORB service implementation to determine what server side
+ * policy of a particular type is in effect for an IOR being
+ * constructed. When the IOR being constructed is for an object
+ * implemented using a POA, all Policy objects passed to the
+ * <code>PortableServer.POA.create_POA</code> call that created that
+ * POA are accessable via <code>get_effective_policy</code>.
+ * <p>
+ * If a policy for the given type is not known to the ORB, then this
+ * operation will throw <code>INV_POLICY</code> with a standard minor
+ * code of 2.
+ *
+ * @param type an int specifying the type of policy to return.
+ * @return The effective <code>CORBA.Policy</code> 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.
+ */
+ CORBA::Policy get_effective_policy
+ (in CORBA::PolicyType type);
+
+ /**
+ * A portable ORB service implementation calls
+ * <code>add_ior_component</code> from its implementation of
+ * <code>establish_components</code> 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.
+ * <p>
+ * Any number of components may exist with the same component ID.
+ *
+ * @param tagged_component The IOP.TaggedComponent to add.
+ */
+ void add_ior_component
+ (in IOP::TaggedComponent tagged_component);
+
+ /**
+ * A portable ORB service implementation calls
+ * <code>add_ior_component_to_profile</code> from its implementation of
+ * <code>establish_components</code> 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.
+ * <p>
+ * Any number of components may exist with the same component ID.
+ *
+ * @param tagged_component The <code>IOP.TaggedComponent</code> to add.
+ * @param profile_id The profile id of the profile to
+ * which this component will be added.
+ * @exception BAD_PARAM thrown, with a standard minor code of 29, if the
+ * given profile ID does not define a known profile or it is
+ * impossible to add components to that profile.
+ */
+ void add_ior_component_to_profile (
+ in IOP::TaggedComponent tagged_component,
+ in IOP::ProfileId profile_id);
+
+ /** Return the adapter manager id of the object adapter
+ * that was just created and is running IOR interceptors.
+ */
+ readonly attribute AdapterManagerId manager_id ;
+
+ /** Return the adapter state of the object adapter
+ * that was just created and is running IOR interceptors.
+ */
+ readonly attribute AdapterState state ;
+
+ /** Return the object reference template of the object adapter
+ * that was just created and is running IOR interceptors.
+ */
+ readonly attribute ObjectReferenceTemplate adapter_template ;
+
+ /** On read, returns the current factory that will be used to create
+ * object references for the object adapter that was just created
+ * and is running IOR interceptors. By default, this factory is the same
+ * as the value of the adapter_template attribute. The current_factory
+ * may also be set to another object reference template inside an
+ * IORInterceptor_3_0.
+ */
+ attribute ObjectReferenceFactory current_factory ;
+ };
+
+ /**
+ * Interceptor used to establish tagged components in the profiles within
+ * an IOR.
+ * <p>
+ * In some cases, a portable ORB service implementation may need to add
+ * information describing the server's or object's ORB service related
+ * capabilities to object references in order to enable the ORB service
+ * implementation in the client to function properly.
+ * <p>
+ * This is supported through the <code>IORInterceptor</code> and
+ * <code>IORInfo</code> interfaces.
+ *
+ * @see IORInfo
+ */
+ local interface IORInterceptor : Interceptor {
+ /**
+ * A server side ORB calls the <code>establish_components</code>
+ * operation on all registered <code>IORInterceptor</code> instances
+ * when it is assembling the list of components that will be included
+ * in the profile or profiles of an object reference. This operation
+ * is not necessarily called for each individual object reference.
+ * In the case of the POA, this operation is called each time POA::create_POA
+ * is called. In any case, <code>establish_components</code> is
+ * guaranteed to be called at least once for each distinct set of
+ * server policies.
+ * <p>
+ * An implementation of <code>establish_components</code> must not
+ * throw exceptions. If it does, the ORB shall ignore the exception
+ * and proceed to call the next IOR Interceptor's
+ * <code>establish_components</code> operation.
+ *
+ * @param info The <code>IORInfo</code> instance used by the ORB
+ * service to query applicable policies and add components to be
+ * included in the generated IORs.
+ */
+ void establish_components (in IORInfo info);
+ };
+
+ local interface IORInterceptor_3_0 : IORInterceptor {
+ /** The components_established method is invoked on all registered
+ * IORInterceptor_3_0 instances after establish_components
+ * has been invoked on all registered IORInterceptor instances.
+ * The adapter_template is available in info during this call.
+ * The current_factory may be get or set in info during this call.
+ * <p>
+ * Any exception thrown from this method is handled by the Object
+ * Adapter that called this interceptor. In the case of the POA,
+ * an exception results in a OBJ_ADAPTER exception with an OMG
+ * standard minor code of 6.
+ * @param info The IORInfo for the object adapter being created.
+ */
+ void components_established( in IORInfo info ) ;
+
+ /** Called whenever the state of an adapter manager changes.
+ * For the POA, that is the POAManager. If the state change
+ * is reported through <code>adapter_manager_state_changed</code>,
+ * it is not reported through <code>adapter_state_changed</code>.
+ * @param id the adapter manager id of the adapter manager that
+ * changed state
+ * @param state the new state of the adapter manager
+ */
+ void adapter_manager_state_changed( in AdapterManagerId id,
+ in AdapterState state ) ;
+
+ /** Called whenever the state of an object adapter changes, and
+ * the state change is not caused by an adapter manager. Such
+ * changes are reported to all registered <code>IORInterceptor_3_0</code>
+ * instances.
+ * @param templates the sequence of <code>ObjectReferenceTemplate</code> instances
+ * on which this state change occurred.
+ * @param state the new <code>AdapterState</code> shared by all of the templates.
+ */
+ void adapter_state_changed( in ObjectReferenceTemplateSeq templates,
+ in AdapterState state ) ;
+ };
+
+ /**
+ * Enables policy types to be constructed using
+ * <code>CORBA.ORB.create_policy</code>.
+ * <p>
+ * A portable ORB service implementation registers an instance of the
+ * <code>PolicyFactory</code> interface during ORB initialization in order
+ * to enable its policy types to be constructed using
+ * <code>CORBA.ORB.create_policy</code>. The POA is required to preserve
+ * any policy which is registered with <code>ORBInitInfo</code> in this
+ * manner.
+ *
+ * @see ORBInitInfo#register_policy_factory
+ */
+ local interface PolicyFactory
+ {
+ /**
+ * Returns an instance of the appropriate interface derived from
+ * <code>CORBA.Policy</code> whose value corresponds to the
+ * specified any.
+ * <p>
+ * The ORB calls <code>create_policy</code> on a registered
+ * <code>PolicyFactory</code> instance when
+ * <code>CORBA.ORB.create_policy</code> is called for the
+ * <code>PolicyType</code> under which the <code>PolicyFactory</code> has
+ * been registered. The <code>create_policy</code> operation then
+ * returns an instance of the appropriate interface derived from
+ * <code>CORBA.Policy</code> whose value corresponds to the specified
+ * any. If it cannot, it shall throw an exception as described for
+ * <code>CORBA.ORB.create_policy</code>.
+ *
+ * @param type An int specifying the type of policy being created.
+ * @param value An any containing data with which to construct the
+ * <code>CORBA.Policy</code>.
+ * @return A <code>CORBA.Policy</code> object of the specified type and
+ * value.
+ */
+ CORBA::Policy create_policy
+ (in CORBA::PolicyType type, in any value)
+ raises (CORBA::PolicyError);
+ };
+
+ /**
+ * Passed to each <code>ORBInitializer</code>, allowing it to
+ * to register interceptors and perform other duties while the ORB is
+ * initializing.
+ * <p>
+ * The <code>ORBInitInfo</code> object is only valid during
+ * <code>ORB.init</code>. If a service keeps a reference to its
+ * <code>ORBInitInfo</code> object and tries to use it after
+ * <code>ORB.init</code> returns, the object no longer exists and an
+ * <code>OBJECT_NOT_EXIST</code> exception shall be thrown.
+ *
+ * @see ORBInitializer
+ */
+ local interface ORBInitInfo {
+
+ /** Object id, represented as a String */
+ typedef string ObjectId;
+
+ /**
+ * Only one Interceptor of a given name can be registered with the
+ * ORB for each Interceptor type. If an attempt is made to register a
+ * second Interceptor with the same name, DuplicateName is thrown.
+ * <p>
+ * An Interceptor may be anonymous, i.e., have an empty string as the
+ * name attribute. Any number of anonymous Interceptors may be
+ * registered with the ORB so, if the Interceptor being registered
+ * is anonymous, the registration operation will not throw
+ * <code>DuplicateName</code>.
+ */
+ exception DuplicateName {
+ /**
+ * The name for which there was already an interceptor registered.
+ */
+ string name;
+ };
+
+ /**
+ * This exception is thrown by
+ * <code>register_initial_reference</code> and
+ * <code>resolve_initial_references</code>.
+ * <code>register_initial_reference</code> throws <code>InvalidName</code>
+ * if:
+ * <ul>
+ * <li>this operation is called with an empty string id; or</li>
+ * <li>this operation is called with an id that is already registered,
+ * including the default names defined by OMG.</li>
+ * </ul>
+ * <code>resolve_initial_references</code> throws
+ * <code>InvalidName</code> if the name to be resolved is invalid.
+ */
+ exception InvalidName {};
+
+ /**
+ * Returns the arguments passed to <code>ORB.init</code>. They may or
+ * may not contain the ORB's arguments.
+ */
+ readonly attribute CORBA::StringSeq arguments;
+
+ /**
+ * Returns the ID of the ORB being initialized.
+ */
+ readonly attribute string orb_id;
+
+ /**
+ * Returns the <code>IOP.CodecFactory</code>. The
+ * <code>CodecFactory</code> is normally obtained via a call to
+ * <code>ORB.resolve_initial_references( "CodecFactory" )</code>, but
+ * since the ORB is not yet available and Interceptors, particularly when
+ * processing service contexts, will require a <code>Codec</code>, a
+ * means of obtaining a <code>Codec</code> is necessary during ORB
+ * initialization.
+ */
+ readonly attribute IOP::CodecFactory codec_factory;
+
+ /**
+ * Identical to <code>ORB.register_initial_reference</code>. 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. The only difference
+ * is that the version of this operation on the ORB uses PIDL
+ * (<code>CORBA.ORB.ObjectId</code>) and
+ * (<code>CORBA.ORB.InvalidName</code>) whereas the version in this
+ * interface uses IDL defined in this interface; the semantics are
+ * identical.
+ */
+ void register_initial_reference (in ObjectId id, in Object obj)
+ raises (InvalidName);
+
+ // This was incorrectly returning void in orbos/99-12-02, correction
+ // from errata in orbos/00-01-01
+ /**
+ * Identical to <code>ORB.resolve_initial_references</code>. 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. The only difference is that
+ * the version of this operation on the ORB uses PIDL
+ * (<code>CORBA::ORB::ObjectId</code> and
+ * <code>CORBA::ORB::InvalidName</code>) whereas the version in this
+ * interface uses IDL defined in this interface; the semantics
+ * are identical.
+ * <p>
+ * This operation is only valid during post_init.
+ */
+ Object resolve_initial_references (in ObjectId id) raises (InvalidName);
+
+ /**
+ * Used to add a client-side request Interceptor to the list of
+ * client-side request Interceptors.
+ *
+ * @param interceptor The <code>ClientRequestInterceptor</code> to be
+ * added.
+ * @exception DuplicateName thrown if a client-side request Interceptor
+ * has already been registered with this Interceptor's name.
+ */
+ void add_client_request_interceptor
+ (in ClientRequestInterceptor interceptor)
+ raises (DuplicateName);
+
+ /**
+ * Used to add a server-side request Interceptor to the list of
+ * server-side request Interceptors.
+ *
+ * @param interceptor The ServerRequestInterceptor to be added.
+ * @exception DuplicateName thrown if a server-side request Interceptor
+ * has already been registered with this Interceptor's name
+ */
+ void add_server_request_interceptor (
+ in ServerRequestInterceptor interceptor)
+ raises (DuplicateName);
+
+ /**
+ * Used to add an IOR Interceptor to the list of IOR Interceptors.
+ *
+ * @param interceptor The IORInterceptor to be added.
+ * @exception DuplicateName thrown if an IOR Interceptor has already
+ * been registered with this Interceptor's name.
+ */
+ void add_ior_interceptor (in IORInterceptor interceptor)
+ raises (DuplicateName);
+
+ /**
+ * Called to allocate a slot on <code>PortableInterceptor.Current</code>.
+ * <p>
+ * Note that while slot id's can be allocated within an ORB initializer,
+ * the slots themselves cannot be initialized.
+ *
+ * @return The index to the slot which has been allocated.
+ * @exception BAD_INV_ORDER thrown, with a standard minor code of 14, if
+ * <code>set_slot</code> or <code>get_slot</code> is called on the
+ * <code>PICurrent</code> within an ORB initializer.
+ * @see Current
+ */
+ SlotId allocate_slot_id ();
+
+ /**
+ * Registers a <code>PolicyFactory</code> for the given
+ * <code>PolicyType</code>.
+ *
+ * @param type The policy type that the given <code>PolicyFactory</code>
+ * serves.
+ * @param policy_factory The factory for the given policy type.
+ * @exception BAD_INV_ORDER thrown, with a standard minor code of 16, if
+ * a <code>PolicyFactory</code> already exists for the given
+ * <code>PolicyType</code>.
+ */
+ void register_policy_factory (
+ in CORBA::PolicyType type,
+ in PolicyFactory policy_factory);
+ };
+
+ /**
+ * Facilitates interceptor registration and ORB initialization.
+ * <p>
+ * Interceptors are intended to be a means by which ORB services gain
+ * access to ORB processing, effectively becoming part of the ORB.
+ * Since Interceptors are part of the ORB, when <code>ORB.init</code>
+ * returns an ORB, the Interceptors shall have been registered.
+ * Interceptors cannot be registered on an ORB after it has been
+ * returned by a call to <code>ORB.init</code>.
+ * <p>
+ * An Interceptor is registered by registering an associated
+ * <code>ORBInitializer</code> object which implements the
+ * <code>ORBInitializer</code> interface. When an ORB is initializing,
+ * it shall call each registered <code>ORBInitializer</code>, passing it
+ * an <code>ORBInitInfo</code> object which is used to register its
+ * Interceptor.
+ * <p>
+ * <b>Registering ORB Initializers in Java</b>
+ * <p>
+ * ORBInitializers are registered via Java ORB properties.
+ * <p>
+ * The property names are of the form:
+ * <blockquote><code>
+ * org.omg.PortableInterceptor.ORBInitializerClass.&lt;Service&gt;
+ * </code></blockquote>
+ * where <code>&lt;Service&gt;</code> is the string name of a class
+ * which implements
+ * <blockquote><code>
+ * org.omg.PortableInterceptor.ORBInitializer
+ * </code></blockquote>
+ * To avoid name collisions, the reverse DNS name convention should be
+ * used. For example, if company X has three initializers, it could define
+ * the following properties:
+ * <ul>
+ * <li><code>
+ * org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init1
+ * </code></li>
+ * <li><code>
+ * org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init2
+ * </code></li>
+ * <li><code>
+ * org.omg.PortableInterceptor.ORBInitializerClass.com.x.Init3
+ * </code></li>
+ * </ul>
+ * During ORB.init, these ORB properties which begin with
+ * <code>org.omg.PortableInterceptor.ORBInitializerClass</code> shall be
+ * collected, the <code>&lt;Service&gt;</code> portion of each property
+ * shall be extracted, an object shall be instantiated with the
+ * <code>&lt;Service&gt;</code> string as its class name, and the
+ * <code>pre_init</code> and <code>post_init</code> methods shall be
+ * called on that object. If there are any exceptions, the ORB shall
+ * ignore them and proceed.
+ * <p>
+ * <b><i>Example</i></b>
+ * <p>
+ * A client-side logging service written by company X, for example, may
+ * have the following ORBInitializer implementation:
+ * <pre><code>
+ * package com.x.logging;
+ *
+ * import org.omg.PortableInterceptor.Interceptor;
+ * import org.omg.PortableInterceptor.ORBInitializer;
+ * import org.omg.PortableInterceptor.ORBInitInfo;
+ *
+ * public class LoggingService implements ORBInitializer {
+ * void pre_init( ORBInitInfo info ) {
+ * // Instantiate the Logging Service s Interceptor.
+ * Interceptor interceptor = new LoggingInterceptor();
+ *
+ * // Register the Logging Service s Interceptor.
+ * info.add_client_request_interceptor( interceptor );
+ * }
+ *
+ * void post_init( ORBInitInfo info ) {
+ * // This service does not need two init points.
+ * }
+ * }
+ * </code></pre>
+ * To run a program called <code>MyApp</code> using this logging
+ * service, the user could type:
+ * <blockquote><code>
+ * java
+ *-Dorg.omg.PortableInterceptor.ORBInitializerClass.com.x.Logging.LoggingService
+ * MyApp
+ * </code></blockquote>
+ * <p>
+ * <b>Notes about Registering Interceptors</b>
+ * <p>
+ * Request Interceptors are registered on a per-ORB basis.
+ * <p>
+ * To achieve virtual per-object Interceptors, query the policies on the
+ * target from within the interception points to determine whether they
+ * should do any work.
+ * <p>
+ * To achieve virtual per-POA Interceptors, instantiate each POA with a
+ * different ORB. While Interceptors may be ordered administratively,
+ * there is no concept of order with respect to the registration of
+ * Interceptors. Request Interceptors are concerned with service contexts.
+ * Service contexts have no order, so there is no purpose for request
+ * Interceptors to have an order. IOR Interceptors are concerned with
+ * tagged components. Tagged components also have no order, so there
+ * is no purpose for IOR Interceptors to have an order.
+ * <p>
+ * Registration code should avoid using the ORB (i.e., calling
+ * <code>ORB.init</code> with the provided <code>orb_id</code>). Since
+ * registration occurs during ORB initialization, results of invocations
+ * on this ORB while it is in this state are undefined.
+ *
+ * @see ORBInitInfo
+ */
+ local interface ORBInitializer {
+
+ /**
+ * Called during ORB initialization. If it is expected that initial
+ * services registered by an interceptor will be used by other
+ * interceptors, then those initial services shall be registered at
+ * this point via calls to
+ * <code>ORBInitInfo.register_initial_reference</code>.
+ *
+ * @param info provides initialization attributes and operations by
+ * which Interceptors can be registered.
+ */
+ void pre_init (in ORBInitInfo info);
+
+ /**
+ * Called during ORB initialization. If a service must resolve initial
+ * references as part of its initialization, it can assume that all
+ * initial references will be available at this point.
+ * <p>
+ * Calling the <code>post_init</code> operations is not the final
+ * task of ORB initialization. The final task, following the
+ * <code>post_init</code> calls, is attaching the lists of registered
+ * interceptors to the ORB. Therefore, the ORB does not contain the
+ * interceptors during calls to <code>post_init</code>. If an
+ * ORB-mediated call is made from within <code>post_init</code>, no
+ * request interceptors will be invoked on that call.
+ * Likewise, if an operation is performed which causes an IOR to be
+ * created, no IOR interceptors will be invoked.
+ *
+ * @param info provides initialization attributes and
+ * operations by which Interceptors can be registered.
+ */
+ void post_init (in ORBInitInfo info);
+ };
+};
diff --git a/src/java.corba/share/classes/org/omg/PortableInterceptor/Messaging.idl b/src/java.corba/share/classes/org/omg/PortableInterceptor/Messaging.idl
new file mode 100644
index 0000000..32690f5
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableInterceptor/Messaging.idl
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2000, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#ifndef _MESSAGING_IDL_
+#define _MESSAGING_IDL_
+
+#pragma prefix "omg.org"
+
+module Messaging {
+
+ /** Synchronization scope */
+ typedef short SyncScope;
+
+ /**
+ * Constant, defined in the Messaging spec, to define how far the
+ * request shall progress before control is returned to the client.
+ */
+ const SyncScope SYNC_WITH_TRANSPORT = 1;
+};
+
+#endif // _MESSAGING_IDL_
+
diff --git a/src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html b/src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html
new file mode 100644
index 0000000..9c4034e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableInterceptor/ORBInitInfoPackage/package.html
@@ -0,0 +1,52 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+-->
+
+</head>
+<body bgcolor="white">
+<P>This package contains the exceptions and typedefs from the <code>ORBInitInfo</code>
+local interface of the <code>PortableInterceptor</code> module specified in the OMG
+Portable Interceptor specification,
+<a href="http://www.omg.org/cgi-bin/doc?ptc/2000-08-06">
+ptc/2000-08-06</a>, section 21.7.2. Please
+refer to that OMG specification for further details.
+
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html b/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html
new file mode 100644
index 0000000..f35c534
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableInterceptor/package.html
@@ -0,0 +1,103 @@
+<!doctype html>
+<html>
+<head>
+<!--
+
+Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+This code is free software; you can redistribute it and/or modify it
+under the terms of the GNU General Public License version 2 only, as
+published by the Free Software Foundation. Oracle designates this
+particular file as subject to the "Classpath" exception as provided
+by Oracle in the LICENSE file that accompanied this code.
+
+This code is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+version 2 for more details (a copy is included in the LICENSE file that
+accompanied this code).
+
+You should have received a copy of the GNU General Public License version
+2 along with this work; if not, write to the Free Software Foundation,
+Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+or visit www.oracle.com if you need additional information or have any
+questions.
+
+-->
+
+</head>
+<body>
+
+Provides a mechanism to register ORB hooks through which ORB services
+can intercept the normal flow of execution of the ORB.
+
+<h2>Interceptor Types</h2>
+There are currently three types of interceptors that can be registered:
+<ul>
+ <li>{@link org.omg.PortableInterceptor.IORInterceptor IORInterceptor} -
+ Used to establish tagged components in the profiles within an IOR.</li>
+ <li>{@link org.omg.PortableInterceptor.ClientRequestInterceptor
+ClientRequestInterceptor} -
+ Intercepts the flow of a request/reply sequence through the ORB on
+ the <i>client</i> side.</li>
+ <li>{@link org.omg.PortableInterceptor.ServerRequestInterceptor
+ServerRequestInterceptor} -
+ Intercepts the flow of a request/reply sequence through the ORB on
+ the <i>server</i> side.</li>
+</ul>
+See the javadocs for class <code>
+{@link org.omg.PortableInterceptor.ORBInitializer ORBInitializer}</code>
+for how to go about registering interceptors.
+
+<a id="unimpl"></a>
+<h2>Known limitations / unimplemented methods in package
+<code>org.omg.PortableInterceptor</code></h2>
+
+<ul>
+ <li>
+ <code><b>RequestInfo</b></code>
+ <ul>
+ <li><code><b>sync_scope()</b></code>: Always returns SYNC_WITH_TRANSPORT</li>
+ <li><code><b>arguments()</b></code>: Only supported for DII/DSI calls</li>
+ <li><code><b>exceptions()</b></code>: Only supported for DII calls on client side.
+ Not supported on server-side.</li>
+ <li><code><b>contexts()</b></code>: Only supported for DII calls on client side.
+ Not supported on server-side since our ORB does not send contexts.
+ </li>
+ <li><code><b>operation_context()</b></code>: Only supported for DII calls
+ on client side. Not supported on server-side since ORB
+ does not send contexts.</li>
+ <li><code><b>result()</b></code>: Only supported for DII/DSI calls</li>
+ </ul>
+ </li>
+ <li>
+ <code><b>ClientRequestInfo</b></code>
+ <ul>
+ <li><code><b>received_exception_id()</b></code>: Always returns null in the
+ DII case</li>
+ <li><code><b>get_request_policy(int type)</b></code>: Not implemented.</li>
+ </ul>
+ </li>
+ <li>
+ <code><b>ServerRequestInfo</b></code>
+ <ul>
+ <li><code><b>sending_exception()</b></code>: Does not support user exceptions on
+ the server side in non-DSI case.</li>
+ </ul>
+ </li>
+</ul>
+
+<h2>Package Specification</h2>
+<P>For a precise list of supported sections of official OMG specifications with which
+the Java[tm] Platform, Standard Edition 6 complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/CurrentHelper.java b/src/java.corba/share/classes/org/omg/PortableServer/CurrentHelper.java
new file mode 100644
index 0000000..82ec778
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/CurrentHelper.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.PortableServer;
+
+
+/**
+* org/omg/PortableServer/CurrentHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.1"
+* from ../../../../src/share/classes/org/omg/PortableServer/poa.idl
+* Tuesday, October 23, 2001 1:17:01 PM PDT
+*/
+
+
+/**
+ * The PortableServer::Current interface, derived from
+ * CORBA::Current, provides method implementations with
+ * access to the identity of the object on which the
+ * method was invoked. The Current interface is provided
+ * to support servants that implement multiple objects,
+ * but can be used within the context of POA-dispatched
+ * method invocations on any servant. To provide location
+ * transparency, ORBs are required to support use of
+ * Current in the context of both locally and remotely
+ * invoked operations. An instance of Current can be
+ * obtained by the application by issuing the
+ * CORBA::ORB::resolve_initial_references("POACurrent")
+ * operation. Thereafter, it can be used within the
+ * context of a method dispatched by the POA to obtain
+ * the POA and ObjectId that identify the object on
+ * which that operation was invoked.
+ */
+abstract public class CurrentHelper
+{
+ private static String _id = "IDL:omg.org/PortableServer/Current:2.3";
+
+ public static void insert (org.omg.CORBA.Any a,
+ org.omg.PortableServer.Current 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.PortableServer.Current 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 (
+ org.omg.PortableServer.CurrentHelper.id (), "Current");
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.PortableServer.Current read (
+ org.omg.CORBA.portable.InputStream istream)
+ {
+ throw new org.omg.CORBA.MARSHAL ();
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream,
+ org.omg.PortableServer.Current value)
+ {
+ throw new org.omg.CORBA.MARSHAL ();
+ }
+
+ public static org.omg.PortableServer.Current narrow (
+ org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.omg.PortableServer.Current)
+ return (org.omg.PortableServer.Current)obj;
+ else if (!obj._is_a (id ()))
+ throw new org.omg.CORBA.BAD_PARAM ();
+ return null;
+ }
+
+}
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/CurrentPackage/package.html b/src/java.corba/share/classes/org/omg/PortableServer/CurrentPackage/package.html
new file mode 100644
index 0000000..cb33802
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/CurrentPackage/package.html
@@ -0,0 +1,61 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+
+-->
+
+</head>
+<body bgcolor="white">
+<P> Provides method implementations with
+ access to the identity of the object on which the
+ method was invoked. The <code>Current</code> package
+ supports servants that implement multiple objects,
+ but can be used within the context of POA-dispatched
+ method invocations on any servant. To provide location
+ transparency, ORBs are required to support use of
+ <code>Current</code> in the context of both locally and remotely
+ invoked operations. An instance of <code>Current</code> can be
+ obtained by the application by issuing the
+ <code>CORBA::ORB::resolve_initial_references("POACurrent")</code>
+ operation. Thereafter, it can be used within the
+ context of a method dispatched by the POA to obtain
+ the <code>POA</code> and <code>ObjectId</code> that identify the object on
+ which that operation was invoked.
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/DynamicImplementation.java b/src/java.corba/share/classes/org/omg/PortableServer/DynamicImplementation.java
new file mode 100644
index 0000000..aaac51e
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/DynamicImplementation.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.PortableServer;
+
+/**
+ * Allows dynamic handling of object invocations. POA-based DSI
+ * servants inherit from the
+ * standard <code>DynamicImplementation</code> class, this class inherits
+ * from the <code>Servant</code> class. Based on IDL to Java spec.
+ * CORBA V 2.3.1 ptc/00-01-08.pdf.
+ */
+abstract public class DynamicImplementation extends Servant {
+
+/**
+ * Receives requests issued to any CORBA object
+ * incarnated by the DSI servant and performs the processing
+ * necessary to execute the request.
+ * @param request the request issued to the CORBA object.
+ */
+ abstract public void invoke(org.omg.CORBA.ServerRequest request);
+}
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/POAHelper.java b/src/java.corba/share/classes/org/omg/PortableServer/POAHelper.java
new file mode 100644
index 0000000..7a37689
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/POAHelper.java
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.PortableServer;
+
+/**
+* org/omg/PortableServer/POAHelper.java .
+* Generated by the IDL-to-Java compiler (portable), version "3.1"
+* from ../../../../src/share/classes/org/omg/PortableServer/poa.idl
+* Tuesday, October 23, 2001 1:16:58 PM PDT
+*/
+
+
+/**
+ * A POA object manages the implementation of a
+ * collection of objects. The POA supports a name space
+ * for the objects, which are identified by Object Ids.
+ * A POA also provides a name space for POAs. A POA is
+ * created as a child of an existing POA, which forms a
+ * hierarchy starting with the root POA. A POA object
+ * must not be exported to other processes, or
+ * externalized with ORB::object_to_string.
+ */
+abstract public class POAHelper
+{
+ private static String _id = "IDL:omg.org/PortableServer/POA:2.3";
+
+ public static void insert (org.omg.CORBA.Any a,
+ org.omg.PortableServer.POA 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.PortableServer.POA 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 (org.omg.PortableServer.POAHelper.id (), "POA");
+ }
+ return __typeCode;
+ }
+
+ public static String id ()
+ {
+ return _id;
+ }
+
+ public static org.omg.PortableServer.POA read (
+ org.omg.CORBA.portable.InputStream istream)
+ {
+ throw new org.omg.CORBA.MARSHAL ();
+ }
+
+ public static void write (org.omg.CORBA.portable.OutputStream ostream,
+ org.omg.PortableServer.POA value)
+ {
+ throw new org.omg.CORBA.MARSHAL ();
+ }
+
+ public static org.omg.PortableServer.POA narrow (org.omg.CORBA.Object obj)
+ {
+ if (obj == null)
+ return null;
+ else if (obj instanceof org.omg.PortableServer.POA)
+ return (org.omg.PortableServer.POA)obj;
+ else if (!obj._is_a (id ()))
+ throw new org.omg.CORBA.BAD_PARAM ();
+ return null;
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/POAManagerPackage/package.html b/src/java.corba/share/classes/org/omg/PortableServer/POAManagerPackage/package.html
new file mode 100644
index 0000000..7bdbaec
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/POAManagerPackage/package.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+
+-->
+
+</head>
+<body bgcolor="white">
+<P>
+Encapsulates the processing
+ state of the POAs it is associated with. Each <code>POA</code> object has an associated <code>POAManager</code> object. A POA manager may be associated with one or more
+ POA objects.
+
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html b/src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html
new file mode 100644
index 0000000..3cda2fb
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/POAPackage/package.html
@@ -0,0 +1,82 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+
+-->
+
+</head>
+<body bgcolor="white">
+
+<P>Allows programmers to construct object implementations that are portable
+between different ORB products.
+
+<P>The Portable Object Adaptor (POA) is designed to meet the following goals:
+<UL>
+<LI>Allow programmers to construct object implementations that are portable between different ORB products.
+<LI>Provide support for objects with persistent identities.
+<LI>Provide support for transparent activation of objects.
+<LI>Allow a single servant to support multiple object identities simultaneously.
+</UL>
+
+
+
+<P>Given an interface <code>My</code> defined in <code>My.idl</code>, the file <code>MyPOA.java</code>
+is generated by the <code>idlj</code> compiler. You must provide
+the implementation for <code>My</code> and it must inherit from <code>MyPOA</code>.
+
+<P><code>MyPOA.java</code> is a stream-based skeleton that extends
+<code>org.omg.PortableServer.Servant</code> and implements the <code>InvokeHandler</code>
+interface and the operations interface associated with the IDL interface the skeleton implements.
+
+<P>The <code>PortableServer</code> module for the Portable Object Adapter (POA)
+defines the native <code>Servant</code> type. In the Java programming language,
+the <code>Servant</code> type is mapped to the Java <code>org.omg.PortableServer.Servant</code> class.
+It serves as the base class for all POA servant implementations
+and provides a number of methods that may be invoked by the application programmer,
+as well as methods which are invoked by the POA itself
+and may be overridden by the user to control aspects of servant behavior.
+
+
+
+<P>All Mapping corresponds to the Chapter 11 of
+ CORBA V2.3.1 specified by OMG document formal/99-10-07.pdf.
+ The exception to this is the <code>id</code> attribute, which is added in ptc/00-08-06,
+ section 11.3.8.26.
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6, ORB complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/Servant.java b/src/java.corba/share/classes/org/omg/PortableServer/Servant.java
new file mode 100644
index 0000000..de960bb
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/Servant.java
@@ -0,0 +1,266 @@
+/*
+ * Copyright (c) 1997, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.PortableServer;
+
+import org.omg.CORBA.ORB;
+import org.omg.PortableServer.portable.Delegate;
+
+/**
+ * Defines the native <code>Servant</code> type. In Java, the
+ * <code>Servant</code> type is mapped to the Java
+ * <code>org.omg.PortableServer.Servant</code> class.
+ * It serves as the base class for all POA servant
+ * implementations and provides a number of methods that may
+ * be invoked by the application programmer, as well as methods
+ * which are invoked by the POA itself and may be overridden by
+ * the user to control aspects of servant behavior.
+ * Based on IDL to Java spec. (CORBA V2.3.1) ptc/00-01-08.pdf.
+ */
+
+abstract public class Servant {
+
+ private transient Delegate _delegate = null;
+ /**
+ * Gets the ORB vendor-specific implementation of
+ * <code>PortableServer::Servant</code>.
+ * @return <code>_delegate</code> the ORB vendor-specific
+ * implementation of <code>PortableServer::Servant</code>.
+ */
+ final public Delegate _get_delegate() {
+ if (_delegate == null) {
+ throw
+ new
+ org.omg.CORBA.BAD_INV_ORDER
+ ("The Servant has not been associated with an ORB instance");
+ }
+ return _delegate;
+ }
+
+ /**
+ * Supports the Java ORB portability
+ * interfaces by providing a method for classes that support
+ * ORB portability through delegation to set their delegate.
+ * @param delegate ORB vendor-specific implementation of
+ * the <code>PortableServer::Servant</code>.
+ */
+ final public void _set_delegate(Delegate delegate) {
+ _delegate = delegate;
+ }
+
+ /**
+ * Allows the servant to obtain the object reference for
+ * the target CORBA object it is incarnating for that request.
+ * @return <code>this_object</code> <code>Object</code> reference
+ * associated with the request.
+ */
+ final public org.omg.CORBA.Object _this_object() {
+ return _get_delegate().this_object(this);
+ }
+
+ /**
+ * Allows the servant to obtain the object reference for
+ * the target CORBA Object it is incarnating for that request.
+ * @param orb ORB with which the servant is associated.
+ * @return <code>_this_object</code> reference associated with the request.
+ */
+ final public org.omg.CORBA.Object _this_object(ORB orb) {
+ try {
+ ((org.omg.CORBA_2_3.ORB)orb).set_delegate(this);
+ }
+ catch(ClassCastException e) {
+ throw
+ new
+ org.omg.CORBA.BAD_PARAM
+ ("POA Servant requires an instance of org.omg.CORBA_2_3.ORB");
+ }
+ return _this_object();
+ }
+
+ /**
+ * Returns the instance of the ORB
+ * currently associated with the <code>Servant</code> (convenience method).
+ * @return <code>orb</code> the instance of the ORB currently
+ * associated with the <code>Servant</code>.
+ */
+ final public ORB _orb() {
+ return _get_delegate().orb(this);
+ }
+
+ /**
+ * Allows easy execution of common methods, equivalent to
+ * <code>PortableServer::Current:get_POA</code>.
+ * @return <code>poa</code> POA associated with the servant.
+ */
+ final public POA _poa() {
+ return _get_delegate().poa(this);
+ }
+
+ /**
+ * Allows easy execution of
+ * common methods, equivalent
+ * to calling <code>PortableServer::Current::get_object_id</code>.
+ * @return <code>object_id</code> the <code>Object</code> ID associated
+ * with this servant.
+ */
+ final public byte[] _object_id() {
+ return _get_delegate().object_id(this);
+ }
+
+ /**
+ * Returns the
+ * root POA from the ORB instance associated with the servant.
+ * Subclasses may override this method to return a different POA.
+ * @return <code>default_POA</code> the POA associated with the
+ * <code>Servant</code>.
+ */
+ public POA _default_POA() {
+ return _get_delegate().default_POA(this);
+ }
+
+ /**
+ * Checks to see if the specified <code>repository_id</code> is present
+ * on the list returned by <code>_all_interfaces()</code> or is the
+ * <code>repository_id</code> for the generic CORBA Object.
+ * @param repository_id the <code>repository_id</code>
+ * to be checked in the repository list or against the id
+ * of generic CORBA objects.
+ * @return <code>is_a</code> boolean indicating whether the specified
+ * <code>repository_id</code> is
+ * in the repository list or is same as a generic CORBA
+ * object.
+ */
+ public boolean _is_a(String repository_id) {
+ return _get_delegate().is_a(this, repository_id);
+ }
+
+ /**
+ * Checks for the existence of an
+ * <code>Object</code>.
+ * The <code>Servant</code> provides a default implementation of
+ * <code>_non_existent()</code> that can be overridden by derived servants.
+ * @return <code>non_existent</code> <code>true</code> if that object does
+ * not exist, <code>false</code> otherwise.
+ */
+ public boolean _non_existent() {
+ return _get_delegate().non_existent(this);
+ }
+
+ // Ken and Simon will ask about editorial changes
+ // needed in IDL to Java mapping to the following
+ // signature.
+ /**
+ * Returns an object in the Interface Repository
+ * which provides type information that may be useful to a program.
+ * <code>Servant</code> provides a default implementation of
+ * <code>_get_interface()</code>
+ * that can be overridden by derived servants if the default
+ * behavior is not adequate.
+ * @return <code>get_interface</code> type information that corresponds to this servant.
+ */
+ /*
+ public org.omg.CORBA.Object _get_interface() {
+ return _get_delegate().get_interface(this);
+ }
+ */
+
+ // _get_interface_def() replaces the _get_interface() method
+
+ /**
+ * Returns an <code>InterfaceDef</code> object as a
+ * <code>CORBA::Object</code> that defines the runtime type of the
+ * <code>CORBA::Object</code> implemented by the <code>Servant</code>.
+ * The invoker of <code>_get_interface_def</code>
+ * must narrow the result to an <code>InterfaceDef</code> in order
+ * to use it.
+ * <P>This default implementation of <code>_get_interface_def()</code>
+ * can be overridden
+ * by derived servants if the default behavior is not adequate.
+ * As defined in the CORBA 2.3.1 specification, section 11.3.1, the
+ * default behavior of <code>_get_interface_def()</code> is to use
+ * the most derived
+ * interface of a static servant or the most derived interface retrieved
+ * from a dynamic servant to obtain the <code>InterfaceDef</code>.
+ * This behavior must
+ * be supported by the <code>Delegate</code> that implements the
+ * <code>Servant</code>.
+ * @return <code>get_interface_def</code> an <code>InterfaceDef</code>
+ * object as a
+ * <code>CORBA::Object</code> that defines the runtime type of the
+ * <code>CORBA::Object</code> implemented by the <code>Servant</code>.
+ */
+ public org.omg.CORBA.Object _get_interface_def()
+ {
+ // First try to call the delegate implementation class's
+ // "Object get_interface_def(..)" method (will work for ORBs
+ // whose delegates implement this method).
+ // Else call the delegate implementation class's
+ // "InterfaceDef get_interface(..)" method using reflection
+ // (will work for ORBs that were built using an older version
+ // of the Delegate interface with a get_interface method
+ // but not a get_interface_def method).
+
+ org.omg.PortableServer.portable.Delegate delegate = _get_delegate();
+ try {
+ // If the ORB's delegate class does not implement
+ // "Object get_interface_def(..)", this will throw
+ // an AbstractMethodError.
+ return delegate.get_interface_def(this);
+ } catch( AbstractMethodError aex ) {
+ // Call "InterfaceDef get_interface(..)" method using reflection.
+ try {
+ Class[] argc = { org.omg.PortableServer.Servant.class };
+ java.lang.reflect.Method meth =
+ delegate.getClass().getMethod("get_interface", argc);
+ Object[] argx = { this };
+ return (org.omg.CORBA.Object)meth.invoke(delegate, argx);
+ } catch( java.lang.reflect.InvocationTargetException exs ) {
+ Throwable t = exs.getTargetException();
+ if (t instanceof Error) {
+ throw (Error) t;
+ } else if (t instanceof RuntimeException) {
+ throw (RuntimeException) t;
+ } else {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+ } catch( RuntimeException rex ) {
+ throw rex;
+ } catch( Exception exr ) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+ }
+ }
+
+ // methods for which the user must provide an
+ // implementation
+ /**
+ * Used by the ORB to obtain complete type
+ * information from the servant.
+ * @param poa POA with which the servant is associated.
+ * @param objectId is the id corresponding to the object
+ * associated with this servant.
+ * @return list of type information for the object.
+ */
+ abstract public String[] _all_interfaces( POA poa, byte[] objectId);
+}
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java b/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java
new file mode 100644
index 0000000..76c8030
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/CookieHolder.java
@@ -0,0 +1,57 @@
+/*
+ * Copyright (c) 1998, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package org.omg.PortableServer.ServantLocatorPackage;
+
+/**
+ * The native type PortableServer::ServantLocator::Cookie is mapped
+ * to java.lang.Object. A CookieHolder class is provided for passing
+ * the Cookie type as an out parameter. The CookieHolder class
+ * follows exactly the same pattern as the other holder classes
+ * for basic types.
+ */
+
+final public class CookieHolder implements org.omg.CORBA.portable.Streamable
+{
+ public java.lang.Object value;
+
+ public CookieHolder() { }
+
+ public CookieHolder(java.lang.Object initial) {
+ value = initial;
+ }
+
+ public void _read( org.omg.CORBA.portable.InputStream is) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ public void _write( org.omg.CORBA.portable.OutputStream os) {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+
+ public org.omg.CORBA.TypeCode _type() {
+ throw new org.omg.CORBA.NO_IMPLEMENT();
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html b/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html
new file mode 100644
index 0000000..a409400
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/ServantLocatorPackage/package.html
@@ -0,0 +1,51 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+
+-->
+
+</head>
+<body bgcolor="white">
+Provides classes and interfaces for locating the servant.
+
+<P>This package supplies a <code>CookieHolder</code> class for passing
+the <code>Cookie</code> type as an <code>out</code> parameter. The <code>CookieHolder</code> class
+follows exactly the same pattern as the other holder classes for basic types.
+
+<H2>Package Specification</H2>
+
+<P>For a precise list of supported sections of official OMG specifications with which
+the Java[tm] Platform, Standard Edition 6 complies, see <A
+HREF="../../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/corba.idl b/src/java.corba/share/classes/org/omg/PortableServer/corba.idl
new file mode 100644
index 0000000..6d0a028
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/corba.idl
@@ -0,0 +1,101 @@
+/*
+ * Copyright (c) 1997, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+
+// minimal definitions to keep idltojava happy while compiling poa.idl
+#pragma prefix "omg.org"
+
+module CORBA {
+
+ typedef string Identifier;
+ typedef string RepositoryId;
+
+ // basic Policy definition
+ typedef unsigned long PolicyType ;
+
+ /** The Policy interface provides a mechanism for ORBs and Object
+ * Services to allow access to certain choices that affect their
+ * operation. This information is accessed in a structured manner
+ * using interfaces derived from the org.omg.CORBA.Policy interface.
+ */
+ interface Policy {
+ /** Return the constant value that corresponds to the
+ * type of the policy object. The values of
+ * the polivy objectys are allocated by the OMG.
+ * New values for PolicyType should be obtained from the OMG by
+ * sending mail to request@omg.org. In general the constant
+ * values that are allocated are defined in conjunction with
+ * the definition of the corresponding policy object.
+ * @return the constant value that corresponds to the type of
+ * the policy object.
+ */
+ readonly attribute PolicyType policy_type;
+
+ /** Copies the policy object. The copy does not retain any
+ * relationships that the policy had with any domain or object.
+ * @return the copy of the policy object.
+ */
+ Policy copy( );
+
+ /** Destroys the policy object. It is the responsibility of
+ * the policy object to determine whether it can be destroyed.
+ */
+ void destroy( );
+ };
+
+ typedef sequence <Policy> PolicyList;
+
+ /**
+ * An interface that makes it possible to access information
+ * associated with a particular thread of execution, such as
+ * security information or a transaction identifier.
+ * <P>
+ * An ORB or CORBA service that needs its own thread-specific
+ * state extends the CORBA package's <code>Current</code>.
+ * Users of the service can obtain an instance of the appropriate
+ * <code>Current</code> interface by invoking
+ * <code>ORB.resolve_initial_references</code>.
+ * For example, the Security service obtains the <code>Current</code>
+ * relevant to it by invoking
+ * <PRE>
+ * ORB.resolve_initial_references("SecurityCurrent");
+ * </PRE>
+ * <P>
+ * A CORBA service does not have to use this method of keeping context
+ * but may choose to do so.
+ * <P>
+ * Methods on classes that implement from <code>Current</code> access state
+ * associated with the thread in which they are invoked, not state associated
+ * with the thread from which the <code>Current</code> was obtained.
+ * Current objects must not be exported to other processes, or externalized
+ * with ORB.object_to_string. If any attempt is made to do so, the offending
+ * operation will raise a MARSHAL system exception.
+ * @see <a href="package-summary.html#unimpl"><code>portable</code>
+ * package comments for unimplemented features</a>
+ */
+ interface Current { };
+};
+
+
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/package.html b/src/java.corba/share/classes/org/omg/PortableServer/package.html
new file mode 100644
index 0000000..ab441f9
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/package.html
@@ -0,0 +1,230 @@
+<!doctype html>
+<html>
+<head>
+<!--
+
+ Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+
+-->
+
+</head>
+<body>
+Provides classes and interfaces for making the server side of your applications
+portable across multivendor ORBs.
+
+<P>In Java, Portable Object Adaptor (POA)-based Dynamic Skeleton Interface (DSI)
+servants inherit from the standard <code>DynamicImplementation</code> class, which
+inherits from the <code>Servant</code> class. The native <code>Servant</code> type is
+defined by the <code>PortableServer</code> module for the POA. In Java, the
+ <code>Servant</code> type is mapped to the Java
+ <code>org.omg.PortableServer.Servant</code> class.
+ It serves as the base class for all POA servant
+ implementations and provides a number of methods that may
+ be invoked by the application programmer, as well as methods
+ which are invoked by the POA itself and may be overridden by
+ the user to control aspects of servant behavior.
+
+<H2>Package Specification</H2>
+
+<P>For a precise list of supported sections of official OMG specifications with which
+the Java[tm] Platform, Standard Edition 6 complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+<H2>POA-related Interfaces</H2>
+
+<P>The <code>PortableServer</code> module defines the following POA-related interfaces:
+<UL>
+ <LI><code>POA</code>
+ <LI><code>POAManager</code>
+ <LI><code>ServantManager</code>
+ <LI><code>ServantActivator</code>
+ <LI><code>ServantLocator</code>
+ <LI><code>AdapterActivator</code>
+ <LI><code>ThreadPolicy</code>
+ <LI><code>LifespanPolicy</code>
+ <LI><code>IdUniquenessPolicy</code>
+ <LI><code>IdAssignmentPolicy</code>
+ <LI><code>ImplicitActivationPolicy</code>
+ <LI><code>ServantRetentionPolicy</code>
+ <LI><code>RequestProcessingPolicy</code>
+ <LI><code>Current</code>
+</UL>
+
+<P>In addition, the POA defines the <code>Servant</code> native type.
+
+<H3>Operations classes</H3>
+
+<P>Each of the interfaces listed above has an associated <code>Operations</code> interface.
+The <code>Operations</code> interface is generated by the <code>idlj</code> compiler and
+contains the method signatures for methods defined in its associated interface.
+The <code>Operations</code> interface can be accessed by both the client and the server,
+while its associated interface can only be called by the client.
+
+<H3>Value Classes</H3>
+
+Classes ending in the suffix <code>PolicyValue</code> provide the values used
+for the <code>create_POA</code> call, which sets the policy for the POA. See
+the <a href="#sampleserver">sample code</a> below for a demonstration.
+<code>PolicyValue</code> files include the following:
+<UL>
+<LI><code>IdAssignmentPolicyValue</code>
+<LI><code>IdUniquenessPolicyValue</code>
+<LI><code>ImplicitActivationPolicyValue</code>
+<LI><code>LifespanPolicyValue</code>
+<LI><code>RequestProcessingPolicyValue</code>
+<LI><code>ServantRetentionPolicyValue</code>
+<LI><code>ThreadPolicyValue</code>
+</UL>
+
+<H3>Helper Classes</H3>
+
+<P>Helper classes, which are generated for all user-defined types in an OMG IDL
+interface, supply static methods needed to manipulate those types.
+There is only one method in a helper class that an application programmer uses:
+the <code>narrow</code> method. Only Java interfaces mapped from IDL interfaces
+will have a helper class that includes a <code>narrow</code> method, so in
+the <code>PortableServer</code> package, only the following classes have a <code>narrow</code> method:
+<UL>
+<LI><code>ForwardRequestHelper</code>
+<LI><code>ServantActivatorHelper</code>
+<LI><code>ServantLocatorHelper</code>
+</UL>
+
+<H3>POA Classes</H3>
+
+<P>POA classes are used to implement the <code>ServantActivator</code> or <code>ServantLocator</code>.
+
+<H3>Exceptions</H3>
+
+<P>The <code>ForwardRequest</code> exception indicates to the ORB
+that it is responsible for delivering the current request and
+subsequent <code>ForwardRequest</code> requests to the object denoted in the
+<code>forward_reference</code> member of the exception.
+
+<H3>Interfaces Implemented by the Application Programmer</H3>
+
+<P>Most of what <code>PortableServer</code> does is transparent to the user.
+The result is that programmers will use only a few of the interfaces mentioned above.
+The remaining interfaces will be provided by the ORB implementation.
+The interfaces of interest to application programmers are the following:
+<ul>
+ <LI><code>AdapterActivator</code>
+ <P>Adapter activators are associated with POAs.
+ An adapter activator supplies a POA with the ability to create child POAs on demand,
+ as a side-effect of receiving a request that names the child POA (or one of its children),
+ or when <code>find_POA</code> is called with an activate parameter value of <code>TRUE</code>.
+ An application server that creates all its needed POAs at the beginning of execution
+ does not need to use or provide an adapter activator; it is necessary
+ only for the case in which POAs need to be created during request processing.
+ <LI><code>ServantLocator</code>
+ <P>When the POA has the <code>NON_RETAIN</code> policy,
+ it uses servant managers that are <code>ServantLocator</code>s.
+ <LI><code>ServantActivator</code>
+ <P>When the POA has the <code>RETAIN</code> policy,
+ it uses servant managers that are <code>ServantActivator</code>s.
+</ul>
+
+
+<H2>Package <code>org.omg.PortableServer.ServantLocatorPackage</code></H2>
+
+<P>This package supplies a <code>CookieHolder</code> class for passing
+the <code>Cookie</code> type as an <code>out</code> parameter. The <code>CookieHolder</code> class
+follows exactly the same pattern as the other holder classes for basic types.
+
+<H2>Related Documentation</H2>
+
+<P>For an overview of Java IDL, please see:
+{@extLink idl_guides Java&nbsp;IDL home page}.
+
+<H2>Example Code</H2>
+<a id="sampleserver"></a>
+<H3>Example Server Code</H3>
+<PRE>
+import javax.naming.InitialContext;
+import javax.naming.Context;
+import javax.rmi.PortableRemoteObject ;
+import com.sun.corba.se.impl.poa.POAORB;
+import org.omg.PortableServer.*;
+import java.util.*;
+import org.omg.CORBA.*;
+import javax.rmi.CORBA.Stub;
+import javax.rmi.CORBA.Util;
+
+
+
+public class HelloServer {
+ public HelloServer(String[] args) {
+ try {
+ Properties p = System.getProperties();
+ // p.put("org.omg.CORBA.ORBClass", "com.sun.corba.ee.internal.POA.POAORB");
+ ORB orb = ORB.init( args, p );
+
+ POA rootPOA = (POA)orb.resolve_initial_references("RootPOA");
+<strong>
+ Policy[] tpolicy = new Policy[3];
+ tpolicy[0] = rootPOA.create_lifespan_policy(
+ LifespanPolicyValue.TRANSIENT );
+ tpolicy[1] = rootPOA.create_request_processing_policy(
+ RequestProcessingPolicyValue.USE_ACTIVE_OBJECT_MAP_ONLY );
+ tpolicy[2] = rootPOA.create_servant_retention_policy(
+ ServantRetentionPolicyValue.RETAIN);
+ POA tpoa = rootPOA.create_POA("MyTransientPOA", null, tpolicy);
+</strong>
+
+ String ObjectId = "MyObjectId";
+ byte[] oid = ObjectId.getBytes();
+
+ org.omg.CORBA.Object obj = tpoa.create_reference_with_id(oid,
+ new _HelloImpl_Tie()._all_interfaces(tpoa, oid)[0]);
+ HelloInterface helloRef = (HelloInterface)PortableRemoteObject.narrow(
+ obj, HelloInterface.class );
+
+ Context initialNamingContext = new InitialContext();
+ initialNamingContext.rebind("HelloService", helloRef);
+ System.out.println("Hello Server: Ready...");
+ orb.run();
+ } catch (Exception e) {
+ System.out.println("Trouble: " + e);
+ e.printStackTrace();
+ }
+ }
+
+
+ public static void main(String args[]) {
+ new HelloServer( args );
+ }
+}
+
+
+</PRE>
+
+
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/poa.idl b/src/java.corba/share/classes/org/omg/PortableServer/poa.idl
new file mode 100644
index 0000000..aecf570
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/poa.idl
@@ -0,0 +1,1191 @@
+/*
+ * Copyright (c) 1997, 2001, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "corba.idl"
+#include "CORBAX.idl"
+
+#pragma prefix "omg.org"
+/**
+ * All Mapping corresponds to the Chapter 11 of
+ * CORBA V2.3.1 specified by OMG document formal/99-10-07.pdf.
+ * The exception to this is the id attribute, which is added in ptc/00-08-06,
+ * section 11.3.8.26.
+ */
+module PortableServer {
+
+ #pragma version PortableServer 2.3
+
+ // forward reference
+ interface POA;
+
+ /**
+ * List of POAs
+ */
+ typedef sequence<POA> POAList;
+
+ /**
+ * Values of type Servant support a language specific
+ * programming interface that can be used by the ORB to
+ * obtain a default POA for that servant.
+ * Some language mappings may allow Servant values to
+ * be implicitly converted to object references under
+ * appropriate conditions.
+ */
+ native Servant;
+
+ /**
+ * ObjectId value associated with the object reference.
+ */
+ typedef sequence<octet> ObjectId;
+
+ /**
+ * ForwardRequest to indicate to the ORB
+ * that it is responsible for delivering
+ * the current request and subsequent
+ * requests to the object denoted in the
+ * forward_reference member of the exception.
+ */
+ exception ForwardRequest { Object forward_reference; };
+
+ // **********************************************
+ //
+ // Policy interfaces
+ //
+ // **********************************************
+
+ /**
+ * The value representing THREAD_POLICY_ID.
+ */
+ const CORBA::PolicyType THREAD_POLICY_ID = 16;
+ /**
+ * The value representing LIFESPAN_POLICY_ID.
+ */
+ const CORBA::PolicyType LIFESPAN_POLICY_ID = 17;
+ /**
+ * The value representing ID_UNIQUENESS_POLICY_ID.
+ */
+ const CORBA::PolicyType ID_UNIQUENESS_POLICY_ID = 18;
+ /**
+ * The value representing ID_ASSIGNMENT_POLICY_ID.
+ */
+ const CORBA::PolicyType ID_ASSIGNMENT_POLICY_ID = 19;
+ /**
+ * The value representing IMPLICIT_ACTIVATION_POLICY_ID.
+ */
+ const CORBA::PolicyType IMPLICIT_ACTIVATION_POLICY_ID = 20;
+ /**
+ * The value representing SERVANT_RETENTION_POLICY_ID.
+ */
+ const CORBA::PolicyType SERVANT_RETENTION_POLICY_ID = 21;
+ /**
+ * The value representing REQUEST_PROCESSING_POLICY_ID.
+ */
+ const CORBA::PolicyType REQUEST_PROCESSING_POLICY_ID = 22;
+
+ /**
+ * The ThreadPolicyValue can have the following values.
+ * ORB_CTRL_MODEL - The ORB is responsible for assigning
+ * requests for an ORB- controlled POA to threads.
+ * SINGLE_THREAD_MODEL - Requests for a single-threaded
+ * POA are processed sequentially.
+ */
+ enum ThreadPolicyValue { ORB_CTRL_MODEL, SINGLE_THREAD_MODEL };
+
+ /**
+ * The ThreadPolicy specifies the threading model
+ * used with the created POA. The default is
+ * ORB_CTRL_MODEL.
+ */
+ interface ThreadPolicy : CORBA::Policy {
+ #pragma sun_local ThreadPolicy ""
+ /**
+ * specifies the policy value
+ */
+ readonly attribute ThreadPolicyValue value;
+ };
+
+ /**
+ * The LifespanPolicyValue can have the following values.
+ * TRANSIENT - The objects implemented in the POA
+ * cannot outlive the POA instance in which they are
+ * first created.
+ * PERSISTENT - The objects implemented in the POA can
+ * outlive the process in which they are first created.
+ */
+ enum LifespanPolicyValue { TRANSIENT, PERSISTENT };
+
+ /**
+ * The LifespanPolicy specifies the lifespan of the
+ * objects implemented in the created POA. The default
+ * is TRANSIENT.
+ */
+ interface LifespanPolicy : CORBA::Policy {
+ #pragma sun_local LifespanPolicy ""
+ /**
+ * specifies the policy value
+ */
+ readonly attribute LifespanPolicyValue value;
+ };
+
+ /**
+ * IdUniquenessPolicyValue can have the following values.
+ * UNIQUE_ID - Servants activated with that POA support
+ * exactly one Object Id. MULTIPLE_ID - a servant
+ * activated with that POA may support one or more
+ * Object Ids.
+ */
+ enum IdUniquenessPolicyValue { UNIQUE_ID, MULTIPLE_ID };
+
+ /**
+ * The IdUniquenessPolicy specifies whether the servants
+ * activated in the created POA must have unique object i
+ * identities. The default is UNIQUE_ID.
+ */
+ interface IdUniquenessPolicy : CORBA::Policy {
+ #pragma sun_local IdUniquenessPolicy ""
+ /**
+ * specifies the policy value
+ */
+ readonly attribute IdUniquenessPolicyValue value;
+ };
+
+ /**
+ * The IdAssignmentPolicyValue can have the following
+ * values. USER_ID - Objects created with that POA are
+ * assigned Object Ids only by the application.
+ * SYSTEM_ID - Objects created with that POA are
+ * assigned Object Ids only by the POA. If the POA also
+ * has the PERSISTENT policy, assigned Object Ids must
+ * be unique across all instantiations of the same POA.
+ */
+ enum IdAssignmentPolicyValue { USER_ID, SYSTEM_ID };
+
+ /**
+ * IdAssignmentPolicy specifies whether Object Ids in
+ * the created POA are generated by the application or
+ * by the ORB. The default is SYSTEM_ID.
+ */
+ interface IdAssignmentPolicy : CORBA::Policy {
+ #pragma sun_local IdAssignmentPolicy ""
+ /**
+ * specifies the policy value
+ */
+ readonly attribute IdAssignmentPolicyValue value;
+ };
+
+ /**
+ * ImplicitActivationPolicyValue has the following
+ * semantics.
+ * IMPLICIT_ACTIVATION to indicate implicit activation
+ * of servants. This requires SYSTEM_ID and RETAIN
+ * policies to be set.
+ * NO_IMPLICIT_ACTIVATION to indicate no implicit
+ * servant activation.
+ */
+ enum ImplicitActivationPolicyValue {
+ IMPLICIT_ACTIVATION, NO_IMPLICIT_ACTIVATION
+ };
+
+ /**
+ * This policy specifies whether implicit activation
+ * of servants is supported in the created POA.
+ */
+ interface ImplicitActivationPolicy : CORBA::Policy {
+ #pragma sun_local ImplicitActivationPolicy ""
+ /**
+ * specifies the policy value
+ */
+ readonly attribute ImplicitActivationPolicyValue value;
+ };
+
+ /**
+ * ServantRetentionPolicyValue can have the following
+ * values. RETAIN - to indicate that the POA will retain
+ * active servants in its Active Object Map.
+ * NON_RETAIN - to indicate Servants are not retained by
+ * the POA. If no ServantRetentionPolicy is specified at
+ * POA creation, the default is RETAIN.
+ */
+ enum ServantRetentionPolicyValue { RETAIN, NON_RETAIN };
+
+ /**
+ * This policy specifies whether the created POA retains
+ * active servants in an Active Object Map.
+ */
+ interface ServantRetentionPolicy : CORBA::Policy {
+ #pragma sun_local ServantRetentionPolicy ""
+ /**
+ * specifies the policy value
+ */
+ readonly attribute ServantRetentionPolicyValue value;
+ };
+
+ /**
+ * The RequestProcessingPolicyValue can have the following
+ * values. USE_ACTIVE_OBJECT_MAP_ONLY - If the Object Id
+ * is not found in the Active Object Map,
+ * an OBJECT_NOT_EXIST exception is returned to the
+ * client. The RETAIN policy is also required.
+ * USE_DEFAULT_SERVANT - If the Object Id is not found in
+ * the Active Object Map or the NON_RETAIN policy is
+ * present, and a default servant has been registered
+ * with the POA using the set_servant operation,
+ * the request is dispatched to the default servant.
+ * USE_SERVANT_MANAGER - If the Object Id is not found
+ * in the Active Object Map or the NON_RETAIN policy
+ * is present, and a servant manager has been registered
+ * with the POA using the set_servant_manager operation,
+ * the servant manager is given the opportunity to
+ * locate a servant or raise an exception.
+ */
+ enum RequestProcessingPolicyValue {
+ USE_ACTIVE_OBJECT_MAP_ONLY, USE_DEFAULT_SERVANT, USE_SERVANT_MANAGER
+ };
+
+ /**
+ * This policy specifies how requests are processed by
+ * the created POA. The default is
+ * USE_ACTIVE_OBJECT_MAP_ONLY.
+ */
+ interface RequestProcessingPolicy : CORBA::Policy {
+ #pragma sun_local RequestProcessingPolicy ""
+ /**
+ * specifies the policy value
+ */
+ readonly attribute RequestProcessingPolicyValue value;
+ };
+
+
+ // **************************************************
+ //
+ // POAManager interface
+ //
+ // **********************************
+ /**
+ * Each POA object has an associated POAManager object.
+ * A POA manager may be associated with one or more
+ * POA objects. A POA manager encapsulates the processing
+ * state of the POAs it is associated with.
+ */
+ interface POAManager {
+ #pragma sun_local POAManager ""
+ exception AdapterInactive{ };
+ /**
+ * Specifies the states for the POAManager
+ */
+ enum State {HOLDING, ACTIVE, DISCARDING, INACTIVE};
+
+ /**
+ * This operation changes the state of the POA manager
+ * to active, causing associated POAs to start processing
+ * requests.
+ * @exception AdapterInactive is raised if the operation is
+ * invoked on the POAManager in inactive state.
+ */
+ void activate()
+ raises(AdapterInactive);
+ /**
+ * This operation changes the state of the POA manager
+ * to holding, causing associated POAs to queue incoming
+ * requests.
+ * @param wait_for_completion if FALSE, the operation
+ * returns immediately after changing state.
+ * If TRUE, it waits for all active requests
+ * to complete.
+ * @exception AdapterInactive is raised if the operation is
+ * invoked on the POAManager in inactive state.
+ */
+ void hold_requests(in boolean wait_for_completion)
+ raises(AdapterInactive);
+ /**
+ * This operation changes the state of the POA manager
+ * to discarding. This causes associated POAs to discard
+ * incoming requests.
+ * @param wait_for_completion if FALSE, the operation
+ * returns immediately after changing state.
+ * If TRUE, it waits for all active requests
+ * to complete.
+ * @exception AdapterInactive is raised if the operation is
+ * invoked on the POAManager in inactive state.
+ */
+ void discard_requests(in boolean wait_for_completion)
+ raises(AdapterInactive);
+
+ /**
+ * This operation changes the state of the POA manager
+ * to inactive, causing associated POAs to reject the
+ * requests that have not begun executing as well as
+ * as any new requests.
+ * @param etherealize_objects a flag to indicate whether
+ * to invoke the etherealize operation of the
+ * associated servant manager for all active
+ * objects.
+ * @param wait_for_completion if FALSE, the operation
+ * returns immediately after changing state.
+ * If TRUE, it waits for all active requests
+ * to complete.
+ * @exception AdapterInactive is raised if the operation is
+ * invoked on the POAManager in inactive state.
+ */
+ void deactivate(in boolean etherealize_objects,
+ in boolean wait_for_completion)
+ raises(AdapterInactive);
+ /**
+ * This operation returns the state of the POA manager.
+ */
+ State get_state();
+ };
+
+
+ // **************************************************
+ //
+ // AdapterActivator interface
+ //
+ // ****************************
+
+ /**
+ * An adapter activator supplies a POA with the ability
+ * to create child POAs on demand, as a side-effect of
+ * receiving a request that names the child POA
+ * (or one of its children), or when find_POA is called
+ * with an activate parameter value of TRUE.
+ */
+
+ interface AdapterActivator {
+ #pragma sun_local AdapterActivator ""
+ #pragma version AdapterActivator 2.3
+ /**
+ * This operation is invoked when the ORB receives
+ * a request for an object reference that identifies
+ * a target POA that does not exist. The ORB invokes
+ * this operation once for each POA that must be
+ * created in order for the target POA to exist.
+ * @param parent indicates the parent POA for the POA
+ * that needs to be created.
+ * @param name identifies the name of the POA relative to
+ * the parent.
+ * @return returns TRUE if the POA was created or FALSE
+ * otherwise.
+ */
+ boolean unknown_adapter(in POA parent, in string name);
+ };
+
+
+ // **************************************************
+ //
+ // ServantManager interface
+ //
+ // ******************************
+
+ /**
+ * A servant manager supplies a POA with the ability
+ * to activate objects on demand when the POA receives
+ * a request targeted at an inactive object. A servant
+ * manager is registered with a POA as a callback object,
+ * to be invoked by the POA when necessary.
+ * ServantManagers can either be ServantActivators or
+ * ServantLocators. A ServantManager object must be
+ * local to the process containing the POA objects
+ * it is registered with.
+ */
+
+ interface ServantManager
+ { #pragma sun_local ServantManager "" };
+
+
+ /**
+ * When the POA has the RETAIN policy it uses servant
+ * managers that are ServantActivators.
+ */
+ interface ServantActivator : ServantManager {
+ #pragma version ServantActivator 2.3
+ #pragma sun_localservant ServantActivator ""
+ /**
+ * This operation is invoked by the POA whenever the
+ * POA receives a request for an object that is not
+ * currently active, assuming the POA has the
+ * USE_SERVANT_MANAGER and RETAIN policies.
+ * @param oid object Id associated with the object on
+ * the request was made.
+ * @param adapter object reference for the POA in which
+ * the object is being activated.
+ * @return Servant corresponding to oid is created or
+ * located by the user supplied servant manager.
+ * @exception ForwardRequest to indicate to the ORB
+ * that it is responsible for delivering
+ * the current request and subsequent
+ * requests to the object denoted in the
+ * forward_reference member of the exception.
+ */
+ Servant incarnate ( in ObjectId oid, in POA adapter )
+ raises (ForwardRequest);
+ /**
+ * This operation is invoked whenever a servant for
+ * an object is deactivated, assuming the POA has
+ * the USE_SERVANT_MANAGER and RETAIN policies.
+ * @param oid object Id associated with the object
+ * being deactivated.
+ * @param adapter object reference for the POA in which
+ * the object was active.
+ * @param serv contains reference to the servant
+ * associated with the object being deactivated.
+ * @param cleanup_in_progress if TRUE indicates that
+ * destroy or deactivate is called with
+ * etherealize_objects param of TRUE. FALSE
+ * indicates that etherealize was called due to
+ * other reasons.
+ * @param remaining_activations indicates whether the
+ * Servant Manager can destroy a servant. If
+ * set to TRUE, the Servant Manager should wait
+ * until all invocations in progress have
+ * completed.
+ */
+ void etherealize ( in ObjectId oid,
+ in POA adapter,
+ in Servant serv,
+ in boolean cleanup_in_progress,
+ in boolean remaining_activations);
+ };
+
+
+ /**
+ * When the POA has the NON_RETAIN policy it uses servant
+ * managers that are ServantLocators. Because the POA
+ * knows that the servant returned by this servant
+ * manager will be used only for a single request,
+ * it can supply extra information to the servant
+ * manager's operations and the servant manager's pair
+ * of operations may be able to cooperate to do
+ * something different than a ServantActivator.
+ * When the POA uses the ServantLocator interface,
+ * immediately after performing the operation invocation
+ * on the servant returned by preinvoke, the POA will
+ * invoke postinvoke on the servant manager, passing the
+ * ObjectId value and the Servant value as parameters
+ * (among others). This feature may be used to force
+ * every request for objects associated with a POA to
+ * be mediated by the servant manager.
+ */
+ interface ServantLocator : ServantManager {
+ #pragma sun_localservant ServantLocator ""
+ /**
+ * Opaque data used to pass the information from
+ * preinvoke to postinvoke hooks. This specific
+ * by the language mapping, that is why it is
+ * specified as native.
+ */
+ native Cookie;
+ /**
+ * This operations is used to get a servant that will be
+ * used to process the request that caused preinvoke to
+ * be called.
+ * @param oid the object id associated with object on
+ * which the request was made.
+ * @param adapter the reference for POA in which the
+ * object is being activated.
+ * @param operation the operation name.
+ * @param the_cookie an opaque value that can be set
+ * by the servant manager to be used
+ * during postinvoke.
+ * @return Servant used to process incoming request.
+ * @exception ForwardRequest to indicate to the ORB
+ * that it is responsible for delivering
+ * the current request and subsequent
+ * requests to the object denoted in the
+ * forward_reference member of the exception.
+ */
+ Servant preinvoke( in ObjectId oid, in POA adapter,
+ in CORBA::Identifier operation,
+ out Cookie the_cookie )
+ raises (ForwardRequest);
+ /**
+ * This operation is invoked whenener a servant completes
+ * a request.
+ * @param oid the object id ssociated with object on which
+ * the request was made.
+ * @param adapter the reference for POA in which the
+ * object was active.
+ * @param the_cookie an opaque value that contains
+ * the data set by preinvoke.
+ * @param the_servant reference to the servant that is
+ * associated with the object.
+ */
+ void postinvoke( in ObjectId oid, in POA adapter,
+ in CORBA::Identifier operation,
+ in Cookie the_cookie,
+ in Servant the_servant);
+ };
+
+
+ // **************************************************
+ //
+ // POA interface
+ //
+ // *****************************************
+
+ /**
+ * A POA object manages the implementation of a
+ * collection of objects. The POA supports a name space
+ * for the objects, which are identified by Object Ids.
+ * A POA also provides a name space for POAs. A POA is
+ * created as a child of an existing POA, which forms a
+ * hierarchy starting with the root POA. A POA object
+ * must not be exported to other processes, or
+ * externalized with ORB::object_to_string.
+ */
+ interface POA {
+ #pragma sun_local POA ""
+ #pragma version POA 2.3
+ /**
+ * specifies that an child POA with the specified
+ * name already exists.
+ */
+ exception AdapterAlreadyExists { };
+
+ /**
+ * This is raised if the POA with a specified Name cannot
+ * be found.
+ */
+ exception AdapterNonExistent { };
+
+ /**
+ * This is raised if any of the policy objects are
+ * not valid for the ORB
+ */
+ exception InvalidPolicy {
+ unsigned short index;
+ };
+
+ /**
+ * This is raised if no default servant is associated
+ * with the POA.
+ */
+ exception NoServant { };
+
+ /**
+ * specifies that an object is already active or
+ * exists in the Active Object Map.
+ */
+ exception ObjectAlreadyActive { };
+ /**
+ * specifies that the object is not active or its
+ * mapping does not exist in the Active Object Map.
+ */
+
+ exception ObjectNotActive { };
+
+ /**
+ * This is raised when an attempt is made to activate
+ * a servant that is already active or has a mapping in
+ * the Active Object Map.
+ */
+ exception ServantAlreadyActive { };
+
+ /**
+ * This is raised when an attempt is made to access a
+ * servant that is not active or is not registered in
+ * the Active Object Map.
+ */
+ exception ServantNotActive { };
+
+ /**
+ * This is raised if the reference was not created by
+ * the POA
+ * specified in the reference.
+ */
+ exception WrongAdapter { };
+
+ /**
+ * WrongPolicy is specified when the POA does not
+ * specify the policy appropriate for its operations.
+ */
+ exception WrongPolicy { };
+
+
+ //----------------------------------------
+ //
+ // POA creation and destruction
+ //
+ //-------------------------------
+
+ /**
+ * This operation creates a new POA as a child of the
+ * target POA.
+ * @param adapter_name identifies the new POA with
+ * respect to other POAs with the same parent POA.
+ * @param a_POAManager specifies the POA Manager to be
+ * associated with the new POA.
+ * @param policies specifies policy objects to be
+ * associated with the POA to control its behavior.
+ * @exception AdapterAlreadyExists specifies that the
+ * target POA already has a child POA with
+ * the specified name.
+ * @exception InvalidPolicy is raised if any of the
+ * policy objects are not valid for the ORB,
+ * or are in conflict, or require an
+ * administrative action that has not been
+ * performed.
+ */
+ POA create_POA(in string adapter_name,
+ in POAManager a_POAManager,
+ in CORBA::PolicyList policies)
+ raises (AdapterAlreadyExists, InvalidPolicy);
+
+ /**
+ * If the target POA is the parent of a child POA with
+ * the specified name (relative to the target POA), that
+ * child POA is returned.
+ * @param adapter_name POA name to be found.
+ * @param activate_it if a POA with the specified
+ * name does not exist and the value of
+ * the activate_it parameter is TRUE, the target
+ * POA's AdapterActivator, if one exists,
+ * is invoked.
+ * @return POA if one exists or is activated by the
+ * AdapterActivator.
+ * @return AdapterNonExistent is raised if POA with
+ * a specified name cannot be found or
+ * activated using AdapaterActivator.
+ */
+ POA find_POA(in string adapter_name,
+ in boolean activate_it)
+ raises (AdapterNonExistent);
+
+ /**
+ * This operation destroys the POA and all descendant
+ * POAs. All descendant POAs are destroyed (recursively)
+ * before the destruction of the containing POA. The POA
+ * so destroyed (that is, the POA with its name) may be
+ * re-created later in the same process.
+ * @param etherealize_objects flag to indicate whether
+ * etherealize operation on servant manager needs
+ * to be called.
+ * @param wait_for_completion flag to indicate whether
+ * POA and its children need to wait for active
+ * requests and the etherealization to complete.
+ *
+ */
+ void destroy( in boolean etherealize_objects,
+ in boolean wait_for_completion);
+
+ // **************************************************
+ //
+ // Factories for Policy objects
+ //
+ // ************
+ /**
+ * These operations each return a reference to a policy
+ * object with the specified value.
+ * @param value policy type
+ * @return ThreadPolcy Object
+ */
+ ThreadPolicy create_thread_policy(
+ in ThreadPolicyValue value);
+ /**
+ * These operations each return a reference to a policy
+ * object with the specified value.
+ * @param value policy type
+ * @return LifespanPolicy Object.
+ */
+ LifespanPolicy create_lifespan_policy(
+ in LifespanPolicyValue value);
+ /**
+ * These operations each return a reference to a policy
+ * object with the specified value.
+ * @param value policy type
+ * @return IdUniquenessPolicy Object.
+ */
+ IdUniquenessPolicy create_id_uniqueness_policy(
+ in IdUniquenessPolicyValue value);
+ /**
+ * These operations each return a reference to a policy
+ * object with the specified value.
+ * @param value policy type
+ * @return IdAssignmentPolicy Object.
+ */
+ IdAssignmentPolicy create_id_assignment_policy(
+ in IdAssignmentPolicyValue value);
+ /**
+ * These operations each return a reference to a policy
+ * object with the specified value.
+ * @param value policy type
+ * @return ImplicitActivationPolicy Object.
+ */
+ ImplicitActivationPolicy create_implicit_activation_policy(
+ in ImplicitActivationPolicyValue value);
+ /**
+ * These operations each return a reference to a policy
+ * object with the specified value.
+ * @param value policy type
+ * @return ServantRetentionPolicy Object.
+ */
+ ServantRetentionPolicy create_servant_retention_policy(
+ in ServantRetentionPolicyValue value);
+ /**
+ * These operations each return a reference to a policy
+ * object with the specified value.
+ * @param value policy type
+ * @return RequestProcessingPolicy Object.
+ */
+
+ RequestProcessingPolicy create_request_processing_policy(
+ in RequestProcessingPolicyValue value);
+
+ //--------------------------------------------------
+ //
+ // POA attributes
+ //
+ //-----------------------------------
+ /**
+ * This attribute identifies the POA relative to its
+ * parent. This name is assigned when the POA is created.
+ */
+ readonly attribute string the_name;
+ /**
+ * This attribute identifies the parent of the POA.
+ * The parent of the root POA is null.
+ */
+ readonly attribute POA the_parent;
+ /**
+ * This attribute identifies the current set of all
+ * child POAs of the POA. The set of child POAs
+ * includes only the POA's immediate children, and
+ * not their descendants.
+ */
+ readonly attribute POAList the_children;
+ /**
+ * This attribute identifies the POA manager
+ * associated with the POA.
+ */
+ readonly attribute POAManager the_POAManager;
+
+ /**
+ * This attribute identifies the adapter activator
+ * associated with the POA.
+ */
+ attribute AdapterActivator the_activator;
+
+ //--------------------------------------------------
+ //
+ // Servant Manager registration:
+ //
+ //--------------------------------------------------
+ /**
+ *
+ * If the ServantRetentionPolicy of the POA is RETAIN,
+ * then the ServantManager argument (imgr) shall support
+ * the ServantActivator interface. For a NON_RETAIN policy,
+ * the ServantManager shall support the ServantLocator
+ * interface. If the argument is nil, or does not support
+ * the required interface, then the OBJ_ADAPTER
+ * exception is raised.
+ * @return ServantManager associated with a POA or null if
+ * none exists.
+ * @exception WrongPolicy raised if the
+ * USE_SERVANT_MANAGER policy is not specified.
+ */
+ ServantManager get_servant_manager()
+ raises (WrongPolicy);
+ /**
+ *
+ * This operation sets the default servant manager
+ * associated with the POA. This operation may only be
+ * invoked once after a POA has been created. Attempting
+ * to set the servant manager after one has already
+ * been set will result in the BAD_INV_ORDER exception
+ * being raised.
+ * @param imgr servant manager to be used as a default.
+ * @exception WrongPolicy raised if the
+ * USE_SERVANT_MANAGER policy is not specified.
+ */
+ void set_servant_manager( in ServantManager imgr)
+ raises (WrongPolicy);
+
+ //--------------------------------------------------
+ //
+ // operations for the USE_DEFAULT_SERVANT policy
+ //
+ //----------
+ /**
+ * This operation returns the default servant associated
+ * with the POA.
+ * @return p_servant default servant associated with a POA.
+ * @exception NoServant raised if no default servant is
+ * associated with the POA.
+ * @exception WrongPolicy raised if the
+ * USE_DEFAULT_SERVANT policy is not specified.
+ */
+ Servant get_servant()
+ raises (NoServant, WrongPolicy);
+
+ /**
+ *
+ * This operation registers the specified servant with
+ * the POA as the default servant. This servant will
+ * be used for all requests for which no servant is
+ * found in the Active Object Map.
+ * @param p_servant servant to be used as a default.
+ * @exception WrongPolicy raised if the
+ * USE_DEFAULT_SERVANT policy is not specified.
+ */
+ void set_servant(in Servant p_servant)
+ raises (WrongPolicy);
+
+ // **************************************************
+ //
+ // object activation and deactivation
+ //
+ // ************
+
+ /**
+ *
+ * This operation generates an Object Id and enters
+ * the Object Id and the specified servant in the
+ * Active Object Map.
+ * @param p_servant servant to be associated with an
+ * object to be activated.
+ * @return POA generated object id.
+ * @exception ServantAlreadyActive is raised if the
+ * POA has UNIQUE_ID policy and servant is
+ * is already in the Active Object Map.
+ * @exception WrongPolicy raised if the SYSTEM_ID and
+ * RETAIN policies are not specified.
+ */
+ ObjectId activate_object( in Servant p_servant )
+ raises (ServantAlreadyActive, WrongPolicy);
+ /**
+ * This operation enters an association between the
+ * specified Object Id and the specified servant in the
+ * Active Object Map.
+ * @param id object id for the object to be activated.
+ * @param p_servant servant to be associated with the
+ * object.
+ * @exception ServantAlreadyActive raised if the POA
+ * has the UNIQUE_ID policy and the servant
+ * is already in the Active Object Map.
+ * @exception ObjectAlreadyActive raised if the object is
+ * already active in the POA.
+ * @exception WrongPolicy raised if the RETAIN policy is
+ * is not specified.
+ */
+
+ void activate_object_with_id( in ObjectId id,
+ in Servant p_servant)
+ raises ( ServantAlreadyActive, ObjectAlreadyActive,
+ WrongPolicy);
+ /**
+ *
+ * This operation causes the ObjectId specified in the
+ * oid parameter to be deactivated. An ObjectId which
+ * has been deactivated continues to process requests
+ * until there are no active requests for that ObjectId.
+ * A deactivated ObjectId is removed from the Active
+ * Object Map when all requests executing for that
+ * ObjectId have completed.
+ * @param oid Object Id for the object to be deactivated.
+ * @exception ObjectNotActive if the object with the
+ * specified oid is not in the Active Object
+ * Map.
+ * @exception WrongPolicy raised if the RETAIN policy is
+ * is not specified.
+ */
+ void deactivate_object(in ObjectId oid)
+ raises (ObjectNotActive, WrongPolicy);
+
+ // **************************************************
+ //
+ // reference creation operations
+ //
+ // *****************
+ /**
+ * This operation creates an object reference that
+ * encapsulates a POA-generated Object Id value and
+ * the specified interface repository id.
+ *
+ * @param intf rep id for creating an object reference.
+ * @return object reference created using intf.
+ * @exception WrongPolicy if SYSTEM_ID policy is not
+ * specified.
+ */
+ Object create_reference ( in CORBA::RepositoryId intf )
+ raises (WrongPolicy);
+
+ /**
+ * This operation creates an object reference that
+ * encapsulates the specified Object Id and interface
+ * repository Id values. It does not cause an activation
+ * to take place. The resulting reference may be passed
+ * to clients, so that subsequent requests on those
+ * references will cause the object to be activated
+ * if necessary, or the default servant used, depending
+ * on the applicable policies.
+ * @param oid object id for creating an objref
+ * @param intf rep id for creating an objref
+ * @return object reference created using oid and intf
+ * @exception BAD_PARAM is raised if the POA has the
+ * SYSTEM_ID policy and it detects that the
+ * Object Id value was not generated by the
+ * system or for this POA.
+ */
+ Object create_reference_with_id ( in ObjectId oid,
+ in CORBA::RepositoryId intf );
+ // not specified in 11.3.8.19 raises (WrongPolicy);
+
+ //--------------------------------------------------
+ //
+ // Identity mapping operations:
+ //
+ //--------------------------------------------------
+ /**
+ * This operation has four possible behaviors.
+ * 1. If the POA has the UNIQUE_ID policy and the
+ * specified servant is active, the Object Id associated
+ * with that servant is returned.
+ * 2. If the POA has the IMPLICIT_ACTIVATION policy and
+ * either the POA has the MULTIPLE_ID policy or the
+ * specified servant is not active, the servant is
+ * activated using a POA-generated Object Id and the
+ * Interface Id associated with the servant, and that
+ * Object Id is returned.
+ * 3. If the POA has the USE_DEFAULT_SERVANT policy,
+ * the servant specified is the default servant, and the
+ * operation is being invoked in the context of executing
+ * a request on the default servant, then the ObjectId
+ * associated with the current invocation is returned.
+ * 4. Otherwise, the ServantNotActive exception is raised.
+ *
+ * @param p_servant servant for which the object disi returned.
+ * @return object id associated with the servant.
+ * @exception ServantNotActive if the above rules and
+ * policy combination is not met.
+ * @exception WrongPolicy if the USE_DEFAULT_SERVANT policy
+ * or a combination of the RETAIN policy and
+ * either the UNIQUE_ID or IMPLICIT_ACTIVATION
+ * policies are not present.
+ */
+ ObjectId servant_to_id(in Servant p_servant)
+ raises (ServantNotActive, WrongPolicy);
+
+ /**
+ * This operation requires the RETAIN policy and either
+ * the UNIQUE_ID or IMPLICIT_ACTIVATION policies if
+ * invoked outside the context of an operation dispatched
+ * by this POA. It has four possible behaviors.
+ * 1. If the POA has both the RETAIN and the
+ * UNIQUE_ID policy and the specified servant is active,
+ * an object reference encapsulating the information used
+ * to activate the servant is returned.
+ * 2. If the POA has both the RETAIN and the
+ * IMPLICIT_ACTIVATION policy and either the POA has the
+ * MULTIPLE_ID policy or the specified servant is not
+ * active, the servant is activated using a POA-generated
+ * Object Id and the Interface Id associated with the
+ * servant, and a corresponding object reference is
+ * returned.
+ * 3. If the operation was invoked in the context of
+ * executing a request on the specified servant, the
+ * reference associated with the current invocation
+ * is returned.
+ * 4. Otherwise, the ServantNotActive exception is raised.
+ *
+ * @param p_servant servant for which the object reference
+ * needs to be obtained.
+ * @return object reference associated with the servant.
+ * @exception WrongPolicy if the operation is not invoked
+ * in the context of executing a request on
+ * the specified servant and the required
+ * policies are not present.
+ * @exception ServantNotActive if the above specified
+ * policies and rules are not met.
+ */
+ Object servant_to_reference(in Servant p_servant)
+ raises (ServantNotActive, WrongPolicy);
+
+ /**
+ * If the POA has the RETAIN policy and the specified
+ * object is present in the Active Object Map, this
+ * operation returns the servant associated with that
+ * object in the Active Object Map. Otherwise, if the
+ * POA has the USE_DEFAULT_SERVANT policy and a default
+ * servant has been registered with the POA, this
+ * operation returns the default servant. If the object
+ * reference was not created by this POA,
+ * the WrongAdapter exception is raised. (OMG Issue
+ * on inconsistency with the POA.IDL.
+ *
+ * @param reference object reference for which the
+ * servant is returned.
+ * @return servant associated with the reference.
+ * @exception WrongPolicy if neither the RETAIN policy or
+ * the USE_DEFAULT_SERVANT policy is present.
+ * @exception ObjectNotActive if the servant is not
+ * present in the Active Object Map (for RETAIN)
+ * or no default servant is registered (for
+ * USE_DEFAULT_POLICY).
+ * @exception WrongAdapter if reference was not created by
+ * this POA instance.
+ */
+ Servant reference_to_servant(in Object reference)
+ raises (ObjectNotActive, WrongPolicy, WrongAdapter);
+
+ /**
+ * This operation returns the Object Id value
+ * encapsulated by the specified reference. This
+ * operation is valid only if the reference was created
+ * by the POA on which the operation is being performed.
+ * The object denoted by the reference does not have
+ * to be active for this operation to succeed.
+ *
+ * @param reference the object reference from which the
+ * object id needs to be returned.
+ * @return object id encapsulated in the reference.
+ * @exception WrongAdapter if the reference was not
+ * created by the POA specified in the
+ * reference.
+ * @exception WrongPolicy declared to allow future
+ * extensions.
+ *
+ */
+ ObjectId reference_to_id(in Object reference)
+ raises (WrongAdapter, WrongPolicy);
+
+ /**
+ * If the POA has the RETAIN policy and the specified
+ * ObjectId is in the Active Object Map, this operation
+ * returns the servant associated with that object in
+ * the Active Object Map. Otherwise, if the POA has
+ * the USE_DEFAULT_SERVANT policy and a default servant
+ * has been registered with the POA, this operation
+ * returns the default servant.
+ *
+ * @param oid object id for the which the servant is
+ * returned.
+ * @return servant associated with oid.
+ * @exception ObjectNotActive is raised if ObjectId is
+ * is not in the Active Object Map (for RETAIN
+ * policy), or no default servant is registered
+ * (for USE_DEFAULT_SERVANT policy).
+ *
+ * @exception WrongPolicy is raised if the RETAIN policy
+ * or the USE_DEFAULT_SERVANT
+ * policy is not present.
+ */
+ Servant id_to_servant(in ObjectId oid)
+ raises (ObjectNotActive, WrongPolicy);
+
+ /**
+ * If an object with the specified Object Id value is
+ * currently active, a reference encapsulating the
+ * information used to activate the object is returned.
+ *
+ * @param oid id of the object for which the
+ * reference is returned.
+ * @return the object reference
+ *
+ * @exception ObjectNotActive if the Object Id value
+ * is not active in the POA.
+ * @exception WrongPolicy if the RETAIN policy is not
+ * present.
+ */
+ Object id_to_reference(in ObjectId oid)
+ raises (ObjectNotActive, WrongPolicy);
+
+ /**
+ * This returns the unique id of the POA in the process in which it
+ * is created. It is for use by portable interceptors.
+ * <p>
+ * This id is guaranteed unique for the life span of the POA in the
+ * process. For persistent POAs, this means that if a POA is created
+ * in the same path with the same name as another POA, these POAs
+ * are identical and, therefore, have the same id. For transient
+ * POAs, each POA is unique.
+ */
+ readonly attribute ::org::omg::CORBA::OctetSeq id;
+
+ };
+
+ // *****************************************************
+ //
+ // Current interface:
+ //
+ // *****************************************************
+
+ /**
+ * The PortableServer::Current interface, derived from
+ * CORBA::Current, provides method implementations with
+ * access to the identity of the object on which the
+ * method was invoked. The Current interface is provided
+ * to support servants that implement multiple objects,
+ * but can be used within the context of POA-dispatched
+ * method invocations on any servant. To provide location
+ * transparency, ORBs are required to support use of
+ * Current in the context of both locally and remotely
+ * invoked operations. An instance of Current can be
+ * obtained by the application by issuing the
+ * CORBA::ORB::resolve_initial_references("POACurrent")
+ * operation. Thereafter, it can be used within the
+ * context of a method dispatched by the POA to obtain
+ * the POA and ObjectId that identify the object on
+ * which that operation was invoked.
+ */
+ interface Current : CORBA::Current {
+ #pragma sun_local Current ""
+ #pragma version Current 2.3
+ /**
+ * The exception that is used to indicate that the
+ * operation is invoked outside the context of the
+ * POA-dispatched operation.
+ */
+
+ exception NoContext { };
+
+ /**
+ * Returns reference to the POA implementing the
+ * object in whose context it is called.
+ *
+ * @return The poa implementing the object
+ *
+ * @exception NoContext is raised when the operation is
+ * outside the context of a POA-dispatched
+ * operation
+ */
+ POA get_POA()
+ raises (NoContext);
+
+ /**
+ * Returns the ObjectId identifying the object in
+ * whose context it is called.
+ *
+ * @return the ObjectId of the object
+ *
+ * @exception NoContext is raised when the operation
+ * is called outside the context of a POA-dispatched
+ * operation.
+ */
+
+ ObjectId get_object_id()
+ raises (NoContext);
+ };
+};
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/portable/Delegate.java b/src/java.corba/share/classes/org/omg/PortableServer/portable/Delegate.java
new file mode 100644
index 0000000..56d9a4b
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/portable/Delegate.java
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 1999, 2003, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package org.omg.PortableServer.portable;
+
+import org.omg.PortableServer.Servant;
+import org.omg.PortableServer.POA;
+
+/**
+ * The portability package contains interfaces and classes
+ * that are designed for and intended to be used by ORB
+ * implementor. It exposes the publicly defined APIs that
+ * are used to connect stubs and skeletons to the ORB.
+ * The Delegate interface provides the ORB vendor specific
+ * implementation of PortableServer::Servant.
+ * Conformant to spec CORBA V2.3.1, ptc/00-01-08.pdf
+ */
+public interface Delegate {
+/**
+ * Convenience method that returns the instance of the ORB
+ * currently associated with the Servant.
+ * @param Self the servant.
+ * @return ORB associated with the Servant.
+ */
+ org.omg.CORBA.ORB orb(Servant Self);
+
+/**
+ * This allows the servant to obtain the object reference for
+ * the target CORBA Object it is incarnating for that request.
+ * @param Self the servant.
+ * @return Object reference associated with the request.
+ */
+ org.omg.CORBA.Object this_object(Servant Self);
+
+/**
+ * The method _poa() is equivalent to
+ * calling PortableServer::Current:get_POA.
+ * @param Self the servant.
+ * @return POA associated with the servant.
+ */
+ POA poa(Servant Self);
+
+/**
+ * The method _object_id() is equivalent
+ * to calling PortableServer::Current::get_object_id.
+ * @param Self the servant.
+ * @return ObjectId associated with this servant.
+ */
+ byte[] object_id(Servant Self);
+
+/**
+ * The default behavior of this function is to return the
+ * root POA from the ORB instance associated with the servant.
+ * @param Self the servant.
+ * @return POA associated with the servant class.
+ */
+ POA default_POA(Servant Self);
+
+/**
+ * This method checks to see if the specified repid is present
+ * on the list returned by _all_interfaces() or is the
+ * repository id for the generic CORBA Object.
+ * @param Self the servant.
+ * @param Repository_Id the repository_id to be checked in the
+ * repository list or against the id of generic CORBA
+ * object.
+ * @return boolean indicating whether the specified repid is
+ * in the list or is same as that got generic CORBA
+ * object.
+ */
+ boolean is_a(Servant Self, String Repository_Id);
+
+/**
+ * This operation is used to check for the existence of the
+ * Object.
+ * @param Self the servant.
+ * @return boolean true to indicate that object does not exist,
+ * and false otherwise.
+ */
+ boolean non_existent(Servant Self);
+ //Simon And Ken Will Ask About Editorial Changes
+ //In Idl To Java For The Following Signature.
+
+/**
+ * This operation returns an object in the Interface Repository
+ * which provides type information that may be useful to a program.
+ * @param self the servant.
+ * @return type information corresponding to the object.
+ */
+ // The get_interface() method has been replaced by get_interface_def()
+ //org.omg.CORBA.Object get_interface(Servant Self);
+
+ org.omg.CORBA.Object get_interface_def(Servant self);
+}
diff --git a/src/java.corba/share/classes/org/omg/PortableServer/portable/package.html b/src/java.corba/share/classes/org/omg/PortableServer/portable/package.html
new file mode 100644
index 0000000..9969bb6
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/PortableServer/portable/package.html
@@ -0,0 +1,49 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ Copyright (c) 2001, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+
+-->
+
+</head>
+<body bgcolor="white">
+Provides classes and interfaces for making the server side of your applications
+portable across multivendor ORBs.
+
+<P>The <code>portable</code> package contains interfaces and classes
+ that are designed for and intended to be used by an ORB
+implementor. It exposes the publicly defined APIs that
+ are used to connect stubs and skeletons to the ORB.
+ The <code>Delegate</code> interface provides the ORB-vendor-specific
+ implementation of <code>PortableServer::Servant</code>.
+ This package conforms CORBA Specification V2.3.1, ptc/00-01-08.
+
+@since 1.4
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/SendingContext/RunTime.java b/src/java.corba/share/classes/org/omg/SendingContext/RunTime.java
new file mode 100644
index 0000000..b5eb36a
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/SendingContext/RunTime.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1998, 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.SendingContext;
+
+/** Defines the base class that represents the Sending Context of a
+* request. The sending context provides access to information about
+* the runtime environment of the originator of a GIOP message. For example,
+* when a value type is marshalled on a GIOP Request message, the receiver
+* of the value type may need to ask the sender about the CodeBase for the
+* implementation of the value type.
+*/
+public interface RunTime extends RunTimeOperations, org.omg.CORBA.Object, org.omg.CORBA.portable.IDLEntity
+{
+}
diff --git a/src/java.corba/share/classes/org/omg/SendingContext/RunTimeOperations.java b/src/java.corba/share/classes/org/omg/SendingContext/RunTimeOperations.java
new file mode 100644
index 0000000..7205ce8
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/SendingContext/RunTimeOperations.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 1999, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package org.omg.SendingContext;
+
+/** Defines operations on the base class that represents the Sending Context of a
+* request. The sending context provides access to information about
+* the runtime environment of the originator of a GIOP message. For example,
+* when a value type is marshalled on a GIOP Request message, the receiver
+* of the value type may need to ask the sender about the CodeBase for the
+* implementation of the value type.
+*/
+public interface RunTimeOperations
+{
+}
diff --git a/src/java.corba/share/classes/org/omg/SendingContext/package.html b/src/java.corba/share/classes/org/omg/SendingContext/package.html
new file mode 100644
index 0000000..a76f241
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/SendingContext/package.html
@@ -0,0 +1,76 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+
+ Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+
+-->
+
+</head>
+<body bgcolor="white">
+ Provides support for the marshalling of value types. Value type
+ marshalling may require access to an implementation of the value type or
+ to meta information about the value type. This information is passed
+ between the sending context and the receiving context using a particular
+ service context containing an instance of the
+ <code>SendingContext.RunTime</code> interface.
+ <P>
+ A sending context may be either the client side or the server side of
+ an invocation, depending on which contains a value type.
+ The sending context is the client side of an
+ invocation if the request contains a value type. It is the server side
+ if the reply contains a value type. The other party in the communication
+ is the receiving context.
+ <P>
+ The service context marshalled for <code>SendingContext</code>
+ consists of an encapsulated IOR for the <code>SendingContext.RunTime</code>
+ interface. <code>RunTime</code> is just a marker
+ interface defined to allow extensibility in the future. There is
+ currently only one subinterface of <code>RunTime</code> defined:
+ the <code>SendingContext.CodeBase</code> interface.
+ The interface <code>CodeBase</code> defines operations to obtain code URLs
+ and meta-information about a value type received from the sending
+ context.
+ <P>
+ Note that these classes are currently defined in the
+ <code>com.sun.org.omg.SendingContext</code>
+ package rather than in the package <code>org.omg.SendingContext</code>.
+ This has been done to avoid including large parts of the interface
+ repository in the JDK core, since the interface repository is still
+ evolving in response to the needs of the CORBA Components work.
+
+<H3>Package Specification</H3>
+
+<P>For a precise list of supported sections of official specifications with which
+the Java[tm] Platform, Standard Edition 6 ORB complies, see <A
+HREF="../CORBA/doc-files/compliance.html">Official Specifications for CORBA
+support in Java[tm] SE 6</A>.
+
+@since 1.3
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/org/omg/stub/java/rmi/_Remote_Stub.java b/src/java.corba/share/classes/org/omg/stub/java/rmi/_Remote_Stub.java
new file mode 100644
index 0000000..d1cb4cd
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/stub/java/rmi/_Remote_Stub.java
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1999, 2000, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+// Stub class generated by rmic, do not edit.
+// Contents subject to change without notice.
+
+package org.omg.stub.java.rmi;
+
+import java.rmi.Remote;
+import javax.rmi.CORBA.Stub;
+
+/**
+ * This class provides the Stub for the Remote Type. The class is generated
+ * by the rmic compiler, and is still under works at OMG. It's contents are
+ * subject to change without notice as the specification evolves.
+ */
+public final class _Remote_Stub extends Stub implements Remote {
+
+ private static final String _type_ids[] = {
+ ""
+ };
+
+ /**
+ * Returns an array of repository ids that an object implements.
+ * The string at index zero represents the most derived interface. The last id,
+ * for the generic CORBA object is (i.e., IDL:omg.org/CORBA/Object:1.0") is
+ * implied and not present.
+ * @return an array of repository ids that an object implements.
+ */
+ public String[] _ids() {
+ return (String[]) _type_ids.clone();
+ }
+}
diff --git a/src/java.corba/share/classes/org/omg/stub/java/rmi/package.html b/src/java.corba/share/classes/org/omg/stub/java/rmi/package.html
new file mode 100644
index 0000000..6ac9fec
--- /dev/null
+++ b/src/java.corba/share/classes/org/omg/stub/java/rmi/package.html
@@ -0,0 +1,40 @@
+<html>
+<head>
+<title>org.omg.stub.java.rmi package</title>
+<!--
+
+ Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+
+-->
+</head>
+<body bgcolor="white">
+ Contains RMI-IIOP Stubs for the Remote types that occur in the
+ <code>java.rmi</code> package.
+
+@since 1.3
+<br>
+@serial exclude
+</body>
+</html>
diff --git a/src/java.corba/share/classes/sun/corba/Bridge.java b/src/java.corba/share/classes/sun/corba/Bridge.java
new file mode 100644
index 0000000..e22240e
--- /dev/null
+++ b/src/java.corba/share/classes/sun/corba/Bridge.java
@@ -0,0 +1,379 @@
+/*
+ * Copyright (c) 2004, 2016, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.corba ;
+
+import java.io.OptionalDataException;
+import java.lang.invoke.MethodHandle;
+import java.lang.reflect.Field ;
+import java.lang.reflect.Constructor ;
+import java.lang.StackWalker;
+import java.lang.StackWalker.StackFrame;
+import java.util.Optional;
+import java.util.stream.Stream;
+
+import java.security.AccessController;
+import java.security.Permission;
+import java.security.PrivilegedAction;
+
+import sun.misc.Unsafe;
+import sun.reflect.ReflectionFactory;
+
+/** This class provides the methods for fundamental JVM operations
+ * needed in the ORB that are not part of the public Java API. This includes:
+ * <ul>
+ * <li>throwException, which can throw undeclared checked exceptions.
+ * This is needed to handle throwing arbitrary exceptions across a standardized
+ * OMG interface that (incorrectly) does not specify appropriate exceptions.</li>
+ * <li>putXXX/getXXX methods that allow unchecked access to fields of objects.
+ * This is used for setting uninitialzed non-static final fields (which is
+ * impossible with reflection) and for speed.</li>
+ * <li>objectFieldOffset to obtain the field offsets for use in the putXXX/getXXX methods</li>
+ * <li>newConstructorForSerialization to get the special constructor required for a
+ * Serializable class</li>
+ * <li>latestUserDefinedLoader to get the latest user defined class loader from
+ * the call stack as required by the RMI-IIOP specification (really from the
+ * JDK 1.1 days)</li>
+ * </ul>
+ * The code that calls Bridge.get() must have the following Permissions:
+ * <ul>
+ * <li>BridgePermission "getBridge"</li>
+ * <li>ReflectPermission "suppressAccessChecks"</li>
+ * <li>RuntimePermission "getStackWalkerWithClassReference"</li>
+ * <li>RuntimePermission "reflectionFactoryAccess"</li>
+ * </ul>
+ * <p>
+ * All of these permissions are required to obtain and correctly initialize
+ * the instance of Bridge. No security checks are performed on calls
+ * made to Bridge instance methods, so access to the Bridge instance
+ * must be protected.
+ * <p>
+ * This class is a singleton (per ClassLoader of course). Access to the
+ * instance is obtained through the Bridge.get() method.
+ */
+public final class Bridge
+{
+ private static final Permission getBridgePermission =
+ new BridgePermission("getBridge");
+ private static Bridge bridge = null ;
+
+ /** Access to Unsafe to read/write fields. */
+ private static final Unsafe unsafe = AccessController.doPrivileged(
+ (PrivilegedAction<Unsafe>)() -> {
+ try {
+ Field field = Unsafe.class.getDeclaredField("theUnsafe");
+ field.setAccessible(true);
+ return (Unsafe)field.get(null);
+
+ } catch (NoSuchFieldException |IllegalAccessException ex) {
+ throw new InternalError("Unsafe.theUnsafe field not available", ex);
+ }
+ }
+ ) ;
+
+ private final ReflectionFactory reflectionFactory ;
+ private final StackWalker stackWalker;
+
+ private Bridge() {
+ reflectionFactory = ReflectionFactory.getReflectionFactory();
+ stackWalker = StackWalker.getInstance(
+ StackWalker.Option.RETAIN_CLASS_REFERENCE);
+ }
+
+ /** Fetch the Bridge singleton. This requires the following
+ * permissions:
+ * <ul>
+ * <li>BridgePermission "getBridge"</li>
+ * <li>ReflectPermission "suppressAccessChecks"</li>
+ * <li>RuntimePermission "getStackWalkerWithClassReference"</li>
+ * <li>RuntimePermission "reflectionFactoryAccess"</li>
+ * </ul>
+ * @return The singleton instance of the Bridge class
+ * @throws SecurityException if the caller does not have the
+ * required permissions and the caller has a non-null security manager.
+ */
+ public static final synchronized Bridge get()
+ {
+ SecurityManager sman = System.getSecurityManager() ;
+ if (sman != null)
+ sman.checkPermission( getBridgePermission ) ;
+
+ if (bridge == null) {
+ bridge = new Bridge() ;
+ }
+
+ return bridge ;
+ }
+
+ /** Returns true if the loader that loaded the frame's declaring class
+ * is a user loader (if it is not the platform class loader or one of
+ * its ancestor).
+ */
+ private boolean isUserLoader(StackFrame sf) {
+ ClassLoader cl = sf.getDeclaringClass().getClassLoader();
+ if (cl == null) return false;
+ ClassLoader p = ClassLoader.getPlatformClassLoader();
+ while (cl != p && p != null) p = p.getParent();
+ return cl != p;
+ }
+
+ private Optional<StackFrame> getLatestUserDefinedLoaderFrame(Stream<StackFrame> stream) {
+ return stream.filter(this::isUserLoader).findFirst();
+ }
+
+
+ /** Obtain the latest user defined ClassLoader from the call stack.
+ * This is required by the RMI-IIOP specification.
+ */
+ public final ClassLoader getLatestUserDefinedLoader() {
+ // requires getClassLoader permission => needs doPrivileged.
+ PrivilegedAction<ClassLoader> pa = () ->
+ stackWalker.walk(this::getLatestUserDefinedLoaderFrame)
+ .map(sf -> sf.getDeclaringClass().getClassLoader())
+ .orElseGet(() -> ClassLoader.getPlatformClassLoader());
+ return AccessController.doPrivileged(pa);
+ }
+
+ /**
+ * Fetches a field element within the given
+ * object <code>o</code> at the given offset.
+ * The result is undefined unless the offset was obtained from
+ * {@link #objectFieldOffset} on the {@link java.lang.reflect.Field}
+ * of some Java field and the object referred to by <code>o</code>
+ * is of a class compatible with that field's class.
+ * @param o Java heap object in which the field from which the offset
+ * was obtained resides
+ * @param offset indication of where the field resides in a Java heap
+ * object
+ * @return the value fetched from the indicated Java field
+ * @throws RuntimeException No defined exceptions are thrown, not even
+ * {@link NullPointerException}
+ */
+ public final int getInt(Object o, long offset)
+ {
+ return unsafe.getInt( o, offset ) ;
+ }
+
+ /**
+ * Stores a value into a given Java field.
+ * <p>
+ * The first two parameters are interpreted exactly as with
+ * {@link #getInt(Object, long)} to refer to a specific
+ * Java field. The given value is stored into that field.
+ * <p>
+ * The field must be of the same type as the method
+ * parameter <code>x</code>.
+ *
+ * @param o Java heap object in which the field resides, if any, else
+ * null
+ * @param offset indication of where the field resides in a Java heap
+ * object.
+ * @param x the value to store into the indicated Java field
+ * @throws RuntimeException No defined exceptions are thrown, not even
+ * {@link NullPointerException}
+ */
+ public final void putInt(Object o, long offset, int x)
+ {
+ unsafe.putInt( o, offset, x ) ;
+ }
+
+ /**
+ * @see #getInt(Object, long)
+ */
+ public final Object getObject(Object o, long offset)
+ {
+ return unsafe.getObject( o, offset ) ;
+ }
+
+ /**
+ * @see #putInt(Object, long, int)
+ */
+ public final void putObject(Object o, long offset, Object x)
+ {
+ unsafe.putObject( o, offset, x ) ;
+ }
+
+ /** @see #getInt(Object, long) */
+ public final boolean getBoolean(Object o, long offset)
+ {
+ return unsafe.getBoolean( o, offset ) ;
+ }
+ /** @see #putInt(Object, long, int) */
+ public final void putBoolean(Object o, long offset, boolean x)
+ {
+ unsafe.putBoolean( o, offset, x ) ;
+ }
+ /** @see #getInt(Object, long) */
+ public final byte getByte(Object o, long offset)
+ {
+ return unsafe.getByte( o, offset ) ;
+ }
+ /** @see #putInt(Object, long, int) */
+ public final void putByte(Object o, long offset, byte x)
+ {
+ unsafe.putByte( o, offset, x ) ;
+ }
+ /** @see #getInt(Object, long) */
+ public final short getShort(Object o, long offset)
+ {
+ return unsafe.getShort( o, offset ) ;
+ }
+ /** @see #putInt(Object, long, int) */
+ public final void putShort(Object o, long offset, short x)
+ {
+ unsafe.putShort( o, offset, x ) ;
+ }
+ /** @see #getInt(Object, long) */
+ public final char getChar(Object o, long offset)
+ {
+ return unsafe.getChar( o, offset ) ;
+ }
+ /** @see #putInt(Object, long, int) */
+ public final void putChar(Object o, long offset, char x)
+ {
+ unsafe.putChar( o, offset, x ) ;
+ }
+ /** @see #getInt(Object, long) */
+ public final long getLong(Object o, long offset)
+ {
+ return unsafe.getLong( o, offset ) ;
+ }
+ /** @see #putInt(Object, long, int) */
+ public final void putLong(Object o, long offset, long x)
+ {
+ unsafe.putLong( o, offset, x ) ;
+ }
+ /** @see #getInt(Object, long) */
+ public final float getFloat(Object o, long offset)
+ {
+ return unsafe.getFloat( o, offset ) ;
+ }
+ /** @see #putInt(Object, long, int) */
+ public final void putFloat(Object o, long offset, float x)
+ {
+ unsafe.putFloat( o, offset, x ) ;
+ }
+ /** @see #getInt(Object, long) */
+ public final double getDouble(Object o, long offset)
+ {
+ return unsafe.getDouble( o, offset ) ;
+ }
+ /** @see #putInt(Object, long, int) */
+ public final void putDouble(Object o, long offset, double x)
+ {
+ unsafe.putDouble( o, offset, x ) ;
+ }
+
+ /**
+ * This constant differs from all results that will ever be returned from
+ * {@link #objectFieldOffset}.
+ */
+ public static final long INVALID_FIELD_OFFSET = -1;
+
+ /**
+ * Returns the offset of a non-static field.
+ */
+ public final long objectFieldOffset(Field f)
+ {
+ return unsafe.objectFieldOffset( f ) ;
+ }
+
+ /**
+ * Returns the offset of a static field.
+ */
+ public final long staticFieldOffset(Field f)
+ {
+ return unsafe.staticFieldOffset( f ) ;
+ }
+
+ /**
+ * Ensure that the class has been initalized.
+ * @param cl the class to ensure is initialized
+ */
+ public final void ensureClassInitialized(Class<?> cl) {
+ unsafe.ensureClassInitialized(cl);
+ }
+
+
+ /** Throw the exception.
+ * The exception may be an undeclared checked exception.
+ */
+ public final void throwException(Throwable ee)
+ {
+ unsafe.throwException( ee ) ;
+ }
+
+ /**
+ * Obtain a constructor for Class cl.
+ * This is used to create a constructor for Serializable classes that
+ * construct an instance of the Serializable class using the
+ * no args constructor of the first non-Serializable superclass
+ * of the Serializable class.
+ */
+ public final Constructor<?> newConstructorForSerialization( Class<?> cl ) {
+ return reflectionFactory.newConstructorForSerialization( cl ) ;
+ }
+
+ public final Constructor<?> newConstructorForExternalization(Class<?> cl) {
+ return reflectionFactory.newConstructorForExternalization( cl ) ;
+ }
+
+ /**
+ * Returns true if the given class defines a static initializer method,
+ * false otherwise.
+ */
+ public final boolean hasStaticInitializerForSerialization(Class<?> cl) {
+ return reflectionFactory.hasStaticInitializerForSerialization(cl);
+ }
+
+ public final MethodHandle writeObjectForSerialization(Class<?> cl) {
+ return reflectionFactory.writeObjectForSerialization(cl);
+ }
+
+ public final MethodHandle readObjectForSerialization(Class<?> cl) {
+ return reflectionFactory.readObjectForSerialization(cl);
+ }
+
+ public final MethodHandle readObjectNoDataForSerialization(Class<?> cl) {
+ return reflectionFactory.readObjectNoDataForSerialization(cl);
+ }
+
+ public final MethodHandle readResolveForSerialization(Class<?> cl) {
+ return reflectionFactory.readResolveForSerialization(cl);
+ }
+
+ public final MethodHandle writeReplaceForSerialization(Class<?> cl) {
+ return reflectionFactory.writeReplaceForSerialization(cl);
+ }
+
+ /**
+ * Return a new OptionalDataException instance.
+ * @return a new OptionalDataException instance
+ */
+ public final OptionalDataException newOptionalDataExceptionForSerialization(boolean bool) {
+ return reflectionFactory.newOptionalDataExceptionForSerialization(bool);
+ }
+
+}
diff --git a/src/java.corba/share/classes/sun/corba/BridgePermission.java b/src/java.corba/share/classes/sun/corba/BridgePermission.java
new file mode 100644
index 0000000..a842814
--- /dev/null
+++ b/src/java.corba/share/classes/sun/corba/BridgePermission.java
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.corba ;
+
+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().
+ */
+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".
+ *
+ * @param name the name of the BridgePermission.
+ */
+ 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".
+ *
+ * @param name the name of the BridgePermission.
+ * @param actions should be null.
+ */
+
+ public BridgePermission(String name, String actions)
+ {
+ super(name, actions);
+ }
+}
diff --git a/src/java.corba/share/classes/sun/corba/EncapsInputStreamFactory.java b/src/java.corba/share/classes/sun/corba/EncapsInputStreamFactory.java
new file mode 100644
index 0000000..236a680
--- /dev/null
+++ b/src/java.corba/share/classes/sun/corba/EncapsInputStreamFactory.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.corba;
+
+import java.nio.ByteBuffer;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+
+import com.sun.corba.se.impl.encoding.EncapsInputStream;
+import com.sun.corba.se.impl.encoding.TypeCodeInputStream;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+import com.sun.corba.se.pept.protocol.MessageMediator;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.org.omg.SendingContext.CodeBase;
+
+public class EncapsInputStreamFactory {
+
+ public static EncapsInputStream newEncapsInputStream(
+ final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
+ final boolean littleEndian, final GIOPVersion version) {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
+ @Override
+ public EncapsInputStream run() {
+ return new EncapsInputStream(orb, buf, size,
+ littleEndian, version);
+ }
+ });
+ }
+
+ public static EncapsInputStream newEncapsInputStream(
+ final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
+ final int size, final boolean littleEndian,
+ final GIOPVersion version) {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
+ @Override
+ public EncapsInputStream run() {
+ return new EncapsInputStream(orb, byteBuffer, size,
+ littleEndian, version);
+ }
+ });
+ }
+
+ public static EncapsInputStream newEncapsInputStream(
+ final org.omg.CORBA.ORB orb, final byte[] data, final int size) {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
+ @Override
+ public EncapsInputStream run() {
+ return new EncapsInputStream(orb, data, size);
+ }
+ });
+ }
+
+ public static EncapsInputStream newEncapsInputStream(
+ final EncapsInputStream eis) {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
+ @Override
+ public EncapsInputStream run() {
+ return new EncapsInputStream(eis);
+ }
+ });
+ }
+
+ public static EncapsInputStream newEncapsInputStream(
+ final org.omg.CORBA.ORB orb, final byte[] data, final int size,
+ final GIOPVersion version) {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
+ @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,
+ final GIOPVersion version, final CodeBase codeBase) {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<EncapsInputStream>() {
+ @Override
+ public EncapsInputStream run() {
+ return new EncapsInputStream(orb, data, size, version,
+ codeBase);
+ }
+ });
+ }
+
+ public static TypeCodeInputStream newTypeCodeInputStream(
+ final org.omg.CORBA.ORB orb, final byte[] buf, final int size,
+ final boolean littleEndian, final GIOPVersion version) {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
+ @Override
+ public TypeCodeInputStream run() {
+ return new TypeCodeInputStream(orb, buf, size,
+ littleEndian, version);
+ }
+ });
+ }
+
+ public static TypeCodeInputStream newTypeCodeInputStream(
+ final org.omg.CORBA.ORB orb, final ByteBuffer byteBuffer,
+ final int size, final boolean littleEndian,
+ final GIOPVersion version) {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
+ @Override
+ public TypeCodeInputStream run() {
+ return new TypeCodeInputStream(orb, byteBuffer, size,
+ littleEndian, version);
+ }
+ });
+ }
+
+ public static TypeCodeInputStream newTypeCodeInputStream(
+ final org.omg.CORBA.ORB orb, final byte[] data, final int size) {
+ return AccessController
+ .doPrivileged(new PrivilegedAction<TypeCodeInputStream>() {
+ @Override
+ public TypeCodeInputStream run() {
+ return new TypeCodeInputStream(orb, data, size);
+ }
+ });
+ }
+}
diff --git a/src/java.corba/share/classes/sun/corba/JavaCorbaAccess.java b/src/java.corba/share/classes/sun/corba/JavaCorbaAccess.java
new file mode 100644
index 0000000..0d21551
--- /dev/null
+++ b/src/java.corba/share/classes/sun/corba/JavaCorbaAccess.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.corba;
+
+import com.sun.corba.se.impl.io.ValueHandlerImpl;
+
+public interface JavaCorbaAccess {
+ public ValueHandlerImpl newValueHandlerImpl();
+ public Class<?> loadClass(String className) throws ClassNotFoundException;
+}
diff --git a/src/java.corba/share/classes/sun/corba/OutputStreamFactory.java b/src/java.corba/share/classes/sun/corba/OutputStreamFactory.java
new file mode 100644
index 0000000..d723e22
--- /dev/null
+++ b/src/java.corba/share/classes/sun/corba/OutputStreamFactory.java
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.corba;
+
+import com.sun.corba.se.impl.corba.AnyImpl;
+import com.sun.corba.se.impl.encoding.BufferManagerWrite;
+import com.sun.corba.se.impl.encoding.CDROutputObject;
+import com.sun.corba.se.impl.encoding.EncapsOutputStream;
+import com.sun.corba.se.impl.encoding.TypeCodeOutputStream;
+import com.sun.corba.se.impl.protocol.giopmsgheaders.Message;
+
+import com.sun.corba.se.pept.protocol.MessageMediator;
+
+import com.sun.corba.se.spi.orb.ORB;
+import com.sun.corba.se.spi.transport.CorbaConnection;
+import com.sun.corba.se.spi.ior.iiop.GIOPVersion;
+import com.sun.corba.se.spi.protocol.CorbaMessageMediator;
+
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+public final class OutputStreamFactory {
+
+ private OutputStreamFactory() {
+ }
+
+ public static TypeCodeOutputStream newTypeCodeOutputStream(
+ final ORB orb) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<TypeCodeOutputStream>() {
+ @Override
+ public TypeCodeOutputStream run() {
+ return new TypeCodeOutputStream(orb);
+ }
+ });
+ }
+
+ public static TypeCodeOutputStream newTypeCodeOutputStream(
+ final ORB orb, final boolean littleEndian) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<TypeCodeOutputStream>() {
+ @Override
+ public TypeCodeOutputStream run() {
+ return new TypeCodeOutputStream(orb, littleEndian);
+ }
+ });
+ }
+
+ public static EncapsOutputStream newEncapsOutputStream(
+ final ORB orb) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<EncapsOutputStream>() {
+ @Override
+ public EncapsOutputStream run() {
+ return new EncapsOutputStream(
+ (com.sun.corba.se.spi.orb.ORB)orb);
+ }
+ });
+ }
+
+ public static EncapsOutputStream newEncapsOutputStream(
+ final ORB orb, final GIOPVersion giopVersion) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<EncapsOutputStream>() {
+ @Override
+ public EncapsOutputStream run() {
+ return new EncapsOutputStream(
+ (com.sun.corba.se.spi.orb.ORB)orb, giopVersion);
+ }
+ });
+ }
+
+ public static EncapsOutputStream newEncapsOutputStream(
+ final ORB orb, final boolean isLittleEndian) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<EncapsOutputStream>() {
+ @Override
+ public EncapsOutputStream run() {
+ return new EncapsOutputStream(
+ (com.sun.corba.se.spi.orb.ORB)orb, isLittleEndian);
+ }
+ });
+ }
+
+ public static CDROutputObject newCDROutputObject(
+ final ORB orb, final MessageMediator messageMediator,
+ final Message header, final byte streamFormatVersion) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<CDROutputObject>() {
+ @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<CDROutputObject>() {
+ @Override
+ public CDROutputObject run() {
+ return new CDROutputObject(orb, messageMediator,
+ header, streamFormatVersion, strategy);
+ }
+ });
+ }
+
+ public static CDROutputObject newCDROutputObject(
+ final ORB orb, final CorbaMessageMediator mediator,
+ final GIOPVersion giopVersion, final CorbaConnection connection,
+ final Message header, final byte streamFormatVersion) {
+ return AccessController.doPrivileged(
+ new PrivilegedAction<CDROutputObject>() {
+ @Override
+ public CDROutputObject run() {
+ return new CDROutputObject(orb, mediator,
+ giopVersion, connection, header, streamFormatVersion);
+ }
+ });
+ }
+
+}
diff --git a/src/java.corba/share/classes/sun/corba/SharedSecrets.java b/src/java.corba/share/classes/sun/corba/SharedSecrets.java
new file mode 100644
index 0000000..cd9078e
--- /dev/null
+++ b/src/java.corba/share/classes/sun/corba/SharedSecrets.java
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.corba;
+
+import java.lang.reflect.Field;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
+import com.sun.corba.se.impl.io.ValueUtility;
+import sun.misc.Unsafe;
+
+/** 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. */
+
+// SharedSecrets cloned in corba repo to avoid build issues
+public class SharedSecrets {
+
+ /** Access to Unsafe to read/write fields. */
+ private static final Unsafe unsafe = AccessController.doPrivileged(
+ (PrivilegedAction<Unsafe>)() -> {
+ try {
+ Field field = Unsafe.class.getDeclaredField("theUnsafe");
+ field.setAccessible(true);
+ return (Unsafe)field.get(null);
+
+ } catch (NoSuchFieldException |IllegalAccessException ex) {
+ throw new InternalError("Unsafe.theUnsafe field not available", ex);
+ }
+ }
+ );
+
+ private static JavaCorbaAccess javaCorbaAccess;
+
+ public static JavaCorbaAccess getJavaCorbaAccess() {
+ if (javaCorbaAccess == null) {
+ // Ensure ValueUtility is initialized; we know that that class
+ // provides the shared secret
+ unsafe.ensureClassInitialized(ValueUtility.class);
+ }
+ return javaCorbaAccess;
+ }
+
+ public static void setJavaCorbaAccess(JavaCorbaAccess access) {
+ javaCorbaAccess = access;
+ }
+
+}
diff --git a/src/java.corba/share/classes/sun/corba/package.html b/src/java.corba/share/classes/sun/corba/package.html
new file mode 100644
index 0000000..c3c228e
--- /dev/null
+++ b/src/java.corba/share/classes/sun/corba/package.html
@@ -0,0 +1,37 @@
+<HTML>
+<HEAD>
+ <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
+ <TITLE>package</TITLE>
+<!--
+
+ Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+ DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+
+ This code is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License version 2 only, as
+ published by the Free Software Foundation. Oracle designates this
+ particular file as subject to the "Classpath" exception as provided
+ by Oracle in the LICENSE file that accompanied this code.
+
+ This code is distributed in the hope that it will be useful, but WITHOUT
+ ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ version 2 for more details (a copy is included in the LICENSE file that
+ accompanied this code).
+
+ You should have received a copy of the GNU General Public License version
+ 2 along with this work; if not, write to the Free Software Foundation,
+ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+
+ Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ or visit www.oracle.com if you need additional information or have any
+ questions.
+
+
+-->
+</HEAD>
+<BODY BGCOLOR="#FFFFFF">
+Provides an internal API that the Sun ORB implementation uses to
+access JVM functions that have no standard APIs.
+</BODY>
+</HTML>
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/AbstractType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/AbstractType.java
new file mode 100644
index 0000000..a6969a6
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/AbstractType.java
@@ -0,0 +1,205 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Vector;
+import sun.tools.java.CompilerError;
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.ClassDefinition;
+
+/**
+ * AbstractType represents any non-special interface which does not
+ * inherit from java.rmi.Remote, for which all methods throw RemoteException.
+ * <p>
+ * The static forAbstract(...) method must be used to obtain an instance, and will
+ * return null if the ClassDefinition is non-conforming.
+ * @author Bryan Atsatt
+ */
+public class AbstractType extends RemoteType {
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create an AbstractType for the given class.
+ *
+ * If the class is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static AbstractType forAbstract(ClassDefinition classDef,
+ ContextStack stack,
+ boolean quiet)
+ {
+ boolean doPop = false;
+ AbstractType result = null;
+
+ try {
+
+ // Do we already have it?
+
+ sun.tools.java.Type theType = classDef.getType();
+ Type existing = getType(theType,stack);
+
+ if (existing != null) {
+
+ if (!(existing instanceof AbstractType)) return null; // False hit.
+
+ // Yep, so return it...
+
+ return (AbstractType) existing;
+
+ }
+
+ // Could this be an abstract?
+
+ if (couldBeAbstract(stack,classDef,quiet)) {
+
+ // Yes, so try it...
+
+ AbstractType it = new AbstractType(stack, classDef);
+ putType(theType,it,stack);
+ stack.push(it);
+ doPop = true;
+
+ if (it.initialize(quiet,stack)) {
+ stack.pop(true);
+ result = it;
+ } else {
+ removeType(theType,stack);
+ stack.pop(false);
+ }
+ }
+ } catch (CompilerError e) {
+ if (doPop) stack.pop(false);
+ }
+
+ return result;
+ }
+
+ /**
+ * Return a string describing this type.
+ */
+ public String getTypeDescription () {
+ return "Abstract interface";
+ }
+
+ //_____________________________________________________________________
+ // Internal/Subclass Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create a AbstractType instance for the given class. The resulting
+ * object is not yet completely initialized.
+ */
+ private AbstractType(ContextStack stack, ClassDefinition classDef) {
+ super(stack,classDef,TYPE_ABSTRACT | TM_INTERFACE | TM_COMPOUND);
+ }
+
+ //_____________________________________________________________________
+ // Internal Interfaces
+ //_____________________________________________________________________
+
+
+ private static boolean couldBeAbstract(ContextStack stack, ClassDefinition classDef,
+ boolean quiet) {
+
+ // Return true if interface and not remote...
+
+ boolean result = false;
+
+ if (classDef.isInterface()) {
+ BatchEnvironment env = stack.getEnv();
+
+ try {
+ result = ! env.defRemote.implementedBy(env, classDef.getClassDeclaration());
+ if (!result) failedConstraint(15,quiet,stack,classDef.getName());
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+ } else {
+ failedConstraint(14,quiet,stack,classDef.getName());
+ }
+
+
+ return result;
+ }
+
+
+ /**
+ * Initialize this instance.
+ */
+ private boolean initialize (boolean quiet,ContextStack stack) {
+
+ boolean result = false;
+ ClassDefinition self = getClassDefinition();
+
+ try {
+
+ // Get methods...
+
+ Vector directMethods = new Vector();
+
+ if (addAllMethods(self,directMethods,true,quiet,stack) != null) {
+
+ // Do we have any methods?
+
+ boolean validMethods = true;
+
+ if (directMethods.size() > 0) {
+
+ // Yes. Walk 'em, ensuring each is a valid remote method...
+
+ for (int i = 0; i < directMethods.size(); i++) {
+
+ if (! isConformingRemoteMethod((Method) directMethods.elementAt(i),true)) {
+ validMethods = false;
+ }
+ }
+ }
+
+ if (validMethods) {
+
+ // We're ok, so pass 'em up...
+
+ result = initialize(null,directMethods,null,stack,quiet);
+ }
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+
+ return result;
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ArrayType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ArrayType.java
new file mode 100644
index 0000000..11bb49a
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ArrayType.java
@@ -0,0 +1,270 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Vector;
+import java.util.HashSet;
+import sun.tools.java.CompilerError;
+import sun.tools.java.Identifier;
+import sun.tools.java.ClassDefinition;
+import java.lang.reflect.Array;
+
+/**
+ * ArrayType is a wrapper for any of the other types. The getElementType()
+ * method can be used to get the array element type. The getArrayDimension()
+ * method can be used to get the array dimension.
+ *
+ * @author Bryan Atsatt
+ */
+public class ArrayType extends Type {
+
+ private Type type;
+ private int arrayDimension;
+ private String brackets;
+ private String bracketsSig;
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create an ArrayType object for the given type.
+ *
+ * If the class is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static ArrayType forArray( sun.tools.java.Type theType,
+ ContextStack stack) {
+
+
+ ArrayType result = null;
+ sun.tools.java.Type arrayType = theType;
+
+ if (arrayType.getTypeCode() == TC_ARRAY) {
+
+ // Find real type...
+
+ while (arrayType.getTypeCode() == TC_ARRAY) {
+ arrayType = arrayType.getElementType();
+ }
+
+ // Do we already have it?
+
+ Type existing = getType(theType,stack);
+ if (existing != null) {
+
+ if (!(existing instanceof ArrayType)) return null; // False hit.
+
+ // Yep, so return it...
+
+ return (ArrayType) existing;
+ }
+
+ // Now try to make a Type from it...
+
+ Type temp = CompoundType.makeType(arrayType,null,stack);
+
+ if (temp != null) {
+
+ // Got a valid one. Make an array type...
+
+ result = new ArrayType(stack,temp,theType.getArrayDimension());
+
+ // Add it...
+
+ putType(theType,result,stack);
+
+ // Do the stack thing in case tracing on...
+
+ stack.push(result);
+ stack.pop(true);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Return signature for this type (e.g. com.acme.Dynamite
+ * would return "com.acme.Dynamite", byte = "B")
+ */
+ public String getSignature() {
+ return bracketsSig + type.getSignature();
+ }
+
+ /**
+ * Get element type. Returns null if not an array.
+ */
+ public Type getElementType () {
+ return type;
+ }
+
+ /**
+ * Get array dimension. Returns zero if not an array.
+ */
+ public int getArrayDimension () {
+ return arrayDimension;
+ }
+
+ /**
+ * Get brackets string. Returns "" if not an array.
+ */
+ public String getArrayBrackets () {
+ return brackets;
+ }
+
+ /**
+ * Return a string representation of this type.
+ */
+ public String toString () {
+ return getQualifiedName() + brackets;
+ }
+
+ /**
+ * Return a string describing this type.
+ */
+ public String getTypeDescription () {
+ return "Array of " + type.getTypeDescription();
+ }
+
+
+ /**
+ * Return the name of this type. For arrays, will include "[]" if useIDLNames == false.
+ * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ * @param globalIDLNames If true and useIDLNames true, prepends "::".
+ */
+ public String getTypeName ( boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) {
+ if (useIDLNames) {
+ return super.getTypeName(useQualifiedNames,useIDLNames,globalIDLNames);
+ } else {
+ return super.getTypeName(useQualifiedNames,useIDLNames,globalIDLNames) + brackets;
+ }
+ }
+
+ //_____________________________________________________________________
+ // Subclass/Internal Interfaces
+ //_____________________________________________________________________
+
+
+ /**
+ * Convert all invalid types to valid ones.
+ */
+ protected void swapInvalidTypes () {
+ if (type.getStatus() != STATUS_VALID) {
+ type = getValidType(type);
+ }
+ }
+
+ /*
+ * Add matching types to list. Return true if this type has not
+ * been previously checked, false otherwise.
+ */
+ protected boolean addTypes (int typeCodeFilter,
+ HashSet checked,
+ Vector matching) {
+
+ // Check self.
+
+ boolean result = super.addTypes(typeCodeFilter,checked,matching);
+
+ // Have we been checked before?
+
+ if (result) {
+
+ // No, so add element type...
+
+ getElementType().addTypes(typeCodeFilter,checked,matching);
+ }
+
+ return result;
+ }
+
+ /**
+ * Create an ArrayType instance for the given type. The resulting
+ * object is not yet completely initialized.
+ */
+ private ArrayType(ContextStack stack, Type type, int arrayDimension) {
+ super(stack,TYPE_ARRAY);
+ this.type = type;
+ this.arrayDimension = arrayDimension;
+
+ // Create our brackets string...
+
+ brackets = "";
+ bracketsSig = "";
+ for (int i = 0; i < arrayDimension; i ++) {
+ brackets += "[]";
+ bracketsSig += "[";
+ }
+
+ // Now set our names...
+
+ String idlName = IDLNames.getArrayName(type,arrayDimension);
+ String[] module = IDLNames.getArrayModuleNames(type);
+ setNames(type.getIdentifier(),module,idlName);
+
+ // Set our repositoryID...
+
+ setRepositoryID();
+ }
+
+
+ /*
+ * Load a Class instance. Return null if fail.
+ */
+ protected Class loadClass() {
+ Class result = null;
+ Class elementClass = type.getClassInstance();
+ if (elementClass != null) {
+ result = Array.newInstance(elementClass, new int[arrayDimension]).getClass();
+ }
+ return result;
+ }
+
+ /**
+ * Release all resources
+ */
+ protected void destroy () {
+ super.destroy();
+ if (type != null) {
+ type.destroy();
+ type = null;
+ }
+ brackets = null;
+ bracketsSig = null;
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/BatchEnvironment.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/BatchEnvironment.java
new file mode 100644
index 0000000..d9de475
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/BatchEnvironment.java
@@ -0,0 +1,260 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import sun.rmi.rmic.Main;
+import sun.tools.java.ClassPath;
+import java.io.OutputStream;
+import sun.tools.java.ClassDefinition;
+import sun.tools.java.ClassDeclaration;
+import sun.tools.java.Identifier;
+import sun.tools.java.ClassNotFound;
+import java.util.HashSet;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.util.Iterator;
+
+/**
+ * BatchEnvironment for iiop extends rmic's version to add
+ * parse state.
+ */
+public class BatchEnvironment extends sun.rmi.rmic.BatchEnvironment implements Constants {
+
+ /*
+ * If the following flag is true, then the IDL generator can map
+ * the methods and constants of non-conforming types. However,
+ * this is very expensive, so the default should be false.
+ */
+ private boolean parseNonConforming = false;
+
+ /**
+ * This flag indicates that the stubs and ties need to be generated without
+ * the package prefix (org.omg.stub).
+ */
+ private boolean standardPackage;
+
+ /* Common objects used within package */
+
+ HashSet alreadyChecked = new HashSet();
+ Hashtable allTypes = new Hashtable(3001, 0.5f);
+ Hashtable invalidTypes = new Hashtable(256, 0.5f);
+ DirectoryLoader loader = null;
+ ClassPathLoader classPathLoader = null;
+ Hashtable nameContexts = null;
+ Hashtable namesCache = new Hashtable();
+ NameContext modulesContext = new NameContext(false);
+
+ ClassDefinition defRemote = null;
+ ClassDefinition defError = null;
+ ClassDefinition defException = null;
+ ClassDefinition defRemoteException = null;
+ ClassDefinition defCorbaObject = null;
+ ClassDefinition defSerializable = null;
+ ClassDefinition defExternalizable = null;
+ ClassDefinition defThrowable = null;
+ ClassDefinition defRuntimeException = null;
+ ClassDefinition defIDLEntity = null;
+ ClassDefinition defValueBase = null;
+
+ sun.tools.java.Type typeRemoteException = null;
+ sun.tools.java.Type typeIOException = null;
+ sun.tools.java.Type typeException = null;
+ sun.tools.java.Type typeThrowable = null;
+
+ ContextStack contextStack = null;
+
+ /**
+ * Create a BatchEnvironment for rmic with the given class path,
+ * stream for messages and Main.
+ */
+ public BatchEnvironment(OutputStream out, ClassPath path, Main main) {
+
+ super(out,path,main);
+
+ // Make sure we have our definitions...
+
+ try {
+ defRemote =
+ getClassDeclaration(idRemote).getClassDefinition(this);
+ defError =
+ getClassDeclaration(idJavaLangError).getClassDefinition(this);
+ defException =
+ getClassDeclaration(idJavaLangException).getClassDefinition(this);
+ defRemoteException =
+ getClassDeclaration(idRemoteException).getClassDefinition(this);
+ defCorbaObject =
+ getClassDeclaration(idCorbaObject).getClassDefinition(this);
+ defSerializable =
+ getClassDeclaration(idJavaIoSerializable).getClassDefinition(this);
+ defRuntimeException =
+ getClassDeclaration(idJavaLangRuntimeException).getClassDefinition(this);
+ defExternalizable =
+ getClassDeclaration(idJavaIoExternalizable).getClassDefinition(this);
+ defThrowable=
+ getClassDeclaration(idJavaLangThrowable).getClassDefinition(this);
+ defIDLEntity=
+ getClassDeclaration(idIDLEntity).getClassDefinition(this);
+ defValueBase=
+ getClassDeclaration(idValueBase).getClassDefinition(this);
+ typeRemoteException = defRemoteException.getClassDeclaration().getType();
+ typeException = defException.getClassDeclaration().getType();
+ typeIOException = getClassDeclaration(idJavaIoIOException).getType();
+ typeThrowable = getClassDeclaration(idJavaLangThrowable).getType();
+
+ classPathLoader = new ClassPathLoader(path);
+
+ } catch (ClassNotFound e) {
+ error(0, "rmic.class.not.found", e.name);
+ throw new Error();
+ }
+ }
+
+ /**
+ * Return whether or not to parse non-conforming types.
+ */
+ public boolean getParseNonConforming () {
+ return parseNonConforming;
+ }
+
+ /**
+ * Set whether or not to parse non-conforming types.
+ */
+ public void setParseNonConforming (boolean parseEm) {
+
+ // If we are transitioning from not parsing to
+ // parsing, we need to throw out any previously
+ // parsed types...
+
+ if (parseEm && !parseNonConforming) {
+ reset();
+ }
+
+ parseNonConforming = parseEm;
+ }
+
+ void setStandardPackage(boolean standardPackage) {
+ this.standardPackage = standardPackage;
+ }
+
+ boolean getStandardPackage() {
+ return standardPackage;
+ }
+
+ /**
+ * Clear out any data from previous executions.
+ */
+ public void reset () {
+
+ // First, find all Type instances and call destroy()
+ // on them...
+
+ for (Enumeration e = allTypes.elements() ; e.hasMoreElements() ;) {
+ Type type = (Type) e.nextElement();
+ type.destroy();
+ }
+
+ for (Enumeration e = invalidTypes.keys() ; e.hasMoreElements() ;) {
+ Type type = (Type) e.nextElement();
+ type.destroy();
+ }
+
+ for (Iterator e = alreadyChecked.iterator() ; e.hasNext() ;) {
+ Type type = (Type) e.next();
+ type.destroy();
+ }
+
+ if (contextStack != null) contextStack.clear();
+
+ // Remove and clear all NameContexts in the
+ // nameContexts cache...
+
+ if (nameContexts != null) {
+ for (Enumeration e = nameContexts.elements() ; e.hasMoreElements() ;) {
+ NameContext context = (NameContext) e.nextElement();
+ context.clear();
+ }
+ nameContexts.clear();
+ }
+
+ // Now remove all table entries...
+
+ allTypes.clear();
+ invalidTypes.clear();
+ alreadyChecked.clear();
+ namesCache.clear();
+ modulesContext.clear();
+
+ // Clean up remaining...
+ loader = null;
+ parseNonConforming = false;
+
+ // REVISIT - can't clean up classPathLoader here
+ }
+
+ /**
+ * Release resources, if any.
+ */
+ public void shutdown() {
+ if (alreadyChecked != null) {
+ //System.out.println();
+ //System.out.println("allTypes.size() = "+ allTypes.size());
+ //System.out.println(" InstanceCount before reset = "+Type.instanceCount);
+ reset();
+ //System.out.println(" InstanceCount AFTER reset = "+Type.instanceCount);
+
+ alreadyChecked = null;
+ allTypes = null;
+ invalidTypes = null;
+ nameContexts = null;
+ namesCache = null;
+ modulesContext = null;
+ defRemote = null;
+ defError = null;
+ defException = null;
+ defRemoteException = null;
+ defCorbaObject = null;
+ defSerializable = null;
+ defExternalizable = null;
+ defThrowable = null;
+ defRuntimeException = null;
+ defIDLEntity = null;
+ defValueBase = null;
+ typeRemoteException = null;
+ typeIOException = null;
+ typeException = null;
+ typeThrowable = null;
+
+ super.shutdown();
+ }
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ClassPathLoader.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ClassPathLoader.java
new file mode 100644
index 0000000..7f9b9c5
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ClassPathLoader.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (c) 2000, 2004, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+package sun.rmi.rmic.iiop;
+
+import java.io.*;
+import sun.tools.java.ClassPath ;
+import sun.tools.java.ClassFile ;
+
+/**
+ * A ClassLoader that will ultimately use a given sun.tools.java.ClassPath to
+ * find the desired file. This works for any JAR files specified in the given
+ * ClassPath as well -- reusing all of that wonderful sun.tools.java code.
+ *
+ *@author Everett Anderson
+ */
+public class ClassPathLoader extends ClassLoader
+{
+ private ClassPath classPath;
+
+ public ClassPathLoader(ClassPath classPath) {
+ this.classPath = classPath;
+ }
+
+ // Called by the super class
+ protected Class findClass(String name) throws ClassNotFoundException
+ {
+ byte[] b = loadClassData(name);
+ return defineClass(name, b, 0, b.length);
+ }
+
+ /**
+ * Load the class with the given fully qualified name from the ClassPath.
+ */
+ private byte[] loadClassData(String className)
+ throws ClassNotFoundException
+ {
+ // Build the file name and subdirectory from the
+ // class name
+ String filename = className.replace('.', File.separatorChar)
+ + ".class";
+
+ // Have ClassPath find the file for us, and wrap it in a
+ // ClassFile. Note: This is where it looks inside jar files that
+ // are specified in the path.
+ ClassFile classFile = classPath.getFile(filename);
+
+ if (classFile != null) {
+
+ // Provide the most specific reason for failure in addition
+ // to ClassNotFound
+ Exception reportedError = null;
+ byte data[] = null;
+
+ try {
+ // ClassFile is beautiful because it shields us from
+ // knowing if it's a separate file or an entry in a
+ // jar file.
+ DataInputStream input
+ = new DataInputStream(classFile.getInputStream());
+
+ // Can't rely on input available() since it will be
+ // something unusual if it's a jar file! May need
+ // to worry about a possible problem if someone
+ // makes a jar file entry with a size greater than
+ // max int.
+ data = new byte[(int)classFile.length()];
+
+ try {
+ input.readFully(data);
+ } catch (IOException ex) {
+ // Something actually went wrong reading the file. This
+ // is a real error so save it to report it.
+ data = null;
+ reportedError = ex;
+ } finally {
+ // Just don't care if there's an exception on close!
+ // I hate that close can throw an IOException!
+ try { input.close(); } catch (IOException ex) {}
+ }
+ } catch (IOException ex) {
+ // Couldn't get the input stream for the file. This is
+ // probably also a real error.
+ reportedError = ex;
+ }
+
+ if (data == null)
+ throw new ClassNotFoundException(className, reportedError);
+
+ return data;
+ }
+
+ // Couldn't find the file in the class path.
+ throw new ClassNotFoundException(className);
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ClassType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ClassType.java
new file mode 100644
index 0000000..2693ecc
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ClassType.java
@@ -0,0 +1,215 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import sun.tools.java.CompilerError;
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.ClassDeclaration;
+import sun.tools.java.ClassDefinition;
+import sun.rmi.rmic.IndentingWriter;
+import java.io.IOException;
+
+/**
+ * ClassType is an abstract base representing any non-special class
+ * type.
+ *
+ * @author Bryan Atsatt
+ */
+public abstract class ClassType extends CompoundType {
+
+ private ClassType parent;
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Return the parent class of this type. Returns null if this
+ * type is an interface or if there is no parent.
+ */
+ public ClassType getSuperclass() {
+ return parent;
+ }
+
+
+ /**
+ * Print this type.
+ * @param writer The stream to print to.
+ * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ * @param globalIDLNames If true and useIDLNames true, prepends "::".
+ */
+ public void print ( IndentingWriter writer,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+ if (isInner()) {
+ writer.p("// " + getTypeDescription() + " (INNER)");
+ } else {
+ writer.p("// " + getTypeDescription());
+ }
+ writer.pln(" (" + getRepositoryID() + ")\n");
+
+ printPackageOpen(writer,useIDLNames);
+
+ if (!useIDLNames) {
+ writer.p("public ");
+ }
+
+ String prefix = "";
+ writer.p("class " + getTypeName(false,useIDLNames,false));
+ if (printExtends(writer,useQualifiedNames,useIDLNames,globalIDLNames)) {
+ prefix = ",";
+ }
+ printImplements(writer,prefix,useQualifiedNames,useIDLNames,globalIDLNames);
+ writer.plnI(" {");
+ printMembers(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ writer.pln();
+ printMethods(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+
+ if (useIDLNames) {
+ writer.pOln("};");
+ } else {
+ writer.pOln("}");
+ }
+
+ printPackageClose(writer,useIDLNames);
+ }
+
+
+ //_____________________________________________________________________
+ // Subclass/Internal Interfaces
+ //_____________________________________________________________________
+
+ protected void destroy () {
+ if (!destroyed) {
+ super.destroy();
+ if (parent != null) {
+ parent.destroy();
+ parent = null;
+ }
+ }
+ }
+
+ /**
+ * Create a ClassType instance for the given class. NOTE: This constructor
+ * is ONLY for SpecialClassType.
+ */
+ protected ClassType(ContextStack stack, int typeCode, ClassDefinition classDef) {
+ super(stack,typeCode,classDef); // Call special parent constructor.
+ if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) {
+ throw new CompilerError("Not a class");
+ }
+ parent = null;
+ }
+
+ /**
+ * Create a ClassType instance for the given class. NOTE: This constructor
+ * is ONLY for ImplementationType. It does not walk the parent chain.
+ */
+ protected ClassType(int typeCode, ClassDefinition classDef,ContextStack stack) {
+ super(stack,classDef,typeCode);
+
+ if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) {
+ throw new CompilerError("Not a class");
+ }
+ parent = null;
+ }
+
+ /**
+ * Create an ClassType instance for the given class. The resulting
+ * object is not yet completely initialized. Subclasses must call
+ * initialize(directInterfaces,directInterfaces,directConstants);
+ */
+ protected ClassType(ContextStack stack,
+ ClassDefinition classDef,
+ int typeCode) {
+ super(stack,classDef,typeCode);
+ if ((typeCode & TM_CLASS) == 0 && classDef.isInterface()) {
+ throw new CompilerError("Not a class");
+ }
+ parent = null;
+ }
+
+ /**
+ * Convert all invalid types to valid ones.
+ */
+ protected void swapInvalidTypes () {
+ super.swapInvalidTypes();
+ if (parent != null && parent.getStatus() != STATUS_VALID) {
+ parent = (ClassType) getValidType(parent);
+ }
+ }
+
+ /**
+ * Modify the type description with exception info.
+ */
+ public String addExceptionDescription (String typeDesc) {
+ if (isException) {
+ if (isCheckedException) {
+ typeDesc = typeDesc + " - Checked Exception";
+ } else {
+ typeDesc = typeDesc + " - Unchecked Exception";
+ }
+ }
+ return typeDesc;
+ }
+
+
+ protected boolean initParents(ContextStack stack) {
+
+ stack.setNewContextCode(ContextStack.EXTENDS);
+ BatchEnvironment env = stack.getEnv();
+
+ // Init parent...
+
+ boolean result = true;
+
+ try {
+ ClassDeclaration parentDecl = getClassDefinition().getSuperClass(env);
+ if (parentDecl != null) {
+ ClassDefinition parentDef = parentDecl.getClassDefinition(env);
+ parent = (ClassType) makeType(parentDef.getType(),parentDef,stack);
+ if (parent == null) {
+ result = false;
+ }
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ throw new CompilerError("ClassType constructor");
+ }
+
+ return result;
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/CompoundType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/CompoundType.java
new file mode 100644
index 0000000..386e308
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/CompoundType.java
@@ -0,0 +1,2703 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Arrays;
+import java.util.Vector;
+import sun.tools.java.Identifier;
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.ClassDefinition;
+import sun.tools.java.ClassDeclaration;
+import sun.tools.java.MemberDefinition;
+import sun.tools.java.CompilerError;
+import sun.tools.tree.Node;
+import sun.tools.tree.LocalMember;
+import sun.tools.tree.CharExpression;
+import sun.tools.tree.IntegerExpression;
+import sun.rmi.rmic.IndentingWriter;
+import java.io.IOException;
+import java.util.HashSet;
+import java.util.Enumeration;
+import java.io.File;
+
+/**
+ * A CompoundType is an abstract base class for all IIOP class and
+ * interface types.
+ *
+ * @author Bryan Atsatt
+ */
+public abstract class CompoundType extends Type {
+
+ protected Method[] methods;
+ protected InterfaceType[] interfaces;
+ protected Member[] members;
+ protected ClassDefinition classDef;
+ protected ClassDeclaration classDecl;
+
+ protected boolean isCORBAObject = false;
+ protected boolean isIDLEntity = false;
+ protected boolean isAbstractBase = false;
+ protected boolean isValueBase = false;
+ protected boolean isCORBAUserException = false;
+ protected boolean isException = false;
+ protected boolean isCheckedException = false;
+ protected boolean isRemoteExceptionOrSubclass = false;
+ protected String idlExceptionName;
+ protected String qualifiedIDLExceptionName;
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Return true if this type implements
+ * org.omg.CORBA.Object.
+ */
+ public boolean isCORBAObject () {
+ return isCORBAObject;
+ }
+
+ /**
+ * Return true if this type implements
+ * org.omg.CORBA.portable.IDLEntity.
+ */
+ public boolean isIDLEntity () {
+ return isIDLEntity;
+ }
+
+ /**
+ * Return true if this type implements
+ * org.omg.CORBA.portable.ValueBase.
+ */
+ public boolean isValueBase () {
+ return isValueBase;
+ }
+
+ /**
+ * Return true if this type is a CORBA
+ * abstract interface.
+ */
+ public boolean isAbstractBase () {
+ return isAbstractBase;
+ }
+
+ /**
+ * Return true if this type is an exception.
+ */
+ public boolean isException () {
+ return isException;
+ }
+
+ /**
+ * Return true if this type is a "checked" exception.
+ * Result if valid iff isException() returns true.
+ */
+ public boolean isCheckedException () {
+ return isCheckedException;
+ }
+
+ /**
+ * Return true if this type is a java.rmi.RemoteException
+ * or one of its subclasses. Result if valid iff isException()
+ * returns true.
+ */
+ public boolean isRemoteExceptionOrSubclass () {
+ return isRemoteExceptionOrSubclass;
+ }
+
+ /**
+ * Return true if this type is exactly
+ * org.omg.CORBA.UserException.
+ */
+ public boolean isCORBAUserException () {
+ return isCORBAUserException;
+ }
+
+ /**
+ * Return true if this type implements
+ * {@code isIDLEntity() && isException()}.
+ */
+ public boolean isIDLEntityException () {
+ return isIDLEntity() && isException();
+ }
+ /**
+ * Return true if {@code isIDLEntity() && !isValueBase()
+ * && !isAbstractBase() && !isCORBAObject()
+ * && !isIDLEntityException()}.
+ */
+ public boolean isBoxed () {
+ return (isIDLEntity() && !isValueBase() &&
+ !isAbstractBase() && !isCORBAObject() &&
+ !isIDLEntityException());
+ }
+
+ /**
+ * If this type represents an exception, return the
+ * IDL name including the "Ex" mangling, otherwise
+ * return null.
+ */
+ public String getIDLExceptionName () {
+ return idlExceptionName;
+ }
+
+ /**
+ * If this type represents an exception, return the
+ * qualified IDL name including the "Ex" mangling,
+ * otherwise return null.
+ * @param global If true, prepends "::".
+ */
+ public String getQualifiedIDLExceptionName (boolean global) {
+ if (qualifiedIDLExceptionName != null &&
+ global &&
+ getIDLModuleNames().length > 0) {
+ return IDL_NAME_SEPARATOR + qualifiedIDLExceptionName;
+ } else {
+ return qualifiedIDLExceptionName;
+ }
+ }
+
+ /**
+ * Return signature for this type (e.g. com.acme.Dynamite
+ * would return "com.acme.Dynamite", byte = "B")
+ */
+ public String getSignature() {
+ String sig = classDecl.getType().getTypeSignature();
+ if (sig.endsWith(";")) {
+ sig = sig.substring(0,sig.length()-1);
+ }
+ return sig;
+ }
+
+ /**
+ * Return the ClassDeclaration for this type.
+ */
+ public ClassDeclaration getClassDeclaration() {
+ return classDecl;
+ }
+
+ /**
+ * Return the ClassDefinition for this type.
+ */
+ public ClassDefinition getClassDefinition() {
+ return classDef;
+ }
+
+ /**
+ * Return the parent class of this type. Returns null if this
+ * type is an interface or if there is no parent.
+ */
+ public ClassType getSuperclass() {
+ return null;
+ }
+
+ /**
+ * Return an array of interfaces directly implemented by this type.
+ * <p>
+ * The order of the array returned is arbitrary.
+ */
+ public InterfaceType[] getInterfaces() {
+ if( interfaces != null ) {
+ return (InterfaceType[]) interfaces.clone();
+ }
+ return null;
+ }
+
+ /**
+ * Return an array of Type.Method objects representing all
+ * of the methods implemented directly by this type.
+ */
+ public Method[] getMethods() {
+ if( methods != null ) {
+ return (Method[]) methods.clone();
+ }
+ return null;
+ }
+
+ /**
+ * Return an array of Type.Member objects representing all of
+ * the data members directly implemented by this interface.
+ */
+ public Member[] getMembers() {
+ if( members != null ) {
+ return (Member[]) members.clone();
+ }
+ return null;
+ }
+
+ /**
+ * Create a CompoundType object for the given class.
+ *
+ * If the class is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static CompoundType forCompound (ClassDefinition classDef,
+ ContextStack stack) {
+ CompoundType result = null;
+
+ try {
+ result = (CompoundType) makeType(classDef.getType(),classDef,stack);
+ } catch (ClassCastException e) {}
+
+ return result;
+ }
+
+
+ //_____________________________________________________________________
+ // Subclass/Internal Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Release all resources.
+ */
+ protected void destroy () {
+ if (!destroyed) {
+ super.destroy();
+
+ if (methods != null) {
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i] != null) methods[i].destroy();
+ }
+ methods = null;
+ }
+
+ if (interfaces != null) {
+ for (int i = 0; i < interfaces.length; i++) {
+ if (interfaces[i] != null) interfaces[i].destroy();
+ }
+ interfaces = null;
+ }
+
+ if (members != null) {
+ for (int i = 0; i < members.length; i++) {
+ if (members[i] != null) members[i].destroy();
+ }
+ members = null;
+ }
+
+ classDef = null;
+ classDecl = null;
+ }
+ }
+
+ /*
+ * Load a Class instance. Return null if fail.
+ */
+ protected Class loadClass() {
+
+ Class ourClass = null;
+
+ // To avoid getting out-of-date Class instances, and
+ // to ensure that there is an instance, we must compile
+ // any classes that we've seen and which are not yet
+ // compiled. We can't just compile this class, 'cuz it
+ // may have dependencies on classes which have not been
+ // compiled...
+
+ try {
+ env.getMain().compileAllClasses(env);
+ } catch (Exception e1) {
+ for (Enumeration e = env.getClasses() ; e.hasMoreElements() ; ) {
+ ClassDeclaration c = (ClassDeclaration)e.nextElement();
+ }
+ failedConstraint(26,false,stack,"required classes");
+ env.flushErrors();
+ }
+
+ // Now try to get the Class...
+ // The outer try block is there for people who might want to use
+ // the compiler at run-time of their AS.
+ // They could set and use their own context class loader for loading
+ // classes directly.
+ try {
+ ClassLoader cl = Thread.currentThread().getContextClassLoader();
+ ourClass = cl.loadClass(getQualifiedName());
+ } catch(ClassNotFoundException cfe) {
+
+ try {
+ ourClass = env.classPathLoader.loadClass(getQualifiedName());
+ } catch (NullPointerException e) {
+ // This should never happen
+ } catch (ClassNotFoundException e) {
+ // Fall through to the next case (which is to look in the
+ // output directory for generated files)
+ }
+ }
+
+ /* This piece of code used to cause the compiler to ignore jar files
+ on its classpath
+ try {
+ ourClass = Util.loadClass(getQualifiedName(),null,null);
+ } catch (ClassNotFoundException e) {
+ } catch (LinkageError e) {
+ }
+ */
+
+ if (ourClass == null) {
+
+ // Try one last thing. If the class was compiled into
+ // a directory that's not in the classpath, the load
+ // will fail. Let's get the bits off the disk and load
+ // it directly...
+
+ if (env.loader == null) {
+ File destDir = env.getMain().getDestinationDir();
+ if (destDir == null) {
+ destDir = new File(".");
+ }
+ env.loader = new DirectoryLoader(destDir);
+ }
+
+ try {
+ ourClass = env.loader.loadClass(getQualifiedName());
+ } catch (Exception e) {}
+ }
+
+ return ourClass;
+ }
+
+ // Print "extends XX"
+
+ protected boolean printExtends (IndentingWriter writer,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+ ClassType parent = getSuperclass();
+
+ if (parent != null && (!useIDLNames ||
+ (!parent.isType(TYPE_ANY) && !parent.isType(TYPE_CORBA_OBJECT)))) {
+ writer.p(" extends ");
+ parent.printTypeName(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ return true;
+ }
+ return false;
+ }
+
+ // Print "implements XX, YY"
+
+ protected void printImplements (IndentingWriter writer,
+ String prefix,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+ InterfaceType[] interfaces = getInterfaces();
+
+ String adjective = " implements";
+
+ if (isInterface()) {
+ adjective = " extends";
+ }
+
+ if (useIDLNames) {
+ adjective = ":";
+ }
+
+ for (int i = 0; i < interfaces.length; i++) {
+ if (!useIDLNames || (!interfaces[i].isType(TYPE_ANY) && !interfaces[i].isType(TYPE_CORBA_OBJECT))) {
+ if (i == 0) {
+ writer.p(prefix + adjective + " ");
+ } else {
+ writer.p(", ");
+ }
+ interfaces[i].printTypeName(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ }
+ }
+ }
+
+ // Print members
+
+ protected void printMembers ( IndentingWriter writer,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+ CompoundType.Member[] members = getMembers();
+
+ for (int i = 0; i < members.length; i++) {
+ if (!members[i].isInnerClassDeclaration()) {
+ Type it = members[i].getType();
+ String visibility = members[i].getVisibility();
+ String name;
+
+ if (useIDLNames) {
+ name = members[i].getIDLName();
+ } else {
+ name = members[i].getName();
+ }
+
+ String value = members[i].getValue();
+
+ writer.p(visibility);
+ if (visibility.length() > 0) {
+ writer.p(" ");
+ }
+ it.printTypeName(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ writer.p(" " + name);
+
+ if (value != null) {
+ writer.pln(" = " + value + ";");
+ } else {
+ writer.pln(";");
+ }
+ }
+ }
+ }
+
+ // Print methods
+
+ protected void printMethods ( IndentingWriter writer,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+ CompoundType.Method[] methods = getMethods();
+
+ for (int m = 0; m < methods.length; m++) {
+ CompoundType.Method theMethod = methods[m];
+ printMethod(theMethod,writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ }
+ }
+
+ // Print a method...
+
+ protected void printMethod (CompoundType.Method it,
+ IndentingWriter writer,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+
+ // Write visibility...
+
+ String visibility = it.getVisibility();
+
+ writer.p(visibility);
+ if (visibility.length() > 0) {
+ writer.p(" ");
+ }
+
+ // Write return type...
+
+ it.getReturnType().printTypeName(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+
+ // Write method name...
+
+ if (useIDLNames) {
+ writer.p(" " + it.getIDLName());
+ } else {
+ writer.p(" " + it.getName());
+ }
+
+ // Write arguments...
+
+ writer.p(" (");
+ Type[] args = it.getArguments();
+ String[] argNames = it.getArgumentNames();
+
+ for (int i = 0; i < args.length; i++) {
+ if (i > 0) {
+ writer.p(", ");
+ }
+
+ if (useIDLNames) {
+ writer.p("in ");
+ }
+
+ args[i].printTypeName(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ writer.p(" " + argNames[i]);
+ }
+ writer.p(")");
+
+ // Write exceptions...
+
+ ClassType[] exceptions;
+
+ if (isType(TYPE_IMPLEMENTATION)) {
+ exceptions = it.getImplExceptions();
+ } else {
+ exceptions = it.getExceptions();
+ }
+
+ for (int i = 0; i < exceptions.length; i++) {
+ if (i == 0) {
+ if (useIDLNames) {
+ writer.p(" raises (");
+ } else {
+ writer.p(" throws ");
+ }
+ } else {
+ writer.p(", ");
+ }
+
+ if (useIDLNames) {
+ if (useQualifiedNames) {
+ writer.p(exceptions[i].getQualifiedIDLExceptionName(globalIDLNames));
+ } else {
+ writer.p(exceptions[i].getIDLExceptionName());
+ }
+ writer.p(" [a.k.a. ");
+ exceptions[i].printTypeName(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ writer.p("]");
+ } else {
+ exceptions[i].printTypeName(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ }
+ }
+
+ if (useIDLNames && exceptions.length > 0) {
+ writer.p(")");
+ }
+
+ if (it.isInherited()) {
+ writer.p(" // Inherited from ");
+ writer.p(it.getDeclaredBy());
+ }
+
+ writer.pln(";");
+ }
+
+ /**
+ * Create a CompoundType instance for the given class. NOTE: This constructor
+ * is ONLY for SpecialClassType and SpecialInterfaceType.
+ */
+ protected CompoundType(ContextStack stack, int typeCode, ClassDefinition classDef) {
+ super(stack,typeCode);
+ this.classDef = classDef;
+ classDecl = classDef.getClassDeclaration();
+ interfaces = new InterfaceType[0];
+ methods = new Method[0];
+ members = new Member[0];
+
+ // If we are an inner class/interface, reset the type codes...
+
+ if (classDef.isInnerClass()) {
+ setTypeCode(typeCode | TM_INNER);
+ }
+
+ // Set special flags...
+
+ setFlags();
+ }
+
+ private void setFlags() {
+
+ try {
+
+ // Set our special interface flags...
+
+ isCORBAObject = env.defCorbaObject.implementedBy(env,classDecl);
+ isIDLEntity = env.defIDLEntity.implementedBy(env,classDecl);
+ isValueBase = env.defValueBase.implementedBy(env,classDecl);
+ isAbstractBase = isInterface() && // Interface, not a class.
+ isIDLEntity && // Implements IDLEntity.
+ !isValueBase && // Does not implement ValueBase.
+ !isCORBAObject; // Does not implement org.omg.CORBA.Object;
+ isCORBAUserException = (classDecl.getName() == idCorbaUserException);
+
+ // Is this an exception?
+
+ if (env.defThrowable.implementedBy(env, classDecl)) {
+
+ // Yes...
+
+ isException = true;
+
+ // Is it a checked exception?
+
+ if (env.defRuntimeException.implementedBy(env,classDecl) ||
+ env.defError.implementedBy(env,classDecl)) {
+ isCheckedException = false;
+ } else {
+ isCheckedException = true;
+ }
+
+ // Is it java.rmi.RemoteException or a subclass?
+
+ if (env.defRemoteException.implementedBy(env,classDecl)) {
+ isRemoteExceptionOrSubclass = true;
+ } else {
+ isRemoteExceptionOrSubclass = false;
+ }
+ } else {
+ isException = false;
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+ }
+
+ /**
+ * Create a CompoundType instance for the given class. The resulting
+ * object is not yet completely initialized.
+ */
+ protected CompoundType(ContextStack stack, ClassDefinition classDef,
+ int typeCode) {
+ super(stack,typeCode);
+ this.classDef = classDef;
+ classDecl = classDef.getClassDeclaration();
+
+ // If we are an inner class/interface, reset the type codes...
+
+ if (classDef.isInnerClass()) {
+ setTypeCode(typeCode | TM_INNER);
+ }
+
+ // Set special flags...
+
+ setFlags();
+
+ // Set names...
+
+ Identifier id = classDef.getName();
+ String idlName;
+ String[] idlModuleNames;
+
+ try {
+
+ // These can fail if we get case-sensitive name matches...
+
+ idlName = IDLNames.getClassOrInterfaceName(id,env);
+ idlModuleNames = IDLNames.getModuleNames(id,isBoxed(),env);
+
+ setNames(id,idlModuleNames,idlName);
+
+ // Is this an exception?
+
+ if (isException()) {
+
+ // Yes, so set our mangled exception names...
+
+ isException = true;
+ idlExceptionName = IDLNames.getExceptionName(getIDLName());
+ qualifiedIDLExceptionName =
+ IDLNames.getQualifiedName(getIDLModuleNames(),idlExceptionName);
+ }
+
+ // Set interfaces, methods and members...
+
+ interfaces = null; // set in initialize()
+ methods = null; // set in initialize()
+ members = null; // set in initialize()
+
+ } catch (Exception e) {
+ failedConstraint(7,false,stack,id.toString(),e.getMessage());
+ throw new CompilerError("");
+ }
+ }
+
+ /**
+ * Initialize this instance.
+ */
+ protected boolean initialize ( Vector directInterfaces,
+ Vector directMethods,
+ Vector directMembers,
+ ContextStack stack,
+ boolean quiet) {
+
+ boolean result = true;
+
+ // Initialize our arrays...
+
+ if (directInterfaces != null && directInterfaces.size() > 0) {
+ interfaces = new InterfaceType[directInterfaces.size()];
+ directInterfaces.copyInto(interfaces);
+ } else {
+ interfaces = new InterfaceType[0];
+ }
+
+ if (directMethods != null && directMethods.size() > 0) {
+ methods = new Method[directMethods.size()];
+ directMethods.copyInto(methods);
+
+ // Now set the idl names for each...
+
+ try {
+ IDLNames.setMethodNames(this, methods,env);
+ } catch (Exception e) {
+ failedConstraint(13,quiet,stack,getQualifiedName(),e.getMessage());
+ result = false;
+ }
+
+ } else {
+ methods = new Method[0];
+ }
+
+ if (directMembers != null && directMembers.size() > 0) {
+ members = new Member[directMembers.size()];
+ directMembers.copyInto(members);
+
+ // If we have any un-initialized inner classes, now is the time
+ // to init them...
+
+ for (int i = 0; i < members.length; i++) {
+ if (members[i].isInnerClassDeclaration()) {
+ try {
+ members[i].init(stack,this);
+ } catch (CompilerError e) {
+ return false;
+ }
+ }
+ }
+
+ // Now set the idl names for each...
+
+ try {
+ IDLNames.setMemberNames(this, members,methods,env);
+ } catch (Exception e) {
+ int constraint = classDef.isInterface() ? 19 : 20;
+ failedConstraint(constraint,quiet,stack,getQualifiedName(),e.getMessage());
+ result = false;
+ }
+
+ } else {
+ members = new Member[0];
+ }
+
+ // Set our repositoryID...
+
+ if (result) {
+ result = setRepositoryID();
+ }
+
+ return result;
+ }
+
+ /*
+ * Return Type or null if error. classDef may be null.
+ */
+ protected static Type makeType (sun.tools.java.Type theType,
+ ClassDefinition classDef,
+ ContextStack stack) {
+
+ if (stack.anyErrors()) return null;
+
+ // See if we can find this type in the cache. If so, return it...
+
+ String key = theType.toString();
+
+ Type result = getType(key,stack);
+
+ if (result != null) {
+ return result;
+ }
+
+ // Gotta try with context...
+
+ result = getType(key + stack.getContextCodeString(),stack);
+
+ if (result != null) {
+ return result;
+ }
+
+ // Gotta map it...
+
+ BatchEnvironment env = stack.getEnv();
+ int typeCode = theType.getTypeCode();
+ switch (typeCode) {
+ case TC_BOOLEAN:
+ case TC_BYTE:
+ case TC_CHAR:
+ case TC_SHORT:
+ case TC_INT:
+ case TC_LONG:
+ case TC_FLOAT:
+ case TC_DOUBLE:
+ {
+ // Primitive...
+
+ result = PrimitiveType.forPrimitive(theType,stack);
+ break;
+ }
+
+ case TC_ARRAY:
+ {
+ // Array.
+
+ result = ArrayType.forArray(theType,stack);
+ break;
+ }
+
+ case TC_CLASS:
+ {
+ try {
+ // First, make sure we have the class definition...
+
+ ClassDefinition theClass = classDef;
+
+ if (theClass == null) {
+ theClass = env.getClassDeclaration(theType).getClassDefinition(env);
+ }
+
+ // Is it an interface or a class?
+
+ if (theClass.isInterface()) {
+
+ // An interface. Is it a special case?
+
+ result = SpecialInterfaceType.forSpecial(theClass,stack);
+
+ if (result == null) {
+
+ // No, does it implement java.rmi.Remote?
+
+ if (env.defRemote.implementedBy(env,theClass.getClassDeclaration())) {
+
+ // Yep, so just see if we can create an instance of RemoteType
+ // from it...
+
+ boolean parentIsValue = stack.isParentAValue();
+ result = RemoteType.forRemote(theClass,stack,parentIsValue);
+
+ // If we did not succeed AND we are in a value context, then
+ // go ahead and make an NC type out of it...
+
+ if (result == null && parentIsValue) {
+ result = NCInterfaceType.forNCInterface(theClass,stack);
+ }
+ } else {
+
+ // Nope, is it an AbstractType?
+
+ result = AbstractType.forAbstract(theClass,stack,true);
+
+ if (result == null) {
+
+ // No, so treat it as a non-conforming interface type...
+
+ result = NCInterfaceType.forNCInterface(theClass,stack);
+ }
+ }
+ }
+ } else {
+
+ // A class. Is it a special case?
+
+ result = SpecialClassType.forSpecial(theClass,stack);
+
+ if (result == null) {
+
+ ClassDeclaration classDecl = theClass.getClassDeclaration();
+
+ // Nope, does it implement java.rmi.Remote?
+
+ if (env.defRemote.implementedBy(env,classDecl)) {
+
+ // Yep, so just see if we can create an instance of
+ // ImplementationType from it...
+
+ boolean parentIsValue = stack.isParentAValue();
+ result = ImplementationType.forImplementation(theClass,stack,parentIsValue);
+
+ // If we did not succeed AND inValue is true, then
+ // go ahead and make an NC type out of it...
+
+ if (result == null && parentIsValue) {
+ result = NCClassType.forNCClass(theClass,stack);
+ }
+ } else {
+
+ // No, does it implement Serializable?
+
+ if (env.defSerializable.implementedBy(env,classDecl)) {
+
+ // Yep, so just see if we can create an instance of ValueType
+ // from it...
+
+ result = ValueType.forValue(theClass,stack,true);
+ }
+
+ if (result == null) {
+
+ // Treat it as a non-conforming class type...
+
+ result = NCClassType.forNCClass(theClass,stack);
+ }
+ }
+ }
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+ break;
+ }
+
+ default: throw new CompilerError("Unknown typecode (" + typeCode + ") for " + theType.getTypeSignature());
+ }
+
+ return result;
+ }
+
+ /*
+ * Check if exception is RemoteException or one of its parents.
+ */
+ public static boolean isRemoteException (ClassType ex,
+ BatchEnvironment env) {
+ sun.tools.java.Type exceptionType = ex.getClassDeclaration().getType();
+
+ if (exceptionType.equals(env.typeRemoteException) ||
+ exceptionType.equals(env.typeIOException) ||
+ exceptionType.equals(env.typeException) ||
+ exceptionType.equals(env.typeThrowable)) {
+
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * Check if method is conforming.
+ */
+ protected boolean isConformingRemoteMethod (Method method, boolean quiet)
+ throws ClassNotFound {
+
+ // Do we have one exception that is RemoteException or
+ // a superclass of RemoteException?
+
+ boolean haveRemote = false;
+ ClassType[] exceptions = method.getExceptions();
+
+ for (int i = 0; i < exceptions.length; i++) {
+
+ // Is it a conforming exception?
+
+ if (isRemoteException(exceptions[i],env)) {
+
+ // Got it.
+
+ haveRemote = true;
+ break;
+ }
+ }
+
+ // Do we have our exception?
+
+ if (!haveRemote) {
+
+ // No, so report failure...
+
+ failedConstraint(5,quiet,stack,method.getEnclosing(), method.toString());
+ }
+
+ // Are any of the arguments exceptions which implement IDLEntity?
+ // If so, report failure...
+
+ boolean noIDLEntity = !isIDLEntityException(method.getReturnType(),method,quiet);
+ if (noIDLEntity) {
+ Type[] args = method.getArguments();
+ for (int i = 0; i < args.length; i++) {
+ if (isIDLEntityException(args[i],method,quiet)) {
+ noIDLEntity = false;
+ break;
+ }
+ }
+ }
+
+ return (haveRemote && noIDLEntity);
+ }
+
+ protected boolean isIDLEntityException(Type type, CompoundType.Method method,boolean quiet)
+ throws ClassNotFound {
+ if (type.isArray()) {
+ type = type.getElementType();
+ }
+ if (type.isCompound()){
+ if (((CompoundType)type).isIDLEntityException()) {
+ failedConstraint(18,quiet,stack,method.getEnclosing(), method.toString());
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Convert all invalid types to valid ones.
+ */
+ protected void swapInvalidTypes () {
+
+ // Walk all interfaces and check them...
+
+ for (int i = 0; i < interfaces.length; i++) {
+ if (interfaces[i].getStatus() != STATUS_VALID) {
+ interfaces[i] = (InterfaceType)getValidType(interfaces[i]);
+ }
+ }
+
+ // Update methods...
+
+ for (int i = 0; i < methods.length; i++) {
+ methods[i].swapInvalidTypes();
+ }
+
+ // Update members...
+
+ for (int i = 0; i < members.length; i++) {
+ members[i].swapInvalidTypes();
+ }
+ }
+
+ /*
+ * Add matching types to list. Return true if this type has not
+ * been previously checked, false otherwise.
+ */
+ protected boolean addTypes (int typeCodeFilter,
+ HashSet checked,
+ Vector matching) {
+
+ // Check self.
+
+ boolean result = super.addTypes(typeCodeFilter,checked,matching);
+
+ // Have we been checked before?
+
+ if (result) {
+
+ // Nope, so walk parent(s) and check them...
+
+ ClassType parent = getSuperclass();
+
+ if (parent != null) {
+ parent.addTypes(typeCodeFilter,checked,matching);
+ }
+
+ // Walk all interfaces and check them...
+
+ //if (interfaces == null) System.out.println("NULL for " +getQualifiedName() + " interfaces");
+ for (int i = 0; i < interfaces.length; i++) {
+
+ // Now recurse and add it and any referenced types...
+
+ //if (interfaces[i] == null) System.out.println("NULL for " +getQualifiedName() + " interfaces[" + i + "]");
+ interfaces[i].addTypes(typeCodeFilter,checked,matching);
+ }
+
+ // Walk all methods and check arguments...
+
+ //if (methods == null) System.out.println("NULL for " +getQualifiedName() + " methods");
+ for (int i = 0; i < methods.length; i++) {
+
+ // Add return type...
+ //if (methods[i] == null) System.out.println("NULL for " +getQualifiedName() + " methods[" + i + "]");
+ //if (methods[i].getReturnType() == null) System.out.println("NULL for " +getQualifiedName() + methods[i]);
+ methods[i].getReturnType().addTypes(typeCodeFilter,checked,matching);
+
+ // Add args...
+
+ Type[] args = methods[i].getArguments();
+ //if (args == null) System.out.println("NULL for " + getQualifiedName() + " args");
+
+ for (int j = 0; j < args.length; j++) {
+
+ Type arg = args[j];
+ //if (arg == null) System.out.println("NULL for " + getQualifiedName() + " arg[" +j+"]");
+
+ // Add argument...
+
+ arg.addTypes(typeCodeFilter,checked,matching);
+ }
+
+ // Add exceptions...
+
+ ClassType[] exceptions = methods[i].getExceptions();
+ //if (exceptions == null) System.out.println("NULL for " + getQualifiedName() + " exceptions");
+
+ for (int j = 0; j < exceptions.length; j++) {
+
+ ClassType ex = exceptions[j];
+
+ // Add argument...
+
+ ex.addTypes(typeCodeFilter,checked,matching);
+ }
+ }
+
+ // Walk all members and add em...
+
+ //if (members == null) System.out.println("NULL for " +getQualifiedName() + " members");
+ for (int i = 0; i < members.length; i++) {
+ //if (members[i] == null) System.out.println("NULL for " +getQualifiedName() + " members[" + i + "]");
+ Type cType = members[i].getType();
+ //if (cType == null) System.out.println("NULL for " + getQualifiedName() + " cType");
+
+ // Add it...
+
+ cType.addTypes(typeCodeFilter,checked,matching);
+ }
+ }
+
+ return result;
+ }
+
+ /*
+ * Return true if theType is a conforming constant type.
+ */
+ private boolean isConformingConstantType (MemberDefinition member) {
+ return isConformingConstantType(member.getType(),member);
+ }
+
+ /*
+ * Return true if theType is a conforming constant type.
+ */
+ private boolean isConformingConstantType (sun.tools.java.Type theType,MemberDefinition member) {
+
+ // Constraint 3: Constants must be either primitives or String.
+
+ boolean result = true;
+ int typeCode = theType.getTypeCode();
+ switch (typeCode) {
+ case TC_BOOLEAN:
+ case TC_BYTE:
+ case TC_CHAR:
+ case TC_SHORT:
+ case TC_INT:
+ case TC_LONG:
+ case TC_FLOAT:
+ case TC_DOUBLE: // Primitive, so OK...
+ {
+ break;
+ }
+
+ case TC_CLASS: // Must be java.lang.String
+ {
+ if (theType.getClassName() != idJavaLangString) {
+ failedConstraint(3,false,stack,member.getClassDefinition(),member.getName());
+ result = false;
+ }
+ break;
+ }
+
+ case TC_ARRAY: // Array constants are not allowed.
+ {
+ failedConstraint(3,false,stack,member.getClassDefinition(),member.getName());
+ result = false;
+ break;
+ }
+
+ default:
+ throw new Error("unexpected type code: " + typeCode);
+ }
+
+ return result;
+ }
+
+
+ /*
+ * Update any method from 'currentMethods' which is defined in a
+ * parent class so that it's 'declaredBy' field specifies the
+ * parent.
+ * @param current The class or interface to gather methods from.
+ * @param currentMethods The list into which to put the methods.
+ * for contraint 6.
+ * @param quiet true if silent errors.
+ * @param stack the context stack.
+ * @return currentMethods or null if failed a constraint check.
+ */
+ protected Vector updateParentClassMethods(ClassDefinition current,
+ Vector currentMethods,
+ boolean quiet,
+ ContextStack stack)
+ throws ClassNotFound {
+
+ ClassDeclaration parentDecl = current.getSuperClass(env);
+
+ while (parentDecl != null) {
+
+ ClassDefinition parentDef = parentDecl.getClassDefinition(env);
+ Identifier currentID = parentDecl.getName();
+
+ if ( currentID == idJavaLangObject ) break;
+
+ // Walk all members of this class and update any that
+ // already exist in currentMethods...
+
+ for (MemberDefinition member = parentDef.getFirstMember();
+ member != null;
+ member = member.getNextMember()) {
+
+ if (member.isMethod() &&
+ !member.isInitializer() &&
+ !member.isConstructor() &&
+ !member.isPrivate()) {
+
+ // It's a method. Is it valid?
+
+ Method method;
+ try {
+ method = new Method((CompoundType)this,member,quiet,stack);
+ } catch (Exception e) {
+ // Don't report anything here, it's already been reported...
+ return null;
+ }
+
+ // Have we already seen it?
+
+ int index = currentMethods.indexOf(method);
+ if (index >= 0) {
+
+ // Yes, so update it...
+
+ Method currentMethod = (Method)currentMethods.elementAt(index);
+ currentMethod.setDeclaredBy(currentID);
+ }
+ else currentMethods.addElement(method);
+ }
+ }
+
+ // Update parent and keep walking up the chain...
+
+ parentDecl = parentDef.getSuperClass(env);
+ }
+
+ return currentMethods;
+ }
+
+ /*
+ * Add all of the public and protected methods defined in
+ * current (other than initializers) to allMethods. If a sub-interface
+ * re-declares an inherited method, it will not be added.
+ * @param current The class or interface to gather methods from.
+ * @param directMethods The list into which to put the methods.
+ * @param noMultiInheritedMethods A flag to enable/disable checking
+ * for contraint 6.
+ * @param quiet true if silent errors.
+ * @param stack the context stack.
+ * @return directMethods or null if failed a constraint check.
+ */
+ protected Vector addAllMethods (ClassDefinition current, Vector directMethods,
+ boolean noMultiInheritedMethods,
+ boolean quiet,
+ ContextStack stack)
+ throws ClassNotFound {
+
+ // Constraint 6: Multiple inherited interfaces may not
+ // declare the same method.
+
+ ClassDeclaration[] interfaces = current.getInterfaces();
+
+ // We want to add members starting at the _least_ derived
+ // interfaces. To do so, recurse until we have no more
+ // interfaces...
+
+ for (int i = 0; i < interfaces.length; i++) {
+
+ Vector result = addAllMethods(interfaces[i].getClassDefinition(env),
+ directMethods,
+ noMultiInheritedMethods,quiet,stack);
+ if (result == null) {
+ return null;
+ }
+ }
+
+ // Walk all members of this interface, adding any unique methods
+ // other than initializers and private methods...
+
+ for (MemberDefinition member = current.getFirstMember();
+ member != null;
+ member = member.getNextMember())
+ {
+ if (member.isMethod() &&
+ !member.isInitializer() &&
+ !member.isPrivate()) {
+
+ // It's a method. Is it valid?
+
+ Method method;
+ try {
+ method = new Method((CompoundType)this,member,quiet,stack);
+ } catch (Exception e) {
+ // Don't report anything here, it's already been reported...
+ return null;
+ }
+
+ // Have we already seen it?
+
+ if (!directMethods.contains(method)) {
+
+ // Nope, so add it...
+
+ directMethods.addElement(method);
+
+ } else {
+
+ // Yes. This is an error unless we are looking at the
+ // target interface (or this is a ValueType). Are we?
+
+ if (noMultiInheritedMethods && current != classDef &&
+ !stack.isParentAValue() && !stack.getContext().isValue()) {
+
+ // Nope. Say so and signal error by returning null..
+
+ Method existingMethod = (Method) directMethods.elementAt(directMethods.indexOf(method));
+ ClassDefinition existingMemberClassDef = existingMethod.getMemberDefinition().getClassDefinition();
+
+ // There are more legal cases to consider here.
+ // If the two methods belong to interfaces that inherit from each other
+ // then it is just a redefinition which is legal.
+ if ( current != existingMemberClassDef &&
+ ! inheritsFrom(current, existingMemberClassDef) &&
+ ! inheritsFrom(existingMemberClassDef, current))
+ {
+ //Identifier int1 = existingMethod.getEnclosing().getIdentifier();
+ //Identifier int2 = current.getName();
+ //String message = int1.toString() + " and " + int2.toString();
+ String message = existingMemberClassDef.getName() + " and " + current.getName();
+ failedConstraint(6,quiet,stack,classDef,message,method);
+ return null;
+ }
+ }
+
+ // Bug fix 5014329
+
+ // find a matching method.
+ int index = directMethods.indexOf(method);
+ Method other = (Method) directMethods.get(index);
+
+ // merge the two methods, such that the new method
+ // will contain only those exception that can be thrown
+ // by both these methods, not just one of them.
+ Method newMethod = method.mergeWith(other);
+
+ // replace the old method with the new.
+ directMethods.set(index, newMethod);
+ }
+ }
+ }
+
+ return directMethods;
+ }
+
+ // This should really be a method on ClassDefinition, but it takes too long to change the shared source.
+ // Works for both, classes and interfaces.
+ protected boolean inheritsFrom(ClassDefinition def, ClassDefinition otherDef) {
+ if (def == otherDef)
+ return true;
+
+ ClassDefinition superDef;
+ if (def.getSuperClass() != null) {
+ superDef = def.getSuperClass().getClassDefinition();
+ if (inheritsFrom(superDef, otherDef))
+ return true;
+ }
+
+ ClassDeclaration[] interfaces = def.getInterfaces();
+ for (int i=0; i<interfaces.length; i++) {
+ superDef = interfaces[i].getClassDefinition();
+ if (inheritsFrom(superDef, otherDef))
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * Add all of the interfaces implemented directly by current
+ * to the list. Returns null if any are non-conforming.
+ */
+ protected Vector addRemoteInterfaces (Vector list,
+ boolean allowNonConforming,
+ ContextStack stack) throws ClassNotFound {
+
+ // Add all the interfaces of current...
+
+ ClassDefinition theInterface = getClassDefinition();
+ ClassDeclaration[] interfaces = theInterface.getInterfaces();
+
+ stack.setNewContextCode(ContextStack.IMPLEMENTS);
+
+ for (int i = 0; i < interfaces.length; i++) {
+
+ ClassDefinition def = interfaces[i].getClassDefinition(env);
+
+ // Is it a SpecialInterfaceType...
+
+ InterfaceType it = SpecialInterfaceType.forSpecial(def,stack);;
+
+ if (it == null) {
+
+ // No, is it Remote?
+
+ if (env.defRemote.implementedBy(env, interfaces[i])) {
+
+ // Yes, so it must be a RemoteType.
+
+ it = RemoteType.forRemote(def,stack,false);
+
+ } else {
+
+ // Then try Abstract...
+
+ it = AbstractType.forAbstract(def,stack,true);
+
+ if (it == null && allowNonConforming) {
+
+ // Must be non-conforming...
+
+ it = NCInterfaceType.forNCInterface(def,stack);
+ }
+ }
+ }
+
+ if (it != null) {
+ list.addElement(it);
+ } else {
+ return null;
+ }
+ }
+
+ return list;
+ }
+
+ /*
+ * Add all of the interfaces implemented directly by current
+ * to the list.
+ */
+ protected Vector addNonRemoteInterfaces (Vector list,
+ ContextStack stack) throws ClassNotFound {
+
+ // Add all the interfaces of current...
+
+ ClassDefinition theInterface = getClassDefinition();
+ ClassDeclaration[] interfaces = theInterface.getInterfaces();
+
+ stack.setNewContextCode(ContextStack.IMPLEMENTS);
+
+ for (int i = 0; i < interfaces.length; i++) {
+
+ ClassDefinition def = interfaces[i].getClassDefinition(env);
+
+ // First try SpecialInterfaceType...
+
+ InterfaceType it = SpecialInterfaceType.forSpecial(def,stack);
+
+ if (it == null) {
+
+ // Then try AbstractType...
+
+ it = AbstractType.forAbstract(def,stack,true);
+
+ if (it == null) {
+
+ // Then try NCInterfaceType...
+
+ it = NCInterfaceType.forNCInterface(def,stack);
+ }
+ }
+
+ if (it != null) {
+ list.addElement(it);
+ } else {
+ return null;
+ }
+ }
+
+ return list;
+ }
+
+
+ /*
+ * Walk self, adding constants and data members.
+ * @return true if all conform, false otherwise.
+ */
+ protected boolean addAllMembers (Vector allMembers,
+ boolean onlyConformingConstants, // AND inner classes.
+ boolean quiet,
+ ContextStack stack) {
+
+ boolean result = true;
+
+ // Walk all members of this interface...
+
+ for (MemberDefinition member = getClassDefinition().getFirstMember();
+ member != null && result;
+ member = member.getNextMember())
+ {
+ if (!member.isMethod()) {
+
+ try {
+ String value = null;
+
+ // Prod it to setValue if it is a constant...
+
+ member.getValue(env);
+
+ // Get the value, if any...
+
+ Node node = member.getValue();
+
+ if (node != null) {
+ // We don't want to change the code in CharExpression,
+ // which is shared among tools, to return the right string
+ // in case the type is char, so we treat it special here.
+ if (member.getType().getTypeCode() == TC_CHAR) {
+ Integer intValue = (Integer)((IntegerExpression)node).getValue();
+ value = "L'" + String.valueOf((char)intValue.intValue()) + "'";
+ } else {
+ value = node.toString();
+ }
+ }
+
+ // Are we supposed to allow only conforming constants?
+
+ if (onlyConformingConstants && member.getInnerClass() == null) {
+
+ // Yep, so check it...
+
+ if (value == null || !isConformingConstantType(member)) {
+ failedConstraint(3,quiet,stack,member.getClassDefinition(),member.getName());
+ result = false;
+ break;
+ }
+ }
+
+ // Make member and add to list...
+
+ try {
+ Member newMember = new Member(member,value,stack,this);
+ allMembers.addElement(newMember);
+ } catch (CompilerError e) {
+ result = false;
+ }
+
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ result = false;
+ }
+ }
+ }
+
+ return result;
+ }
+ /*
+ * Walk self, adding constants.
+ * @return true if all conform, false otherwise.
+ */
+ protected boolean addConformingConstants (Vector allMembers,
+ boolean quiet,
+ ContextStack stack) {
+
+ boolean result = true;
+
+ // Walk all members of this interface...
+
+ for (MemberDefinition member = getClassDefinition().getFirstMember();
+ member != null && result;
+ member = member.getNextMember())
+ {
+ if (!member.isMethod()) {
+
+ try {
+ String value = null;
+
+ // Prod it to setValue if it is a constant...
+
+ member.getValue(env);
+
+ // Get the value, if any...
+
+ Node node = member.getValue();
+
+ if (node != null) {
+ value = node.toString();
+ }
+
+
+ // Is it a constant?
+
+ if (value != null) {
+
+ // Yes, is it conforming?
+
+ if (!isConformingConstantType(member)) {
+ failedConstraint(3,quiet,stack,member.getClassDefinition(),member.getName());
+ result = false;
+ break;
+ }
+
+ // Yes, so make a member and add to list...
+
+ try {
+ Member newMember = new Member(member,value,stack,this);
+ allMembers.addElement(newMember);
+ } catch (CompilerError e) {
+ result = false;
+ }
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ result = false;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ protected ValueType[] getMethodExceptions (MemberDefinition member,
+ boolean quiet,
+ ContextStack stack) throws Exception {
+
+ boolean result = true;
+ stack.setNewContextCode(ContextStack.METHOD_EXCEPTION);
+ ClassDeclaration[] except = member.getExceptions(env);
+ ValueType[] exceptions = new ValueType[except.length];
+
+ try {
+ for (int i = 0; i < except.length; i++) {
+ ClassDefinition theClass = except[i].getClassDefinition(env);
+ try {
+ ValueType type = ValueType.forValue(theClass,stack,false);
+ if (type != null) {
+ exceptions[i] = type;
+ } else {
+ result = false;
+ }
+ } catch (ClassCastException e1) {
+ failedConstraint(22,quiet,stack,getQualifiedName());
+ throw new CompilerError("Method: exception " + theClass.getName() + " not a class type!");
+ } catch (NullPointerException e2) {
+ failedConstraint(23,quiet,stack,getQualifiedName());
+ throw new CompilerError("Method: caught null pointer exception");
+ }
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(quiet,stack,e);
+ result = false;
+ }
+
+ if (!result) {
+ throw new Exception();
+ }
+
+ // Remove any duplicates (javac seems to allow them, but rmic will
+ // generate bad ties)...
+
+ int dupCount = 0;
+ for (int i = 0; i < exceptions.length; i++) {
+ for (int j = 0; j < exceptions.length; j++) {
+ if (i != j && exceptions[i] != null && exceptions[i] == exceptions[j]) {
+ exceptions[j] = null;
+ dupCount++;
+ }
+ }
+ }
+ if (dupCount > 0) {
+ int offset = 0;
+ ValueType[] temp = new ValueType[exceptions.length - dupCount];
+ for (int i = 0; i < exceptions.length; i++) {
+ if (exceptions[i] != null) {
+ temp[offset++] = exceptions[i];
+ }
+ }
+ exceptions = temp;
+ }
+
+ return exceptions;
+ }
+
+
+ protected static String getVisibilityString (MemberDefinition member) {
+ String vis = "";
+ String prefix = "";
+
+ if (member.isPublic()) {
+ vis += "public";
+ prefix = " ";
+ } else if (member.isProtected()) {
+ vis += "protected";
+ prefix = " ";
+ } else if (member.isPrivate()) {
+ vis += "private";
+ prefix = " ";
+ }
+
+ if (member.isStatic()) {
+ vis += prefix;
+ vis += "static";
+ prefix = " ";
+ }
+
+ if (member.isFinal()) {
+ vis += prefix;
+ vis += "final";
+ prefix = " ";
+ }
+
+ return vis;
+ }
+
+ protected boolean assertNotImpl(Type type,
+ boolean quiet,
+ ContextStack stack,
+ CompoundType enclosing,
+ boolean dataMember) {
+
+ if (type.isType(TYPE_IMPLEMENTATION)) {
+ int constraint = dataMember ? 28 : 21;
+ failedConstraint(constraint,quiet,stack,type,enclosing.getName());
+ return false;
+ }
+ return true;
+ }
+
+ //_____________________________________________________________________
+ // Inner Class "Method"
+ //_____________________________________________________________________
+
+ /**
+ * A CompoundType.Method object encapsulates IIOP-specific information
+ * about a particular method in the interface represented by the outer
+ * instance.
+ */
+ public class Method implements ContextElement, Cloneable {
+
+ /**
+ * Is this method inherited?
+ */
+ public boolean isInherited () {
+ return declaredBy != enclosing.getIdentifier();
+ }
+
+ /**
+ * Is this method an attribute?
+ * Return true if getAttributeKind != ATTRIBUTE_NONE.
+ */
+ public boolean isAttribute () {
+ return attributeKind != ATTRIBUTE_NONE;
+ }
+
+ /**
+ * Is this method a read-write attribute?
+ */
+ public boolean isReadWriteAttribute () {
+ return attributeKind == ATTRIBUTE_IS_RW ||
+ attributeKind == ATTRIBUTE_GET_RW;
+ }
+
+ /**
+ * Return the attribute kind.
+ */
+ public int getAttributeKind() {
+ return attributeKind;
+ }
+
+ /**
+ * Return the attribute name. Will be null if
+ * attribute kind == ATTRIBUTE_NONE.
+ */
+ public String getAttributeName() {
+ return attributeName;
+ }
+
+ /**
+ * For kinds ATTRIBUTE_GET_RW or ATTRIBUTE_IS_RW, return
+ * the index of the matching ATTRIBUTE_SET method, and
+ * vice-versa. For all other cases, return -1.
+ */
+ public int getAttributePairIndex() {
+ return attributePairIndex;
+ }
+
+ /**
+ * Return context element name.
+ */
+ public String getElementName() {
+ return memberDef.toString();
+ }
+
+ /**
+ * Equality check based on method signature.
+ */
+ public boolean equals(Object obj) {
+ Method other = (Method) obj;
+
+ if (getName().equals(other.getName()) &&
+ arguments.length == other.arguments.length) {
+
+ for (int i = 0; i < arguments.length; i++) {
+ if (! arguments[i].equals(other.arguments[i])) {
+ return false;
+ }
+ }
+ return true;
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return getName().hashCode() ^ Arrays.hashCode(arguments);
+ }
+
+ /**
+ * Return a new Method object that is a legal combination of
+ * this method object and another one.
+ *
+ * This requires determining the exceptions declared by the
+ * combined method, which must be only those exceptions
+ * that may thrown by both of the old methods.
+ */
+ public Method mergeWith(Method other) {
+ if (!equals(other)) {
+ env.error(0, "attempt to merge method failed:", getName(),
+ enclosing.getClassDefinition().getName());
+ }
+
+ Vector legalExceptions = new Vector();
+ try {
+ collectCompatibleExceptions(
+ other.exceptions, exceptions, legalExceptions);
+ collectCompatibleExceptions(
+ exceptions, other.exceptions, legalExceptions);
+ } catch (ClassNotFound e) {
+ env.error(0, "class.not.found", e.name,
+ enclosing.getClassDefinition().getName());
+ return null;
+ }
+
+ Method merged = (Method) clone();
+ merged.exceptions = new ValueType[legalExceptions.size()];
+ legalExceptions.copyInto(merged.exceptions);
+ merged.implExceptions = merged.exceptions;
+
+ return merged;
+ }
+
+ /**
+ * Add to the supplied list all exceptions in the "from" array
+ * that are subclasses of an exception in the "with" array.
+ */
+ private void collectCompatibleExceptions(
+ ValueType[] from, ValueType[] with, Vector list)
+ throws ClassNotFound {
+
+ for (int i = 0; i < from.length; i++) {
+ ClassDefinition exceptionDef = from[i].getClassDefinition();
+ if (!list.contains(from[i])) {
+ for (int j = 0; j < with.length; j++) {
+ if (exceptionDef.subClassOf(
+ enclosing.getEnv(),
+ with[j].getClassDeclaration())) {
+ list.addElement(from[i]);
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * Return the compound type which contains this method.
+ */
+ public CompoundType getEnclosing() {
+ return enclosing;
+ }
+
+ /**
+ * Return the identifier for the class or interface which
+ * declares this method.
+ */
+ public Identifier getDeclaredBy() {
+ return declaredBy;
+ }
+
+ /**
+ * Return the visibility (e.g. "public final") of this member.
+ */
+ public String getVisibility() {
+ return vis;
+ }
+
+ /**
+ * Methods to check various attributes.
+ */
+ public boolean isPublic() {
+ return memberDef.isPublic();
+ }
+
+ public boolean isProtected() {
+ return memberDef.isPrivate();
+ }
+
+ public boolean isPrivate() {
+ return memberDef.isPrivate();
+ }
+
+ public boolean isStatic() {
+ return memberDef.isStatic();
+ }
+
+ /**
+ * Return the name of this method.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * IDL_Naming
+ * Return the IDL name of this method.
+ */
+ public String getIDLName() {
+ return idlName;
+ }
+
+ /**
+ * Return the type of this method.
+ */
+ public sun.tools.java.Type getType() {
+ return memberDef.getType();
+ }
+
+ /**
+ * Return true if this is a constructor.
+ */
+ public boolean isConstructor () {
+ return memberDef.isConstructor();
+ }
+
+ /**
+ * Return true if this is NOT a constructor {@code &&} is not
+ * an attribute.
+ */
+ public boolean isNormalMethod () {
+ return (!memberDef.isConstructor()) && attributeKind == ATTRIBUTE_NONE;
+ }
+
+ /**
+ * Get the return type of this method. May be null.
+ */
+ public Type getReturnType() {
+ return returnType;
+ }
+
+ /**
+ * Return the argument types of this method.
+ */
+ public Type[] getArguments() {
+ return (Type[]) arguments.clone();
+ }
+
+ /**
+ * Return the names of the argument types of this method.
+ */
+ public String[] getArgumentNames() {
+ return argumentNames;
+ }
+
+ /**
+ * Return the MemberDefinition from which this method was created.
+ */
+ public MemberDefinition getMemberDefinition() {
+ return memberDef;
+ }
+
+ /**
+ * Return an array of the exception classes declared to be
+ * thrown by this remote method.
+ *
+ * For methods with the same name and type signature inherited
+ * from multiple remote interfaces, the array will contain
+ * the set of exceptions declared in all of the interfaces'
+ * methods that can be legally thrown in each of them.
+ */
+ public ValueType[] getExceptions() {
+ return (ValueType[]) exceptions.clone();
+ }
+
+ /**
+ * Same as getExceptions(), except when method is in an
+ * ImplementationType and the exceptions list is narrower.
+ */
+ public ValueType[] getImplExceptions() {
+ return (ValueType[]) implExceptions.clone();
+ }
+
+ /**
+ * Return an array containing only those exceptions which
+ * need to be caught. Removes java.rmi.RemoteException,
+ * java.lang.RuntimeException, java.lang.Error, and their
+ * subclasses, then removes any exceptions which are more
+ * derived than another in the list. Returns null if no
+ * exceptions need to be caught.
+ */
+ public ValueType[] getUniqueCatchList(ValueType[] list) {
+ ValueType[] result = list;
+ int newSize = list.length;
+
+ try {
+
+ // First, remove RemoteException, RuntimeException, Error, and their subclasses...
+ for (int i = 0; i < list.length; i++) {
+ ClassDeclaration decl = list[i].getClassDeclaration();
+ if (env.defRemoteException.superClassOf(env, decl) ||
+ env.defRuntimeException.superClassOf(env, decl) ||
+ env.defError.superClassOf(env, decl)) {
+ list[i] = null;
+ newSize--;
+ }
+ }
+
+ // Now remove derived types...
+ for (int i = 0; i < list.length; i++) {
+ if (list[i] != null) {
+ ClassDefinition current = list[i].getClassDefinition();
+ for (int j = 0; j < list.length; j++) {
+ if (j != i && list[i] != null && list[j] != null &&
+ current.superClassOf(env, list[j].getClassDeclaration())) {
+ list[j] = null;
+ newSize--;
+ }
+ }
+ }
+ }
+
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e); // Report error but do not stop.
+ }
+
+ // Create new list if we removed anything...
+
+ if (newSize < list.length) {
+ ValueType[] temp = new ValueType[newSize];
+ int offset = 0;
+ for (int i = 0; i < list.length; i++) {
+ if (list[i] != null) {
+ temp[offset++] = list[i];
+ }
+ }
+ list = temp;
+ }
+
+ if (list.length == 0) {
+ return null;
+ } else {
+ return list;
+ }
+ }
+
+ /**
+ * Return an array containing only those exceptions which need to be
+ * handled explicitly by the stub. Removes java.lang.RuntimeException,
+ * java.lang.Error, and their subclasses, since these are all passed
+ * back as CORBA system exceptions. Also removes subclasses of
+ * java.rmi.RemoteException but not java.rmi.RemoteException itself,
+ * since this may need to be thrown by the stub.
+ */
+ public ValueType[] getFilteredStubExceptions(ValueType[] list) {
+ ValueType[] result = list;
+ int newSize = list.length;
+
+ try {
+
+ for (int i = 0; i < list.length; i++) {
+ ClassDeclaration decl = list[i].getClassDeclaration();
+ if ((env.defRemoteException.superClassOf(env, decl) &&
+ !env.defRemoteException.getClassDeclaration().equals(decl)) ||
+ env.defRuntimeException.superClassOf(env, decl) ||
+ env.defError.superClassOf(env, decl)) {
+ list[i] = null;
+ newSize--;
+ }
+ }
+
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e); // Report error but do not stop.
+ }
+
+ // Create new list if we removed anything...
+
+ if (newSize < list.length) {
+ ValueType[] temp = new ValueType[newSize];
+ int offset = 0;
+ for (int i = 0; i < list.length; i++) {
+ if (list[i] != null) {
+ temp[offset++] = list[i];
+ }
+ }
+ list = temp;
+ }
+
+ return list;
+ }
+
+ /**
+ * Return the string representation of this method.
+ */
+ public String toString() {
+
+ if (stringRep == null) {
+
+ StringBuffer result = new StringBuffer(returnType.toString());
+
+ // Add name...
+
+ result.append(" ");
+ result.append(getName());
+ result.append(" (");
+
+ // Add arguments...
+
+ for (int i = 0; i < arguments.length; i++) {
+ if (i > 0) {
+ result.append(", ");
+ }
+ result.append(arguments[i]);
+ result.append(" ");
+ result.append(argumentNames[i]);
+ }
+
+ result.append(")");
+
+ // Add exceptions...
+
+ for (int i = 0; i < exceptions.length; i++) {
+ if (i == 0) {
+ result.append(" throws ");
+ } else {
+ result.append(", ");
+ }
+ result.append(exceptions[i]);
+ }
+
+ result.append(";");
+
+ stringRep = result.toString();
+ }
+
+ return stringRep;
+ }
+
+
+ /**
+ * Set attribute kind. May only be called during initialization.
+ */
+ public void setAttributeKind(int kind) {
+ attributeKind = kind;
+ }
+
+ /**
+ * Set pair index. May only be called during initialization.
+ */
+ public void setAttributePairIndex(int index) {
+ attributePairIndex = index;
+ }
+
+ /**
+ * Set attribute name. May only be called during initialization.
+ */
+ public void setAttributeName(String name) {
+ attributeName = name;
+ }
+
+ /**
+ * Set the idl name. May only be called during initialization.
+ */
+ public void setIDLName (String idlName) {
+ this.idlName=idlName;
+ }
+
+ /**
+ * Set the implExceptions array. May only be called during initialization.
+ */
+ public void setImplExceptions (ValueType[] exceptions) {
+ implExceptions = exceptions;
+ }
+
+ /**
+ * Set the declaredBy Identifier. May only be called during initialization.
+ */
+ public void setDeclaredBy (Identifier by) {
+ declaredBy = by;
+ }
+
+ /**
+ * Convert all invalid types to valid ones.
+ */
+ protected void swapInvalidTypes () {
+
+ // Check return type...
+
+ if (returnType.getStatus() != STATUS_VALID) {
+ returnType = getValidType(returnType);
+ }
+
+ // Check args...
+
+ for (int i = 0; i < arguments.length; i++) {
+ if (arguments[i].getStatus() != STATUS_VALID) {
+ arguments[i] = getValidType(arguments[i]);
+ }
+ }
+
+ // Check exceptions...
+
+ for (int i = 0; i < exceptions.length; i++) {
+ if (exceptions[i].getStatus() != STATUS_VALID) {
+ exceptions[i] = (ValueType)getValidType(exceptions[i]);
+ }
+ }
+
+ // Check implExceptions...
+
+ for (int i = 0; i < implExceptions.length; i++) {
+ if (implExceptions[i].getStatus() != STATUS_VALID) {
+ implExceptions[i] = (ValueType)getValidType(implExceptions[i]);
+ }
+ }
+ }
+
+ /**
+ * Release all resources.
+ */
+ public void destroy () {
+ if (memberDef != null) {
+ memberDef = null;
+ enclosing = null;
+ if (exceptions != null) {
+ for (int i = 0; i < exceptions.length; i++) {
+ if (exceptions[i] != null) exceptions[i].destroy();
+ exceptions[i] = null;
+ }
+ exceptions = null;
+ }
+
+ if (implExceptions != null) {
+ for (int i = 0; i < implExceptions.length; i++) {
+ if (implExceptions[i] != null) implExceptions[i].destroy();
+ implExceptions[i] = null;
+ }
+ implExceptions = null;
+ }
+
+ if (returnType != null) returnType.destroy();
+ returnType = null;
+
+ if (arguments != null) {
+ for (int i = 0; i < arguments.length; i++) {
+ if (arguments[i] != null) arguments[i].destroy();
+ arguments[i] = null;
+ }
+ arguments = null;
+ }
+
+ if (argumentNames != null) {
+ for (int i = 0; i < argumentNames.length; i++) {
+ argumentNames[i] = null;
+ }
+ argumentNames = null;
+ }
+
+ vis = null;
+ name = null;
+ idlName = null;
+ stringRep = null;
+ attributeName = null;
+ declaredBy = null;
+ }
+ }
+
+ private MemberDefinition memberDef;
+ private CompoundType enclosing;
+ private ValueType[] exceptions;
+ private ValueType[] implExceptions;
+ private Type returnType;
+ private Type[] arguments;
+ private String[] argumentNames;
+ private String vis;
+ private String name;
+ private String idlName;
+ private String stringRep = null;
+ private int attributeKind = ATTRIBUTE_NONE;
+ private String attributeName = null;
+ private int attributePairIndex = -1;
+ private Identifier declaredBy = null;
+
+ /**
+ * Make up an argument name for the given type.
+ */
+ private String makeArgName (int argNum, Type type) {
+ return "arg" + argNum;
+ }
+
+ /**
+ * Create a new Method object corresponding to the given
+ * method definition.
+ */
+ public Method (CompoundType enclosing,
+ MemberDefinition memberDef,
+ boolean quiet,
+ ContextStack stack) throws Exception {
+
+ this.enclosing = enclosing;
+ this.memberDef = memberDef;
+ vis = getVisibilityString(memberDef);
+ idlName = null; // See setIDLName()
+ boolean valid = true;
+ declaredBy = memberDef.getClassDeclaration().getName();
+
+ // Set name...
+
+ name = memberDef.getName().toString();
+
+ // Update the context...
+
+ stack.setNewContextCode(ContextStack.METHOD);
+ stack.push(this);
+
+ // Set return type...
+
+ stack.setNewContextCode(ContextStack.METHOD_RETURN);
+ sun.tools.java.Type methodType = memberDef.getType();
+ sun.tools.java.Type rtnType = methodType.getReturnType();
+
+ if (rtnType == sun.tools.java.Type.tVoid) {
+ returnType = PrimitiveType.forPrimitive(rtnType,stack);
+ } else {
+ returnType = makeType(rtnType,null,stack);
+ if (returnType == null ||
+ !assertNotImpl(returnType,quiet,stack,enclosing,false)) {
+ valid = false;
+ failedConstraint(24,quiet,stack,enclosing.getName());
+ }
+ }
+
+ // Set arguments and argument names...
+
+ stack.setNewContextCode(ContextStack.METHOD_ARGUMENT);
+ sun.tools.java.Type[] args = memberDef.getType().getArgumentTypes();
+ arguments = new Type[args.length];
+ argumentNames = new String[args.length];
+ Vector origArgNames = memberDef.getArguments();
+
+ for (int i = 0; i < args.length; i++) {
+ Type type = null;
+ try {
+ type = makeType(args[i],null,stack);
+ } catch (Exception e) {
+ }
+
+ if (type != null) {
+ if (!assertNotImpl(type,quiet,stack,enclosing,false)) {
+ valid = false;
+ } else {
+ arguments[i] = type;
+ if (origArgNames != null) {
+ LocalMember local = (LocalMember)origArgNames.elementAt(i+1);
+ argumentNames[i] = local.getName().toString();
+ } else {
+ argumentNames[i] = makeArgName(i,type);
+ }
+ }
+ } else {
+ valid = false;
+ failedConstraint(25,false,stack,enclosing.getQualifiedName(),name);
+ }
+ }
+
+ if (!valid) {
+ stack.pop(false);
+ throw new Exception();
+ }
+
+ // Set exceptions...
+
+ try {
+ exceptions = enclosing.getMethodExceptions(memberDef,quiet,stack);
+ implExceptions = exceptions;
+ stack.pop(true);
+ } catch (Exception e) {
+ stack.pop(false);
+ throw new Exception();
+ }
+ }
+
+ /**
+ * Cloning is supported by returning a shallow copy of this object.
+ */
+ protected Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new Error("clone failed");
+ }
+ }
+ }
+
+ //_____________________________________________________________________
+ // Inner Class "Member"
+ //_____________________________________________________________________
+
+ /**
+ * An CompoundType.Member object wraps a Type and a value representing
+ * a data member, including constants.
+ */
+ public class Member implements ContextElement, Cloneable {
+
+ /**
+ * Return context element name.
+ */
+ public String getElementName() {
+ return "\"" + getName() + "\"";
+ }
+
+ /**
+ * Return the type of this member.
+ */
+ public Type getType() {
+ return type;
+ }
+
+ /**
+ * Return the name of this member.
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * IDL_Naming
+ * Return the IDL name of this member.
+ */
+ public String getIDLName() {
+ return idlName;
+ }
+
+ /**
+ * Return the visibility (e.g. "public final") of this member.
+ */
+ public String getVisibility() {
+ return vis;
+ }
+
+ /**
+ * Methods to check various attributes.
+ */
+ public boolean isPublic() {
+ return member.isPublic();
+ }
+
+ public boolean isPrivate() {
+ return member.isPrivate();
+ }
+
+ public boolean isStatic() {
+ return member.isStatic();
+ }
+
+ public boolean isFinal() {
+ return member.isFinal();
+ }
+
+ public boolean isTransient() {
+ if (forceTransient) return true;
+ return member.isTransient();
+ }
+
+ /**
+ * Return the value of this member. May be null.
+ */
+ public String getValue() {
+ return value;
+ }
+
+ /**
+ * Return true if this member represents an inner class declaration,
+ * false otherwise.
+ */
+ public boolean isInnerClassDeclaration() {
+ return innerClassDecl;
+ }
+
+ /**
+ * Return true if this member represents a constant.
+ */
+ public boolean isConstant () {
+ return constant;
+ }
+
+ /**
+ * Return the string representation of this constant.
+ */
+ public String toString() {
+
+ String result = type.toString();
+
+ if (value != null) {
+ result += (" = " + value);
+ }
+
+ return result;
+ }
+
+ /**
+ * Convert all invalid types to valid ones.
+ */
+ protected void swapInvalidTypes () {
+ if (type.getStatus() != STATUS_VALID) {
+ type = getValidType(type);
+ }
+ }
+
+ protected void setTransient() {
+ if (! isTransient()) {
+ forceTransient = true;
+ if (vis.length() > 0) {
+ vis = vis + " transient";
+ } else {
+ vis = "transient";
+ }
+ }
+ }
+
+ protected MemberDefinition getMemberDefinition() {
+ return member;
+ }
+
+ /**
+ * Release all resources.
+ */
+ public void destroy () {
+ if (type != null) {
+ type.destroy();
+ type = null;
+ vis = null;
+ value = null;
+ name = null;
+ idlName = null;
+ member = null;
+ }
+ }
+
+ private Type type;
+ private String vis;
+ private String value;
+ private String name;
+ private String idlName;
+ private boolean innerClassDecl;
+ private boolean constant;
+ private MemberDefinition member;
+ private boolean forceTransient;
+
+ /**
+ * Create a new Member object.
+ */
+ public Member(MemberDefinition member,
+ String value,
+ ContextStack stack,
+ CompoundType enclosing) {
+ this.member = member;
+ this.value = value;
+ forceTransient = false;
+ innerClassDecl = member.getInnerClass() != null;
+
+ // If we are not an inner class, finish initializing now.
+ // Otherwise, wait until outer class is finished, then
+ // call init to avoid potential recursion problems...
+
+ if (!innerClassDecl) {
+ init (stack,enclosing);
+ }
+ }
+
+ public void init (ContextStack stack, CompoundType enclosing) {
+
+ constant = false;
+ name = member.getName().toString();
+ vis = getVisibilityString(member);
+ idlName = null;
+
+ // Add self to stack...
+
+ int contextCode = ContextStack.MEMBER;
+ stack.setNewContextCode(contextCode);
+
+ // Check for special contextCodes...
+
+ if (member.isVariable()) {
+ if (value != null && member.isConstant()) {
+ contextCode = ContextStack.MEMBER_CONSTANT;
+ this.constant = true;
+ } else if (member.isStatic()) {
+ contextCode = ContextStack.MEMBER_STATIC;
+ } else if (member.isTransient()) {
+ contextCode = ContextStack.MEMBER_TRANSIENT;
+ }
+ }
+
+ stack.setNewContextCode(contextCode);
+ stack.push(this);
+
+ type = makeType(member.getType(),null,stack);
+
+ if (type == null ||
+ (!innerClassDecl &&
+ !member.isStatic() &&
+ !member.isTransient() &&
+ !assertNotImpl(type,false,stack,enclosing,true))) {
+ stack.pop(false);
+ throw new CompilerError("");
+ }
+
+ // Clean up primitive constant values...
+
+ if (constant && type.isPrimitive()) {
+ if (type.isType(TYPE_LONG) || type.isType(TYPE_FLOAT) || type.isType(TYPE_DOUBLE)) {
+ int length = value.length();
+ char lastChar = value.charAt(length-1);
+ if (!Character.isDigit(lastChar)) {
+ this.value = value.substring(0,length-1);
+ }
+ } else if (type.isType(TYPE_BOOLEAN)) {
+ value = value.toUpperCase();
+ }
+ }
+ if (constant && type.isType(TYPE_STRING)) {
+ value = "L" + value;
+ }
+ stack.pop(true);
+ }
+
+ public void setIDLName (String name) {
+ this.idlName = name;
+ }
+
+ /**
+ * Cloning is supported by returning a shallow copy of this object.
+ */
+ protected Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new Error("clone failed");
+ }
+ }
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Constants.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Constants.java
new file mode 100644
index 0000000..9b22fa9
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Constants.java
@@ -0,0 +1,297 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import sun.tools.java.Identifier;
+
+public interface Constants extends sun.rmi.rmic.Constants {
+
+ // Identifiers for referenced classes:
+
+ public static final Identifier idReplyHandler =
+ Identifier.lookup("org.omg.CORBA.portable.ResponseHandler");
+ public static final Identifier idStubBase =
+ Identifier.lookup("javax.rmi.CORBA.Stub");
+ public static final Identifier idTieBase =
+ Identifier.lookup("org.omg.CORBA.portable.ObjectImpl");
+ public static final Identifier idTieInterface =
+ Identifier.lookup("javax.rmi.CORBA.Tie");
+ public static final Identifier idPOAServantType =
+ Identifier.lookup( "org.omg.PortableServer.Servant" ) ;
+ public static final Identifier idDelegate =
+ Identifier.lookup("org.omg.CORBA.portable.Delegate");
+ public static final Identifier idOutputStream =
+ Identifier.lookup("org.omg.CORBA.portable.OutputStream");
+ public static final Identifier idExtOutputStream =
+ Identifier.lookup("org.omg.CORBA_2_3.portable.OutputStream");
+ public static final Identifier idInputStream =
+ Identifier.lookup("org.omg.CORBA.portable.InputStream");
+ public static final Identifier idExtInputStream =
+ Identifier.lookup("org.omg.CORBA_2_3.portable.InputStream");
+ public static final Identifier idSystemException =
+ Identifier.lookup("org.omg.CORBA.SystemException");
+ public static final Identifier idBadMethodException =
+ Identifier.lookup("org.omg.CORBA.BAD_OPERATION");
+ public static final Identifier idPortableUnknownException =
+ Identifier.lookup("org.omg.CORBA.portable.UnknownException");
+ public static final Identifier idApplicationException =
+ Identifier.lookup("org.omg.CORBA.portable.ApplicationException");
+ public static final Identifier idRemarshalException =
+ Identifier.lookup("org.omg.CORBA.portable.RemarshalException");
+ public static final Identifier idJavaIoExternalizable =
+ Identifier.lookup("java.io.Externalizable");
+ public static final Identifier idCorbaObject =
+ Identifier.lookup("org.omg.CORBA.Object");
+ public static final Identifier idCorbaORB =
+ Identifier.lookup("org.omg.CORBA.ORB");
+ public static final Identifier idClassDesc =
+ Identifier.lookup("javax.rmi.CORBA.ClassDesc");
+ public static final Identifier idJavaIoIOException =
+ Identifier.lookup("java.io.IOException");
+ public static final Identifier idIDLEntity =
+ Identifier.lookup("org.omg.CORBA.portable.IDLEntity");
+ public static final Identifier idValueBase =
+ Identifier.lookup("org.omg.CORBA.portable.ValueBase");
+ public static final Identifier idBoxedRMI =
+ Identifier.lookup("org.omg.boxedRMI");
+ public static final Identifier idBoxedIDL =
+ Identifier.lookup("org.omg.boxedIDL");
+ public static final Identifier idCorbaUserException =
+ Identifier.lookup("org.omg.CORBA.UserException");
+
+
+ // Identifiers for primitive types:
+
+ public static final Identifier idBoolean =
+ Identifier.lookup("boolean");
+ public static final Identifier idByte =
+ Identifier.lookup("byte");
+ public static final Identifier idChar =
+ Identifier.lookup("char");
+ public static final Identifier idShort =
+ Identifier.lookup("short");
+ public static final Identifier idInt =
+ Identifier.lookup("int");
+ public static final Identifier idLong =
+ Identifier.lookup("long");
+ public static final Identifier idFloat =
+ Identifier.lookup("float");
+ public static final Identifier idDouble =
+ Identifier.lookup("double");
+ public static final Identifier idVoid =
+ Identifier.lookup("void");
+
+ // IndentingWriter constructor args:
+
+ public static final int INDENT_STEP = 4;
+ public static final int TAB_SIZE = Integer.MAX_VALUE; // No tabs.
+
+ // Type status codes:
+
+ public static final int STATUS_PENDING = 0;
+ public static final int STATUS_VALID = 1;
+ public static final int STATUS_INVALID = 2;
+
+ // Java Names:
+
+ public static final String NAME_SEPARATOR = ".";
+ public static final String SERIAL_VERSION_UID = "serialVersionUID";
+
+ // IDL Names:
+
+ public static final 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",
+ };
+
+
+ public static final String EXCEPTION_SUFFIX = "Exception";
+ public static final String ERROR_SUFFIX = "Error";
+ public static final String EX_SUFFIX = "Ex";
+
+ public static final String IDL_REPOSITORY_ID_PREFIX = "IDL:";
+ public static final String IDL_REPOSITORY_ID_VERSION = ":1.0";
+
+ public static final String[] IDL_CORBA_MODULE = {"CORBA"};
+ public static final String[] IDL_SEQUENCE_MODULE = {"org","omg","boxedRMI"};
+ public static final String[] IDL_BOXEDIDL_MODULE = {"org","omg","boxedIDL"};
+
+ public static final String IDL_CLASS = "ClassDesc";
+ public static final String[] IDL_CLASS_MODULE = {"javax","rmi","CORBA"};
+
+ public static final String IDL_IDLENTITY = "IDLEntity";
+ public static final String IDL_SERIALIZABLE = "Serializable";
+ public static final String IDL_EXTERNALIZABLE = "Externalizable";
+ public static final String[] IDL_JAVA_IO_MODULE = {"java","io"};
+ public static final String[] IDL_ORG_OMG_CORBA_MODULE = {"org","omg","CORBA"};
+ public static final String[] IDL_ORG_OMG_CORBA_PORTABLE_MODULE = {"org","omg","CORBA","portable"};
+
+ public static final String IDL_JAVA_LANG_OBJECT = "_Object";
+ public static final String[] IDL_JAVA_LANG_MODULE = {"java","lang"};
+
+ public static final String IDL_JAVA_RMI_REMOTE = "Remote";
+ public static final String[] IDL_JAVA_RMI_MODULE = {"java","rmi"};
+
+ public static final String IDL_SEQUENCE = "seq";
+
+ public static final String IDL_CONSTRUCTOR = "create";
+
+ public static final String IDL_NAME_SEPARATOR = "::";
+ public static final String IDL_BOOLEAN = "boolean";
+ public static final String IDL_BYTE = "octet";
+ public static final String IDL_CHAR = "wchar";
+ public static final String IDL_SHORT = "short";
+ public static final String IDL_INT = "long";
+ public static final String IDL_LONG = "long long";
+ public static final String IDL_FLOAT = "float";
+ public static final String IDL_DOUBLE = "double";
+ public static final String IDL_VOID = "void";
+
+ public static final String IDL_STRING = "WStringValue";
+ public static final String IDL_CONSTANT_STRING = "wstring";
+ public static final String IDL_CORBA_OBJECT = "Object";
+ public static final String IDL_ANY = "any";
+
+ // File names:
+
+ public static final String SOURCE_FILE_EXTENSION = ".java";
+ public static final String IDL_FILE_EXTENSION = ".idl";
+
+ // Type Codes:
+
+ public static final int TYPE_VOID = 0x00000001; // In PrimitiveType
+ public static final int TYPE_BOOLEAN = 0x00000002; // In PrimitiveType
+ public static final int TYPE_BYTE = 0x00000004; // In PrimitiveType
+ public static final int TYPE_CHAR = 0x00000008; // In PrimitiveType
+ public static final int TYPE_SHORT = 0x00000010; // In PrimitiveType
+ public static final int TYPE_INT = 0x00000020; // In PrimitiveType
+ public static final int TYPE_LONG = 0x00000040; // In PrimitiveType
+ public static final int TYPE_FLOAT = 0x00000080; // In PrimitiveType
+ public static final int TYPE_DOUBLE = 0x00000100; // In PrimitiveType
+
+ public static final int TYPE_STRING = 0x00000200; // In SpecialClassType (String)
+ public static final int TYPE_ANY = 0x00000400; // In SpecialInterfaceType (Serializable,Externalizable)
+ public static final int TYPE_CORBA_OBJECT = 0x00000800; // In SpecialInterfaceType (CORBA.Object,Remote)
+
+ public static final int TYPE_REMOTE = 0x00001000; // In RemoteType
+ public static final int TYPE_ABSTRACT = 0x00002000; // In AbstractType
+ public static final int TYPE_NC_INTERFACE = 0x00004000; // In NCInterfaceType
+
+ public static final int TYPE_VALUE = 0x00008000; // In ValueType
+ public static final int TYPE_IMPLEMENTATION = 0x00010000; // In ImplementationType
+ public static final int TYPE_NC_CLASS = 0x00020000; // In NCClassType
+
+ public static final int TYPE_ARRAY = 0x00040000; // In ArrayType
+ public static final int TYPE_JAVA_RMI_REMOTE = 0x00080000; // In SpecialInterfaceType
+
+ // Type code masks:
+
+ public static final int TYPE_NONE = 0x00000000;
+ public static final int TYPE_ALL = 0xFFFFFFFF;
+ public static final int TYPE_MASK = 0x00FFFFFF;
+ public static final int TM_MASK = 0xFF000000;
+
+ // Type code modifiers:
+
+ public static final int TM_PRIMITIVE = 0x01000000;
+ public static final int TM_COMPOUND = 0x02000000;
+ public static final int TM_CLASS = 0x04000000;
+ public static final int TM_INTERFACE = 0x08000000;
+ public static final int TM_SPECIAL_CLASS = 0x10000000;
+ public static final int TM_SPECIAL_INTERFACE= 0x20000000;
+ public static final int TM_NON_CONFORMING = 0x40000000;
+ public static final int TM_INNER = 0x80000000;
+
+ // Attribute kinds...
+
+ public static final int ATTRIBUTE_NONE = 0; // Not an attribute.
+ public static final int ATTRIBUTE_IS = 1; // read-only, had "is" prefix.
+ public static final int ATTRIBUTE_GET = 2; // read-only, had "get" prefix.
+ public static final int ATTRIBUTE_IS_RW = 3; // read-write, had "is" prefix.
+ public static final int ATTRIBUTE_GET_RW = 4; // read-write, had "get" prefix.
+ public static final int ATTRIBUTE_SET = 5; // had "set" prefix.
+
+ public static final String[] ATTRIBUTE_WIRE_PREFIX = {
+ "",
+ "_get_",
+ "_get_",
+ "_get_",
+ "_get_",
+ "_set_",
+ };
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ContextElement.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ContextElement.java
new file mode 100644
index 0000000..be95c49
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ContextElement.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+/**
+ * ContextElement provides a common interface for elements of a ContextStack.
+ * @author Bryan Atsatt
+ */
+public interface ContextElement {
+ public String getElementName();
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ContextStack.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ContextStack.java
new file mode 100644
index 0000000..518d9a4
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ContextStack.java
@@ -0,0 +1,447 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import sun.tools.java.CompilerError;
+
+/**
+ * ContextStack provides a mechanism to record parsing state.
+ *
+ * @author Bryan Atsatt
+ */
+public class ContextStack {
+
+ // Context codes.
+
+ public static final int TOP = 1;
+
+ public static final int METHOD = 2;
+ public static final int METHOD_RETURN = 3;
+ public static final int METHOD_ARGUMENT = 4;
+ public static final int METHOD_EXCEPTION = 5;
+
+ public static final int MEMBER = 6;
+ public static final int MEMBER_CONSTANT = 7;
+ public static final int MEMBER_STATIC = 8;
+ public static final int MEMBER_TRANSIENT = 9;
+
+ public static final int IMPLEMENTS = 10;
+ public static final int EXTENDS = 11;
+
+ // String versions of context codes.
+
+ private static final String[] CODE_NAMES = {
+ "UNKNOWN ",
+ "Top level type ",
+ "Method ",
+ "Return parameter ",
+ "Parameter ",
+ "Exception ",
+ "Member ",
+ "Constant member ",
+ "Static member ",
+ "Transient member ",
+ "Implements ",
+ "Extends ",
+ };
+ // Member data.
+
+ private int currentIndex = -1;
+ private int maxIndex = 100;
+ private TypeContext[] stack = new TypeContext[maxIndex];
+ private int newCode = TOP;
+ private BatchEnvironment env = null;
+ private boolean trace = false;
+ private TypeContext tempContext = new TypeContext();
+
+ private static final String TRACE_INDENT = " ";
+
+ /**
+ * Constructor.
+ */
+ public ContextStack (BatchEnvironment env) {
+ this.env = env;
+ env.contextStack = this;
+ }
+
+ /**
+ * Return true if {@code env.nerrors > 0}.
+ */
+ public boolean anyErrors () {
+ return env.nerrors > 0;
+ }
+
+ /**
+ * Enable/disable tracing.
+ */
+ public void setTrace(boolean trace) {
+ this.trace = trace;
+ }
+
+ /**
+ * Check trace flag.
+ */
+ public boolean isTraceOn() {
+ return trace;
+ }
+
+ /**
+ * Get the environment.
+ */
+ public BatchEnvironment getEnv() {
+ return env;
+ }
+
+ /**
+ * Set the new context.
+ */
+ public void setNewContextCode(int code) {
+ newCode = code;
+ }
+
+ /**
+ * Get the current context code.
+ */
+ public int getCurrentContextCode() {
+ return newCode;
+ }
+
+
+ /**
+ * If tracing on, write the current call stack (not the context stack) to
+ * System.out.
+ */
+ final void traceCallStack () {
+ if (trace) dumpCallStack();
+ }
+
+ public final static void dumpCallStack() {
+ new Error().printStackTrace(System.out);
+ }
+
+ /**
+ * Print a line indented by stack depth.
+ */
+ final private void tracePrint (String text, boolean line) {
+ int length = text.length() + (currentIndex * TRACE_INDENT.length());
+ StringBuffer buffer = new StringBuffer(length);
+ for (int i = 0; i < currentIndex; i++) {
+ buffer.append(TRACE_INDENT);
+ }
+ buffer.append(text);
+ if (line) {
+ buffer.append("\n");
+ }
+ System.out.print(buffer.toString());
+ }
+
+ /**
+ * If tracing on, print a line.
+ */
+ final void trace (String text) {
+ if (trace) {
+ tracePrint(text,false);
+ }
+ }
+
+ /**
+ * If tracing on, print a line followed by a '\n'.
+ */
+ final void traceln (String text) {
+ if (trace) {
+ tracePrint(text,true);
+ }
+ }
+
+ /**
+ * If tracing on, print a pre-mapped ContextElement.
+ */
+ final void traceExistingType (Type type) {
+ if (trace) {
+ tempContext.set(newCode,type);
+ traceln(toResultString(tempContext,true,true));
+ }
+ }
+
+ /**
+ * Push a new element on the stack.
+ * @return the new element.
+ */
+ public TypeContext push (ContextElement element) {
+
+ currentIndex++;
+
+ // Grow array if need to...
+
+ if (currentIndex == maxIndex) {
+ int newMax = maxIndex * 2;
+ TypeContext[] newStack = new TypeContext[newMax];
+ System.arraycopy(stack,0,newStack,0,maxIndex);
+ maxIndex = newMax;
+ stack = newStack;
+ }
+
+ // Make sure we have a context object to use at this position...
+
+ TypeContext it = stack[currentIndex];
+
+ if (it == null) {
+ it = new TypeContext();
+ stack[currentIndex] = it;
+ }
+
+ // Set the context object...
+
+ it.set(newCode,element);
+
+ // Trace...
+
+ traceln(toTrialString(it));
+
+ // Return...
+
+ return it;
+ }
+
+ /**
+ * Pop an element from the stack.
+ * @return the new current element or null if top.
+ */
+ public TypeContext pop (boolean wasValid) {
+
+ if (currentIndex < 0) {
+ throw new CompilerError("Nothing on stack!");
+ }
+
+ newCode = stack[currentIndex].getCode();
+ traceln(toResultString(stack[currentIndex],wasValid,false));
+
+ Type last = stack[currentIndex].getCandidateType();
+ if (last != null) {
+
+ // Set status...
+
+ if (wasValid) {
+ last.setStatus(Constants.STATUS_VALID);
+ } else {
+ last.setStatus(Constants.STATUS_INVALID);
+ }
+ }
+
+ currentIndex--;
+
+ if (currentIndex < 0) {
+
+ // Done parsing, so update the invalid types
+ // if this type was valid...
+
+ if (wasValid) {
+ Type.updateAllInvalidTypes(this);
+ }
+ return null;
+ } else {
+ return stack[currentIndex];
+ }
+ }
+
+ /**
+ * Get the current size.
+ */
+ public int size () {
+ return currentIndex + 1;
+ }
+
+ /**
+ * Get a specific context.
+ */
+ public TypeContext getContext (int index) {
+
+ if (currentIndex < index) {
+ throw new Error("Index out of range");
+ }
+ return stack[index];
+ }
+
+ /**
+ * Get the current top context.
+ */
+ public TypeContext getContext () {
+
+ if (currentIndex < 0) {
+ throw new Error("Nothing on stack!");
+ }
+ return stack[currentIndex];
+ }
+
+ /**
+ * Is parent context a value type?
+ */
+ public boolean isParentAValue () {
+
+ if (currentIndex > 0) {
+ return stack[currentIndex - 1].isValue();
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Get parent context. Null if none.
+ */
+ public TypeContext getParentContext () {
+
+ if (currentIndex > 0) {
+ return stack[currentIndex - 1];
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Get a string for the context name...
+ */
+ public String getContextCodeString () {
+
+ if (currentIndex >= 0) {
+ return CODE_NAMES[newCode];
+ } else {
+ return CODE_NAMES[0];
+ }
+ }
+
+ /**
+ * Get a string for the given context code...
+ */
+ public static String getContextCodeString (int contextCode) {
+ return CODE_NAMES[contextCode];
+ }
+
+ private String toTrialString(TypeContext it) {
+ int code = it.getCode();
+ if (code != METHOD && code != MEMBER) {
+ return it.toString() + " (trying " + it.getTypeDescription() + ")";
+ } else {
+ return it.toString();
+ }
+ }
+
+ private String toResultString (TypeContext it, boolean result, boolean preExisting) {
+ int code = it.getCode();
+ if (code != METHOD && code != MEMBER) {
+ if (result) {
+ String str = it.toString() + " --> " + it.getTypeDescription();
+ if (preExisting) {
+ return str + " [Previously mapped]";
+ } else {
+ return str;
+ }
+ }
+ } else {
+ if (result) {
+ return it.toString() + " --> [Mapped]";
+ }
+ }
+ return it.toString() + " [Did not map]";
+ }
+
+ public void clear () {
+ for (int i = 0; i < stack.length; i++) {
+ if (stack[i] != null) stack[i].destroy();
+ }
+ }
+}
+
+
+class TypeContext {
+
+ public void set(int code, ContextElement element) {
+ this.code = code;
+ this.element = element;
+ if (element instanceof ValueType) {
+ isValue = true;
+ } else {
+ isValue = false;
+ }
+ }
+
+ public int getCode() {
+ return code;
+ }
+
+ public String getName() {
+ return element.getElementName();
+ }
+
+ public Type getCandidateType() {
+ if (element instanceof Type) {
+ return (Type) element;
+ } else {
+ return null;
+ }
+}
+
+public String getTypeDescription() {
+ if (element instanceof Type) {
+ return ((Type) element).getTypeDescription();
+ } else {
+ return "[unknown type]";
+ }
+}
+
+public String toString () {
+ if (element != null) {
+ return ContextStack.getContextCodeString(code) + element.getElementName();
+ } else {
+ return ContextStack.getContextCodeString(code) + "null";
+ }
+}
+
+public boolean isValue () {
+ return isValue;
+}
+
+ public boolean isConstant () {
+ return code == ContextStack.MEMBER_CONSTANT;
+ }
+
+ public void destroy() {
+ if (element instanceof Type) {
+ ((Type)element).destroy();
+ }
+ element = null;
+ }
+
+ private int code = 0;
+ private ContextElement element = null;
+ private boolean isValue = false;
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/DirectoryLoader.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/DirectoryLoader.java
new file mode 100644
index 0000000..95add49
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/DirectoryLoader.java
@@ -0,0 +1,160 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Hashtable;
+import java.io.File;
+import java.io.FileInputStream;
+
+/**
+ * DirectoryLoader is a simple ClassLoader which loads from a specified
+ * file system directory.
+ * @author Bryan Atsatt
+ */
+
+public class DirectoryLoader extends ClassLoader {
+
+ private Hashtable cache;
+ private File root;
+
+ /**
+ * Constructor.
+ */
+ public DirectoryLoader (File rootDir) {
+ cache = new Hashtable();
+ if (rootDir == null || !rootDir.isDirectory()) {
+ throw new IllegalArgumentException();
+ }
+ root = rootDir;
+ }
+
+ private DirectoryLoader () {}
+
+ /**
+ * Convenience version of loadClass which sets 'resolve' == true.
+ */
+ public Class loadClass(String className) throws ClassNotFoundException {
+ return loadClass(className, true);
+ }
+
+ /**
+ * This is the required version of loadClass which is called
+ * both from loadClass above and from the internal function
+ * FindClassFromClass.
+ */
+ public synchronized Class loadClass(String className, boolean resolve)
+ throws ClassNotFoundException {
+ Class result;
+ byte classData[];
+
+ // Do we already have it in the cache?
+
+ result = (Class) cache.get(className);
+
+ if (result == null) {
+
+ // Nope, can we get if from the system class loader?
+
+ try {
+
+ result = super.findSystemClass(className);
+
+ } catch (ClassNotFoundException e) {
+
+ // No, so try loading it...
+
+ classData = getClassFileData(className);
+
+ if (classData == null) {
+ throw new ClassNotFoundException();
+ }
+
+ // Parse the class file data...
+
+ result = defineClass(classData, 0, classData.length);
+
+ if (result == null) {
+ throw new ClassFormatError();
+ }
+
+ // Resolve it...
+
+ if (resolve) resolveClass(result);
+
+ // Add to cache...
+
+ cache.put(className, result);
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Reurn a byte array containing the contents of the class file. Returns null
+ * if an exception occurs.
+ */
+ private byte[] getClassFileData (String className) {
+
+ byte result[] = null;
+ FileInputStream stream = null;
+
+ // Get the file...
+
+ File classFile = new File(root,className.replace('.',File.separatorChar) + ".class");
+
+ // Now get the bits...
+
+ try {
+ stream = new FileInputStream(classFile);
+ result = new byte[stream.available()];
+ stream.read(result);
+ } catch(ThreadDeath death) {
+ throw death;
+ } catch (Throwable e) {
+ }
+
+ finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ } catch(ThreadDeath death) {
+ throw death;
+ } catch (Throwable e) {
+ }
+ }
+ }
+
+ return result;
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
new file mode 100644
index 0000000..a19e1ea
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Generator.java
@@ -0,0 +1,436 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+
+package sun.rmi.rmic.iiop;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStreamWriter;
+import java.io.IOException;
+import sun.tools.java.Identifier;
+import sun.tools.java.ClassPath;
+import sun.tools.java.ClassFile;
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.ClassDefinition;
+import sun.tools.java.ClassDeclaration;
+import sun.rmi.rmic.IndentingWriter;
+import sun.rmi.rmic.Main;
+import sun.rmi.rmic.iiop.Util;
+import java.util.HashSet;
+
+/**
+ * Generator provides a small framework from which IIOP-specific
+ * generators can inherit. Common logic is implemented here which uses
+ * both abstract methods as well as concrete methods which subclasses may
+ * want to override. The following methods must be present in any subclass:
+ * <pre>
+ * Default constructor
+ * CompoundType getTopType(BatchEnvironment env, ClassDefinition cdef);
+ * int parseArgs(String argv[], int currentIndex);
+ * boolean requireNewInstance();
+ * OutputType[] getOutputTypesFor(CompoundType topType,
+ * HashSet alreadyChecked);
+ * String getFileNameExtensionFor(OutputType outputType);
+ * void writeOutputFor ( OutputType outputType,
+ * HashSet alreadyChecked,
+ * IndentingWriter writer) throws IOException;
+ * </pre>
+ * @author Bryan Atsatt
+ */
+public abstract class Generator implements sun.rmi.rmic.Generator,
+ sun.rmi.rmic.iiop.Constants {
+
+ protected boolean alwaysGenerate = false;
+ protected BatchEnvironment env = null;
+ protected ContextStack contextStack = null;
+ private boolean trace = false;
+ protected boolean idl = false;
+
+ /**
+ * Examine and consume command line arguments.
+ * @param argv The command line arguments. Ignore null
+ * and unknown arguments. Set each consumed argument to null.
+ * @param error Report any errors using the main.error() methods.
+ * @return true if no errors, false otherwise.
+ */
+ public boolean parseArgs(String argv[], Main main) {
+ for (int i = 0; i < argv.length; i++) {
+ if (argv[i] != null) {
+ if (argv[i].equalsIgnoreCase("-always") ||
+ argv[i].equalsIgnoreCase("-alwaysGenerate")) {
+ alwaysGenerate = true;
+ argv[i] = null;
+ } else if (argv[i].equalsIgnoreCase("-xtrace")) {
+ trace = true;
+ argv[i] = null;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Return true if non-conforming types should be parsed.
+ * @param stack The context stack.
+ */
+ protected abstract boolean parseNonConforming(ContextStack stack);
+
+ /**
+ * Create and return a top-level type.
+ * @param cdef The top-level class definition.
+ * @param stack The context stack.
+ * @return The compound type or null if is non-conforming.
+ */
+ protected abstract CompoundType getTopType(ClassDefinition cdef, ContextStack stack);
+
+ /**
+ * Return an array containing all the file names and types that need to be
+ * generated for the given top-level type. The file names must NOT have an
+ * extension (e.g. ".java").
+ * @param topType The type returned by getTopType().
+ * @param alreadyChecked A set of Types which have already been checked.
+ * Intended to be passed to Type.collectMatching(filter,alreadyChecked).
+ */
+ protected abstract OutputType[] getOutputTypesFor(CompoundType topType,
+ HashSet alreadyChecked);
+
+ /**
+ * Return the file name extension for the given file name (e.g. ".java").
+ * All files generated with the ".java" extension will be compiled. To
+ * change this behavior for ".java" files, override the compileJavaSourceFile
+ * method to return false.
+ * @param outputType One of the items returned by getOutputTypesFor(...)
+ */
+ protected abstract String getFileNameExtensionFor(OutputType outputType);
+
+ /**
+ * Write the output for the given OutputFileName into the output stream.
+ * @param name One of the items returned by getOutputTypesFor(...)
+ * @param alreadyChecked A set of Types which have already been checked.
+ * Intended to be passed to Type.collectMatching(filter,alreadyChecked).
+ * @param writer The output stream.
+ */
+ protected abstract void writeOutputFor(OutputType outputType,
+ HashSet alreadyChecked,
+ IndentingWriter writer) throws IOException;
+
+ /**
+ * Return true if a new instance should be created for each
+ * class on the command line. Subclasses which return true
+ * should override newInstance() to return an appropriately
+ * constructed instance.
+ */
+ protected abstract boolean requireNewInstance();
+
+ /**
+ * Return true if the specified file needs generation.
+ */
+ public boolean requiresGeneration (File target, Type theType) {
+
+ boolean result = alwaysGenerate;
+
+ if (!result) {
+
+ // Get a ClassFile instance for base source or class
+ // file. We use ClassFile so that if the base is in
+ // a zip file, we can still get at it's mod time...
+
+ ClassFile baseFile;
+ ClassPath path = env.getClassPath();
+ String className = theType.getQualifiedName().replace('.',File.separatorChar);
+
+ // First try the source file...
+
+ baseFile = path.getFile(className + ".source");
+
+ if (baseFile == null) {
+
+ // Then try class file...
+
+ baseFile = path.getFile(className + ".class");
+ }
+
+ // Do we have a baseFile?
+
+ if (baseFile != null) {
+
+ // Yes, grab baseFile's mod time...
+
+ long baseFileMod = baseFile.lastModified();
+
+ // Get a File instance for the target. If it is a source
+ // file, create a class file instead since the source file
+ // will frequently be deleted...
+
+ String targetName = IDLNames.replace(target.getName(),".java",".class");
+ String parentPath = target.getParent();
+ File targetFile = new File(parentPath,targetName);
+
+ // Does the target file exist?
+
+ if (targetFile.exists()) {
+
+ // Yes, so grab it's mod time...
+
+ long targetFileMod = targetFile.lastModified();
+
+ // Set result...
+
+ result = targetFileMod < baseFileMod;
+
+ } else {
+
+ // No, so we must generate...
+
+ result = true;
+ }
+ } else {
+
+ // No, so we must generate...
+
+ result = true;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Create and return a new instance of self. Subclasses
+ * which need to do something other than default construction
+ * must override this method.
+ */
+ protected Generator newInstance() {
+ Generator result = null;
+ try {
+ result = (Generator) getClass().newInstance();
+ }
+ catch (Exception e){} // Should ALWAYS work!
+
+ return result;
+ }
+
+ /**
+ * Default constructor for subclasses to use.
+ */
+ protected Generator() {
+ }
+
+ /**
+ * Generate output. Any source files created which need compilation should
+ * be added to the compiler environment using the addGeneratedFile(File)
+ * method.
+ *
+ * @param env The compiler environment
+ * @param cdef The definition for the implementation class or interface from
+ * which to generate output
+ * @param destDir The directory for the root of the package hierarchy
+ * for generated files. May be null.
+ */
+ public void generate(sun.rmi.rmic.BatchEnvironment env, ClassDefinition cdef, File destDir) {
+
+ this.env = (BatchEnvironment) env;
+ contextStack = new ContextStack(this.env);
+ contextStack.setTrace(trace);
+
+ // Make sure the environment knows whether or not to parse
+ // non-conforming types. This will clear out any previously
+ // parsed types if necessary...
+
+ this.env.setParseNonConforming(parseNonConforming(contextStack));
+
+ // Get our top level type...
+
+ CompoundType topType = getTopType(cdef,contextStack);
+ if (topType != null) {
+
+ Generator generator = this;
+
+ // Do we need to make a new instance?
+
+ if (requireNewInstance()) {
+
+ // Yes, so make one. 'this' instance is the one instantiated by Main
+ // and which knows any needed command line args...
+
+ generator = newInstance();
+ }
+
+ // Now generate all output files...
+
+ generator.generateOutputFiles(topType, this.env, destDir);
+ }
+ }
+
+ /**
+ * Create and return a new instance of self. Subclasses
+ * which need to do something other than default construction
+ * must override this method.
+ */
+ protected void generateOutputFiles (CompoundType topType,
+ BatchEnvironment env,
+ File destDir) {
+
+ // Grab the 'alreadyChecked' HashSet from the environment...
+
+ HashSet alreadyChecked = env.alreadyChecked;
+
+ // Ask subclass for a list of output types...
+
+ OutputType[] types = getOutputTypesFor(topType,alreadyChecked);
+
+ // Process each file...
+
+ for (int i = 0; i < types.length; i++) {
+ OutputType current = types[i];
+ String className = current.getName();
+ File file = getFileFor(current,destDir);
+ boolean sourceFile = false;
+
+ // Do we need to generate this file?
+
+ if (requiresGeneration(file,current.getType())) {
+
+ // Yes. If java source file, add to environment so will be compiled...
+
+ if (file.getName().endsWith(".java")) {
+ sourceFile = compileJavaSourceFile(current);
+
+ // Are we supposeded to compile this one?
+
+ if (sourceFile) {
+ env.addGeneratedFile(file);
+ }
+ }
+
+ // Now create an output stream and ask subclass to fill it up...
+
+ try {
+ IndentingWriter out = new IndentingWriter(
+ new OutputStreamWriter(new FileOutputStream(file)),INDENT_STEP,TAB_SIZE);
+
+ long startTime = 0;
+ if (env.verbose()) {
+ startTime = System.currentTimeMillis();
+ }
+
+ writeOutputFor(types[i],alreadyChecked,out);
+ out.close();
+
+ if (env.verbose()) {
+ long duration = System.currentTimeMillis() - startTime;
+ env.output(Main.getText("rmic.generated", file.getPath(), Long.toString(duration)));
+ }
+ if (sourceFile) {
+ env.parseFile(ClassFile.newClassFile(file));
+ }
+ } catch (IOException e) {
+ env.error(0, "cant.write", file.toString());
+ return;
+ }
+ } else {
+
+ // No, say so if we need to...
+
+ if (env.verbose()) {
+ env.output(Main.getText("rmic.previously.generated", file.getPath()));
+ }
+ }
+ }
+ }
+
+ /**
+ * Return the File object that should be used as the output file
+ * for the given OutputType.
+ * @param outputType The type to create a file for.
+ * @param destinationDir The directory to use as the root of the
+ * package heirarchy. May be null, in which case the current
+ * classpath is searched to find the directory in which to create
+ * the output file. If that search fails (most likely because the
+ * package directory lives in a zip or jar file rather than the
+ * file system), the current user directory is used.
+ */
+ protected File getFileFor(OutputType outputType, File destinationDir) {
+ // Calling this method does some crucial initialization
+ // in a subclass implementation. Don't skip it.
+ Identifier id = getOutputId(outputType);
+ File packageDir = null;
+ if(idl){
+ packageDir = Util.getOutputDirectoryForIDL(id,destinationDir,env);
+ } else {
+ packageDir = Util.getOutputDirectoryForStub(id,destinationDir,env);
+ }
+ String classFileName = outputType.getName() + getFileNameExtensionFor(outputType);
+ return new File(packageDir, classFileName);
+ }
+
+ /**
+ * Return an identifier to use for output.
+ * @param outputType the type for which output is to be generated.
+ * @return the new identifier. This implementation returns the input parameter.
+ */
+ protected Identifier getOutputId (OutputType outputType) {
+ return outputType.getType().getIdentifier();
+ }
+
+ /**
+ * Return true if the given file should be compiled.
+ * @param outputType One of the items returned by getOutputTypesFor(...) for
+ * which getFileNameExtensionFor(OutputType) returned ".java".
+ */
+ protected boolean compileJavaSourceFile (OutputType outputType) {
+ return true;
+ }
+
+ //_____________________________________________________________________
+ // OutputType is a simple wrapper for a name and a Type
+ //_____________________________________________________________________
+
+ public class OutputType {
+ private String name;
+ private Type type;
+
+ public OutputType (String name, Type type) {
+ this.name = name;
+ this.type = type;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public Type getType() {
+ return type;
+ }
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/IDLGenerator.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/IDLGenerator.java
new file mode 100644
index 0000000..c29414a
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/IDLGenerator.java
@@ -0,0 +1,2084 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.io.File;
+import java.io.IOException;
+import java.text.DateFormat;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Hashtable;
+import java.util.Locale;
+import java.util.StringTokenizer;
+import java.util.Vector;
+import sun.tools.java.Identifier;
+import sun.tools.java.ClassDefinition;
+import sun.tools.java.CompilerError;
+import sun.rmi.rmic.IndentingWriter;
+import java.util.HashSet;
+import sun.rmi.rmic.Main;
+
+/**
+ * An IDL generator for rmic.
+ *
+ * @author Steve Newberry, Bryan Atsatt
+ */
+public class IDLGenerator extends sun.rmi.rmic.iiop.Generator {
+
+ private boolean valueMethods = true;
+ private boolean factory = true; //init==!factory
+ private Hashtable ifHash = new Hashtable(); //IDL file Hashtable
+ private Hashtable imHash = new Hashtable(); //IDL module Hashtable
+
+ private boolean isThrown = true; //flag for writeInclude
+ private boolean isException = true; //flag for writeBanner, writeIfndef
+ private boolean isForward = true; //flag for writeIfndef
+ private boolean forValuetype = true; //flag for writeInherits
+
+ /**
+ * Default constructor for Main to use.
+ */
+ public IDLGenerator() {
+ }
+
+
+ /**
+ * Return true if a new instance should be created for each
+ * class on the command line. Subclasses which return true
+ * should override newInstance() to return an appropriately
+ * constructed instance.
+ */
+ protected boolean requireNewInstance() {
+ return false;
+ }
+
+ /**
+ * Return true if non-conforming types should be parsed.
+ * @param stack The context stack.
+ */
+ protected boolean parseNonConforming(ContextStack stack) {
+ return valueMethods;
+ }
+
+ /**
+ * Create and return a top-level type.
+ * @param cdef The top-level class definition.
+ * @param stack The context stack.
+ * @return An RemoteType or null if is non-conforming.
+ */
+ protected sun.rmi.rmic.iiop.CompoundType getTopType(ClassDefinition cdef,
+ ContextStack stack) {
+ return CompoundType.forCompound(cdef,stack);
+ }
+
+
+ /**
+ * Return an Identifier which contains the fully-qualified IDL filename
+ * for the given OutputType.
+ * The OutputType contains a filename string (not directory) and Type.
+ * @param ot the OutputType for which directory nesting is to be defined.
+ * @return the new identifier.
+ */
+ protected Identifier getOutputId (
+ OutputType ot ) {
+ Identifier id = super.getOutputId( ot );
+
+ Type t = ot.getType();
+ String fName = ot.getName();
+
+ if ( id == idJavaLangClass ) //java.lang.Class and array of
+ if ( t.isArray() )
+ return Identifier.lookup(
+ "org.omg.boxedRMI.javax.rmi.CORBA." + fName );
+ else return idClassDesc;
+
+ if ( id == idJavaLangString && //array of java.lang.String
+ t.isArray() )
+ return Identifier.lookup( "org.omg.boxedRMI.CORBA." + fName );
+
+ if ( "org.omg.CORBA.Object".equals( t.getQualifiedName() ) &&
+ t.isArray() ) //array of org.omg.CORBA.Object
+ return Identifier.lookup( "org.omg.boxedRMI." + fName );
+
+ if ( t.isArray()) { //array
+ ArrayType at = (ArrayType)t;
+ Type et = at.getElementType();
+ if ( et.isCompound() ) {
+ CompoundType ct = (CompoundType)et;
+ String qName = ct.getQualifiedName();
+ if ( ct.isIDLEntity() )
+ return Identifier.lookup( getQualifiedName( at ) );
+ }
+ return Identifier.lookup( idBoxedRMI,id );
+ }
+
+ if ( t.isCompound() ) { //boxed IDLEntity
+ CompoundType ct = (CompoundType)t;
+ String qName = ct.getQualifiedName();
+ if ( ct.isBoxed() )
+ return Identifier.lookup( getQualifiedName( ct ) );
+ }
+
+ return id;
+ }
+
+
+
+ /**
+ * Return the file name extension for the given file name (e.g. ".java").
+ * All files generated with the ".java" extension will be compiled. To
+ * change this behavior for ".java" files, override the compileJavaSourceFile
+ * method to return false.
+ * @param outputType One of the items returned by getOutputTypesFor(...)
+ */
+ protected String getFileNameExtensionFor(OutputType outputType) {
+ return IDL_FILE_EXTENSION;
+ }
+
+
+ /**
+ * Examine and consume command line arguments.
+ * @param argv The command line arguments. Ignore null
+ * and unknown arguments. Set each consumed argument to null.
+ * @param main Report any errors using the main.error() methods.
+ * @return true if no errors, false otherwise.
+ */
+ public boolean parseArgs(String argv[], Main main) {
+ boolean result = super.parseArgs(argv,main);
+ String idlFrom;
+ String idlTo;
+ if (result) {
+ nextArg:
+ for (int i = 0; i < argv.length; i++) {
+ if (argv[i] != null) {
+ if (argv[i].equalsIgnoreCase("-idl")) {
+ idl = true;
+ argv[i] = null;
+ }
+ else if ( argv[i].equalsIgnoreCase( "-valueMethods" ) ) {
+ valueMethods = true;
+ argv[i] = null;
+ }
+ else if ( argv[i].equalsIgnoreCase( "-noValueMethods" ) ) {
+ valueMethods = false;
+ argv[i] = null;
+ }
+ else if ( argv[i].equalsIgnoreCase( "-init" ) ) {
+ factory = false;
+ argv[i] = null;
+ }
+ else if ( argv[i].equalsIgnoreCase( "-factory" ) ) {
+ factory = true;
+ argv[i] = null;
+ }
+ else if ( argv[i].equalsIgnoreCase( "-idlfile" ) ) {
+ argv[i] = null;
+ if ( ++i < argv.length && argv[i] != null && !argv[i].startsWith("-") ) {
+ idlFrom = argv[i];
+ argv[i] = null;
+ if ( ++i < argv.length && argv[i] != null && !argv[i].startsWith("-") ) {
+ idlTo = argv[i];
+ argv[i] = null;
+ ifHash.put( idlFrom,idlTo );
+ continue nextArg;
+ }
+ }
+ main.error("rmic.option.requires.argument", "-idlfile");
+ result = false;
+ }
+ else if ( argv[i].equalsIgnoreCase( "-idlmodule" ) ) {
+ argv[i] = null;
+ if ( ++i < argv.length && argv[i] != null && !argv[i].startsWith("-") ) {
+ idlFrom = argv[i];
+ argv[i] = null;
+ if ( ++i < argv.length && argv[i] != null && !argv[i].startsWith("-") ) {
+ idlTo = argv[i];
+ argv[i] = null;
+ imHash.put( idlFrom,idlTo );
+ continue nextArg;
+ }
+ }
+ main.error("rmic.option.requires.argument", "-idlmodule");
+ result = false;
+ }
+
+
+ }
+ }
+ }
+ return result;
+ }
+
+
+
+ /**
+ * Return an array of OutputTypes for the IDL files that need to be
+ * generated for the given top-level type.
+ * OutputTypes contain filename string (not directory) and Type.
+ * @param topType The type returned by getTopType().
+ * @param alreadyChecked A set of Types which have already been checked.
+ * @return Array of OutputTypes to generate
+ */
+ protected OutputType[] getOutputTypesFor(
+ CompoundType topType,
+ HashSet alreadyChecked ) {
+ Vector refVec = getAllReferencesFor( topType );
+ Vector outVec = new Vector();
+ for ( int i1 = 0; i1 < refVec.size(); i1++ ) { //forall references
+ Type t = (Type)refVec.elementAt( i1 );
+ if ( t.isArray() ) {
+ ArrayType at = (ArrayType)t;
+ int dim = at.getArrayDimension();
+ Type et = at.getElementType();
+ String fName = unEsc( et.getIDLName() ).replace( ' ','_' );
+ for ( int i2 = 0; i2 < dim; i2++ ) { //foreach dimension
+ String fileName = "seq" + ( i2 + 1 ) + "_" + fName;
+ outVec.addElement( new OutputType( fileName,at ) );
+ }
+ }
+ else if ( t.isCompound() ) {
+ String fName = unEsc( t.getIDLName() );
+ outVec.addElement( new OutputType( fName.replace( ' ','_' ),t ) );
+ if ( t.isClass() ) {
+ ClassType ct = (ClassType)t;
+ if ( ct.isException() ) { //exception file
+ fName = unEsc( ct.getIDLExceptionName() );
+ outVec.addElement( new OutputType( fName.replace( ' ','_' ),t ) );
+ }
+ }
+ }
+ }
+ OutputType[] outArr = new OutputType[outVec.size()];
+ outVec.copyInto( outArr );
+ return outArr;
+ }
+
+ /**
+ * Get all referenced types of a given tyoe for which an IDL file needs
+ * to be generated.
+ * @param ct The given type.
+ * @return Vector of Types for which IDL must be generated.
+ */
+ protected Vector getAllReferencesFor(
+ CompoundType ct ) {
+ Hashtable refHash = new Hashtable();
+ Hashtable spcHash = new Hashtable();
+ Hashtable arrHash = new Hashtable();
+ int refSize;
+ refHash.put( ct.getQualifiedName(),ct ); //put the given type
+ accumulateReferences( refHash,spcHash,arrHash );
+ do {
+ refSize = refHash.size();
+ accumulateReferences( refHash,spcHash,arrHash );
+ }
+ while ( refSize < refHash.size() ); //till hashtable stays same size
+
+ Vector outVec = new Vector();
+ Enumeration e = refHash.elements(); //ordinary references
+ while ( e.hasMoreElements() ) {
+ CompoundType t = (CompoundType)e.nextElement();
+ outVec.addElement( t );
+ }
+ e = spcHash.elements(); //special references
+ while ( e.hasMoreElements() ) {
+ CompoundType t = (CompoundType)e.nextElement();
+ outVec.addElement( t );
+ }
+ e = arrHash.elements(); //array references
+ nextSequence:
+ while ( e.hasMoreElements() ) {
+ ArrayType at = (ArrayType)e.nextElement();
+ int dim = at.getArrayDimension();
+ Type et = at.getElementType();
+ Enumeration e2 = arrHash.elements();
+ while ( e2.hasMoreElements() ) { //eliminate duplicates
+ ArrayType at2 = (ArrayType)e2.nextElement();
+ if ( et == at2.getElementType() && //same element type &
+ dim < at2.getArrayDimension() ) //smaller dimension?
+ continue nextSequence; //ignore this one
+ }
+ outVec.addElement( at );
+ }
+ return outVec;
+ }
+
+
+ /**
+ * Accumulate and filter all those types that are referenced by the given
+ * referenced types.
+ * Keep only those for which IDL is to be generated.
+ * @param refHash Hashtable containing the given types
+ * @param spcHash Hashtable containing referenced specials (IDL typedefs)
+ * @param arrHash Hashtable containing referenced arrays (dimensioned)
+ */
+ protected void accumulateReferences(
+ Hashtable refHash,
+ Hashtable spcHash,
+ Hashtable arrHash ) {
+ Enumeration e = refHash.elements();
+ while ( e.hasMoreElements() ) {
+ CompoundType t = (CompoundType)e.nextElement();
+ Vector datVec = getData( t ); //collect and sort data
+ Vector mthVec = getMethods( t ); //collect and filter methods
+ getInterfaces( t,refHash ); //collect interfaces
+ getInheritance( t,refHash ); //add inheritance
+ getMethodReferences( mthVec,refHash,spcHash,arrHash,refHash );
+ getMemberReferences( datVec,refHash,spcHash,arrHash );
+ }
+ e = arrHash.elements(); //add array element references
+ while ( e.hasMoreElements() ) {
+ ArrayType at = (ArrayType)e.nextElement();
+ Type et = at.getElementType();
+ addReference( et,refHash,spcHash,arrHash );
+ }
+ e = refHash.elements();
+ while ( e.hasMoreElements() ) {
+ CompoundType t = (CompoundType)e.nextElement();
+ if ( !isIDLGeneratedFor( t ) ) //remove if no IDL generation
+ refHash.remove( t.getQualifiedName() );
+ }
+ }
+
+
+
+ /**
+ * Determine if IDL should be generated for a referenced type.
+ * Do not generate IDL for a CORBA Object reference. It gets mapped
+ * to the original IDL or to Object (if exactly org.omg.CORBA.Object)
+ * Generate (boxed) IDL for an IDL Entity unless it is an IDL user
+ * exception, a ValueBase, an AbstractBase (or a CORBA Object).
+ * Do not generate IDL for Implementation classes..unless they inherit
+ * from multiple distinct remote interfaces
+ * @param t The type to check.
+ * @return true or false
+ */
+ protected boolean isIDLGeneratedFor(
+ CompoundType t ) {
+ if ( t.isCORBAObject() ) return false;
+ if ( t.isIDLEntity() )
+ if ( t.isBoxed() ) return true;
+ else if ( "org.omg.CORBA.portable.IDLEntity"
+ .equals( t.getQualifiedName() ) ) return true;
+ else if ( t.isCORBAUserException() ) return true;
+ else return false;
+ Hashtable inhHash = new Hashtable();
+ getInterfaces( t,inhHash );
+ if ( t.getTypeCode() == TYPE_IMPLEMENTATION )
+ if ( inhHash.size() < 2 ) return false; //no multiple inheritance
+ else return true;
+ return true; //generate IDL for this type
+ }
+
+
+ /**
+ * Write the output for the given OutputFileName into the output stream.
+ * (The IDL mapping for java.lang.Class is generated from
+ * javax.rmi.CORBA.ClassDesc in the tools workspace)
+ * @param ot One of the items returned by getOutputTypesFor(...)
+ * @param alreadyChecked A set of Types which have already been checked.
+ * Intended to be passed to Type.collectMatching(filter,alreadyChecked).
+ * @param p The output stream.
+ */
+ protected void writeOutputFor(
+ OutputType ot,
+ HashSet alreadyChecked,
+ IndentingWriter p )
+ throws IOException {
+ Type t = ot.getType();
+ if ( t.isArray() ) { //specialcase: sequence
+ writeSequence( ot,p );
+ return;
+ }
+ if ( isSpecialReference( t ) ) { //specialcase: IDL typecode
+ writeSpecial( t,p );
+ return;
+ }
+ if ( t.isCompound() ) { //specialcase: boxed IDL
+ CompoundType ct = (CompoundType)t;
+ if ( ct.isIDLEntity() && ct.isBoxed() ) {
+ writeBoxedIDL( ct,p );
+ return;
+ }
+ }
+ if ( t.isClass() ) { //specialcase: exception
+ ClassType ct = (ClassType)t;
+ if ( ct.isException() ) {
+ String eName = unEsc( ct.getIDLExceptionName() );
+ String fName = ot.getName();
+ if ( fName.equals( eName.replace( ' ','_' ) ) ) {
+ writeException( ct,p );
+ return;
+ }
+ }
+ }
+ switch ( t.getTypeCode() ) { //general case
+ case TYPE_IMPLEMENTATION:
+ writeImplementation( (ImplementationType)t,p );
+ break;
+ case TYPE_NC_CLASS:
+ case TYPE_NC_INTERFACE:
+ writeNCType( (CompoundType)t,p );
+ break;
+ case TYPE_ABSTRACT: //AbstractType is a RemoteType
+ case TYPE_REMOTE:
+ writeRemote( (RemoteType)t,p );
+ break;
+ case TYPE_VALUE:
+ writeValue( (ValueType)t,p );
+ break;
+ default:
+ throw new CompilerError(
+ "IDLGenerator got unexpected type code: "
+ + t.getTypeCode());
+ }
+ }
+
+
+ /**
+ * Write an IDL interface definition for a Java implementation class
+ * @param t The current ImplementationType
+ * @param p The output stream.
+ */
+ protected void writeImplementation(
+ ImplementationType t,
+ IndentingWriter p )
+ throws IOException {
+ Hashtable inhHash = new Hashtable();
+ Hashtable refHash = new Hashtable();
+ getInterfaces( t,inhHash ); //collect interfaces
+
+ writeBanner( t,0,!isException,p );
+ writeInheritedIncludes( inhHash,p );
+ writeIfndef( t,0,!isException,!isForward,p );
+ writeIncOrb( p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+ p.p( "interface " + t.getIDLName() );
+ writeInherits( inhHash,!forValuetype,p );
+
+ p.pln( " {" );
+ p.pln( "};" );
+
+ p.pO();p.pln();
+ writeModule2( t,p );
+ writeEpilog( t,refHash,p );
+ }
+
+
+ /**
+ * Write an IDL valuetype definition for
+ * 1) a nonconforming Java class
+ * 2) a nonconforming Java interface (that is not an AbstractType)
+ * @param t The current NC Type (NCClassType or NCInterfaceType)
+ * @param p The output stream.
+ */
+ protected void writeNCType(
+ CompoundType t,
+ IndentingWriter p )
+ throws IOException {
+ Vector conVec = getConstants( t ); //collect constants
+ Vector mthVec = getMethods( t ); //collect methods
+ Hashtable inhHash = new Hashtable();
+ Hashtable refHash = new Hashtable();
+ Hashtable spcHash = new Hashtable();
+ Hashtable arrHash = new Hashtable();
+ Hashtable excHash = new Hashtable();
+ getInterfaces( t,inhHash ); //collect interfaces
+ getInheritance( t,inhHash ); //add inheritance
+ getMethodReferences( mthVec,refHash,spcHash,arrHash,excHash );
+
+ writeProlog( t,refHash,spcHash,arrHash,excHash,inhHash,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+ p.p( "abstract valuetype " + t.getIDLName() );
+ writeInherits( inhHash,!forValuetype,p );
+
+ p.pln( " {" );
+ if ( conVec.size() + mthVec.size() > 0 ) { //any content?
+ p.pln();p.pI();
+ for ( int i1 = 0; i1 < conVec.size(); i1++ ) //write constants
+ writeConstant( (CompoundType.Member)conVec.elementAt( i1 ),p );
+ for ( int i1 = 0; i1 < mthVec.size(); i1++ ) //write methods
+ writeMethod( (CompoundType.Method)mthVec.elementAt( i1 ),p );
+ p.pO();p.pln();
+ }
+ p.pln( "};" );
+
+ p.pO();p.pln();
+ writeModule2( t,p );
+ writeEpilog( t,refHash,p );
+ }
+
+
+ /**
+ * Write an IDL interface definition for either:
+ * 1) a conforming Java remote interface (RemoteType)..or
+ * 2) a non-conforming Java interface whose methods all throw
+ * java.rmi.RemoteException (AbstractType)
+ * @param t The current RemoteType
+ * @param p The output stream.
+ */
+ protected void writeRemote(
+ RemoteType t,
+ IndentingWriter p )
+ throws IOException {
+ Vector conVec = getConstants( t ); //collect constants
+ Vector mthVec = getMethods( t ); //collect methods
+ Hashtable inhHash = new Hashtable();
+ Hashtable refHash = new Hashtable();
+ Hashtable spcHash = new Hashtable();
+ Hashtable arrHash = new Hashtable();
+ Hashtable excHash = new Hashtable();
+ getInterfaces( t,inhHash ); //collect interfaces
+ getMethodReferences( mthVec,refHash,spcHash,arrHash,excHash );
+
+ writeProlog( t,refHash,spcHash,arrHash,excHash,inhHash,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+ if ( t.getTypeCode() == TYPE_ABSTRACT ) p.p( "abstract " );
+ p.p( "interface " + t.getIDLName() );
+ writeInherits( inhHash,!forValuetype,p );
+
+ p.pln( " {" );
+ if ( conVec.size() + mthVec.size() > 0 ) { //any constants or methods?
+ p.pln();p.pI();
+ for ( int i1 = 0; i1 < conVec.size(); i1++ ) //constants
+ writeConstant( (CompoundType.Member)conVec.elementAt( i1 ),p );
+ for ( int i1 = 0; i1 < mthVec.size(); i1++ ) //methods, attributes
+ writeMethod( (CompoundType.Method)mthVec.elementAt( i1 ),p );
+ p.pO();p.pln();
+ }
+ p.pln( "};" );
+
+ p.pO();p.pln();
+ writeRepositoryID ( t,p );
+ p.pln();
+ writeModule2( t,p );
+ writeEpilog( t,refHash,p );
+ }
+
+
+ /**
+ * Write an IDL valuetype definition for a conforming Java class.
+ * Methods and constructors are optional..controlled by -valueMethods flag
+ * @param t The current ValueType
+ * @param p The output stream.
+ */
+ protected void writeValue(
+ ValueType t,
+ IndentingWriter p )
+ throws IOException {
+ Vector datVec = getData( t ); //collect and sort data
+ Vector conVec = getConstants( t ); //collect constants
+ Vector mthVec = getMethods( t ); //collect and filter methods
+ Hashtable inhHash = new Hashtable();
+ Hashtable refHash = new Hashtable();
+ Hashtable spcHash = new Hashtable();
+ Hashtable arrHash = new Hashtable();
+ Hashtable excHash = new Hashtable();
+ getInterfaces( t,inhHash ); //collect interfaces
+ getInheritance( t,inhHash ); //add inheritance
+ getMethodReferences( mthVec,refHash,spcHash,arrHash,excHash );
+ getMemberReferences( datVec,refHash,spcHash,arrHash );
+
+ writeProlog( t,refHash,spcHash,arrHash,excHash,inhHash,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+ if ( t.isCustom() ) p.p( "custom " );
+ p.p( "valuetype " + t.getIDLName() );
+ writeInherits( inhHash,forValuetype,p );
+
+ p.pln( " {" );
+ if ( conVec.size() + datVec.size() + mthVec.size() > 0 ) { //any content?
+ p.pln();p.pI();
+ for ( int i1 = 0; i1 < conVec.size(); i1++ ) //write constants
+ writeConstant( (CompoundType.Member)conVec.elementAt( i1 ),p );
+ for ( int i1 = 0; i1 < datVec.size(); i1++ ) {
+ CompoundType.Member mem = (CompoundType.Member)datVec.elementAt( i1 );
+ if ( mem.getType().isPrimitive() )
+ writeData( mem,p ); //write primitive data
+ }
+ for ( int i1 = 0; i1 < datVec.size(); i1++ ) {
+ CompoundType.Member mem = (CompoundType.Member)datVec.elementAt( i1 );
+ if ( !mem.getType().isPrimitive() )
+ writeData( mem,p ); //write non-primitive data
+ }
+ for ( int i1 = 0; i1 < mthVec.size(); i1++ ) //write methods
+ writeMethod( (CompoundType.Method)mthVec.elementAt( i1 ),p );
+ p.pO();p.pln();
+ }
+ p.pln( "};" );
+
+ p.pO();p.pln();
+ writeRepositoryID ( t,p );
+ p.pln();
+ writeModule2( t,p );
+ writeEpilog( t,refHash,p );
+ }
+
+
+ /**
+ * Write IDL prolog for a CompoundType.
+ * @param t The CompoundType.
+ * @param refHash Hashtable loaded with type references.
+ * @param spcHash Hashtable loaded with special type references.
+ * @param arrHash Hashtable loaded with array references.
+ * @param excHash Hashtable loaded with exceptions thrown.
+ * @param inhHash Hashtable loaded with inherited types.
+ * @param p The output stream.
+ */
+ protected void writeProlog(
+ CompoundType t,
+ Hashtable refHash,
+ Hashtable spcHash,
+ Hashtable arrHash,
+ Hashtable excHash,
+ Hashtable inhHash,
+ IndentingWriter p )
+ throws IOException {
+ writeBanner( t,0,!isException,p );
+ writeForwardReferences( refHash,p );
+ writeIncludes( excHash,isThrown,p ); //#includes for exceptions thrown
+ writeInheritedIncludes( inhHash,p );
+ writeIncludes( spcHash,!isThrown,p ); //#includes for special types
+ writeBoxedRMIIncludes( arrHash,p );
+ writeIDLEntityIncludes( refHash,p );
+ writeIncOrb( p );
+ writeIfndef( t,0,!isException,!isForward,p );
+ }
+
+
+ /**
+ * Write IDL epilog for a CompoundType.
+ * @param t The CompoundType.
+ * @param refHash Hashtable loaded with type references.
+ * @param p The output stream.
+ */
+ protected void writeEpilog(
+ CompoundType t,
+ Hashtable refHash,
+ IndentingWriter p )
+ throws IOException {
+ writeIncludes( refHash,!isThrown,p ); //#includes for forward dcl types
+ writeEndif( p );
+ }
+
+
+
+ /**
+ * Write special typedef
+ * @param t A special Type.
+ * @param p The output stream.
+ */
+ protected void writeSpecial(
+ Type t,
+ IndentingWriter p )
+ throws IOException {
+ String spcName = t.getQualifiedName();
+ if ( "java.io.Serializable".equals( spcName ) )
+ writeJavaIoSerializable( t,p );
+ else if ( "java.io.Externalizable".equals( spcName ) )
+ writeJavaIoExternalizable( t,p );
+ else if ( "java.lang.Object".equals( spcName) )
+ writeJavaLangObject( t,p );
+ else if ( "java.rmi.Remote".equals( spcName) )
+ writeJavaRmiRemote( t,p );
+ else if ( "org.omg.CORBA.portable.IDLEntity".equals( spcName) )
+ writeIDLEntity( t,p );
+ }
+
+
+
+ /**
+ * Write a hard-coded IDL typedef definition for the special case
+ * java.io.Serializable.
+ * @param t The current Type
+ * @param p The output stream.
+ */
+ protected void writeJavaIoSerializable(
+ Type t,
+ IndentingWriter p )
+ throws IOException {
+ writeBanner( t,0,!isException,p );
+ writeIfndef( t,0,!isException,!isForward,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+ p.pln( "typedef any Serializable;" );
+ p.pO();p.pln();
+ writeModule2( t,p );
+ writeEndif( p );
+ }
+
+
+ /**
+ * Write a hard-coded IDL typedef definition for the special case
+ * java.io.Externalizable.
+ * @param t The current Type
+ * @param p The output stream.
+ */
+ protected void writeJavaIoExternalizable(
+ Type t,
+ IndentingWriter p )
+ throws IOException {
+ writeBanner( t,0,!isException,p );
+ writeIfndef( t,0,!isException,!isForward,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+ p.pln( "typedef any Externalizable;" );
+ p.pO();p.pln();
+ writeModule2( t,p );
+ writeEndif( p );
+ }
+
+
+ /**
+ * Write a hard-coded IDL typedef definition for the special case
+ * java.lang.Object.
+ * @param t The current Type
+ * @param p The output stream.
+ */
+ protected void writeJavaLangObject(
+ Type t,
+ IndentingWriter p )
+ throws IOException {
+ writeBanner( t,0,!isException,p );
+ writeIfndef( t,0,!isException,!isForward,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+ p.pln( "typedef any _Object;" );
+ p.pO();p.pln();
+ writeModule2( t,p );
+ writeEndif( p );
+ }
+
+
+ /**
+ * Write a hard-coded IDL typedef definition for the special case
+ * java.rmi.Remote.
+ * @param t The current Type
+ * @param p The output stream.
+ */
+ protected void writeJavaRmiRemote(
+ Type t,
+ IndentingWriter p )
+ throws IOException {
+ writeBanner( t,0,!isException,p );
+ writeIfndef( t,0,!isException,!isForward,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+ p.pln( "typedef Object Remote;" );
+ p.pO();p.pln();
+ writeModule2( t,p );
+ writeEndif( p );
+ }
+
+
+
+ /**
+ * Write a hard-coded IDL typedef definition for the special case
+ * org.omg.CORBA.portable.IDLEntity
+ * @param t The current Type
+ * @param p The output stream.
+ */
+ protected void writeIDLEntity(
+ Type t,
+ IndentingWriter p )
+ throws IOException {
+ writeBanner( t,0,!isException,p );
+ writeIfndef( t,0,!isException,!isForward,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+ p.pln( "typedef any IDLEntity;" );
+ p.pO();p.pln();
+ writeModule2( t,p );
+ writeEndif( p );
+ }
+
+
+ /**
+ * Filter and collect non-duplicate inherited interfaces for a type
+ * @param ct The current CompoundType
+ * @param inhHash Hashtable containing the inherited interfaces
+ */
+ protected void getInterfaces(
+ CompoundType ct,
+ Hashtable inhHash ) {
+ InterfaceType[] infs = ct.getInterfaces();
+ nextInterface:
+ for ( int i1 = 0; i1 < infs.length; i1++ ) { //forall inherited interfaces
+ String inhName = infs[i1].getQualifiedName();
+ switch ( ct.getTypeCode() ) {
+ case TYPE_NC_CLASS:
+ case TYPE_VALUE: //filter for classes
+ if ( "java.io.Externalizable".equals( inhName ) ||
+ "java.io.Serializable".equals( inhName ) ||
+ "org.omg.CORBA.portable.IDLEntity".equals( inhName ) )
+ continue nextInterface;
+ break;
+ default: //filter for all others
+ if ( "java.rmi.Remote".equals( inhName ) )
+ continue nextInterface;
+ break;
+ }
+ inhHash.put( inhName,infs[i1] ); //add this one
+ }
+ }
+
+
+ /**
+ * Filter and add base class inheritance for a class type
+ * @param ct The current CompoundType
+ * @param inhHash Hashtable containing inherited types
+ */
+ protected void getInheritance(
+ CompoundType ct,
+ Hashtable inhHash ) {
+ ClassType par = ct.getSuperclass(); //get parent
+ if ( par == null ) return;
+ String parName = par.getQualifiedName();
+ switch ( ct.getTypeCode() ) {
+ case TYPE_NC_CLASS:
+ case TYPE_VALUE:
+ if ( "java.lang.Object".equals( parName ) ) //this is implicit
+ return;
+ break;
+ default: return; //ignore other types
+ }
+ inhHash.put( parName,par ); //add valid base class
+ }
+
+
+ /**
+ * Collect and filter type and array references from methods
+ * @param mthVec Given Vector of methods
+ * @param refHash Hashtable for type references
+ * @param spcHash Hashtable for special type references
+ * @param arrHash Hashtable for array references
+ * @param excHash Hashtable for exceptions thrown
+ */
+ protected void getMethodReferences(
+ Vector mthVec,
+ Hashtable refHash,
+ Hashtable spcHash,
+ Hashtable arrHash,
+ Hashtable excHash ) {
+ for ( int i1 = 0; i1 < mthVec.size(); i1++ ) { //forall methods
+ CompoundType.Method mth = (CompoundType.Method)mthVec.elementAt( i1 );
+ Type[] args = mth.getArguments();
+ Type ret = mth.getReturnType();
+ getExceptions( mth,excHash ); //collect exceptions thrown
+ for ( int i2 = 0; i2 < args.length; i2++ ) //forall arguments
+ addReference( args[i2],refHash,spcHash,arrHash );
+ addReference( ret,refHash,spcHash,arrHash );
+ }
+ }
+
+
+ /**
+ * Collect and filter type and array references from data members
+ * @param datVec Given Vector of data members
+ * @param refHash Hashtable for type references
+ * @param spcHash Hashtable for special type references
+ * @param arrHash Hashtable for array references
+ */
+ protected void getMemberReferences(
+ Vector datVec,
+ Hashtable refHash,
+ Hashtable spcHash,
+ Hashtable arrHash ) {
+ for ( int i1 = 0; i1 < datVec.size(); i1++ ) { //forall datamembers
+ CompoundType.Member mem = (CompoundType.Member)datVec.elementAt( i1 );
+ Type dat = mem.getType();
+ addReference( dat,refHash,spcHash,arrHash );
+ }
+ }
+
+
+ /**
+ * Add reference for given type avoiding duplication.
+ * Sort into specials, arrays and regular references.
+ * Filter out types which are not required.
+ * @param ref Given Type
+ * @param refHash Hashtable for type references
+ * @param spcHash Hashtable for special type references
+ * @param arrHash Hashtable for array references
+ */
+ protected void addReference(
+ Type ref,
+ Hashtable refHash,
+ Hashtable spcHash,
+ Hashtable arrHash ) {
+ String rName = ref.getQualifiedName();
+ switch ( ref.getTypeCode() ) {
+ case TYPE_ABSTRACT:
+ case TYPE_REMOTE:
+ case TYPE_NC_CLASS:
+ case TYPE_NC_INTERFACE:
+ case TYPE_VALUE:
+ refHash.put( rName,ref );
+ return;
+ case TYPE_CORBA_OBJECT:
+ if ( "org.omg.CORBA.Object".equals( rName ) ) return; //don't want
+ refHash.put( rName,ref );
+ return;
+ case TYPE_ARRAY: //array?
+ arrHash.put( rName + ref.getArrayDimension(),ref );
+ return;
+ default:
+ if ( isSpecialReference( ref ) ) //special IDL typedef?
+ spcHash.put( rName,ref );
+ }
+ }
+
+
+
+ /**
+ * Determine whether given Type is a special reference.
+ * Special cases are: java.io.Serializable, java.io.Externalizable,
+ * java.lang.Object, java.rmi.Remote and org.omg.CORBA.portable.IDLEntity
+ * They are special because they have a hard-coded typedef defined in the
+ * spec.
+ * @param ref A referenced Type
+ * @return boolean indicating whether it's a special reference
+ */
+ protected boolean isSpecialReference(
+ Type ref ) {
+ String rName = ref.getQualifiedName();
+ if ( "java.io.Serializable".equals( rName ) ) return true;
+ if ( "java.io.Externalizable".equals( rName ) ) return true;
+ if ( "java.lang.Object".equals( rName) ) return true;
+ if ( "java.rmi.Remote".equals( rName) ) return true;
+ if ( "org.omg.CORBA.portable.IDLEntity".equals( rName) ) return true;
+ return false;
+ }
+
+
+ /**
+ * Collect and filter thrown exceptions for a given pre-filtered method.
+ * Keep only 'checked' exception classes minus java.rmi.RemoteException
+ * and its subclasses
+ * @param mth The current method
+ * @param excHash Hashtable containing non-duplicate thrown exceptions
+ */
+ protected void getExceptions(
+ CompoundType.Method mth,
+ Hashtable excHash ) {
+ ClassType[] excs = mth.getExceptions();
+ for ( int i1 = 0; i1 < excs.length; i1++ ) { //forall exceptions
+ ClassType exc = excs[i1];
+ if ( exc.isCheckedException() &&
+ !exc.isRemoteExceptionOrSubclass() ) {
+ excHash.put( exc.getQualifiedName(),exc );
+ }
+ }
+ }
+
+
+ /**
+ * Collect and filter methods for a type.
+ * Remove any private or inherited methods.
+ * @param ct The current CompoundType
+ * @return Vector containing the methods
+ */
+ protected Vector getMethods(
+ CompoundType ct ) {
+ Vector vec = new Vector();
+ int ctType = ct.getTypeCode();
+ switch ( ctType ) {
+ case TYPE_ABSTRACT:
+ case TYPE_REMOTE: break;
+ case TYPE_NC_CLASS:
+ case TYPE_NC_INTERFACE:
+ case TYPE_VALUE: if ( valueMethods ) break;
+ default: return vec;
+ }
+ Identifier ctId = ct.getIdentifier();
+ CompoundType.Method[] mths = ct.getMethods();
+ nextMethod:
+ for ( int i1 = 0; i1 < mths.length; i1++ ) { //forall methods
+ if ( mths[i1].isPrivate() || //private method?
+ mths[i1].isInherited() ) //inherited method?
+ continue nextMethod; //yes..ignore it
+ if ( ctType == TYPE_VALUE ) {
+ String mthName = mths[i1].getName();
+ if ( "readObject" .equals( mthName ) ||
+ "writeObject" .equals( mthName ) ||
+ "readExternal".equals( mthName ) ||
+ "writeExternal".equals( mthName ) )
+ continue nextMethod; //ignore this one
+ }
+ if ( ( ctType == TYPE_NC_CLASS ||
+ ctType == TYPE_NC_INTERFACE ) &&
+ mths[i1].isConstructor() ) //init not valid for abstract valuetype
+ continue nextMethod; //ignore this one
+ vec.addElement( mths[i1] ); //add this one
+ }
+ return vec;
+ }
+
+
+ /**
+ * Collect constants for a type.
+ * A valid constant is a "public final static" field with a compile-time
+ * constant value for a primitive type or String
+ * @param ct The current CompoundType
+ * @return Vector containing the constants
+ */
+ protected Vector getConstants(
+ CompoundType ct ) {
+ Vector vec = new Vector();
+ CompoundType.Member[] mems = ct.getMembers();
+ for ( int i1 = 0; i1 < mems.length; i1++ ) { //forall members
+ Type memType = mems[i1].getType();
+ String memValue = mems[i1].getValue();
+ if ( mems[i1].isPublic() &&
+ mems[i1].isFinal() &&
+ mems[i1].isStatic() &&
+ ( memType.isPrimitive() || "String".equals( memType.getName() ) ) &&
+ memValue != null )
+ vec.addElement( mems[i1] ); //add this one
+ }
+ return vec;
+ }
+
+
+ /**
+ * Collect and sort data fields for a ValueType.
+ * Sort in Java (not IDL) Unicode name string lexicographic increasing
+ * order.
+ * Non-static, non-transient fields are mapped.
+ * If the type is a custom valuetype, only public fields are mapped.
+ * @param t The current CompoundType
+ * @return Vector containing the data fields
+ */
+ protected Vector getData(
+ CompoundType t ) {
+ Vector vec = new Vector();
+ if ( t.getTypeCode() != TYPE_VALUE ) return vec;
+ ValueType vt = (ValueType)t;
+ CompoundType.Member[] mems = vt.getMembers();
+ boolean notCust = !vt.isCustom();
+ for ( int i1 = 0; i1 < mems.length; i1++ ) { //forall members
+ if ( !mems[i1].isStatic() &&
+ !mems[i1].isTransient() &&
+ ( mems[i1].isPublic() || notCust ) ) {
+ int i2;
+ String memName = mems[i1].getName();
+ for ( i2 = 0; i2 < vec.size(); i2++ ) { //insert in java lex order
+ CompoundType.Member aMem = (CompoundType.Member)vec.elementAt( i2 );
+ if ( memName.compareTo( aMem.getName() ) < 0 ) break;
+ }
+ vec.insertElementAt( mems[i1],i2 ); //insert this one
+ }
+ }
+ return vec;
+ }
+
+
+ /**
+ * Write forward references for referenced interfaces and valuetypes
+ * ...but not if the reference is to a boxed IDLEntity,
+ * @param refHash Hashtable loaded with referenced types
+ * @param p The output stream.
+ */
+ protected void writeForwardReferences(
+ Hashtable refHash,
+ IndentingWriter p )
+ throws IOException {
+ Enumeration refEnum = refHash.elements();
+ nextReference:
+ while ( refEnum.hasMoreElements() ) {
+ Type t = (Type)refEnum.nextElement();
+ if ( t.isCompound() ) {
+ CompoundType ct = (CompoundType)t;
+ if ( ct.isIDLEntity() )
+ continue nextReference; //ignore IDLEntity reference
+ }
+ writeForwardReference( t,p );
+ }
+ }
+
+
+ /**
+ * Write forward reference for given type
+ * @param t Given type
+ * @param p The output stream.
+ */
+ protected void writeForwardReference(
+ Type t,
+ IndentingWriter p )
+ throws IOException {
+ String qName = t.getQualifiedName();
+ if ( "java.lang.String".equals( qName ) ) ;
+ else if ( "org.omg.CORBA.Object".equals( qName ) ) return ; //no fwd dcl
+
+ writeIfndef( t,0,!isException,isForward,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+ switch ( t.getTypeCode() ) {
+ case TYPE_NC_CLASS:
+ case TYPE_NC_INTERFACE: p.p( "abstract valuetype " ); break;
+ case TYPE_ABSTRACT: p.p( "abstract interface " ); break;
+ case TYPE_VALUE: p.p( "valuetype " ); break;
+ case TYPE_REMOTE:
+ case TYPE_CORBA_OBJECT: p.p( "interface " ); break;
+ default: ; //all other types were filtered
+ }
+ p.pln( t.getIDLName() + ";" );
+ p.pO();p.pln();
+ writeModule2( t,p );
+ writeEndif( p );
+ }
+
+
+ /**
+ * Write forward reference for boxed valuetype for single dimension of IDL
+ * sequence.
+ * If the dimension is {@literal < 1} and the element is a CompoundType, write a
+ * forward declare for the element
+ * @param at ArrayType for forward declare
+ * @param dim The dimension to write
+ * @param p The output stream.
+ */
+ protected void writeForwardReference(
+ ArrayType at,
+ int dim,
+ IndentingWriter p)
+ throws IOException {
+ Type et = at.getElementType();
+ if ( dim < 1 ) {
+ if ( et.isCompound() ) {
+ CompoundType ct = (CompoundType)et;
+ writeForwardReference( et,p);
+ }
+ return;
+ }
+ String fName = unEsc( et.getIDLName() ).replace( ' ','_' );
+
+ writeIfndef( at,dim,!isException,isForward,p );
+ writeModule1( at,p );
+ p.pln();p.pI();
+ switch ( et.getTypeCode() ) {
+ case TYPE_NC_CLASS:
+ case TYPE_NC_INTERFACE: p.p( "abstract valuetype " ); break;
+ case TYPE_ABSTRACT: p.p( "abstract interface " ); break;
+ case TYPE_VALUE: p.p( "valuetype " ); break;
+ case TYPE_REMOTE:
+ case TYPE_CORBA_OBJECT: p.p( "interface " ); break;
+ default: ; //all other types were filtered
+ }
+ p.pln( "seq" + dim + "_" + fName + ";" );
+ p.pO();p.pln();
+ writeModule2( at,p );
+ writeEndif( p );
+ }
+
+
+ /**
+ * Write #includes for boxed IDLEntity references.
+ * @param refHash Hashtable loaded with referenced types
+ * @param p The output stream.
+ */
+ protected void writeIDLEntityIncludes(
+ Hashtable refHash,
+ IndentingWriter p )
+ throws IOException {
+ Enumeration refEnum = refHash.elements();
+ while ( refEnum.hasMoreElements() ) {
+ Type t = (Type)refEnum.nextElement();
+ if ( t.isCompound() ) {
+ CompoundType ct = (CompoundType)t;
+ if ( ct.isIDLEntity() ) { //select IDLEntities
+ writeInclude( ct,0,!isThrown,p );
+ refHash.remove( ct.getQualifiedName() ); //avoid another #include
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Write #includes
+ * @param incHash Hashtable loaded with Types to include
+ * @param isThrown true if Types are thrown exceptions
+ * @param p The output stream.
+ */
+ protected void writeIncludes(
+ Hashtable incHash,
+ boolean isThrown,
+ IndentingWriter p )
+ throws IOException {
+ Enumeration incEnum = incHash.elements();
+ while ( incEnum.hasMoreElements() ) {
+ CompoundType t = (CompoundType)incEnum.nextElement();
+ writeInclude( t,0,isThrown,p );
+ }
+ }
+
+
+ /**
+ * Write includes for boxedRMI valuetypes for IDL sequences.
+ * Write only the maximum dimension found for an ArrayType.
+ * @param arrHash Hashtable loaded with array types
+ * @param p The output stream.
+ */
+ protected void writeBoxedRMIIncludes(
+ Hashtable arrHash,
+ IndentingWriter p)
+ throws IOException {
+ Enumeration e1 = arrHash.elements();
+ nextSequence:
+ while ( e1.hasMoreElements() ) {
+ ArrayType at = (ArrayType)e1.nextElement();
+ int dim = at.getArrayDimension();
+ Type et = at.getElementType();
+
+ Enumeration e2 = arrHash.elements();
+ while ( e2.hasMoreElements() ) { //eliminate duplicates
+ ArrayType at2 = (ArrayType)e2.nextElement();
+ if ( et == at2.getElementType() && //same element type &
+ dim < at2.getArrayDimension() ) //smaller dimension?
+ continue nextSequence; //ignore this one
+ }
+ writeInclude( at,dim,!isThrown,p );
+ }
+ }
+
+
+ /**
+ * Write #includes
+ * @param inhHash Hashtable loaded with Types to include
+ * @param p The output stream.
+ */
+ protected void writeInheritedIncludes(
+ Hashtable inhHash,
+ IndentingWriter p )
+ throws IOException {
+ Enumeration inhEnum = inhHash.elements();
+ while ( inhEnum.hasMoreElements() ) {
+ CompoundType t = (CompoundType)inhEnum.nextElement();
+ writeInclude( t,0,!isThrown,p );
+ }
+ }
+
+
+ /**
+ * Write a #include.
+ * @param t Type to include
+ * @param dim The dimension to write if t is an array.
+ * @param isThrown boolean indicating if include is for thrown exception.
+ * @param p The output stream.
+ */
+ protected void writeInclude(
+ Type t,
+ int dim,
+ boolean isThrown,
+ IndentingWriter p)
+ throws IOException {
+ CompoundType ct;
+ String tName;
+ String[] modNames;
+ if ( t.isCompound() ) {
+ ct = (CompoundType)t;
+ String qName = ct.getQualifiedName();
+ if ( "java.lang.String".equals( qName ) ) {
+ writeIncOrb( p ); //#include orb.idl for String
+ return;
+ }
+ if ( "org.omg.CORBA.Object".equals( qName ) )
+ return; //Object treated like primitive
+ modNames = getIDLModuleNames( ct ); //module name array
+ tName = unEsc( ct.getIDLName() ); //file name default
+
+ if ( ct.isException() )
+ if ( ct.isIDLEntityException() )
+ if ( ct.isCORBAUserException() )
+ if ( isThrown ) tName = unEsc( ct.getIDLExceptionName() );
+ else ;
+ else tName = ct.getName(); //use original IDL name
+ else if ( isThrown )
+ tName = unEsc( ct.getIDLExceptionName() );
+ }
+ else if ( t.isArray() ) {
+ Type et = t.getElementType(); //file name for sequence
+ if ( dim > 0 ) {
+ modNames = getIDLModuleNames( t ); //module name array
+ tName = "seq" + dim + "_" + unEsc( et.getIDLName().replace( ' ','_' ) );
+ }
+ else{ //#include element
+ if ( !et.isCompound() ) return; //no include needed for primitive
+ ct = (CompoundType) et;
+ modNames = getIDLModuleNames( ct ); //no boxedRMI for element
+ tName = unEsc( ct.getIDLName() );
+ writeInclude( ct,modNames,tName,p );
+ return;
+ }
+ }
+ else return; //no include needed for primitive
+ writeInclude( t,modNames,tName,p );
+ }
+
+
+ /**
+ * Write a #include doing user specified -idlFile translation (if any) for
+ * IDLEntities.
+ * @param t Type to include.
+ * @param modNames Preprocessed module names (default).
+ * @param tName Preprocessed Type name (default).
+ * @param p The output stream.
+ */
+ protected void writeInclude(
+ Type t,
+ String[] modNames,
+ String tName,
+ IndentingWriter p)
+ throws IOException {
+ if ( t.isCompound() ) {
+ CompoundType it = (CompoundType)t;
+
+ if ( ifHash.size() > 0 && //any -idlFile translation to apply
+ it.isIDLEntity() ) { //..for this IDLEntity?
+ String qName = t.getQualifiedName(); //fully qualified orig Java name
+
+ Enumeration k = ifHash.keys();
+ while ( k.hasMoreElements() ) { //loop thro user-defined -idlFiles
+ String from = (String)k.nextElement();
+ if ( qName.startsWith( from ) ) { //found a match?
+ String to = (String)ifHash.get( from );
+ p.pln( "#include \"" + to + "\"" ); //user-specified idl filename
+ return; //don't look for any more
+ }
+ }
+ }
+ }
+ else if ( t.isArray() ) ; //no -idlFile translation needed for array
+ else return; //no #include needed for primitive
+
+ p.p( "#include \"" ); //no -idlFile translation required
+ for ( int i1 = 0; i1 < modNames.length; i1++ ) p.p( modNames[i1] + "/" );
+ p.p( tName + ".idl\"" );
+ p.pln();
+ }
+
+
+ /**
+ * Return the fully qualified Java Name for a Type.
+ * IDLEntity preprocessing done by getIDLModuleNames(t)
+ * @param t Given Type
+ * @return Array containing the original module nesting.
+ */
+ protected String getQualifiedName(
+ Type t ) {
+ String[] modNames = getIDLModuleNames( t );
+ int len = modNames.length;
+ StringBuffer buf = new StringBuffer();
+ for ( int i1 = 0; i1 < len; i1++ )
+ buf.append( modNames[i1] + "." );
+ buf.append( t.getIDLName() );
+ return buf.toString();
+ }
+
+
+ /**
+ * Return the global fully qualified IDL Name for a Type.
+ * IDLEntity preprocessing done by getIDLModuleNames(t)
+ * @param t Given Type
+ * @return Array containing the original module nesting.
+ */
+ protected String getQualifiedIDLName(Type t) {
+ if ( t.isPrimitive() )
+ return t.getIDLName();
+ if ( !t.isArray() &&
+ "org.omg.CORBA.Object".equals( t.getQualifiedName() ) )
+ return t.getIDLName();
+
+ String[] modNames = getIDLModuleNames( t );
+ int len = modNames.length;
+ if (len > 0) {
+ StringBuffer buf = new StringBuffer();
+ for ( int i1 = 0; i1 < len; i1++ )
+ buf.append( IDL_NAME_SEPARATOR + modNames[i1] );
+ buf.append( IDL_NAME_SEPARATOR + t.getIDLName() );
+ return buf.toString();
+ } else {
+ return t.getIDLName();
+ }
+ }
+
+
+ /**
+ * Return the IDL module nesting of the given Type.
+ * For IDLEntity CompoundTypes (or their arrays) apply any user specified
+ * -idlModule translation or, if none applicable, strip any package
+ * prefix.
+ * Add boxedIDL or boxedRMI modules if required.
+ * @param t Given Type
+ * @return Array containing the original module nesting.
+ */
+ protected String[] getIDLModuleNames(Type t) {
+ String[] modNames = t.getIDLModuleNames(); //default module name array
+ CompoundType ct;
+ if ( t.isCompound() ) {
+ ct = (CompoundType)t;
+ if ( !ct.isIDLEntity ) return modNames; //normal (non-IDLEntity) case
+ if ( "org.omg.CORBA.portable.IDLEntity"
+ .equals( t.getQualifiedName() ) )
+ return modNames;
+ }
+ else if ( t.isArray() ) {
+ Type et = t.getElementType();
+ if ( et.isCompound() ) {
+ ct = (CompoundType)et;
+ if ( !ct.isIDLEntity ) return modNames; //normal (non-IDLEntity) case
+ if ( "org.omg.CORBA.portable.IDLEntity"
+ .equals( t.getQualifiedName() ) )
+ return modNames;
+ }
+ else return modNames;
+ }
+ else return modNames; //no preprocessing needed for primitives
+
+ //it's an IDLEntity or an array of...
+ Vector mVec = new Vector();
+ if ( !translateJavaPackage( ct,mVec ) ) //apply -idlModule translation
+ stripJavaPackage( ct,mVec ); //..or strip prefixes (not both)
+
+ if ( ct.isBoxed() ) { //add boxedIDL if required
+ mVec.insertElementAt( "org",0 );
+ mVec.insertElementAt( "omg",1 );
+ mVec.insertElementAt( "boxedIDL",2 );
+ }
+ if ( t.isArray() ) { //add boxedRMI if required
+ mVec.insertElementAt( "org",0 );
+ mVec.insertElementAt( "omg",1 );
+ mVec.insertElementAt( "boxedRMI",2 );
+ }
+ String[] outArr = new String[mVec.size()];
+ mVec.copyInto( outArr );
+ return outArr;
+ }
+
+
+ /**
+ * Apply user specified -idlModule translation to package names of given
+ * IDLEntity ct. Example:
+ * -idlModule foo.bar real::mod::nesting
+ * @param ct CompoundType containing given IDLEntity.
+ * @param vec Returned Vector of translated IDL module names.
+ * @return boolean true if any translation was done.
+ */
+ protected boolean translateJavaPackage(
+ CompoundType ct,
+ Vector vec ) {
+ vec.removeAllElements();
+ boolean ret = false;
+ String fc = null;
+ if ( ! ct.isIDLEntity() ) return ret;
+
+ String pName = ct.getPackageName(); //start from Java package names
+ if ( pName == null ) return ret;
+ StringTokenizer pt = new StringTokenizer( pName,"." );
+ while ( pt.hasMoreTokens() ) vec.addElement( pt.nextToken() );
+
+ if ( imHash.size() > 0 ) { //any -idlModule translation to apply?
+ Enumeration k = imHash.keys();
+
+ nextModule:
+ while ( k.hasMoreElements() ) { //loop thro user-defined -idlModules
+ String from = (String)k.nextElement(); //from String..
+ StringTokenizer ft = new StringTokenizer( from,"." );
+ int vecLen = vec.size();
+ int ifr;
+ for ( ifr = 0; ifr < vecLen && ft.hasMoreTokens(); ifr++ )
+ if ( ! vec.elementAt(ifr).equals( ft.nextToken() ) )
+ continue nextModule; //..no match
+
+ if ( ft.hasMoreTokens() ) { //matched so far..
+ fc = ft.nextToken(); //a 'from' token remains
+ if ( ! ct.getName().equals( fc ) || //matches class name?
+ ft.hasMoreTokens() )
+ continue nextModule; //..no match
+ }
+
+ ret = true; //found a match
+ for ( int i4 = 0; i4 < ifr; i4++ )
+ vec.removeElementAt( 0 ); //remove 'from' package
+
+ String to = (String)imHash.get( from ); //..to String
+ StringTokenizer tt = new StringTokenizer( to,IDL_NAME_SEPARATOR );
+
+ int itoco = tt.countTokens();
+ int ito = 0;
+ if ( fc != null ) itoco--; //user may have given IDL type
+ for ( ito = 0; ito < itoco; ito++ )
+ vec.insertElementAt( tt.nextToken(),ito ); //insert 'to' modules
+ if ( fc != null ) {
+ String tc = tt.nextToken();
+ if ( ! ct.getName().equals( tc ) ) //not the IDL type, so..
+ vec.insertElementAt( tc,ito ); //insert final 'to' module
+ }
+ }
+ }
+ return ret;
+ }
+
+
+ /**
+ * Strip Java #pragma prefix and/or -pkgPrefix prefix package names from
+ * given IDLEntity ct.
+ * Strip any package prefix which may have been added by comparing with
+ * repository id. For example in Java package fake.omega:
+ * repid = IDL:phoney.pfix/omega/Juliet:1.0 gives { "omega" }
+ * @param ct CompoundType containing given IDLEntity.
+ * @param vec Returned Vector of stripped IDL module names.
+ */
+ protected void stripJavaPackage(
+ CompoundType ct,
+ Vector vec ) {
+ vec.removeAllElements();
+ if ( ! ct.isIDLEntity() ) return;
+
+ String repID = ct.getRepositoryID().substring( 4 );
+ StringTokenizer rept = new StringTokenizer( repID,"/" );
+ if ( rept.countTokens() < 2 ) return;
+
+ while ( rept.hasMoreTokens() )
+ vec.addElement( rept.nextToken() );
+ vec.removeElementAt( vec.size() - 1 );
+
+ String pName = ct.getPackageName(); //start from Java package names
+ if ( pName == null ) return;
+ Vector pVec = new Vector();
+ StringTokenizer pt = new StringTokenizer( pName,"." );
+ while ( pt.hasMoreTokens() ) pVec.addElement( pt.nextToken() );
+
+ int i1 = vec.size() - 1;
+ int i2 = pVec.size() - 1;
+ while ( i1 >= 0 && i2 >= 0 ) { //go R->L till mismatch
+ String rep = (String)( vec.elementAt( i1 ) );
+ String pkg = (String)( pVec.elementAt( i2 ) );
+ if ( ! pkg.equals( rep ) ) break;
+ i1--; i2--;
+ }
+ for ( int i3 = 0; i3 <= i1; i3++ )
+ vec.removeElementAt( 0 ); //strip prefix
+ }
+
+
+
+ /**
+ * Write boxedRMI valuetype for a single dimension of an IDL sequence
+ * indicated by the given OutputType.
+ * The filename for the OutputType is of the form "seqn_elemName" where n
+ * is the dimension required.
+ * @param ot Given OutputType.
+ * @param p The output stream.
+ */
+ protected void writeSequence(
+ OutputType ot,
+ IndentingWriter p)
+ throws IOException {
+ ArrayType at = (ArrayType)ot.getType();
+ Type et = at.getElementType();
+ String fName = ot.getName();
+ int dim = Integer.parseInt( fName.substring( 3,fName.indexOf( "_" ) ) );
+ String idlName = unEsc( et.getIDLName() ).replace( ' ','_' );
+ String qIdlName = getQualifiedIDLName( et );
+ String qName = et.getQualifiedName();
+
+ String repID = at.getRepositoryID();
+ int rix1 = repID.indexOf( '[' ); //edit repository id
+ int rix2 = repID.lastIndexOf( '[' ) + 1;
+ StringBuffer rid = new StringBuffer(
+ repID.substring( 0,rix1 ) +
+ repID.substring( rix2 ) );
+ for ( int i1 = 0; i1 < dim; i1++ ) rid.insert( rix1,'[' );
+
+ String vtName = "seq" + dim + "_" + idlName;
+ boolean isFromIDL = false;
+ if ( et.isCompound() ) {
+ CompoundType ct = (CompoundType)et;
+ isFromIDL = ct.isIDLEntity() || ct.isCORBAObject();
+ }
+ boolean isForwardInclude =
+ et.isCompound() &&
+ !isSpecialReference( et ) &&
+ dim == 1 &&
+ !isFromIDL &&
+ !"org.omg.CORBA.Object".equals(qName) &&
+ !"java.lang.String".equals(qName);
+
+ writeBanner( at,dim,!isException,p );
+ if ( dim == 1 && "java.lang.String".equals(qName) ) //special case
+ writeIncOrb( p );
+ if ( dim == 1 && "org.omg.CORBA.Object".equals(qName) ) ;
+ else if ( isSpecialReference( et ) || dim > 1 || isFromIDL )
+ writeInclude( at,dim-1,!isThrown,p ); //"trivial" include
+ writeIfndef( at,dim,!isException,!isForward,p );
+ if ( isForwardInclude )
+ writeForwardReference( at,dim-1,p ); //forward declare
+ writeModule1( at,p );
+ p.pln();p.pI();
+ p.p( "valuetype " + vtName );
+ p.p( " sequence<" );
+ if ( dim == 1 ) p.p( qIdlName );
+ else {
+ p.p( "seq" + ( dim - 1 ) + "_" );
+ p.p( idlName );
+ }
+ p.pln( ">;" );
+ p.pO();p.pln();
+ p.pln( "#pragma ID " + vtName + " \"" + rid + "\"" );
+ p.pln();
+ writeModule2( at,p );
+ if ( isForwardInclude )
+ writeInclude( at,dim-1,!isThrown,p ); //#include for forward declare
+ writeEndif( p );
+ }
+
+
+ /**
+ * Write valuetype for a boxed IDLEntity.
+ * @param t Given CompoundType representing the IDLEntity.
+ * @param p The output stream.
+ */
+ protected void writeBoxedIDL(
+ CompoundType t,
+ IndentingWriter p)
+ throws IOException {
+ String[] boxNames = getIDLModuleNames( t );
+ int len = boxNames.length;
+ String[] modNames = new String[len - 3]; //remove box modules
+ for ( int i1 = 0; i1 < len - 3; i1++ ) modNames[i1] = boxNames[i1 + 3];
+ String tName = unEsc( t.getIDLName() );
+
+ writeBanner( t,0,!isException,p );
+ writeInclude( t,modNames,tName,p );
+ writeIfndef( t,0,!isException,!isForward,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+
+ p.p( "valuetype " + tName + " " );
+ for ( int i1 = 0; i1 < modNames.length; i1++ )
+ p.p( IDL_NAME_SEPARATOR + modNames[i1] );
+ p.pln( IDL_NAME_SEPARATOR + tName + ";" );
+
+ p.pO();p.pln();
+ writeRepositoryID( t,p );
+ p.pln();
+ writeModule2( t,p );
+ writeEndif( p );
+ }
+
+
+ /**
+ * Write an exception.
+ * @param t Given ClassType representing the exception.
+ * @param p The output stream.
+ */
+ protected void writeException(
+ ClassType t,
+ IndentingWriter p)
+ throws IOException {
+ writeBanner( t,0,isException,p );
+ writeIfndef( t,0,isException,!isForward,p );
+ writeForwardReference( t,p );
+ writeModule1( t,p );
+ p.pln();p.pI();
+
+ p.pln( "exception " + t.getIDLExceptionName() + " {" );
+ p.pln();p.pI();
+ p.pln( t.getIDLName() + " value;" );
+ p.pO();p.pln();
+ p.pln( "};" );
+
+ p.pO();p.pln();
+ writeModule2( t,p );
+ writeInclude( t,0,!isThrown,p ); //include valuetype idl file
+ writeEndif( p );
+ }
+
+
+ /**
+ * Write #pragma to identify the repository ID of the given type
+ * @param t The given Type.
+ * @param p The output stream.
+ */
+ protected void writeRepositoryID(
+ Type t,
+ IndentingWriter p )
+ throws IOException {
+ String repid = t.getRepositoryID();
+ if ( t.isCompound() ) {
+ CompoundType ct = (CompoundType)t;
+ if ( ct.isBoxed() )
+ repid = ct.getBoxedRepositoryID();
+ }
+
+ p.pln( "#pragma ID " + t.getIDLName() + " \"" +
+ repid + "\"" );
+ }
+
+ /**
+ * Write inheritance for an IDL interface or valuetype. Any class
+ * inheritance precedes any interface inheritance.
+ * For a valutype any inheritance from abstract interfaces then
+ * follows the "supports" keyword.
+ * @param inhHash Hashtable loaded with inherited Types
+ * @param forValuetype true if writing inheritance for a valuetype
+ * @param p The output stream.
+ */
+ protected void writeInherits(
+ Hashtable inhHash,
+ boolean forValuetype,
+ IndentingWriter p )
+ throws IOException {
+ int itot = inhHash.size();
+ int iinh = 0;
+ int isup = 0;
+ if ( itot < 1 ) return; //any inheritance to write?
+ Enumeration inhEnum = inhHash.elements();
+ CompoundType ct;
+ if ( forValuetype )
+ while ( inhEnum.hasMoreElements() ) {
+ ct = (CompoundType)inhEnum.nextElement();
+ if ( ct.getTypeCode() == TYPE_ABSTRACT ) isup++;
+ }
+ iinh = itot - isup;
+
+ if ( iinh > 0 ) {
+ p.p( ": " );
+ inhEnum = inhHash.elements();
+ while ( inhEnum.hasMoreElements() ) { //write any class inheritance
+ ct = (CompoundType)inhEnum.nextElement();
+ if ( ct.isClass() ) {
+ p.p( getQualifiedIDLName( ct ) );
+ if ( iinh > 1 ) p.p( ", " ); //delimit them with commas
+ else if ( itot > 1 ) p.p( " " );
+ break; //only one parent
+ }
+ }
+ int i = 0;
+ inhEnum = inhHash.elements();
+ while ( inhEnum.hasMoreElements() ) { //write any interface inheritance
+ ct = (CompoundType)inhEnum.nextElement();
+ if ( !ct.isClass() &&
+ !( ct.getTypeCode() == TYPE_ABSTRACT ) ) {
+ if ( i++ > 0 ) p.p( ", " ); //delimit with commas
+ p.p( getQualifiedIDLName( ct ) );
+ }
+ }
+ }
+ if ( isup > 0 ) { //write abstract interface inheritance
+ p.p( " supports " );
+ int i = 0;
+ inhEnum = inhHash.elements();
+ while ( inhEnum.hasMoreElements() ) {
+ ct = (CompoundType)inhEnum.nextElement();
+ if ( ct.getTypeCode() == TYPE_ABSTRACT ) {
+ if ( i++ > 0 ) p.p( ", " ); //delimit with commas
+ p.p( getQualifiedIDLName( ct ) );
+ }
+ }
+ }
+ }
+
+
+ /**
+ * Write an IDL constant
+ * @param constant The current CompoundType.Member constant
+ * @param p The output stream.
+ */
+ protected void writeConstant(
+ CompoundType.Member constant,
+ IndentingWriter p )
+ throws IOException {
+ Type t = constant.getType();
+ p.p( "const " );
+ p.p( getQualifiedIDLName( t ) );
+ p.p( " " + constant.getIDLName() + " = " + constant.getValue() );
+ p.pln( ";" );
+ }
+
+
+
+ /**
+ * Write an IDL data member
+ * @param data The current CompoundType.Member data member
+ * @param p The output stream.
+ */
+ protected void writeData(
+ CompoundType.Member data,
+ IndentingWriter p )
+ throws IOException {
+ if ( data.isInnerClassDeclaration() ) return; //ignore
+ Type t = data.getType();
+ if ( data.isPublic() )
+ p.p( "public " );
+ else p.p( "private " );
+ p.pln( getQualifiedIDLName( t ) + " " +
+ data.getIDLName() + ";" );
+ }
+
+
+
+ /**
+ * Write an IDL Attribute
+ * @param attr The current CompoundType.Method attribute
+ * @param p The output stream.
+ */
+ protected void writeAttribute(
+ CompoundType.Method attr,
+ IndentingWriter p )
+ throws IOException {
+ if ( attr.getAttributeKind() == ATTRIBUTE_SET ) return; //use getters only
+ Type t = attr.getReturnType();
+ if ( !attr.isReadWriteAttribute() ) p.p( "readonly " );
+ p.p( "attribute " + getQualifiedIDLName( t ) + " " );
+ p.pln( attr.getAttributeName() + ";" );
+ }
+
+
+
+ /**
+ * Write an IDL method
+ * @param method The current CompoundType.Method
+ * @param p The output stream.
+ */
+ protected void writeMethod(
+ CompoundType.Method method,
+ IndentingWriter p )
+ throws IOException {
+ if ( method.isAttribute() ) {
+ writeAttribute( method,p );
+ return;
+ }
+ Type[] pts = method.getArguments();
+ String[] paramNames = method.getArgumentNames();
+ Type rt = method.getReturnType();
+ Hashtable excHash = new Hashtable();
+ getExceptions( method,excHash );
+
+ if ( method.isConstructor() )
+ if ( factory ) p.p( "factory " + method.getIDLName() + "(" );
+ else p.p( "init(" ); //IDL initializer
+ else {
+ p.p( getQualifiedIDLName( rt ) );
+ p.p( " " + method.getIDLName() + "(" );
+ }
+ p.pI();
+
+ for ( int i=0; i < pts.length; i++ ) {
+ if ( i > 0 ) p.pln( "," ); //delimit with comma and newline
+ else p.pln();
+ p.p( "in " );
+ p.p( getQualifiedIDLName( pts[i] ) );
+ p.p( " " + paramNames[i] );
+ }
+ p.pO();
+ p.p( " )" );
+
+ if ( excHash.size() > 0 ) { //any exceptions to write?
+ p.pln( " raises (" );
+ p.pI();
+ int i = 0;
+ Enumeration excEnum = excHash.elements();
+ while ( excEnum.hasMoreElements() ) {
+ ValueType exc = (ValueType)excEnum.nextElement();
+ if ( i > 0 ) p.pln( "," ); //delimit them with commas
+ if ( exc.isIDLEntityException() )
+ if ( exc.isCORBAUserException() )
+ p.p( "::org::omg::CORBA::UserEx" );
+ else {
+ String[] modNames = getIDLModuleNames( exc );
+ for ( int i2 = 0; i2 < modNames.length; i2++ )
+ p.p( IDL_NAME_SEPARATOR + modNames[i2] );
+ p.p( IDL_NAME_SEPARATOR + exc.getName() );
+ }
+ else p.p( exc.getQualifiedIDLExceptionName( true ) );
+ i++;
+ }
+ p.pO();
+ p.p( " )" );
+ }
+
+ p.pln( ";" );
+ }
+
+
+ /**
+ * Remove escape character ("_"), if any, from given String
+ * @param name Given String
+ * @return String with any escape character removed
+ */
+ protected String unEsc(
+ String name ) {
+ if ( name.startsWith( "_" ) ) return name.substring( 1 );
+ else return name;
+ }
+
+
+ /**
+ * Write IDL banner into the output stream for a given Type
+ * @param t The given Type.
+ * @param dim The dimension required if t is an ArrayType.
+ * @param isException true if writing an exception.
+ * @param p The output stream.
+ */
+ protected void writeBanner(
+ Type t,
+ int dim,
+ boolean isException,
+ IndentingWriter p )
+ throws IOException {
+ String[] modNames = getIDLModuleNames( t ); //module name array
+ String fName = unEsc( t.getIDLName() ); //file name default
+ if ( isException && t.isClass() ) {
+ ClassType ct = (ClassType)t; //file name for Exception
+ fName = unEsc( ct.getIDLExceptionName() );
+ }
+ if ( dim > 0 && t.isArray() ) {
+ Type et = t.getElementType(); //file name for sequence
+ fName = "seq" + dim + "_" + unEsc( et.getIDLName().replace( ' ','_' ) );
+ }
+
+ p.pln( "/**" );
+ p.p( " * " );
+ for ( int i1 = 0; i1 < modNames.length; i1++ )
+ p.p( modNames[i1] + "/" );
+ p.pln( fName + ".idl" );
+ p.pln( " * Generated by rmic -idl. Do not edit" );
+ String d = DateFormat.getDateTimeInstance(
+ DateFormat.FULL,DateFormat.FULL,Locale.getDefault() )
+ .format( new Date() );
+ String ocStr = "o'clock";
+ int ocx = d.indexOf( ocStr ); //remove unwanted o'clock, if any
+ p.p ( " * " );
+ if ( ocx > -1 )
+ p.pln( d.substring( 0,ocx ) + d.substring( ocx + ocStr.length() ) );
+ else p.pln( d );
+ p.pln( " */" );
+ p.pln();
+ }
+
+
+ /**
+ * Write #include for orb.idl
+ * @param p The output stream.
+ */
+ protected void writeIncOrb(
+ IndentingWriter p )
+ throws IOException {
+ p.pln( "#include \"orb.idl\"" );
+ }
+
+
+ /**
+ * Write #ifndef guard into the output stream for a given Type
+ * @param t The given Type.
+ * @param dim The dimension required if t is an ArrayType.
+ * @param isException true if writing an exception.
+ * @param isForward. No #define needed if it's a forward declare
+ * @param p The output stream.
+ */
+ protected void writeIfndef(
+ Type t,
+ int dim,
+ boolean isException,
+ boolean isForward,
+ IndentingWriter p )
+ throws IOException {
+ String[] modNames = getIDLModuleNames( t ); //module name array
+ String fName = unEsc( t.getIDLName() ); //file name default
+ if ( isException && t.isClass() ) {
+ ClassType ct = (ClassType)t; //file name for Exception
+ fName = unEsc( ct.getIDLExceptionName() );
+ }
+ if ( dim > 0 && t.isArray() ) {
+ Type et = t.getElementType(); //file name for sequence
+ fName = "seq" + dim + "_" + unEsc( et.getIDLName().replace( ' ','_' ) );
+ }
+ p.pln();
+ p.p( "#ifndef __" );
+ for ( int i = 0; i < modNames.length; i++ ) p.p( modNames[i] + "_" );
+ p.pln( fName + "__" );
+ if ( !isForward ) {
+ p.p( "#define __" );
+ for ( int i = 0; i < modNames.length; i++ ) p.p( modNames[i] + "_" );
+ p.pln( fName + "__" );
+ p.pln();
+ }
+ }
+
+
+ /**
+ * Write #endif bracket into the output stream
+ * @param p The output stream.
+ */
+ protected void writeEndif(
+ IndentingWriter p )
+ throws IOException {
+ p.pln("#endif");
+ p.pln();
+ }
+
+ /**
+ * Write Module start bracketing for the given type into the output stream
+ * @param t The given Type
+ * @param p The output stream.
+ */
+ protected void writeModule1(
+ Type t,
+ IndentingWriter p )
+ throws IOException {
+
+ String[] modNames = getIDLModuleNames( t );
+ p.pln();
+ for ( int i = 0; i < modNames.length; i++ )
+ p.pln( "module " + modNames[i] + " {" );
+ }
+
+ /**
+ * Write Module end bracketing for the given type into the output stream
+ * @param t The given Type
+ * @param p The output stream.
+ */
+ protected void writeModule2(
+ Type t,
+ IndentingWriter p )
+ throws IOException {
+ String[] modNames = getIDLModuleNames( t );
+ for ( int i=0; i < modNames.length; i++ ) p.pln( "};" );
+ p.pln();
+ }
+
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/IDLNames.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/IDLNames.java
new file mode 100644
index 0000000..b69e6d0
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/IDLNames.java
@@ -0,0 +1,1227 @@
+/*
+ * Copyright (c) 1998, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Hashtable;
+import java.util.Locale;
+import sun.tools.java.Identifier;
+import sun.tools.java.CompilerError;
+import sun.tools.java.ClassDefinition;
+import sun.tools.java.ClassNotFound;
+import com.sun.corba.se.impl.util.RepositoryId;
+
+/**
+ * IDLNames provides static utility methods to perform the IDL
+ * name mappings specified in Chapter 5 of the Java Language
+ * to IDL specification.
+ *
+ * @author Bryan Atsatt
+ */
+public class IDLNames implements sun.rmi.rmic.iiop.Constants {
+
+ /**
+ * Used to convert ascii to hex.
+ */
+ public 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',
+ };
+
+ // 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
+ // qualified Java name with '.' package separators
+ // uniformly, and is safe because that is the only
+ // legal use of '.' in a Java name.
+
+ private 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
+ };
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Convert a name. The nameContext argument MUST be pre-filled with
+ * all names from the appropriate context (e.g. all the method names
+ * in a given class). The names must not have had any IDL conversions
+ * applied.
+ * <p>
+ * Section 28.3.2.2
+ * Section 28.3.2.3
+ * Section 28.3.2.4
+ * Section 28.3.2.7 (member and method names only)
+ */
+ public static String getMemberOrMethodName (NameContext nameContext,
+ String name,
+ BatchEnvironment env) {
+
+ // Check namesCache...
+
+ String result = (String) env.namesCache.get(name);
+
+ if (result == null) {
+
+ // 28.3.2.7 Case sensitive member names.
+
+ // Note: This must be done before any of
+ // the other conversions!
+
+ result = nameContext.get(name);
+
+ // 28.3.2.3 Leading underscores...
+
+ result = convertLeadingUnderscores(result);
+
+ // 28.3.2.2 IDL keywords (NOTE: must be done
+ // after leading underscore conversion because
+ // the mangling for IDL keywords creates a
+ // leading underscore!)...
+
+ result = convertIDLKeywords(result);
+
+ // 28.3.2.4 Illegal IDL identifier characters...
+
+ result = convertToISOLatin1(result);
+
+ // Add to namesCache...
+
+ env.namesCache.put(name,result);
+ }
+
+ return result;
+ }
+
+ /**
+ * Convert names with illegal IDL identifier characters.
+ * <p>
+ * Section 28.3.2.4
+ */
+ public static String convertToISOLatin1 (String name) {
+
+ // First, replace any escape sequences...
+
+ String result = replace(name,"x\\u","U");
+ result = replace(result,"x\\U","U");
+
+ // Now see if we have any remaining illegal characters (see
+ // IDL_IDENTIFIER_CHARS array)...
+
+ int length = result.length();
+ StringBuffer buffer = null;
+
+ for (int i = 0; i < length; i++) {
+
+ char c = result.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 StringBuffer(result.substring(0,i));
+ }
+
+ // Convert the character into the IDL escape syntax...
+
+ buffer.append("U");
+ buffer.append((char)ASCII_HEX[(c & 0xF000) >>> 12]);
+ buffer.append((char)ASCII_HEX[(c & 0x0F00) >>> 8]);
+ buffer.append((char)ASCII_HEX[(c & 0x00F0) >>> 4]);
+ buffer.append((char)ASCII_HEX[(c & 0x000F)]);
+
+ } else {
+ if (buffer != null) {
+ buffer.append(c);
+ }
+ }
+ }
+
+ if (buffer != null) {
+ result = buffer.toString();
+ }
+
+ return result;
+ }
+
+ /**
+ * Convert names which collide with IDL keywords.
+ * <p>
+ * Section 28.3.2.5
+ */
+ public static String convertIDLKeywords (String name) {
+
+ for (int i = 0; i < IDL_KEYWORDS.length; i++) {
+ if (name.equalsIgnoreCase(IDL_KEYWORDS[i])) {
+ return "_" + name;
+ }
+ }
+
+ return name;
+ }
+
+ /**
+ * Convert names which have leading underscores
+ * <p>
+ * Section 28.3.2.3
+ */
+ public static String convertLeadingUnderscores (String name) {
+
+ if (name.startsWith("_")) {
+ return "J" + name;
+ }
+
+ return name;
+ }
+
+ /**
+ * Convert a type name.
+ * <p>
+ * Section 28.3.2.5
+ * Section 28.3.2.7 (class or interface names only)
+ * Throws exception if fails 28.3.2.7.
+ */
+ public static String getClassOrInterfaceName (Identifier id,
+ BatchEnvironment env) throws Exception {
+
+ // Get the type and package name...
+
+ String typeName = id.getName().toString();
+ String packageName = null;
+
+ if (id.isQualified()) {
+ packageName = id.getQualifier().toString();
+ }
+
+ // Check namesCache...
+
+ String result = (String) env.namesCache.get(typeName);
+
+ if (result == null) {
+
+ // 28.3.2.5 Inner classes...
+
+ result = replace(typeName,". ","__");
+
+ // 28.3.2.4 Illegal identifier characters...
+
+ result = convertToISOLatin1(result);
+
+ // 28.3.2.7 Case sensitive class or interface names...
+
+ NameContext context = NameContext.forName(packageName,false,env);
+ context.assertPut(result);
+
+ // Run it through the name checks...
+
+ result = getTypeOrModuleName(result);
+
+ // Add it to the namesCache...
+
+ env.namesCache.put(typeName,result);
+ }
+
+ return result;
+ }
+
+ /**
+ * Convert an Exception name.
+ * <p>
+ * Section 28.3.7.2 (see ValueType)
+ */
+ public static String getExceptionName (String idlName) {
+
+ String result = idlName;
+// d.11315 Incorrectly mangled exception names
+ if (idlName.endsWith(EXCEPTION_SUFFIX)) {
+
+ // Remove "Exception" and append "Ex". Strip leading underscore
+ // in case the idlName is exactly "_Exception"...
+
+ result = stripLeadingUnderscore(idlName.substring(0,idlName.lastIndexOf(EXCEPTION_SUFFIX)) + EX_SUFFIX);
+ } else {
+ result = idlName + EX_SUFFIX;
+ }
+
+ return result;
+ }
+
+ /**
+ * Convert a qualified Identifier into an array of IDL names.
+ * <p>
+ * Section 28.3.2.1 (see CompoundType)
+ * Throws exception if fails 28.3.2.7.
+ */
+ public static String[] getModuleNames (Identifier theID,
+ boolean boxIt,
+ BatchEnvironment env) throws Exception {
+
+ String[] result = null;
+
+ if (theID.isQualified()) {
+
+ // Extract the qualifier...
+
+ Identifier id = theID.getQualifier();
+
+ // 28.3.2.7 Case sensitive module names.
+
+ env.modulesContext.assertPut(id.toString());
+
+ // Count them...
+
+ int count = 1;
+ Identifier current = id;
+ while (current.isQualified()) {
+ current = current.getQualifier();
+ count++;
+ }
+
+ result = new String[count];
+ int index = count-1;
+ current = id;
+
+ // Now walk them and fill our array (backwards)...
+
+ for (int i = 0; i < count; i++) {
+
+ String item = current.getName().toString();
+
+ // Check namesCache...
+
+ String cachedItem = (String) env.namesCache.get(item);
+
+ if (cachedItem == null) {
+
+ // 28.3.2.4 Illegal identifier characters...
+
+ cachedItem = convertToISOLatin1(item);
+
+ // Run it through the name checks...
+
+ cachedItem = getTypeOrModuleName(cachedItem);
+
+ // Add it to the namesCache...
+
+ env.namesCache.put(item,cachedItem);
+ }
+
+ result[index--] = cachedItem;
+ current = current.getQualifier();
+ }
+ }
+
+
+ // If it is supposed to be "boxed", prepend
+ // IDL_BOXEDIDL_MODULE...
+
+ if (boxIt) {
+ if (result == null) {
+ result = IDL_BOXEDIDL_MODULE;
+ } else {
+ String[] boxed = new String[result.length+IDL_BOXEDIDL_MODULE.length];
+ System.arraycopy(IDL_BOXEDIDL_MODULE,0,boxed,0,IDL_BOXEDIDL_MODULE.length);
+ System.arraycopy(result,0,boxed,IDL_BOXEDIDL_MODULE.length,result.length);
+ result = boxed;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Get an array name with the specified dimensions.
+ * <p>
+ * Section 28.3.6 (see ArrayType)
+ */
+ public static String getArrayName (Type theType, int arrayDimension) {
+
+ StringBuffer idlName = new StringBuffer(64);
+
+ // Prefix with seq<n>_...
+
+ idlName.append(IDL_SEQUENCE);
+ idlName.append(Integer.toString(arrayDimension));
+ idlName.append("_");
+
+ // Add the type name. We need to map any spaces in the
+ // name to "_"...
+
+ idlName.append(replace(stripLeadingUnderscore(theType.getIDLName())," ","_"));
+
+ // And we're done...
+
+ return idlName.toString();
+ }
+
+ /**
+ * Get an array module names.
+ */
+ public static String[] getArrayModuleNames (Type theType) {
+
+ String[] moduleName;
+ String[] typeModule = theType.getIDLModuleNames();
+ int typeModuleLength = typeModule.length;
+
+ // Does the type have a module?
+
+ if (typeModuleLength == 0) {
+
+ // Nope, so just use the sequence module...
+
+ moduleName = IDL_SEQUENCE_MODULE;
+ } else {
+
+ // Yes, so gotta concatenate...
+
+ moduleName = new String[typeModuleLength + IDL_SEQUENCE_MODULE.length];
+ System.arraycopy(IDL_SEQUENCE_MODULE,0,moduleName,0,IDL_SEQUENCE_MODULE.length);
+ System.arraycopy(typeModule,0,moduleName,IDL_SEQUENCE_MODULE.length,typeModuleLength);
+ }
+
+ return moduleName;
+ }
+
+ private static int getInitialAttributeKind (CompoundType.Method method,
+ BatchEnvironment env) throws ClassNotFound {
+
+ int result = ATTRIBUTE_NONE;
+
+ // First make sure it is not a constructor...
+
+ if (!method.isConstructor()) {
+
+ // Now check exceptions. It may not throw any checked
+ // exception other than RemoteException or one of its
+ // subclasses...
+
+ boolean validExceptions = true;
+ ClassType[] exceptions = method.getExceptions();
+
+ if (exceptions.length > 0) {
+ for (int i = 0; i < exceptions.length; i++) {
+ if (exceptions[i].isCheckedException() &&
+ !exceptions[i].isRemoteExceptionOrSubclass()) {
+ validExceptions = false;
+ break;
+ }
+ }
+ } else {
+
+ // If this is a ValueType, it is ok to not have any exceptions,
+ // otherwise this method does not qualify...
+
+ validExceptions = method.getEnclosing().isType(TYPE_VALUE);
+ }
+
+ if (validExceptions) {
+ String name = method.getName();
+ int nameLength = name.length();
+ int argCount = method.getArguments().length;
+ Type returnType = method.getReturnType();
+ boolean voidReturn = returnType.isType(TYPE_VOID);
+ boolean booleanReturn = returnType.isType(TYPE_BOOLEAN);
+
+ // It's a getter if name starts with "get" and it has no arguments
+ // and a return type that is not void...
+
+ if (name.startsWith("get") && nameLength > 3 && argCount == 0 && !voidReturn) {
+ result = ATTRIBUTE_GET;
+ } else {
+
+ // It's a getter if name starts with "is" and it has no arguments
+ // and a boolean return type...
+
+ if (name.startsWith("is") && nameLength > 2 && argCount == 0 && booleanReturn) {
+ result = ATTRIBUTE_IS;
+ } else {
+
+ // It's a setter if name starts with "set" and it has 1 argument
+ // and a void return type...
+
+ if (name.startsWith("set") && nameLength > 3 && argCount == 1 && voidReturn) {
+ result = ATTRIBUTE_SET;
+ }
+ }
+ }
+ }
+ }
+
+ return result;
+ }
+
+ private static void setAttributeKinds (CompoundType.Method[] methods,
+ int[] kinds,
+ String[] names) {
+
+ int count = methods.length;
+
+ // Strip the prefixes off of the attribute names...
+
+ for (int i = 0; i < count; i++) {
+ switch (kinds[i]) {
+ case ATTRIBUTE_GET: names[i] = names[i].substring(3); break;
+ case ATTRIBUTE_IS: names[i] = names[i].substring(2); break;
+ case ATTRIBUTE_SET: names[i] = names[i].substring(3); break;
+ }
+ }
+
+ // Now, we need to look at all the IS attributes to see
+ // if there is a corresponding getter or setter which has
+ // a different return type. If so, mark it as not an
+ // attribute. Do this before checking for invalid setters...
+
+ for (int i = 0; i < count; i++) {
+ if (kinds[i] == ATTRIBUTE_IS) {
+ for (int j = 0; j < count; j++) {
+ if (j != i &&
+ (kinds[j] == ATTRIBUTE_GET || kinds[j] == ATTRIBUTE_SET) &&
+ names[i].equals(names[j])) {
+
+ // We have matching getter or setter. Do the types match?
+
+ Type isType = methods[i].getReturnType();
+ Type targetType;
+
+ if (kinds[j] == ATTRIBUTE_GET) {
+ targetType = methods[j].getReturnType();
+ } else {
+ targetType = methods[j].getArguments()[0];
+ }
+
+ if (!isType.equals(targetType)) {
+
+ // No, so forget this guy as an attribute...
+
+ kinds[i] = ATTRIBUTE_NONE;
+ names[i] = methods[i].getName();
+ break;
+ }
+ }
+ }
+ }
+ }
+
+ // Now, we need to look at all the setters to see if there
+ // is a corresponding getter. If not, it is not a setter.
+ // If there is, change the getter type to _RW and set the
+ // pair index...
+
+ for (int i = 0; i < count; i++) {
+ if (kinds[i] == ATTRIBUTE_SET) {
+ int getterIndex = -1;
+ int isGetterIndex = -1;
+ // First look for is-getters, then for getters.
+ // This is preferred for boolean attributes.
+ for (int j = 0; j < count; j++) {
+ if (j != i && names[i].equals(names[j])) {
+ // Yep, is the return type of the getter the same
+ // as the argument type of the setter?
+
+ Type getterReturn = methods[j].getReturnType();
+ Type setterArg = methods[i].getArguments()[0];
+
+ if (getterReturn.equals(setterArg)) {
+ if (kinds[j] == ATTRIBUTE_IS) {
+ isGetterIndex = j;
+ // continue looking for another getter
+ } else if (kinds[j] == ATTRIBUTE_GET) {
+ getterIndex = j;
+ // continue looking for an is-getter
+ }
+ }
+ }
+ }
+
+ if (getterIndex > -1) {
+ if (isGetterIndex > -1) {
+ // We have both, a boolean is-getter and a boolean getter.
+ // Use the is-getter and drop the getter.
+
+ // We have a matching getter. Change it to a read-write type...
+ kinds[isGetterIndex] = ATTRIBUTE_IS_RW;
+
+ // Now set the pair index for both the getter and the setter...
+ methods[isGetterIndex].setAttributePairIndex(i);
+ methods[i].setAttributePairIndex(isGetterIndex);
+
+ // We found a better matching is-getter.
+ // Forget this other getter as an attribute.
+ kinds[getterIndex] = ATTRIBUTE_NONE;
+ names[getterIndex] = methods[getterIndex].getName();
+ } else {
+ // We only have one getter.
+
+ // We have a matching getter. Change it to a read-write type...
+ kinds[getterIndex] = ATTRIBUTE_GET_RW;
+
+ // Now set the pair index for both the getter and the setter...
+ methods[getterIndex].setAttributePairIndex(i);
+ methods[i].setAttributePairIndex(getterIndex);
+ }
+ } else {
+ if (isGetterIndex > -1) {
+ // We only have one is-getter.
+
+ // We have a matching getter. Change it to a read-write type...
+ kinds[isGetterIndex] = ATTRIBUTE_IS_RW;
+
+ // Now set the pair index for both the getter and the setter...
+ methods[isGetterIndex].setAttributePairIndex(i);
+ methods[i].setAttributePairIndex(isGetterIndex);
+ } else {
+ // We did not find a matching getter.
+ // Forget this setter as an attribute.
+ kinds[i] = ATTRIBUTE_NONE;
+ names[i] = methods[i].getName();
+ }
+ }
+ }
+ }
+
+ // Finally, do the case conversion and set the
+ // attribute kinds for each method...
+
+ for (int i = 0; i < count; i++) {
+
+ if (kinds[i] != ATTRIBUTE_NONE) {
+
+ String name = names[i];
+
+ // Is the first character upper case?
+
+ if (Character.isUpperCase(name.charAt(0))) {
+
+ // Yes, is the second?
+
+ if (name.length() == 1 || Character.isLowerCase(name.charAt(1))) {
+
+ // No, so convert the first character to lower case...
+
+ StringBuffer buffer = new StringBuffer(name);
+ buffer.setCharAt(0,Character.toLowerCase(name.charAt(0)));
+ names[i] = buffer.toString();
+ }
+ }
+ }
+
+ methods[i].setAttributeKind(kinds[i]);
+ }
+ }
+
+ /**
+ * Set all the method names in a given class.
+ * <p>
+ * Section 28.3.2.7 (see CompoundType)
+ * Section 28.3.2.7
+ * Section 28.3.4.3 (RemoteType/AbstractType only).
+ */
+ public static void setMethodNames (CompoundType container,
+ CompoundType.Method[] allMethods,
+ BatchEnvironment env)
+ throws Exception {
+
+ // This method implements the following name mangling sequence:
+ //
+ // 1. If methods belong to a Remote interface, identify
+ // those which qualify as an attribute under 28.3.4.3.
+ // Those that do are referred to as 'attributes' below;
+ // those that do not are referred to as 'methods'.
+ //
+ // 2. Apply the 28.3.4.3 manglings, except "__", to all
+ // attribute names.
+ //
+ // 3. Apply all 28.3 manglings, except 28.3.2.7, to all names.
+ //
+ // 4. Apply 28.3.2.7 manglings to all method names.
+ //
+ // 5. Compare each attribute name to each method name. For
+ // any which compare equal, append "__" to the attribute
+ // name.
+ //
+ // 6. Compare each name (attribute and method) to all others.
+ // If any compare equal, throw an Exception with the
+ // conflicting name as the message.
+
+ int count = allMethods.length;
+
+ if (count == 0) return;
+
+ // Make an array of all the method names...
+
+ String[] names = new String[count];
+ for (int i = 0; i < count; i++) {
+ names[i] = allMethods[i].getName();
+ }
+
+ // Are we dealing with a RemoteType, AbstractType, or ValueType?
+
+ CompoundType enclosing = allMethods[0].getEnclosing();
+ if (enclosing.isType(TYPE_REMOTE) ||
+ enclosing.isType(TYPE_ABSTRACT) ||
+ enclosing.isType(TYPE_VALUE)) {
+
+ // Yes, so we must do the 28.3.4.3 attribute mapping. First, get
+ // the initial attribute kind of each method...
+
+ int[] kinds = new int[count];
+
+ for (int i = 0; i < count; i++) {
+ kinds[i] = getInitialAttributeKind(allMethods[i],env);
+ }
+
+ // Now set the attribute kind for each method and do the
+ // 28.3.4.3 name mangling...
+
+ setAttributeKinds(allMethods,kinds,names);
+ }
+
+ // Make and populate a new context from our names array...
+
+ NameContext context = new NameContext(true);
+
+ for (int i = 0; i < count; i++) {
+ context.put(names[i]);
+ }
+
+ // Apply the appropriate 28.3 manglings to all the names...
+
+ boolean haveConstructor = false;
+ for (int i = 0; i < count; i++) {
+ if (!allMethods[i].isConstructor()) {
+ names[i] = getMemberOrMethodName(context,names[i],env);
+ } else {
+ names[i] = IDL_CONSTRUCTOR;
+ haveConstructor = true;
+ }
+ }
+
+ // Now do the 28.3.2.7 mangling for method name collisions...
+ // Do this in two passes so that we don't change one during
+ // the detection of collisions and then miss a real one...
+
+ boolean overloaded[] = new boolean[count];
+ for (int i = 0; i < count; i++) {
+ overloaded[i] = (!allMethods[i].isAttribute() &&
+ !allMethods[i].isConstructor() &&
+ doesMethodCollide(names[i],allMethods[i],allMethods,names,true));
+ }
+ convertOverloadedMethods(allMethods,names,overloaded);
+
+ // Now do the same mangling for constructor name collisions...
+
+ for (int i = 0; i < count; i++) {
+ overloaded[i] = (!allMethods[i].isAttribute() &&
+ allMethods[i].isConstructor() &&
+ doesConstructorCollide(names[i],allMethods[i],allMethods,names,true));
+ }
+ convertOverloadedMethods(allMethods,names,overloaded);
+
+ // Now do the 28.3.4.3 mangling for attribute name collisions...
+
+ for (int i = 0; i < count; i++) {
+
+ CompoundType.Method method = allMethods[i];
+
+ // If this is an attribute name, does it collide with a method?
+
+ if (method.isAttribute() &&
+ doesMethodCollide(names[i],method,allMethods,names,true)) {
+
+ // Yes, so add double underscore...
+
+ names[i] += "__";
+ }
+ }
+
+ // Do the same mangling for any constructors which collide with
+ // methods...
+
+ if (haveConstructor) {
+ for (int i = 0; i < count; i++) {
+ CompoundType.Method method = allMethods[i];
+
+ // Is this a constructor which collides with a method?
+
+ if (method.isConstructor() &&
+ doesConstructorCollide(names[i],method,allMethods,names,false)) {
+
+ // Yes, so add double underscore...
+
+ names[i] += "__";
+ }
+ }
+ }
+
+ // Now see if we have a collision with the container name (28.3.2.9).
+
+ String containerName = container.getIDLName();
+ for (int i = 0; i < count; i++) {
+ if (names[i].equalsIgnoreCase(containerName)) {
+ // Do not add underscore to attributes.
+ // Otherwise getFoo will turn into _get_foo_.
+ if (! allMethods[i].isAttribute()) {
+ names[i] += "_";
+ }
+ }
+ }
+
+ // Now see if we have any collisions (28.3.2.9). If we do,
+ // it's an error. Note: a get/set pair does not collide.
+
+ for (int i = 0; i < count; i++) {
+
+ // Does it collide with any other name?
+
+ if (doesMethodCollide(names[i],allMethods[i],allMethods,names,false)) {
+
+ // Yes, so bail...
+
+ throw new Exception(allMethods[i].toString());
+ }
+ }
+
+ // Ok. We have unique names. Create the appropriate 'wire' name
+ // for each and set as the 'idl' name. If it is an attribute, also
+ // set the attribute name...
+
+ for (int i = 0; i < count; i++) {
+
+ CompoundType.Method method = allMethods[i];
+ String wireName = names[i];
+
+ if (method.isAttribute()) {
+ wireName = ATTRIBUTE_WIRE_PREFIX[method.getAttributeKind()] +
+ stripLeadingUnderscore(wireName);
+ String attributeName = names[i];
+ method.setAttributeName(attributeName);
+ }
+ method.setIDLName(wireName);
+ }
+ }
+
+ private static String stripLeadingUnderscore (String name) {
+ if (name != null && name.length() > 1
+ && name.charAt(0) == '_')
+ {
+ return name.substring(1);
+ }
+ return name;
+ }
+
+
+ private static String stripTrailingUnderscore (String name) {
+ if (name != null && name.length() > 1 &&
+ name.charAt(name.length() - 1) == '_')
+ {
+ return name.substring(0, name.length() - 1);
+ }
+ return name;
+ }
+
+
+ private static void convertOverloadedMethods(CompoundType.Method[] allMethods,
+ String[] names,
+ boolean[] overloaded) {
+
+ for (int i = 0; i < names.length; i++) {
+
+ // Do we need to mangle it?
+
+ if (overloaded[i]) {
+
+ // Yes, so add arguments...
+
+ CompoundType.Method method = allMethods[i];
+ Type[] args = method.getArguments();
+
+ for (int k = 0; k < args.length; k++) {
+
+ // Add the separator...
+
+ names[i] += "__";
+
+ // Get the fully qualified IDL name, without the "::"
+ // prefix...
+
+ String argIDLName = args[k].getQualifiedIDLName(false);
+
+ // Replace any occurances of "::_" with "_" to
+ // undo any IDL keyword mangling and do next step
+ // at the same time...
+
+ argIDLName = replace(argIDLName,"::_","_");
+
+ // Replace any occurances of "::" with "_"...
+
+ argIDLName = replace(argIDLName,"::","_");
+
+ // Replace any occurances of " " with "_"...
+
+ argIDLName = replace(argIDLName," ","_");
+
+ // Add the argument type name...
+
+ names[i] += argIDLName;
+ }
+
+ if (args.length == 0) {
+ names[i] += "__";
+ }
+
+ // Remove any IDL keyword mangling...
+
+ names[i] = stripLeadingUnderscore(names[i]);
+ }
+ }
+ }
+
+ private static boolean doesMethodCollide (String name,
+ CompoundType.Method method,
+ CompoundType.Method[] allMethods,
+ String[] allNames,
+ boolean ignoreAttributes) {
+
+ // Scan all methods looking for a match...
+
+ for (int i = 0; i < allMethods.length; i++) {
+
+ CompoundType.Method target = allMethods[i];
+
+ if (method != target && // Not same instance
+ !target.isConstructor() && // Not a constructor
+ (!ignoreAttributes || !target.isAttribute()) && // Correct kind
+ name.equals(allNames[i])) { // Same names
+
+ // Are we looking at a get/set pair?
+
+ int kind1 = method.getAttributeKind();
+ int kind2 = target.getAttributeKind();
+
+ if ((kind1 != ATTRIBUTE_NONE && kind2 != ATTRIBUTE_NONE) &&
+ ((kind1 == ATTRIBUTE_SET && kind2 != ATTRIBUTE_SET) ||
+ (kind1 != ATTRIBUTE_SET && kind2 == ATTRIBUTE_SET) ||
+ // one is a is-getter/setter pair and the other is just a getter
+ (kind1 == ATTRIBUTE_IS_RW && kind2 == ATTRIBUTE_GET) ||
+ (kind1 == ATTRIBUTE_GET && kind2 == ATTRIBUTE_IS_RW))) {
+
+ // Yes, so ignore it...
+
+ } else {
+
+ // No, so we have a collision...
+
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ private static boolean doesConstructorCollide (String name,
+ CompoundType.Method method,
+ CompoundType.Method[] allMethods,
+ String[] allNames,
+ boolean compareConstructors) {
+
+ // Scan all methods looking for a match...
+
+ for (int i = 0; i < allMethods.length; i++) {
+
+ CompoundType.Method target = allMethods[i];
+
+ if (method != target && // Not same instance
+ (target.isConstructor() == compareConstructors) && // Correct kind
+ name.equals(allNames[i])) { // Same names
+
+ // We have a collision...
+
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+
+ /**
+ * Set all the member names in a given class.
+ * <p>
+ * Section 28.3.2.7 (see CompoundType)
+ * Section 28.3.2.7
+ */
+ public static void setMemberNames (CompoundType container,
+ CompoundType.Member[] allMembers,
+ CompoundType.Method[] allMethods,
+ BatchEnvironment env)
+ throws Exception {
+
+ // Make and populate a new context...
+
+ NameContext context = new NameContext(true);
+
+ for (int i = 0; i < allMembers.length; i++) {
+ context.put(allMembers[i].getName());
+ }
+
+ // Now set all the idl names...
+
+ for (int i = 0; i < allMembers.length; i++) {
+
+ CompoundType.Member member = allMembers[i];
+ String idlName = getMemberOrMethodName(context,member.getName(),env);
+ member.setIDLName(idlName);
+ }
+
+ // First see if we have a collision with the container name (28.3.2.9).
+
+ String containerName = container.getIDLName();
+ for (int i = 0; i < allMembers.length; i++) {
+ String name = allMembers[i].getIDLName();
+ if (name.equalsIgnoreCase(containerName)) {
+ // REVISIT - How is this different than line 788
+ allMembers[i].setIDLName(name+"_");
+ }
+ }
+
+ // Check for collisions between member names...
+
+ for (int i = 0; i < allMembers.length; i++) {
+ String name = allMembers[i].getIDLName();
+ for (int j = 0; j < allMembers.length; j++) {
+ if (i != j && allMembers[j].getIDLName().equals(name)) {
+
+ // Collision...
+
+ throw new Exception(name);
+ }
+ }
+ }
+
+ // Now check for collisions between member names and
+ // method names...
+
+ boolean changed;
+ do {
+ changed = false;
+ for (int i = 0; i < allMembers.length; i++) {
+ String name = allMembers[i].getIDLName();
+ for (int j = 0; j < allMethods.length; j++) {
+ if (allMethods[j].getIDLName().equals(name)) {
+
+ // Collision, so append "_" to member name...
+
+ allMembers[i].setIDLName(name+"_");
+ changed = true;
+ break;
+ }
+ }
+ }
+ } while (changed);
+ }
+
+ /**
+ * Get the name for the specified type code.
+ * <p>
+ * Section 28.3..3 (see PrimitiveType)
+ * Section 28.3.5.10 (see SpecialClassType)
+ * Section 28.3.4.1 (see SpecialInterfaceType)
+ * Section 28.3.10.1 (see SpecialInterfaceType)
+ * Section 28.3.10.2 (see SpecialClassType)
+ */
+ public static String getTypeName(int typeCode, boolean isConstant) {
+
+ String idlName = null;
+
+ switch (typeCode) {
+ case TYPE_VOID: idlName = IDL_VOID; break;
+ case TYPE_BOOLEAN: idlName = IDL_BOOLEAN; break;
+ case TYPE_BYTE: idlName = IDL_BYTE; break;
+ case TYPE_CHAR: idlName = IDL_CHAR; break;
+ case TYPE_SHORT: idlName = IDL_SHORT; break;
+ case TYPE_INT: idlName = IDL_INT; break;
+ case TYPE_LONG: idlName = IDL_LONG; break;
+ case TYPE_FLOAT: idlName = IDL_FLOAT; break;
+ case TYPE_DOUBLE: idlName = IDL_DOUBLE; break;
+ case TYPE_ANY: idlName = IDL_ANY; break;
+ case TYPE_CORBA_OBJECT: idlName = IDL_CORBA_OBJECT; break;
+ case TYPE_STRING:
+ {
+ if (isConstant) {
+ idlName = IDL_CONSTANT_STRING;
+ } else {
+ idlName = IDL_STRING;
+ }
+
+ break;
+ }
+ }
+
+ return idlName;
+ }
+
+ /**
+ * Create a qualified name.
+ */
+ public static String getQualifiedName (String[] idlModuleNames, String idlName) {
+ String result = null;
+ if (idlModuleNames != null && idlModuleNames.length > 0) {
+ for (int i = 0; i < idlModuleNames.length;i++) {
+ if (i == 0) {
+ result = idlModuleNames[0];
+ } else {
+ result += IDL_NAME_SEPARATOR;
+ result += idlModuleNames[i];
+ }
+ }
+ result += IDL_NAME_SEPARATOR;
+ result += idlName;
+ } else {
+ result = idlName;
+ }
+ return result;
+ }
+
+ /**
+ * Replace substrings
+ * @param source The source string.
+ * @param match The string to search for within the source string.
+ * @param replace The replacement for any matching components.
+ * @return
+ */
+ public static String replace (String source, String match, String replace) {
+
+ int index = source.indexOf(match,0);
+
+ if (index >=0) {
+
+ // We have at least one match, so gotta do the
+ // work...
+
+ StringBuffer result = new StringBuffer(source.length() + 16);
+ int matchLength = match.length();
+ int startIndex = 0;
+
+ while (index >= 0) {
+ result.append(source.substring(startIndex,index));
+ result.append(replace);
+ startIndex = index + matchLength;
+ index = source.indexOf(match,startIndex);
+ }
+
+ // Grab the last piece, if any...
+
+ if (startIndex < source.length()) {
+ result.append(source.substring(startIndex));
+ }
+
+ return result.toString();
+
+ } else {
+
+ // No matches, just return the source...
+
+ return source;
+ }
+ }
+
+ /**
+ * Get an IDL style repository id for
+ */
+ public static String getIDLRepositoryID (String idlName) {
+ return IDL_REPOSITORY_ID_PREFIX +
+ replace(idlName,"::", "/") +
+ IDL_REPOSITORY_ID_VERSION;
+ }
+
+ //_____________________________________________________________________
+ // Internal Interfaces
+ //_____________________________________________________________________
+
+
+ /**
+ * Convert a type or module name.
+ * <p>
+ * Section 28.3.2.2
+ * Section 28.3.2.3
+ */
+ private static String getTypeOrModuleName (String name) {
+
+ // 28.3.2.3 Leading underscores...
+
+ String result = convertLeadingUnderscores(name);
+
+ // 28.3.2.2 IDL keywords (NOTE: must be done
+ // after leading underscore conversion because
+ // the mangling for IDL keywords creates a
+ // leading underscore!)...
+
+ return convertIDLKeywords(result);
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ImplementationType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ImplementationType.java
new file mode 100644
index 0000000..db31715
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ImplementationType.java
@@ -0,0 +1,292 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Vector;
+import sun.tools.java.CompilerError;
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.ClassDefinition;
+import sun.tools.java.MemberDefinition;
+
+/**
+ * ImplementationType represents any non-special class which implements
+ * one or more interfaces which inherit from java.rmi.Remote.
+ * <p>
+ * The static forImplementation(...) method must be used to obtain an instance,
+ * and will return null if the ClassDefinition is non-conforming.
+ *
+ * @author Bryan Atsatt
+ */
+public class ImplementationType extends ClassType {
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create an ImplementationType for the given class.
+ *
+ * If the class is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static ImplementationType forImplementation(ClassDefinition classDef,
+ ContextStack stack,
+ boolean quiet) {
+ if (stack.anyErrors()) return null;
+
+ boolean doPop = false;
+ ImplementationType result = null;
+
+ try {
+ // Do we already have it?
+
+ sun.tools.java.Type theType = classDef.getType();
+ Type existing = getType(theType,stack);
+
+ if (existing != null) {
+
+ if (!(existing instanceof ImplementationType)) return null; // False hit.
+
+ // Yep, so return it...
+
+ return (ImplementationType) existing;
+
+ }
+
+ // Could this be an implementation?
+
+ if (couldBeImplementation(quiet,stack,classDef)) {
+
+ // Yes, so check it...
+
+ ImplementationType it = new ImplementationType(stack, classDef);
+ putType(theType,it,stack);
+ stack.push(it);
+ doPop = true;
+
+ if (it.initialize(stack,quiet)) {
+ stack.pop(true);
+ result = it;
+ } else {
+ removeType(theType,stack);
+ stack.pop(false);
+ }
+ }
+ } catch (CompilerError e) {
+ if (doPop) stack.pop(false);
+ }
+
+ return result;
+ }
+
+ /**
+ * Return a string describing this type.
+ */
+ public String getTypeDescription () {
+ return "Implementation";
+ }
+
+
+ //_____________________________________________________________________
+ // Internal Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create a ImplementationType instance for the given class. The resulting
+ * object is not yet completely initialized.
+ */
+ private ImplementationType(ContextStack stack, ClassDefinition classDef) {
+ super(TYPE_IMPLEMENTATION | TM_CLASS | TM_COMPOUND,classDef,stack); // Use special constructor.
+ }
+
+
+ private static boolean couldBeImplementation(boolean quiet, ContextStack stack,
+ ClassDefinition classDef) {
+ boolean result = false;
+ BatchEnvironment env = stack.getEnv();
+
+ try {
+ if (!classDef.isClass()) {
+ failedConstraint(17,quiet,stack,classDef.getName());
+ } else {
+ result = env.defRemote.implementedBy(env, classDef.getClassDeclaration());
+ if (!result) failedConstraint(8,quiet,stack,classDef.getName());
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+
+ return result;
+ }
+
+
+ /**
+ * Initialize this instance.
+ */
+ private boolean initialize (ContextStack stack, boolean quiet) {
+
+ boolean result = false;
+ ClassDefinition theClass = getClassDefinition();
+
+ if (initParents(stack)) {
+
+ // Make up our collections...
+
+ Vector directInterfaces = new Vector();
+ Vector directMethods = new Vector();
+
+ // Check interfaces...
+
+ try {
+ if (addRemoteInterfaces(directInterfaces,true,stack) != null) {
+
+ boolean haveRemote = false;
+
+ // Get methods from all interfaces...
+
+ for (int i = 0; i < directInterfaces.size(); i++) {
+ InterfaceType theInt = (InterfaceType) directInterfaces.elementAt(i);
+ if (theInt.isType(TYPE_REMOTE) ||
+ theInt.isType(TYPE_JAVA_RMI_REMOTE)) {
+ haveRemote = true;
+ }
+
+ copyRemoteMethods(theInt,directMethods);
+ }
+
+ // Make sure we have at least one remote interface...
+
+ if (!haveRemote) {
+ failedConstraint(8,quiet,stack,getQualifiedName());
+ return false;
+ }
+
+ // Now check the methods to ensure we have the
+ // correct throws clauses...
+
+ if (checkMethods(theClass,directMethods,stack,quiet)) {
+
+ // We're ok, so pass 'em up...
+
+ result = initialize(directInterfaces,directMethods,null,stack,quiet);
+ }
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+ }
+
+ return result;
+ }
+
+ private static void copyRemoteMethods(InterfaceType type, Vector list) {
+
+ if (type.isType(TYPE_REMOTE)) {
+
+ // Copy all the unique methods from type...
+
+ Method[] allMethods = type.getMethods();
+
+ for (int i = 0; i < allMethods.length; i++) {
+ Method theMethod = allMethods[i];
+
+ if (!list.contains(theMethod)) {
+ list.addElement(theMethod);
+ }
+ }
+
+ // Now recurse thru all inherited interfaces...
+
+ InterfaceType[] allInterfaces = type.getInterfaces();
+
+ for (int i = 0; i < allInterfaces.length; i++) {
+ copyRemoteMethods(allInterfaces[i],list);
+ }
+ }
+ }
+
+ // Walk all methods of the class, and for each that is already in
+ // the list, call setImplExceptions()...
+
+ private boolean checkMethods(ClassDefinition theClass, Vector list,
+ ContextStack stack, boolean quiet) {
+
+ // Convert vector to array...
+
+ Method[] methods = new Method[list.size()];
+ list.copyInto(methods);
+
+ for (MemberDefinition member = theClass.getFirstMember();
+ member != null;
+ member = member.getNextMember()) {
+
+ if (member.isMethod() && !member.isConstructor()
+ && !member.isInitializer()) {
+
+ // It's a method...
+
+ if (!updateExceptions(member,methods,stack,quiet)) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ private boolean updateExceptions (MemberDefinition implMethod, Method[] list,
+ ContextStack stack, boolean quiet) {
+ int length = list.length;
+ String implMethodSig = implMethod.toString();
+
+ for (int i = 0; i < length; i++) {
+ Method existingMethod = list[i];
+ MemberDefinition existing = existingMethod.getMemberDefinition();
+
+ // Do we have a matching method?
+
+ if (implMethodSig.equals(existing.toString())) {
+
+ // Yes, so create exception list...
+
+ try {
+ ValueType[] implExcept = getMethodExceptions(implMethod,quiet,stack);
+ existingMethod.setImplExceptions(implExcept);
+ } catch (Exception e) {
+ return false;
+ }
+ }
+ }
+ return true;
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/InterfaceType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/InterfaceType.java
new file mode 100644
index 0000000..5fd2b65
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/InterfaceType.java
@@ -0,0 +1,122 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.io.IOException;
+import sun.tools.java.CompilerError;
+import sun.tools.java.ClassDefinition;
+import sun.rmi.rmic.IndentingWriter;
+
+/**
+ * InterfaceType is an abstract base representing any non-special
+ * interface type.
+ *
+ * @author Bryan Atsatt
+ */
+public abstract class InterfaceType extends CompoundType {
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Print this type.
+ * @param writer The stream to print to.
+ * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ * @param globalIDLNames If true and useIDLNames true, prepends "::".
+ */
+ public void print ( IndentingWriter writer,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+ if (isInner()) {
+ writer.p("// " + getTypeDescription() + " (INNER)");
+ } else {
+ writer.p("// " + getTypeDescription() + "");
+ }
+ writer.pln(" (" + getRepositoryID() + ")\n");
+ printPackageOpen(writer,useIDLNames);
+
+ if (!useIDLNames) {
+ writer.p("public ");
+ }
+
+ writer.p("interface " + getTypeName(false,useIDLNames,false));
+ printImplements(writer,"",useQualifiedNames,useIDLNames,globalIDLNames);
+ writer.plnI(" {");
+ printMembers(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ writer.pln();
+ printMethods(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ writer.pln();
+
+ if (useIDLNames) {
+ writer.pOln("};");
+ } else {
+ writer.pOln("}");
+ }
+ printPackageClose(writer,useIDLNames);
+ }
+
+ //_____________________________________________________________________
+ // Subclass/Internal Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create a InterfaceType instance for the given class. NOTE: This constructor
+ * is ONLY for SpecialInterfaceType.
+ */
+ protected InterfaceType(ContextStack stack, int typeCode, ClassDefinition classDef) {
+ super(stack,typeCode,classDef); // Call special parent constructor.
+
+ if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) {
+ throw new CompilerError("Not an interface");
+ }
+ }
+
+ /**
+ * Create a InterfaceType instance for the given class. The resulting
+ * object is not yet completely initialized. Subclasses must call
+ * initialize(directInterfaces,directInterfaces,directConstants);
+ */
+ protected InterfaceType(ContextStack stack,
+ ClassDefinition classDef,
+ int typeCode) {
+ super(stack,classDef,typeCode);
+
+ if ((typeCode & TM_INTERFACE) == 0 || ! classDef.isInterface()) {
+ throw new CompilerError("Not an interface");
+ }
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NCClassType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NCClassType.java
new file mode 100644
index 0000000..4f2d489
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NCClassType.java
@@ -0,0 +1,172 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Vector;
+import sun.tools.java.CompilerError;
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.ClassDefinition;
+
+/**
+ * NCClassType represents any non-special class which does not
+ * extends one or more interfaces which inherit from java.rmi.Remote.
+ * <p>
+ * The static forImplementation(...) method must be used to obtain an instance,
+ * and will return null if the ClassDefinition is non-conforming.
+ *
+ * @author Bryan Atsatt
+ */
+public class NCClassType extends ClassType {
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create an NCClassType for the given class.
+ *
+ * If the class is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static NCClassType forNCClass(ClassDefinition classDef,
+ ContextStack stack) {
+
+ if (stack.anyErrors()) return null;
+
+ boolean doPop = false;
+ try {
+ // Do we already have it?
+
+ sun.tools.java.Type theType = classDef.getType();
+ Type existing = getType(theType,stack);
+
+ if (existing != null) {
+
+ if (!(existing instanceof NCClassType)) return null; // False hit.
+
+ // Yep, so return it...
+
+ return (NCClassType) existing;
+
+ }
+
+ NCClassType it = new NCClassType(stack, classDef);
+ putType(theType,it,stack);
+ stack.push(it);
+ doPop = true;
+
+ if (it.initialize(stack)) {
+ stack.pop(true);
+ return it;
+ } else {
+ removeType(theType,stack);
+ stack.pop(false);
+ return null;
+ }
+ } catch (CompilerError e) {
+ if (doPop) stack.pop(false);
+ return null;
+ }
+ }
+
+ /**
+ * Return a string describing this type.
+ */
+ public String getTypeDescription () {
+ return addExceptionDescription("Non-conforming class");
+ }
+
+ //_____________________________________________________________________
+ // Internal/Subclass Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create a NCClassType instance for the given class. The resulting
+ * object is not yet completely initialized.
+ */
+ private NCClassType(ContextStack stack, ClassDefinition classDef) {
+ super(stack,classDef,TYPE_NC_CLASS | TM_CLASS | TM_COMPOUND);
+ }
+
+ //_____________________________________________________________________
+ // Internal Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Initialize this instance.
+ */
+ private boolean initialize (ContextStack stack) {
+ if (!initParents(stack)) {
+ return false;
+ }
+
+ if (stack.getEnv().getParseNonConforming()) {
+
+ Vector directInterfaces = new Vector();
+ Vector directMethods = new Vector();
+ Vector directMembers = new Vector();
+
+ try {
+
+ // Get methods...
+
+ if (addAllMethods(getClassDefinition(),directMethods,false,false,stack) != null) {
+
+ // Update parent class methods...
+
+ if (updateParentClassMethods(getClassDefinition(),directMethods,false,stack) != null) {
+
+ // Get conforming constants...
+
+ if (addConformingConstants(directMembers,false,stack)) {
+
+ // We're ok, so pass 'em up...
+
+ if (!initialize(directInterfaces,directMethods,directMembers,stack,false)) {
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+ return false;
+ } else {
+ return initialize(null,null,null,stack,false);
+ }
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NCInterfaceType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NCInterfaceType.java
new file mode 100644
index 0000000..e47f2b4
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NCInterfaceType.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Vector;
+import sun.tools.java.CompilerError;
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.ClassDefinition;
+
+/**
+ * NCInterfaceType represents any non-special, non-conforming interface.
+ * <p>
+ * The static forNCInterface(...) method must be used to obtain an instance.
+ * @author Bryan Atsatt
+ */
+public class NCInterfaceType extends InterfaceType {
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create an NCInterfaceType for the given class.
+ *
+ * If the class is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static NCInterfaceType forNCInterface( ClassDefinition classDef,
+ ContextStack stack) {
+ if (stack.anyErrors()) return null;
+
+ boolean doPop = false;
+ try {
+ // Do we already have it?
+
+ sun.tools.java.Type theType = classDef.getType();
+ Type existing = getType(theType,stack);
+
+ if (existing != null) {
+
+ if (!(existing instanceof NCInterfaceType)) return null; // False hit.
+
+ // Yep, so return it...
+
+ return (NCInterfaceType) existing;
+ }
+
+ NCInterfaceType it = new NCInterfaceType(stack, classDef);
+ putType(theType,it,stack);
+ stack.push(it);
+ doPop = true;
+
+ if (it.initialize(stack)) {
+ stack.pop(true);
+ return it;
+ } else {
+ removeType(theType,stack);
+ stack.pop(false);
+ return null;
+ }
+ } catch (CompilerError e) {
+ if (doPop) stack.pop(false);
+ return null;
+ }
+ }
+
+ /**
+ * Return a string describing this type.
+ */
+ public String getTypeDescription () {
+ return "Non-conforming interface";
+ }
+
+ //_____________________________________________________________________
+ // Internal/Subclass Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create a NCInterfaceType instance for the given class. The resulting
+ * object is not yet completely initialized.
+ */
+ private NCInterfaceType(ContextStack stack, ClassDefinition classDef) {
+ super(stack,classDef,TYPE_NC_INTERFACE | TM_INTERFACE | TM_COMPOUND);
+ }
+
+ //_____________________________________________________________________
+ // Internal Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Initialize this instance.
+ */
+ private boolean initialize (ContextStack stack) {
+
+ if (stack.getEnv().getParseNonConforming()) {
+
+ Vector directInterfaces = new Vector();
+ Vector directMethods = new Vector();
+ Vector directMembers = new Vector();
+
+ try {
+
+ // need to include parent interfaces in IDL generation...
+ addNonRemoteInterfaces( directInterfaces,stack );
+
+ // Get methods...
+
+ if (addAllMethods(getClassDefinition(),directMethods,false,false,stack) != null) {
+
+ // Get conforming constants...
+
+ if (addConformingConstants(directMembers,false,stack)) {
+
+ // We're ok, so pass 'em up...
+
+ if (!initialize(directInterfaces,directMethods,directMembers,stack,false)) {
+ return false;
+ }
+ }
+ }
+ return true;
+
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+ return false;
+ } else {
+ return initialize(null,null,null,stack,false);
+ }
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NameContext.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NameContext.java
new file mode 100644
index 0000000..13907f1
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/NameContext.java
@@ -0,0 +1,232 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Hashtable;
+
+/**
+ * A NameContext enables detection of strings which differ only
+ * in case.
+ *
+ * @author Bryan Atsatt
+ */
+class NameContext {
+
+ private Hashtable table;
+ private boolean allowCollisions;
+
+ /**
+ * Get a context for the given name. Name may be null, in
+ * which case this method will return the default context.
+ */
+ public static synchronized NameContext forName (String name,
+ boolean allowCollisions,
+ BatchEnvironment env) {
+
+ NameContext result = null;
+
+ // Do we need to use the default context?
+
+ if (name == null) {
+
+ // Yes.
+
+ name = "null";
+ }
+
+ // Have we initialized our hashtable?
+
+ if (env.nameContexts == null) {
+
+ // Nope, so do it...
+
+ env.nameContexts = new Hashtable();
+
+ } else {
+
+ // Yes, see if we already have the requested
+ // context...
+
+ result = (NameContext) env.nameContexts.get(name);
+ }
+
+ // Do we have the requested context?
+
+ if (result == null) {
+
+ // Nope, so create and add it...
+
+ result = new NameContext(allowCollisions);
+
+ env.nameContexts.put(name,result);
+ }
+
+ return result;
+ }
+
+ /**
+ * Construct a context.
+ * @param allowCollisions true if case-sensitive name collisions
+ * are allowed, false if not.
+ */
+ public NameContext (boolean allowCollisions) {
+ this.allowCollisions = allowCollisions;
+ table = new Hashtable();
+ }
+
+ /**
+ * Add a name to this context. If constructed with allowCollisions
+ * false and a collision occurs, this method will throw an exception
+ * in which the message contains the string: "name" and "collision".
+ */
+ public void assertPut (String name) throws Exception {
+
+ String message = add(name);
+
+ if (message != null) {
+ throw new Exception(message);
+ }
+ }
+
+ /**
+ * Add a name to this context..
+ */
+ public void put (String name) {
+
+ if (allowCollisions == false) {
+ throw new Error("Must use assertPut(name)");
+ }
+
+ add(name);
+ }
+
+ /**
+ * Add a name to this context. If constructed with allowCollisions
+ * false and a collision occurs, this method will return a message
+ * string, otherwise returns null.
+ */
+ private String add (String name) {
+
+ // First, create a key by converting name to lowercase...
+
+ String key = name.toLowerCase();
+
+ // Does this key exist in the context?
+
+ Name value = (Name) table.get(key);
+
+ if (value != null) {
+
+ // Yes, so they match if we ignore case. Do they match if
+ // we don't ignore case?
+
+ if (!name.equals(value.name)) {
+
+ // No, so this is a case-sensitive match. Are we
+ // supposed to allow this?
+
+ if (allowCollisions) {
+
+ // Yes, make sure it knows that it collides...
+
+ value.collisions = true;
+
+ } else {
+
+ // No, so return a message string...
+
+ return new String("\"" + name + "\" and \"" + value.name + "\"");
+ }
+ }
+ } else {
+
+ // No, so add it...
+
+ table.put(key,new Name(name,false));
+ }
+
+ return null;
+ }
+
+ /**
+ * Get a name from the context. If it has collisions, the name
+ * will be converted as specified in section 5.2.7.
+ */
+ public String get (String name) {
+
+ Name it = (Name) table.get(name.toLowerCase());
+ String result = name;
+
+ // Do we need to mangle it?
+
+ if (it.collisions) {
+
+ // Yep, so do it...
+
+ int length = name.length();
+ boolean allLower = true;
+
+ for (int i = 0; i < length; i++) {
+
+ if (Character.isUpperCase(name.charAt(i))) {
+ result += "_";
+ result += i;
+ allLower = false;
+ }
+ }
+
+ if (allLower) {
+ result += "_";
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Remove all entries.
+ */
+ public void clear () {
+ table.clear();
+ }
+
+ public class Name {
+ public String name;
+ public boolean collisions;
+
+ public Name (String name, boolean collisions) {
+ this.name = name;
+ this.collisions = collisions;
+ }
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/PrimitiveType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/PrimitiveType.java
new file mode 100644
index 0000000..7311fa4
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/PrimitiveType.java
@@ -0,0 +1,195 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import sun.tools.java.CompilerError;
+import sun.tools.java.Identifier;
+import sun.tools.java.ClassDefinition;
+
+/**
+ * PrimitiveType wraps primitive types and void.
+ * <p>
+ * The static forPrimitive(...) method must be used to obtain an instance, and
+ * will return null if the type is non-conforming.
+ *
+ * @author Bryan Atsatt
+ */
+public class PrimitiveType extends Type {
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create a PrimitiveType object for the given type.
+ *
+ * If the type is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static PrimitiveType forPrimitive(sun.tools.java.Type type,
+ ContextStack stack) {
+
+ if (stack.anyErrors()) return null;
+
+ // Do we already have it?
+
+ Type existing = getType(type,stack);
+
+ if (existing != null) {
+
+ if (!(existing instanceof PrimitiveType)) return null; // False hit.
+
+ // Yep, so return it...
+
+ return (PrimitiveType) existing;
+ }
+
+ int typeCode;
+
+ switch (type.getTypeCode()) {
+ case TC_VOID: typeCode = TYPE_VOID; break;
+ case TC_BOOLEAN: typeCode = TYPE_BOOLEAN; break;
+ case TC_BYTE: typeCode = TYPE_BYTE; break;
+ case TC_CHAR: typeCode = TYPE_CHAR; break;
+ case TC_SHORT: typeCode = TYPE_SHORT; break;
+ case TC_INT: typeCode = TYPE_INT; break;
+ case TC_LONG: typeCode = TYPE_LONG; break;
+ case TC_FLOAT: typeCode = TYPE_FLOAT; break;
+ case TC_DOUBLE: typeCode = TYPE_DOUBLE; break;
+ default: return null;
+ }
+
+ PrimitiveType it = new PrimitiveType(stack,typeCode);
+
+ // Add it...
+
+ putType(type,it,stack);
+
+ // Do the stack thing in case tracing on...
+
+ stack.push(it);
+ stack.pop(true);
+
+ return it;
+ }
+
+ /**
+ * Return signature for this type (e.g. com.acme.Dynamite
+ * would return "com.acme.Dynamite", byte = "B")
+ */
+ public String getSignature() {
+ switch (getTypeCode()) {
+ case TYPE_VOID: return SIG_VOID;
+ case TYPE_BOOLEAN: return SIG_BOOLEAN;
+ case TYPE_BYTE: return SIG_BYTE;
+ case TYPE_CHAR: return SIG_CHAR;
+ case TYPE_SHORT: return SIG_SHORT;
+ case TYPE_INT: return SIG_INT;
+ case TYPE_LONG: return SIG_LONG;
+ case TYPE_FLOAT: return SIG_FLOAT;
+ case TYPE_DOUBLE: return SIG_DOUBLE;
+ default: return null;
+ }
+ }
+
+ /**
+ * Return a string describing this type.
+ */
+ public String getTypeDescription () {
+ return "Primitive";
+ }
+
+ /**
+ * IDL_Naming
+ * Return the fully qualified IDL name for this type (e.g. com.acme.Dynamite would
+ * return "com::acme::Dynamite").
+ * @param global If true, prepends "::".
+ */
+ public String getQualifiedIDLName(boolean global) {
+ return super.getQualifiedIDLName(false);
+ }
+
+ //_____________________________________________________________________
+ // Subclass/Internal Interfaces
+ //_____________________________________________________________________
+
+ /*
+ * Load a Class instance. Return null if fail.
+ */
+ protected Class loadClass() {
+ switch (getTypeCode()) {
+ case TYPE_VOID: return Null.class;
+ case TYPE_BOOLEAN: return boolean.class;
+ case TYPE_BYTE: return byte.class;
+ case TYPE_CHAR: return char.class;
+ case TYPE_SHORT: return short.class;
+ case TYPE_INT: return int.class;
+ case TYPE_LONG: return long.class;
+ case TYPE_FLOAT: return float.class;
+ case TYPE_DOUBLE: return double.class;
+ default: throw new CompilerError("Not a primitive type");
+ }
+ }
+
+ /**
+ * IDL_Naming
+ * Create an PrimitiveType instance for the given class.
+ */
+ private PrimitiveType(ContextStack stack, int typeCode) {
+ super(stack,typeCode | TM_PRIMITIVE);
+
+ // Validate type and set names...
+
+ String idlName = IDLNames.getTypeName(typeCode,false);
+ Identifier id = null;
+
+ switch (typeCode) {
+ case TYPE_VOID: id = idVoid; break;
+ case TYPE_BOOLEAN: id = idBoolean; break;
+ case TYPE_BYTE: id = idByte; break;
+ case TYPE_CHAR: id = idChar; break;
+ case TYPE_SHORT: id = idShort; break;
+ case TYPE_INT: id = idInt; break;
+ case TYPE_LONG: id = idLong; break;
+ case TYPE_FLOAT: id = idFloat; break;
+ case TYPE_DOUBLE: id = idDouble; break;
+ default: throw new CompilerError("Not a primitive type");
+ }
+
+ setNames(id,null,idlName);
+ setRepositoryID();
+ }
+}
+
+class Null {}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/PrintGenerator.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/PrintGenerator.java
new file mode 100644
index 0000000..414b62c
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/PrintGenerator.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.OutputStreamWriter;
+import sun.tools.java.CompilerError;
+import sun.tools.java.ClassDefinition;
+import sun.rmi.rmic.IndentingWriter;
+import sun.rmi.rmic.Main;
+
+/**
+ * An IDL generator for rmic.
+ *
+ * @author Bryan Atsatt
+ */
+public class PrintGenerator implements sun.rmi.rmic.Generator,
+ sun.rmi.rmic.iiop.Constants {
+
+ private static final int JAVA = 0;
+ private static final int IDL = 1;
+ private static final int BOTH = 2;
+
+ private int whatToPrint; // Initialized in parseArgs.
+ private boolean global = false;
+ private boolean qualified = false;
+ private boolean trace = false;
+ private boolean valueMethods = false;
+
+ private IndentingWriter out;
+
+ /**
+ * Default constructor for Main to use.
+ */
+ public PrintGenerator() {
+ OutputStreamWriter writer = new OutputStreamWriter(System.out);
+ out = new IndentingWriter (writer);
+ }
+
+ /**
+ * Examine and consume command line arguments.
+ * @param argv The command line arguments. Ignore null
+ * @param error Report any errors using the main.error() methods.
+ * @return true if no errors, false otherwise.
+ */
+ public boolean parseArgs(String argv[], Main main) {
+ for (int i = 0; i < argv.length; i++) {
+ if (argv[i] != null) {
+ String arg = argv[i].toLowerCase();
+ if (arg.equals("-xprint")) {
+ whatToPrint = JAVA;
+ argv[i] = null;
+ if (i+1 < argv.length) {
+ if (argv[i+1].equalsIgnoreCase("idl")) {
+ argv[++i] = null;
+ whatToPrint = IDL;
+ } else if (argv[i+1].equalsIgnoreCase("both")) {
+ argv[++i] = null;
+ whatToPrint = BOTH;
+ }
+ }
+ } else if (arg.equals("-xglobal")) {
+ global = true;
+ argv[i] = null;
+ } else if (arg.equals("-xqualified")) {
+ qualified = true;
+ argv[i] = null;
+ } else if (arg.equals("-xtrace")) {
+ trace = true;
+ argv[i] = null;
+ } else if (arg.equals("-xvaluemethods")) {
+ valueMethods = true;
+ argv[i] = null;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * Generate output. Any source files created which need compilation should
+ * be added to the compiler environment using the addGeneratedFile(File)
+ * method.
+ *
+ * @param env The compiler environment
+ * @param cdef The definition for the implementation class or interface from
+ * which to generate output
+ * @param destDir The directory for the root of the package hierarchy
+ * for generated files. May be null.
+ */
+ public void generate(sun.rmi.rmic.BatchEnvironment env, ClassDefinition cdef, File destDir) {
+
+ BatchEnvironment ourEnv = (BatchEnvironment) env;
+ ContextStack stack = new ContextStack(ourEnv);
+ stack.setTrace(trace);
+
+ if (valueMethods) {
+ ourEnv.setParseNonConforming(true);
+ }
+
+ // Get our top level type...
+
+ CompoundType topType = CompoundType.forCompound(cdef,stack);
+
+ if (topType != null) {
+
+ try {
+
+ // Collect up all the compound types...
+
+ Type[] theTypes = topType.collectMatching(TM_COMPOUND);
+
+ for (int i = 0; i < theTypes.length; i++) {
+
+ out.pln("\n-----------------------------------------------------------\n");
+
+ Type theType = theTypes[i];
+
+ switch (whatToPrint) {
+ case JAVA: theType.println(out,qualified,false,false);
+ break;
+
+ case IDL: theType.println(out,qualified,true,global);
+ break;
+
+ case BOTH: theType.println(out,qualified,false,false);
+ theType.println(out,qualified,true,global);
+ break;
+
+ default: throw new CompilerError("Unknown type!");
+ }
+ }
+
+ out.flush();
+
+ } catch (IOException e) {
+ throw new CompilerError("PrintGenerator caught " + e);
+ }
+ }
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/RemoteType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/RemoteType.java
new file mode 100644
index 0000000..ad13d76
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/RemoteType.java
@@ -0,0 +1,251 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Vector;
+import sun.tools.java.CompilerError;
+import sun.tools.java.ClassDefinition;
+import sun.tools.java.ClassNotFound;
+
+/**
+ * RemoteType represents any non-special interface which inherits
+ * from java.rmi.Remote.
+ * <p>
+ * The static forRemote(...) method must be used to obtain an instance, and will
+ * return null if the ClassDefinition is non-conforming.
+ * @author Bryan Atsatt
+ */
+public class RemoteType extends InterfaceType {
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create an RemoteType for the given class.
+ *
+ * If the class is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static RemoteType forRemote(ClassDefinition classDef,
+ ContextStack stack,
+ boolean quiet) {
+
+ if (stack.anyErrors()) return null;
+
+ boolean doPop = false;
+ RemoteType result = null;
+
+ try {
+ // Do we already have it?
+
+ sun.tools.java.Type theType = classDef.getType();
+ Type existing = getType(theType,stack);
+
+ if (existing != null) {
+
+ if (!(existing instanceof RemoteType)) return null; // False hit.
+
+ // Yep, so return it...
+
+ return (RemoteType) existing;
+ }
+
+ // Could this be a remote type?
+
+ if (couldBeRemote(quiet,stack,classDef)) {
+
+ // Yes, so check it...
+
+ RemoteType it = new RemoteType(stack,classDef);
+ putType(theType,it,stack);
+ stack.push(it);
+ doPop = true;
+
+ if (it.initialize(quiet,stack)) {
+ stack.pop(true);
+ result = it;
+ } else {
+ removeType(theType,stack);
+ stack.pop(false);
+ }
+ }
+ } catch (CompilerError e) {
+ if (doPop) stack.pop(false);
+ }
+
+ return result;
+ }
+
+ /**
+ * Return a string describing this type.
+ */
+ public String getTypeDescription () {
+ return "Remote interface";
+ }
+
+ //_____________________________________________________________________
+ // Internal/Subclass Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create a RemoteType instance for the given class. The resulting
+ * object is not yet completely initialized.
+ */
+ protected RemoteType(ContextStack stack, ClassDefinition classDef) {
+ super(stack,classDef,TYPE_REMOTE | TM_INTERFACE | TM_COMPOUND);
+ }
+
+ /**
+ * Create a RemoteType instance for the given class. The resulting
+ * object is not yet completely initialized.
+ */
+ protected RemoteType(ContextStack stack, ClassDefinition classDef, int typeCode) {
+ super(stack,classDef,typeCode);
+ }
+
+ //_____________________________________________________________________
+ // Internal Interfaces
+ //_____________________________________________________________________
+
+
+ private static boolean couldBeRemote (boolean quiet, ContextStack stack,
+ ClassDefinition classDef) {
+
+ boolean result = false;
+ BatchEnvironment env = stack.getEnv();
+
+ try {
+ if (!classDef.isInterface()) {
+ failedConstraint(16,quiet,stack,classDef.getName());
+ } else {
+ result = env.defRemote.implementedBy(env,classDef.getClassDeclaration());
+ if (!result) failedConstraint(1,quiet,stack,classDef.getName());
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+
+ return result;
+ }
+
+
+ /**
+ * Initialize this instance.
+ */
+ private boolean initialize (boolean quiet,ContextStack stack) {
+
+ boolean result = false;
+
+ // Go check it out and gather up the info we need...
+
+ Vector directInterfaces = new Vector();
+ Vector directMethods = new Vector();
+ Vector directConstants = new Vector();
+
+ if (isConformingRemoteInterface(directInterfaces,
+ directMethods,
+ directConstants,
+ quiet,
+ stack)){
+
+ // We're ok, so pass 'em up...
+
+ result = initialize(directInterfaces,directMethods,directConstants,stack,quiet);
+ }
+
+ return result;
+ }
+
+ /**
+ * Check to ensure that the interface and all it's methods and arguments
+ * conforms to the RMI/IDL java subset for remote interfaces as defined
+ * by the "Java to IDL Mapping" specification, section 4.
+ * @param directInterfaces All directly implmented interfaces will be
+ * added to this list.
+ * @param directMethods All directly implemented methods (other than
+ * constructors and initializers) will be added to this list.
+ * @param directConstants All constants defined by theInterface will be
+ * added to this list.
+ * @param quiet True if should not report constraint failures.
+ * @return true if constraints satisfied, false otherwise.
+ */
+ private boolean isConformingRemoteInterface ( Vector directInterfaces,
+ Vector directMethods,
+ Vector directConstants,
+ boolean quiet,
+ ContextStack stack) {
+
+ ClassDefinition theInterface = getClassDefinition();
+
+ try {
+
+ // Get all remote interfaces...
+
+ if (addRemoteInterfaces(directInterfaces,false,stack) == null ) {
+ return false;
+ }
+
+ // Make sure all constants are conforming...
+
+ if (!addAllMembers(directConstants,true,quiet,stack)) {
+ return false;
+ }
+
+ // Now, collect up all methods...
+
+ if (addAllMethods(theInterface,directMethods,true,quiet,stack) == null) {
+ // Failed a constraint check...
+ return false;
+ }
+
+ // Now walk 'em, ensuring each is a valid remote method...
+
+ boolean methodsConform = true;
+ for (int i = 0; i < directMethods.size(); i++) {
+ if (! isConformingRemoteMethod((Method) directMethods.elementAt(i),quiet)) {
+ methodsConform = false;
+ }
+ }
+ if (!methodsConform) {
+ return false;
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ return false;
+ }
+
+ return true;
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/SpecialClassType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/SpecialClassType.java
new file mode 100644
index 0000000..dd992f3
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/SpecialClassType.java
@@ -0,0 +1,171 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.CompilerError;
+import sun.tools.java.Identifier;
+import sun.tools.java.ClassDefinition;
+
+/**
+ * SpecialClassType represents any one of the following types:
+ * <pre>
+ * java.lang.Object
+ * java.lang.String
+ * </pre>
+ * all of which are treated as special cases.
+ * <p>
+ * The static forSpecial(...) method must be used to obtain an instance, and
+ * will return null if the type is non-conforming.
+ *
+ * @author Bryan Atsatt
+ */
+public class SpecialClassType extends ClassType {
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create a SpecialClassType object for the given class.
+ *
+ * If the class is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static SpecialClassType forSpecial (ClassDefinition theClass,
+ ContextStack stack) {
+ if (stack.anyErrors()) return null;
+
+ sun.tools.java.Type type = theClass.getType();
+
+ // Do we already have it?
+
+ String typeKey = type.toString() + stack.getContextCodeString();
+
+ Type existing = getType(typeKey,stack);
+
+ if (existing != null) {
+
+ if (!(existing instanceof SpecialClassType)) return null; // False hit.
+
+ // Yep, so return it...
+
+ return (SpecialClassType) existing;
+ }
+
+ // Is it a special type?
+
+ int typeCode = getTypeCode(type,theClass,stack);
+
+ if (typeCode != TYPE_NONE) {
+
+ // Yes...
+
+ SpecialClassType result = new SpecialClassType(stack,typeCode,theClass);
+ putType(typeKey,result,stack);
+ stack.push(result);
+ stack.pop(true);
+ return result;
+
+ } else {
+
+ return null;
+ }
+ }
+
+ /**
+ * Return a string describing this type.
+ */
+ public String getTypeDescription () {
+ return "Special class";
+ }
+
+ //_____________________________________________________________________
+ // Subclass/Internal Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create an SpecialClassType instance for the given class.
+ */
+ private SpecialClassType(ContextStack stack, int typeCode,
+ ClassDefinition theClass) {
+ super(stack,typeCode | TM_SPECIAL_CLASS | TM_CLASS | TM_COMPOUND, theClass);
+ Identifier id = theClass.getName();
+ String idlName = null;
+ String[] idlModuleName = null;
+ boolean constant = stack.size() > 0 && stack.getContext().isConstant();
+
+ // Set names...
+
+ switch (typeCode) {
+ case TYPE_STRING: {
+ idlName = IDLNames.getTypeName(typeCode,constant);
+ if (!constant) {
+ idlModuleName = IDL_CORBA_MODULE;
+ }
+ break;
+ }
+
+ case TYPE_ANY: {
+ idlName = IDL_JAVA_LANG_OBJECT;
+ idlModuleName = IDL_JAVA_LANG_MODULE;
+ break;
+ }
+ }
+
+ setNames(id,idlModuleName,idlName);
+
+ // Init parents...
+
+ if (!initParents(stack)) {
+
+ // Should not be possible!
+
+ throw new CompilerError("SpecialClassType found invalid parent.");
+ }
+
+ // Initialize CompoundType...
+
+ initialize(null,null,null,stack,false);
+ }
+
+ private static int getTypeCode(sun.tools.java.Type type, ClassDefinition theClass, ContextStack stack) {
+ if (type.isType(TC_CLASS)) {
+ Identifier id = type.getClassName();
+ if (id == idJavaLangString) return TYPE_STRING;
+ if (id == idJavaLangObject) return TYPE_ANY;
+ }
+ return TYPE_NONE;
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/SpecialInterfaceType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/SpecialInterfaceType.java
new file mode 100644
index 0000000..ca2e26e
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/SpecialInterfaceType.java
@@ -0,0 +1,233 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.CompilerError;
+import sun.tools.java.Identifier;
+import sun.tools.java.ClassDeclaration;
+import sun.tools.java.ClassDefinition;
+
+/**
+ * SpecialInterfaceType represents any one of the following types:
+ * <pre>
+ * java.rmi.Remote
+ * java.io.Serializable
+ * java.io.Externalizable
+ * org.omg.CORBA.Object
+ * org.omg.CORBA.portable.IDLEntity
+ * </pre>
+ * all of which are treated as special cases. For all but CORBA.Object,
+ * the type must match exactly. For CORBA.Object, the type must either be
+ * CORBA.Object or inherit from it.
+ * <p>
+ * The static forSpecial(...) method must be used to obtain an instance, and
+ * will return null if the type is non-conforming.
+ *
+ * @author Bryan Atsatt
+ */
+public class SpecialInterfaceType extends InterfaceType {
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create a SpecialInterfaceType object for the given class.
+ *
+ * If the class is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static SpecialInterfaceType forSpecial ( ClassDefinition theClass,
+ ContextStack stack) {
+
+ if (stack.anyErrors()) return null;
+
+ // Do we already have it?
+
+ sun.tools.java.Type type = theClass.getType();
+ Type existing = getType(type,stack);
+
+ if (existing != null) {
+
+ if (!(existing instanceof SpecialInterfaceType)) return null; // False hit.
+
+ // Yep, so return it...
+
+ return (SpecialInterfaceType) existing;
+ }
+
+ // Is it special?
+
+ if (isSpecial(type,theClass,stack)) {
+
+ // Yes...
+
+ SpecialInterfaceType result = new SpecialInterfaceType(stack,0,theClass);
+ putType(type,result,stack);
+ stack.push(result);
+
+ if (result.initialize(type,stack)) {
+ stack.pop(true);
+ return result;
+ } else {
+ removeType(type,stack);
+ stack.pop(false);
+ return null;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return a string describing this type.
+ */
+ public String getTypeDescription () {
+ return "Special interface";
+ }
+
+ //_____________________________________________________________________
+ // Subclass/Internal Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create an SpecialInterfaceType instance for the given class.
+ */
+ private SpecialInterfaceType(ContextStack stack, int typeCode,
+ ClassDefinition theClass) {
+ super(stack,typeCode | TM_SPECIAL_INTERFACE | TM_INTERFACE | TM_COMPOUND, theClass);
+ setNames(theClass.getName(),null,null); // Fixed in initialize.
+ }
+
+ private static boolean isSpecial(sun.tools.java.Type type,
+ ClassDefinition theClass,
+ ContextStack stack) {
+ if (type.isType(TC_CLASS)) {
+ Identifier id = type.getClassName();
+
+ if (id.equals(idRemote)) return true;
+ if (id == idJavaIoSerializable) return true;
+ if (id == idJavaIoExternalizable) return true;
+ if (id == idCorbaObject) return true;
+ if (id == idIDLEntity) return true;
+ BatchEnvironment env = stack.getEnv();
+ try {
+ if (env.defCorbaObject.implementedBy(env,theClass.getClassDeclaration())) return true;
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+ }
+ return false;
+ }
+
+ private boolean initialize(sun.tools.java.Type type, ContextStack stack) {
+
+ int typeCode = TYPE_NONE;
+ Identifier id = null;
+ String idlName = null;
+ String[] idlModuleName = null;
+ boolean constant = stack.size() > 0 && stack.getContext().isConstant();
+
+ if (type.isType(TC_CLASS)) {
+ id = type.getClassName();
+
+ if (id.equals(idRemote)) {
+ typeCode = TYPE_JAVA_RMI_REMOTE;
+ idlName = IDL_JAVA_RMI_REMOTE;
+ idlModuleName = IDL_JAVA_RMI_MODULE;
+ } else if (id == idJavaIoSerializable) {
+ typeCode = TYPE_ANY;
+ idlName = IDL_SERIALIZABLE;
+ idlModuleName = IDL_JAVA_IO_MODULE;
+ } else if (id == idJavaIoExternalizable) {
+ typeCode = TYPE_ANY;
+ idlName = IDL_EXTERNALIZABLE;
+ idlModuleName = IDL_JAVA_IO_MODULE;
+ } else if (id == idIDLEntity) {
+ typeCode = TYPE_ANY;
+ idlName = IDL_IDLENTITY;
+ idlModuleName = IDL_ORG_OMG_CORBA_PORTABLE_MODULE;
+ } else {
+
+ typeCode = TYPE_CORBA_OBJECT;
+
+ // Is it exactly org.omg.CORBA.Object?
+
+ if (id == idCorbaObject) {
+
+ // Yes, so special case...
+
+ idlName = IDLNames.getTypeName(typeCode,constant);
+ idlModuleName = null;
+
+ } else {
+
+ // No, so get the correct names...
+
+ try {
+
+ // These can fail if we get case-sensitive name matches...
+
+ idlName = IDLNames.getClassOrInterfaceName(id,env);
+ idlModuleName = IDLNames.getModuleNames(id,isBoxed(),env);
+
+ } catch (Exception e) {
+ failedConstraint(7,false,stack,id.toString(),e.getMessage());
+ throw new CompilerError("");
+ }
+ }
+ }
+ }
+
+ if (typeCode == TYPE_NONE) {
+ return false;
+ }
+
+ // Reset type code...
+
+ setTypeCode(typeCode | TM_SPECIAL_INTERFACE | TM_INTERFACE | TM_COMPOUND);
+
+ // Set names
+
+ if (idlName == null) {
+ throw new CompilerError("Not a special type");
+ }
+
+ setNames(id,idlModuleName,idlName);
+
+ // Initialize CompoundType...
+
+ return initialize(null,null,null,stack,false);
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/StaticStringsHash.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/StaticStringsHash.java
new file mode 100644
index 0000000..7d86db5
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/StaticStringsHash.java
@@ -0,0 +1,372 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+/**
+ * StaticStringsHash takes an array of constant strings and
+ * uses several different hash methods to try to find the
+ * 'best' one for that set. The set of methods is currently
+ * fixed, but with a little work could be made extensible thru
+ * subclassing.
+ * <p>
+ * The current set of methods is:
+ * <ol>
+ * <li> length() - works well when all strings are different length.</li>
+ * <li> charAt(n) - works well when one offset into all strings is different.</li>
+ * <li> hashCode() - works well with larger arrays.</li>
+ * </ol>
+ * After constructing an instance over the set of strings, the
+ * <code>getKey(String)</code> method can be used to use the selected hash
+ * method to produce a key. The <code>method</code> string will contain
+ * "length()", "charAt(n)", or "hashCode()", and is intended for use by
+ * code generators.
+ * <p>
+ * The <code>keys</code> array will contain the full set of unique keys.
+ * <p>
+ * The <code>buckets</code> array will contain a set of arrays, one for
+ * each key in the <code>keys</code>, where <code>buckets[x][y]</code>
+ * is an index into the <code>strings</code> array.
+ * @author Bryan Atsatt
+ */
+public class StaticStringsHash {
+
+ /** The set of strings upon which the hash info is created */
+ public String[] strings = null;
+
+ /** Unique hash keys */
+ public int[] keys = null;
+
+ /** Buckets for each key, where buckets[x][y] is an index
+ * into the strings[] array. */
+ public int[][] buckets = null;
+
+ /** The method to invoke on String to produce the hash key */
+ public String method = null;
+
+ /** Get a key for the given string using the
+ * selected hash method.
+ * @param str the string to return a key for.
+ * @return the key.
+ */
+ public int getKey(String str) {
+ switch (keyKind) {
+ case LENGTH: return str.length();
+ case CHAR_AT: return str.charAt(charAt);
+ case HASH_CODE: return str.hashCode();
+ }
+ throw new Error("Bad keyKind");
+ }
+
+ /** Constructor
+ * @param strings the set of strings upon which to
+ * find an optimal hash method. Must not contain
+ * duplicates.
+ */
+ public StaticStringsHash(String[] strings) {
+ this.strings = strings;
+ length = strings.length;
+ tempKeys = new int[length];
+ bucketSizes = new int[length];
+ setMinStringLength();
+
+ // Decide on the best algorithm based on
+ // which one has the smallest maximum
+ // bucket depth. First, try length()...
+
+ int currentMaxDepth = getKeys(LENGTH);
+ int useCharAt = -1;
+ boolean useHashCode = false;
+
+ if (currentMaxDepth > 1) {
+
+ // At least one bucket had more than one
+ // entry, so try charAt(i). If there
+ // are a lot of strings in the array,
+ // and minStringLength is large, limit
+ // the search to a smaller number of
+ // characters to avoid spending a lot
+ // of time here that is most likely to
+ // be pointless...
+
+ int minLength = minStringLength;
+ if (length > CHAR_AT_MAX_LINES &&
+ length * minLength > CHAR_AT_MAX_CHARS) {
+ minLength = length/CHAR_AT_MAX_CHARS;
+ }
+
+ charAt = 0;
+ for (int i = 0; i < minLength; i++) {
+ int charAtDepth = getKeys(CHAR_AT);
+ if (charAtDepth < currentMaxDepth) {
+ currentMaxDepth = charAtDepth;
+ useCharAt = i;
+ if (currentMaxDepth == 1) {
+ break;
+ }
+ }
+ charAt++;
+ }
+ charAt = useCharAt;
+
+
+ if (currentMaxDepth > 1) {
+
+ // At least one bucket had more than one
+ // entry, try hashCode().
+ //
+ // Since the cost of computing a full hashCode
+ // (for the runtime target string) is much higher
+ // than the previous methods, use it only if it is
+ // substantially better. The definition of 'substantial'
+ // here is not very well founded, and could be improved
+ // with some further analysis ;^)
+
+ int hashCodeDepth = getKeys(HASH_CODE);
+ if (hashCodeDepth < currentMaxDepth-3) {
+
+ // Using the full hashCode results in at least
+ // 3 fewer entries in the worst bucket, so will
+ // therefore avoid at least 3 calls to equals()
+ // in the worst case.
+ //
+ // Note that using a number smaller than 3 could
+ // result in using a hashCode when there are only
+ // 2 strings in the array, and that would surely
+ // be a poor performance choice.
+
+ useHashCode = true;
+ }
+ }
+
+ // Reset keys if needed...
+
+ if (!useHashCode) {
+ if (useCharAt >= 0) {
+
+ // Use the charAt(i) method...
+
+ getKeys(CHAR_AT);
+
+ } else {
+
+ // Use length method...
+
+ getKeys(LENGTH);
+ }
+ }
+ }
+
+ // Now allocate and fill our real hashKeys array...
+
+ keys = new int[bucketCount];
+ System.arraycopy(tempKeys,0,keys,0,bucketCount);
+
+ // Sort keys and bucketSizes arrays...
+
+ boolean didSwap;
+ do {
+ didSwap = false;
+ for (int i = 0; i < bucketCount - 1; i++) {
+ if (keys[i] > keys[i+1]) {
+ int temp = keys[i];
+ keys[i] = keys[i+1];
+ keys[i+1] = temp;
+ temp = bucketSizes[i];
+ bucketSizes[i] = bucketSizes[i+1];
+ bucketSizes[i+1] = temp;
+ didSwap = true;
+ }
+ }
+ }
+ while (didSwap == true);
+
+ // Allocate our buckets array. Fill the string
+ // index slot with an unused key so we can
+ // determine which are free...
+
+ int unused = findUnusedKey();
+ buckets = new int[bucketCount][];
+ for (int i = 0; i < bucketCount; i++) {
+ buckets[i] = new int[bucketSizes[i]];
+ for (int j = 0; j < bucketSizes[i]; j++) {
+ buckets[i][j] = unused;
+ }
+ }
+
+ // And fill it in...
+
+ for(int i = 0; i < strings.length; i++) {
+ int key = getKey(strings[i]);
+ for (int j = 0; j < bucketCount; j++) {
+ if (keys[j] == key) {
+ int k = 0;
+ while (buckets[j][k] != unused) {
+ k++;
+ }
+ buckets[j][k] = i;
+ break;
+ }
+ }
+ }
+ }
+
+ /** Print an optimized 'contains' method for the
+ * argument strings
+ */
+ public static void main (String[] args) {
+ StaticStringsHash hash = new StaticStringsHash(args);
+ System.out.println();
+ System.out.println(" public boolean contains(String key) {");
+ System.out.println(" switch (key."+hash.method+") {");
+ for (int i = 0; i < hash.buckets.length; i++) {
+ System.out.println(" case "+hash.keys[i]+": ");
+ for (int j = 0; j < hash.buckets[i].length; j++) {
+ if (j > 0) {
+ System.out.print(" } else ");
+ } else {
+ System.out.print(" ");
+ }
+ System.out.println("if (key.equals(\""+ hash.strings[hash.buckets[i][j]] +"\")) {");
+ System.out.println(" return true;");
+ }
+ System.out.println(" }");
+ }
+ System.out.println(" }");
+ System.out.println(" return false;");
+ System.out.println(" }");
+ }
+
+ private int length;
+ private int[] tempKeys;
+ private int[] bucketSizes;
+ private int bucketCount;
+ private int maxDepth;
+ private int minStringLength = Integer.MAX_VALUE;
+ private int keyKind;
+ private int charAt;
+
+ private static final int LENGTH = 0;
+ private static final int CHAR_AT = 1;
+ private static final int HASH_CODE = 2;
+
+ /* Determines the maximum number of charAt(i)
+ * tests that will be done. The search is
+ * limited because if the number of characters
+ * is large enough, the likelyhood of finding
+ * a good hash key based on this method is
+ * low. The CHAR_AT_MAX_CHARS limit only
+ * applies f there are more strings than
+ * CHAR_AT_MAX_LINES.
+ */
+ private static final int CHAR_AT_MAX_LINES = 50;
+ private static final int CHAR_AT_MAX_CHARS = 1000;
+
+ private void resetKeys(int keyKind) {
+ this.keyKind = keyKind;
+ switch (keyKind) {
+ case LENGTH: method = "length()"; break;
+ case CHAR_AT: method = "charAt("+charAt+")"; break;
+ case HASH_CODE: method = "hashCode()"; break;
+ }
+ maxDepth = 1;
+ bucketCount = 0;
+ for (int i = 0; i < length; i++) {
+ tempKeys[i] = 0;
+ bucketSizes[i] = 0;
+ }
+ }
+
+ private void setMinStringLength() {
+ for (int i = 0; i < length; i++) {
+ if (strings[i].length() < minStringLength) {
+ minStringLength = strings[i].length();
+ }
+ }
+ }
+
+ private int findUnusedKey() {
+ int unused = 0;
+ int keysLength = keys.length;
+
+ // Note that we just assume that resource
+ // exhaustion will occur rather than an
+ // infinite loop here if the set of keys
+ // is very large.
+
+ while (true) {
+ boolean match = false;
+ for (int i = 0; i < keysLength; i++) {
+ if (keys[i] == unused) {
+ match = true;
+ break;
+ }
+ }
+ if (match) {
+ unused--;
+ } else {
+ break;
+ }
+ }
+ return unused;
+ }
+
+ private int getKeys(int methodKind) {
+ resetKeys(methodKind);
+ for(int i = 0; i < strings.length; i++) {
+ addKey(getKey(strings[i]));
+ }
+ return maxDepth;
+ }
+
+ private void addKey(int key) {
+
+ // Have we seen this one before?
+
+ boolean addIt = true;
+ for (int j = 0; j < bucketCount; j++) {
+ if (tempKeys[j] == key) {
+ addIt = false;
+ bucketSizes[j]++;
+ if (bucketSizes[j] > maxDepth) {
+ maxDepth = bucketSizes[j];
+ }
+ break;
+ }
+ }
+
+ if (addIt) {
+ tempKeys[bucketCount] = key;
+ bucketSizes[bucketCount] = 1;
+ bucketCount++;
+ }
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/StubGenerator.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/StubGenerator.java
new file mode 100644
index 0000000..bceb86c
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/StubGenerator.java
@@ -0,0 +1,2380 @@
+/*
+ * Copyright (c) 1998, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.SerializablePermission;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.util.Vector;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import sun.tools.java.Identifier;
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.ClassDefinition;
+import sun.tools.java.ClassDeclaration;
+import sun.tools.java.CompilerError;
+import sun.rmi.rmic.IndentingWriter;
+import java.util.HashSet;
+import java.util.Arrays;
+import com.sun.corba.se.impl.util.Utility;
+import com.sun.corba.se.impl.util.PackagePrefixChecker;
+import sun.rmi.rmic.Main;
+
+
+/**
+ * An IIOP stub/tie generator for rmic.
+ *
+ * @author Bryan Atsatt
+ * @author Anil Vijendran
+ * @author M. Mortazavi
+ */
+
+public class StubGenerator extends sun.rmi.rmic.iiop.Generator {
+
+ private static final String DEFAULT_STUB_CLASS = "javax.rmi.CORBA.Stub";
+ private static final String DEFAULT_TIE_CLASS = "org.omg.CORBA_2_3.portable.ObjectImpl";
+ private static final String DEFAULT_POA_TIE_CLASS = "org.omg.PortableServer.Servant";
+
+ protected boolean reverseIDs = false;
+ protected boolean localStubs = true;
+ protected boolean standardPackage = false;
+ protected boolean useHash = true;
+ protected String stubBaseClass = DEFAULT_STUB_CLASS;
+ protected String tieBaseClass = DEFAULT_TIE_CLASS;
+ protected HashSet namesInUse = new HashSet();
+ protected Hashtable classesInUse = new Hashtable();
+ protected Hashtable imports = new Hashtable();
+ protected int importCount = 0;
+ protected String currentPackage = null;
+ protected String currentClass = null;
+ protected boolean castArray = false;
+ protected Hashtable transactionalObjects = new Hashtable() ;
+ protected boolean POATie = false ;
+ protected boolean emitPermissionCheck = false;
+
+ /**
+ * Default constructor for Main to use.
+ */
+ public StubGenerator() {
+ }
+
+ /**
+ * Overridden in order to set the standardPackage flag.
+ */
+ public void generate(
+ sun.rmi.rmic.BatchEnvironment env,
+ ClassDefinition cdef, File destDir) {
+ ((sun.rmi.rmic.iiop.BatchEnvironment)env).
+ setStandardPackage(standardPackage);
+ super.generate(env, cdef, destDir);
+ }
+
+ /**
+ * Return true if a new instance should be created for each
+ * class on the command line. Subclasses which return true
+ * should override newInstance() to return an appropriately
+ * constructed instance.
+ */
+ protected boolean requireNewInstance() {
+ return false;
+ }
+
+ /**
+ * Return true if non-conforming types should be parsed.
+ * @param stack The context stack.
+ */
+ protected boolean parseNonConforming(ContextStack stack) {
+
+ // We let the environment setting decide so that
+ // another generator (e.g. IDLGenerator) can change
+ // it and we will just go with the flow...
+
+ return stack.getEnv().getParseNonConforming();
+ }
+
+ /**
+ * Create and return a top-level type.
+ * @param cdef The top-level class definition.
+ * @param stack The context stack.
+ * @return The compound type or null if is non-conforming.
+ */
+ protected CompoundType getTopType(ClassDefinition cdef, ContextStack stack) {
+
+ CompoundType result = null;
+
+ // Do we have an interface?
+
+ if (cdef.isInterface()) {
+
+ // Yes, so first try Abstract...
+
+ result = AbstractType.forAbstract(cdef,stack,true);
+
+ if (result == null) {
+
+ // Then try Remote...
+
+ result = RemoteType.forRemote(cdef,stack,false);
+ }
+ } else {
+
+ // Not an interface, so try Implementation...
+
+ result = ImplementationType.forImplementation(cdef,stack,false);
+ }
+
+ return result;
+ }
+
+ /**
+ * Examine and consume command line arguments.
+ * @param argv The command line arguments. Ignore null
+ * and unknown arguments. Set each consumed argument to null.
+ * @param error Report any errors using the main.error() methods.
+ * @return true if no errors, false otherwise.
+ */
+ public boolean parseArgs(String argv[], Main main) {
+ Object marker = new Object() ;
+
+ // Reset any cached options...
+
+ reverseIDs = false;
+ localStubs = true;
+ useHash = true;
+ stubBaseClass = DEFAULT_STUB_CLASS;
+ // tieBaseClass = DEFAULT_TIE_CLASS;
+ transactionalObjects = new Hashtable() ;
+
+ // Parse options...
+
+ boolean result = super.parseArgs(argv,main);
+ if (result) {
+ for (int i = 0; i < argv.length; i++) {
+ if (argv[i] != null) {
+ String arg = argv[i].toLowerCase();
+ if (arg.equals("-iiop")) {
+ argv[i] = null;
+ } else if (arg.equals("-xreverseids")) {
+ reverseIDs = true;
+ argv[i] = null;
+ } else if (arg.equals("-nolocalstubs")) {
+ localStubs = false;
+ argv[i] = null;
+ } else if (arg.equals("-xnohash")) {
+ useHash = false;
+ argv[i] = null;
+ } else if (argv[i].equals("-standardPackage")) {
+ standardPackage = true;
+ argv[i] = null;
+ } else if (argv[i].equals("-emitPermissionCheck")) {
+ emitPermissionCheck = true;
+ argv[i] = null;
+ } else if (arg.equals("-xstubbase")) {
+ argv[i] = null;
+ if (++i < argv.length && argv[i] != null && !argv[i].startsWith("-")) {
+ stubBaseClass = argv[i];
+ argv[i] = null;
+ } else {
+ main.error("rmic.option.requires.argument", "-Xstubbase");
+ result = false;
+ }
+ } else if (arg.equals("-xtiebase")) {
+ argv[i] = null;
+ if (++i < argv.length && argv[i] != null && !argv[i].startsWith("-")) {
+ tieBaseClass = argv[i];
+ argv[i] = null;
+ } else {
+ main.error("rmic.option.requires.argument", "-Xtiebase");
+ result = false;
+ }
+ } else if (arg.equals("-transactional" )) {
+ // Scan for the next non-flag argument.
+ // Assume that it is a class name and add it
+ // to the list of transactional classes.
+ for ( int ctr=i+1; ctr<argv.length; ctr++ ) {
+ if (argv[ctr].charAt(1) != '-') {
+ transactionalObjects.put( argv[ctr], marker ) ;
+ break ;
+ }
+ }
+ argv[i] = null;
+ } else if (arg.equals( "-poa" )) {
+ POATie = true ;
+ argv[i] = null;
+ }
+ }
+ }
+ }
+ if(POATie){
+ tieBaseClass = DEFAULT_POA_TIE_CLASS;
+ } else {
+ tieBaseClass = DEFAULT_TIE_CLASS;
+ }
+ return result;
+ }
+
+ /**
+ * Return an array containing all the file names and types that need to be
+ * generated for the given top-level type. The file names must NOT have an
+ * extension (e.g. ".java").
+ * @param topType The type returned by getTopType().
+ * @param alreadyChecked A set of Types which have already been checked.
+ * Intended to be passed to topType.collectMatching(filter,alreadyChecked).
+ */
+ protected OutputType[] getOutputTypesFor(CompoundType topType,
+ HashSet alreadyChecked) {
+
+ // We want to generate stubs for all remote and implementation types,
+ // so collect them up.
+ //
+ // We use the form of collectMatching which allows us to pass in a set of
+ // types which have previously been checked. By doing so, we ensure that if
+ // the command line contains Hello and HelloImpl, we will only generate
+ // output for Hello once...
+
+ int filter = TYPE_REMOTE | TYPE_IMPLEMENTATION;
+ Type[] genTypes = topType.collectMatching(filter,alreadyChecked);
+ int count = genTypes.length;
+ Vector list = new Vector(count+5);
+ BatchEnvironment theEnv = topType.getEnv();
+
+ // Now walk all types...
+
+ for (int i = 0; i < genTypes.length; i++) {
+
+ Type type = genTypes[i];
+ String typeName = type.getName();
+ boolean createStub = true;
+
+ // Is it an implementation type?
+
+ if (type instanceof ImplementationType) {
+
+ // Yes, so add a tie for it...
+
+ list.addElement(new OutputType(Utility.tieNameForCompiler(typeName), type));
+
+ // Does it have more than 1 remote interface? If so, we
+ // want to create a stub for it...
+
+ int remoteInterfaceCount = 0;
+ InterfaceType[] interfaces = ((CompoundType)type).getInterfaces();
+ for (int j = 0; j < interfaces.length; j++) {
+ if (interfaces[j].isType(TYPE_REMOTE) &&
+ !interfaces[j].isType(TYPE_ABSTRACT)) {
+ remoteInterfaceCount++;
+ }
+ }
+
+ if (remoteInterfaceCount <= 1) {
+
+ // No, so do not create a stub for this type...
+
+ createStub = false;
+ }
+ }
+
+ // Is it an abstract interface type?
+
+ if (type instanceof AbstractType) {
+
+ // Do not create a stub for this type...
+
+ createStub = false; // d11141
+ }
+
+ if (createStub) {
+
+ // Add a stub for the type...
+
+ list.addElement(new OutputType(Utility.stubNameForCompiler(typeName), type));
+ }
+ }
+
+ // Copy list into array..
+
+ OutputType[] outputTypes = new OutputType[list.size()];
+ list.copyInto(outputTypes);
+ return outputTypes;
+ }
+
+ /**
+ * Return the file name extension for the given file name (e.g. ".java").
+ * All files generated with the ".java" extension will be compiled. To
+ * change this behavior for ".java" files, override the compileJavaSourceFile
+ * method to return false.
+ * @param outputType One of the items returned by getOutputTypesFor(...)
+ */
+ protected String getFileNameExtensionFor(OutputType outputType) {
+ return SOURCE_FILE_EXTENSION;
+ }
+
+ /**
+ * Write the output for the given OutputFileName into the output stream.
+ * @param name One of the items returned by getOutputTypesFor(...)
+ * @param alreadyChecked A set of Types which have already been checked.
+ * Intended to be passed to Type.collectMatching(filter,alreadyChecked).
+ * @param writer The output stream.
+ */
+ protected void writeOutputFor( OutputType outputType,
+ HashSet alreadyChecked,
+ IndentingWriter writer) throws IOException {
+
+ String fileName = outputType.getName();
+ CompoundType theType = (CompoundType) outputType.getType();
+
+ // Are we doing a Stub or Tie?
+
+ if (fileName.endsWith(Utility.RMI_STUB_SUFFIX)) {
+
+ // Stub.
+
+ writeStub(outputType,writer);
+
+ } else {
+
+ // Tie
+
+ writeTie(outputType,writer);
+ }
+ }
+
+ /**
+ * Write a stub for the specified type.
+ */
+ protected void writeStub(OutputType outputType,
+ IndentingWriter p) throws IOException {
+
+ CompoundType theType = (CompoundType) outputType.getType();
+ RemoteType[] remoteInterfaces = getDirectRemoteInterfaces(theType);
+
+ // Write comment.
+
+ p.pln("// Stub class generated by rmic, do not edit.");
+ p.pln("// Contents subject to change without notice.");
+ p.pln();
+
+ // Set our standard classes...
+
+ setStandardClassesInUse(theType,true);
+
+ // Add classes for this type...
+
+ addClassesInUse(theType,remoteInterfaces);
+
+ // Write package and import statements...
+
+ writePackageAndImports(p);
+
+// generate
+// import java.security.AccessController;
+// import java.security.PrivilegedAction;
+// import java.io.SerializablePermission;
+ if (emitPermissionCheck) {
+ p.pln("import java.security.AccessController;");
+ p.pln("import java.security.PrivilegedAction;");
+ p.pln("import java.io.SerializablePermission;");
+ p.pln();
+ p.pln();
+ }
+
+ // Declare the stub class; implement all remote interfaces.
+
+ p.p("public class " + currentClass);
+
+ p.p(" extends " + getName(stubBaseClass));
+ p.p(" implements ");
+ if (remoteInterfaces.length > 0) {
+ for(int i = 0; i < remoteInterfaces.length; i++) {
+ if (i > 0) {
+ p.pln(",");
+ }
+ String objName = testUtil(getName(remoteInterfaces[i]), theType);
+ p.p(objName);
+ }
+ }
+
+ // Add java.rmi.Remote if this type does not implement it.
+ // This allows stubs for Abstract interfaces to be treated
+ // uniformly...
+
+ if (!implementsRemote(theType)) {
+ p.pln(",");
+ p.p(getName("java.rmi.Remote"));
+ }
+
+ p.plnI(" {");
+ p.pln();
+
+ // Write the ids...
+
+ writeIds( p, theType, false );
+ p.pln();
+
+ if (emitPermissionCheck) {
+
+ // produce the following generated code for example
+ //
+ // private transient boolean _instantiated = false;
+ //
+ // private static Void checkPermission() {
+ // SecurityManager sm = System.getSecurityManager();
+ // if (sm != null) {
+ // sm.checkPermission(new SerializablePermission(
+ // "enableSubclassImplementation")); // testing
+ // }
+ // return null;
+ // }
+ //
+ // private _XXXXX_Stub(Void ignore) {
+ // }
+ //
+ // public _XXXXX_Stub() {
+ // this(checkPermission());
+ // _instantiated = true;
+ // }
+ //
+ // private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
+ // checkPermission();
+ // s.defaultReadObject();
+ // _instantiated = true;
+ // }
+ //
+ // where XXXXX is the name of the remote interface
+
+ p.pln();
+ p.plnI("private transient boolean _instantiated = false;");
+ p.pln();
+ p.pO();
+ p.plnI("private static Void checkPermission() {");
+ p.plnI("SecurityManager sm = System.getSecurityManager();");
+ p.pln("if (sm != null) {");
+ p.pI();
+ p.plnI("sm.checkPermission(new SerializablePermission(");
+ p.plnI("\"enableSubclassImplementation\"));");
+ p.pO();
+ p.pO();
+ p.pOln("}");
+ p.pln("return null;");
+ p.pO();
+ p.pOln("}");
+ p.pln();
+ p.pO();
+
+ p.pI();
+ p.plnI("private " + currentClass + "(Void ignore) { }");
+ p.pln();
+ p.pO();
+
+ p.plnI("public " + currentClass + "() { ");
+ p.pln("this(checkPermission());");
+ p.pln("_instantiated = true;");
+ p.pOln("}");
+ p.pln();
+ p.plnI("private void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {");
+ p.plnI("checkPermission();");
+ p.pO();
+ p.pln("s.defaultReadObject();");
+ p.pln("_instantiated = true;");
+ p.pOln("}");
+ p.pln();
+ //p.pO();
+ }
+
+ if (!emitPermissionCheck) {
+ p.pI();
+ }
+
+ // Write the _ids() method...
+
+ p.plnI("public String[] _ids() { ");
+ p.pln("return (String[]) _type_ids.clone();");
+ p.pOln("}");
+
+ // Get all the methods and write each stub method...
+
+ CompoundType.Method[] remoteMethods = theType.getMethods();
+ int methodCount = remoteMethods.length;
+ if (methodCount > 0) {
+ boolean writeHeader = true;
+ for(int i = 0; i < methodCount; i++) {
+ if (!remoteMethods[i].isConstructor()) {
+ if (writeHeader) {
+ writeHeader = false;
+ }
+ p.pln();
+ writeStubMethod(p, remoteMethods[i], theType);
+ }
+ }
+ }
+
+ // Write the cast array hack...
+
+ writeCastArray(p);
+
+ p.pOln("}"); // end stub class
+ }
+
+ void addClassInUse(String qualifiedName) {
+ String unqualifiedName = qualifiedName;
+ String packageName = null;
+ int index = qualifiedName.lastIndexOf('.');
+ if (index > 0) {
+ unqualifiedName = qualifiedName.substring(index+1);
+ packageName = qualifiedName.substring(0,index);
+ }
+ addClassInUse(unqualifiedName,qualifiedName,packageName);
+ }
+
+ void addClassInUse(Type type) {
+ if (!type.isPrimitive()) {
+ Identifier id = type.getIdentifier();
+ String name = IDLNames.replace(id.getName().toString(),". ",".");
+ String packageName = type.getPackageName();
+ String qualifiedName;
+ if (packageName != null) {
+ qualifiedName = packageName+"."+name;
+ } else {
+ qualifiedName = name;
+ }
+ addClassInUse(name,qualifiedName,packageName);
+ }
+ }
+
+ void addClassInUse(Type[] types) {
+ for (int i = 0; i < types.length; i++) {
+ addClassInUse(types[i]);
+ }
+ }
+
+ void addStubInUse(Type type) {
+ if (type.getIdentifier() != idCorbaObject &&
+ type.isType(TYPE_CORBA_OBJECT)) {
+ String stubName = getStubNameFor(type,false);
+ String packageName = type.getPackageName();
+ String fullName;
+ if (packageName == null) {
+ fullName = stubName;
+ } else {
+ fullName = packageName + "." + stubName;
+ }
+ addClassInUse(stubName,fullName,packageName);
+ }
+ if (type.isType(TYPE_REMOTE) ||
+ type.isType(TYPE_JAVA_RMI_REMOTE)) {
+ addClassInUse("javax.rmi.PortableRemoteObject");
+ }
+ }
+
+ String getStubNameFor(Type type, boolean qualified) {
+ String stubName;
+ String className;
+ if (qualified) {
+ className = type.getQualifiedName();
+ } else {
+ className = type.getName();
+ }
+ if (((CompoundType)type).isCORBAObject()) {
+ stubName = Utility.idlStubName(className);
+ } else {
+ stubName = Utility.stubNameForCompiler(className);
+ }
+ return stubName;
+ }
+
+ void addStubInUse(Type[] types) {
+ for (int i = 0; i < types.length; i++) {
+ addStubInUse(types[i]);
+ }
+ }
+
+ private static final String NO_IMPORT = new String();
+
+ void addClassInUse(String unqualifiedName, String qualifiedName, String packageName) {
+
+ // Have we already got an entry for this qualifiedName?
+
+ String currentName = (String)classesInUse.get(qualifiedName);
+
+ if (currentName == null) {
+
+ // No, never seen it before. Grab any existing import
+ // name and then decide what to do...
+
+ String importName = (String) imports.get(unqualifiedName);
+ String nameToUse = null;
+
+ if (packageName == null) {
+
+ // Default package, so doesn't matter which name to use...
+
+ nameToUse = unqualifiedName;
+
+ } else if (packageName.equals("java.lang")) {
+
+ // java.lang.*, so use unqualified name...
+
+ nameToUse = unqualifiedName;
+
+ // unless you want to be able to import things from the right place :--)
+
+ if(nameToUse.endsWith("_Stub")) nameToUse = Util.packagePrefix()+qualifiedName;
+
+ } else if (currentPackage != null && packageName.equals(currentPackage)) {
+
+ // Class in currentPackage, so use unqualified name...
+
+ nameToUse = unqualifiedName;
+
+ // Do we already have a previous import under this
+ // unqualified name?
+
+ if (importName != null) {
+
+ // Yes, so we use qualifiedName...
+
+ nameToUse = qualifiedName;
+
+ }
+
+ } else if (importName != null) {
+
+ // It is in some package for which we normally
+ // would import, but we have a previous import
+ // under this unqualified name. We must use
+ // the qualified name...
+
+ nameToUse = qualifiedName;
+
+ /*
+ // Is the currentPackage the default package?
+
+ if (currentPackage == null) {
+
+ // Yes, so undo the import so that all
+ // uses for this name will be qualified...
+
+ String old = (String)imports.remove(unqualifiedName);
+ classesInUse.put(old,old);
+ importCount--;
+
+ // Note that this name is in use but should
+ // not be imported...
+
+ imports.put(nameToUse,NO_IMPORT);
+ }
+ */
+ } else if (qualifiedName.equals("org.omg.CORBA.Object")) {
+
+ // Always qualify this quy to avoid confusion...
+
+ nameToUse = qualifiedName;
+
+ } else {
+
+ // Default to using unqualified name, and add
+ // this guy to the imports...
+
+ // Check for nested class in which case we use
+ // the fully qualified name instead of imports
+ if (unqualifiedName.indexOf('.') != -1) {
+ nameToUse = qualifiedName;
+ } else {
+ nameToUse = unqualifiedName;
+ imports.put(unqualifiedName,qualifiedName);
+ importCount++;
+ }
+ }
+
+ // Now add the name...
+
+ classesInUse.put(qualifiedName,nameToUse);
+ }
+ }
+
+ String getName(Type type) {
+ if (type.isPrimitive()) {
+ return type.getName() + type.getArrayBrackets();
+ }
+ Identifier id = type.getIdentifier();
+ String name = IDLNames.replace(id.toString(),". ",".");
+ return getName(name) + type.getArrayBrackets();
+ }
+
+ // Added for Bug 4818753
+ String getExceptionName(Type type) {
+ Identifier id = type.getIdentifier();
+ return IDLNames.replace(id.toString(),". ",".");
+ }
+
+ String getName(String qualifiedName) {
+ return (String)classesInUse.get(qualifiedName);
+ }
+
+ String getName(Identifier id) {
+ return getName(id.toString());
+ }
+
+ String getStubName(Type type) {
+ String stubName = getStubNameFor(type,true);
+ return getName(stubName);
+ }
+
+ void setStandardClassesInUse(CompoundType type,
+ boolean stub) throws IOException {
+
+ // Reset our state...
+
+ currentPackage = type.getPackageName();
+ imports.clear();
+ classesInUse.clear();
+ namesInUse.clear();
+ importCount = 0;
+ castArray = false;
+
+ // Add the top-level type...
+
+ addClassInUse(type);
+
+ // Set current class name...
+
+ if (stub) {
+ currentClass = Utility.stubNameForCompiler(type.getName());
+ } else {
+ currentClass = Utility.tieNameForCompiler(type.getName());
+ }
+
+ // Add current class...
+
+ if (currentPackage == null) {
+ addClassInUse(currentClass,currentClass,currentPackage);
+ } else {
+ addClassInUse(currentClass,(currentPackage+"."+currentClass),currentPackage);
+ }
+
+ // Add standard classes...
+
+ addClassInUse("javax.rmi.CORBA.Util");
+ addClassInUse(idRemote.toString());
+ addClassInUse(idRemoteException.toString());
+ addClassInUse(idOutputStream.toString());
+ addClassInUse(idInputStream.toString());
+ addClassInUse(idSystemException.toString());
+ addClassInUse(idJavaIoSerializable.toString());
+ addClassInUse(idCorbaORB.toString());
+ addClassInUse(idReplyHandler.toString());
+
+ // Add stub/tie specific imports...
+
+ if (stub) {
+ addClassInUse(stubBaseClass);
+ addClassInUse("java.rmi.UnexpectedException");
+ addClassInUse(idRemarshalException.toString());
+ addClassInUse(idApplicationException.toString());
+ if (localStubs) {
+ addClassInUse("org.omg.CORBA.portable.ServantObject");
+ }
+ } else {
+ addClassInUse(type);
+ addClassInUse(tieBaseClass);
+ addClassInUse(idTieInterface.toString());
+ addClassInUse(idBadMethodException.toString());
+ addClassInUse(idPortableUnknownException.toString());
+ addClassInUse(idJavaLangThrowable.toString());
+ }
+ }
+
+ void addClassesInUse(CompoundType type, RemoteType[] interfaces) {
+
+ // Walk all methods and add types in use...
+
+ CompoundType.Method[] methods = type.getMethods();
+ for (int i = 0; i < methods.length; i++) {
+ addClassInUse(methods[i].getReturnType());
+ addStubInUse(methods[i].getReturnType());
+ addClassInUse(methods[i].getArguments());
+ addStubInUse(methods[i].getArguments());
+ addClassInUse(methods[i].getExceptions());
+ // bug 4473859: Also include narrower subtypes for use
+ addClassInUse(methods[i].getImplExceptions());
+ }
+
+ // If this is a stub, add all interfaces...
+
+ if (interfaces != null) {
+ addClassInUse(interfaces);
+ }
+ }
+
+ void writePackageAndImports(IndentingWriter p) throws IOException {
+
+ // Write package declaration...
+
+ if (currentPackage != null) {
+ p.pln("package " +
+ Util.correctPackageName(
+ currentPackage, false, standardPackage)
+ + ";");
+ p.pln();
+ }
+
+ // Get imports into an array and sort them...
+
+ String[] names = new String[importCount];
+ int index = 0;
+ for (Enumeration e = imports.elements() ; e.hasMoreElements() ;) {
+ String it = (String) e.nextElement();
+ if (it != NO_IMPORT) {
+ names[index++] = it;
+ }
+ }
+
+ Arrays.sort(names,new StringComparator());
+
+ // Now dump them out...
+
+ for (int i = 0; i < importCount; i++) {
+ if(
+ Util.isOffendingPackage(names[i])
+ && names[i].endsWith("_Stub")
+ && String.valueOf(names[i].charAt(names[i].lastIndexOf(".")+1)).equals("_")
+ ){
+ p.pln("import " + PackagePrefixChecker.packagePrefix()+names[i]+";");
+ } else{
+ p.pln("import " + names[i] + ";");
+ }
+ }
+ p.pln();
+
+ // Include offending packages . . .
+ if ( currentPackage!=null && Util.isOffendingPackage(currentPackage) ){
+ p.pln("import " + currentPackage +".* ;");
+ }
+ p.pln();
+
+ }
+
+ boolean implementsRemote(CompoundType theType) {
+ boolean result = theType.isType(TYPE_REMOTE) && !theType.isType(TYPE_ABSTRACT);
+
+ // If theType is not remote, look at all the interfaces
+ // until we find one that is...
+
+ if (!result) {
+ InterfaceType[] interfaces = theType.getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+ result = implementsRemote(interfaces[i]);
+ if (result) {
+ break;
+ }
+ }
+ }
+
+ return result;
+ }
+
+ void writeStubMethod ( IndentingWriter p,
+ CompoundType.Method method,
+ CompoundType theType) throws IOException {
+
+ // Wtite the method declaration and opening brace...
+ String methodName = method.getName();
+ String methodIDLName = method.getIDLName();
+
+ Type paramTypes[] = method.getArguments();
+ String paramNames[] = method.getArgumentNames();
+ Type returnType = method.getReturnType();
+ ValueType[] exceptions = getStubExceptions(method,false);
+ boolean hasIOException = false;
+
+ addNamesInUse(method);
+ addNameInUse("_type_ids");
+
+ String objName = testUtil(getName(returnType), returnType);
+ p.p("public " + objName + " " + methodName + "(");
+ for(int i = 0; i < paramTypes.length; i++) {
+ if (i > 0)
+ p.p(", ");
+ p.p(getName(paramTypes[i]) + " " + paramNames[i]);
+ }
+
+ p.p(")");
+ if (exceptions.length > 0) {
+ p.p(" throws ");
+ for(int i = 0; i < exceptions.length; i++) {
+ if (i > 0) {
+ p.p(", ");
+ }
+ // Added for Bug 4818753
+ p.p(getExceptionName(exceptions[i]));
+ }
+ }
+
+ p.plnI(" {");
+
+ // Now create the method body...
+ if (emitPermissionCheck) {
+ p.pln("if ((System.getSecurityManager() != null) && (!_instantiated)) {");
+ p.plnI(" throw new java.io.IOError(new java.io.IOException(\"InvalidObject \"));");
+ p.pOln("}");
+ p.pln();
+ }
+
+
+ if (localStubs) {
+ writeLocalStubMethodBody(p,method,theType);
+ } else {
+ writeNonLocalStubMethodBody(p,method,theType);
+ }
+
+ // Close out the method...
+
+ p.pOln("}");
+ }
+
+
+ void writeLocalStubMethodBody (IndentingWriter p,
+ CompoundType.Method method,
+ CompoundType theType) throws IOException {
+
+ String objName;
+ String paramNames[] = method.getArgumentNames();
+ Type returnType = method.getReturnType();
+ ValueType[] exceptions = getStubExceptions(method,false);
+ String methodName = method.getName();
+ String methodIDLName = method.getIDLName();
+
+ p.plnI("if (!Util.isLocal(this)) {");
+ writeNonLocalStubMethodBody(p,method,theType);
+ p.pOlnI("} else {");
+ String so = getVariableName("so");
+
+ p.pln("ServantObject "+so+" = _servant_preinvoke(\""+methodIDLName+"\","+getName(theType)+".class);");
+ p.plnI("if ("+so+" == null) {");
+ if (!returnType.isType(TYPE_VOID)) {
+ p.p("return ");
+ }
+ p.p(methodName+"(");
+ for (int i = 0; i < paramNames.length; i++) {
+ if (i > 0)
+ p.p(", ");
+ p.p(paramNames[i]);
+ }
+ p.pln(");");
+ if (returnType.isType(TYPE_VOID)) {
+ p.pln( "return ;" ) ;
+ }
+
+ p.pOln("}");
+ p.plnI("try {");
+
+ // Generate code to copy required arguments, and
+ // get back the names by which all arguments are known...
+
+ String[] argNames = writeCopyArguments(method,p);
+
+ // Now write the method...
+
+ boolean copyReturn = mustCopy(returnType);
+ String resultName = null;
+ if (!returnType.isType(TYPE_VOID)) {
+ if (copyReturn) {
+ resultName = getVariableName("result");
+ objName = testUtil(getName(returnType), returnType);
+ p.p(objName+" "+resultName + " = ");
+ } else {
+ p.p("return ");
+ }
+ }
+ objName = testUtil(getName(theType), theType);
+ p.p("(("+objName+")"+so+".servant)."+methodName+"(");
+
+ for (int i = 0; i < argNames.length; i++) {
+ if (i > 0)
+ p.p(", ");
+ p.p(argNames[i]);
+ }
+
+ if (copyReturn) {
+ p.pln(");");
+ objName = testUtil(getName(returnType), returnType);
+ p.pln("return ("+objName+")Util.copyObject("+resultName+",_orb());");
+ } else {
+ p.pln(");");
+ }
+
+ String e1 = getVariableName("ex");
+ String e2 = getVariableName("exCopy");
+ p.pOlnI("} catch (Throwable "+e1+") {");
+
+ p.pln("Throwable "+e2+" = (Throwable)Util.copyObject("+e1+",_orb());");
+ for(int i = 0; i < exceptions.length; i++) {
+ if (exceptions[i].getIdentifier() != idRemoteException &&
+ exceptions[i].isType(TYPE_VALUE)) {
+ // Added for Bug 4818753
+ p.plnI("if ("+e2+" instanceof "+getExceptionName(exceptions[i])+") {");
+ p.pln("throw ("+getExceptionName(exceptions[i])+")"+e2+";");
+ p.pOln("}");
+ }
+ }
+
+ p.pln("throw Util.wrapException("+e2+");");
+ p.pOlnI("} finally {");
+ p.pln("_servant_postinvoke("+so+");");
+ p.pOln("}");
+ p.pOln("}");
+ }
+
+
+ void writeNonLocalStubMethodBody ( IndentingWriter p,
+ CompoundType.Method method,
+ CompoundType theType) throws IOException {
+
+ String methodName = method.getName();
+ String methodIDLName = method.getIDLName();
+
+ Type paramTypes[] = method.getArguments();
+ String paramNames[] = method.getArgumentNames();
+ Type returnType = method.getReturnType();
+ ValueType[] exceptions = getStubExceptions(method,true);
+
+ String in = getVariableName("in");
+ String out = getVariableName("out");
+ String ex = getVariableName("ex");
+
+ // Decide if we need to use the new streams for
+ // any of the read calls...
+
+ boolean needNewReadStreamClass = false;
+ for (int i = 0; i < exceptions.length; i++) {
+ if (exceptions[i].getIdentifier() != idRemoteException &&
+ exceptions[i].isType(TYPE_VALUE) &&
+ needNewReadStreamClass(exceptions[i])) {
+ needNewReadStreamClass = true;
+ break;
+ }
+ }
+ if (!needNewReadStreamClass) {
+ for (int i = 0; i < paramTypes.length; i++) {
+ if (needNewReadStreamClass(paramTypes[i])) {
+ needNewReadStreamClass = true;
+ break;
+ }
+ }
+ }
+ if (!needNewReadStreamClass) {
+ needNewReadStreamClass = needNewReadStreamClass(returnType);
+ }
+
+ // Decide if we need to use the new streams for
+ // any of the write calls...
+
+ boolean needNewWriteStreamClass = false;
+ for (int i = 0; i < paramTypes.length; i++) {
+ if (needNewWriteStreamClass(paramTypes[i])) {
+ needNewWriteStreamClass = true;
+ break;
+ }
+ }
+
+ // Now write the method, inserting casts where needed...
+
+ p.plnI("try {");
+ if (needNewReadStreamClass) {
+ p.pln(idExtInputStream + " "+in+" = null;");
+ } else {
+ p.pln(idInputStream + " "+in+" = null;");
+ }
+ p.plnI("try {");
+
+ String argStream = "null";
+
+ if (needNewWriteStreamClass) {
+ p.plnI(idExtOutputStream + " "+out+" = ");
+ p.pln("(" + idExtOutputStream + ")");
+ p.pln("_request(\"" + methodIDLName + "\", true);");
+ p.pO();
+ } else {
+ p.pln("OutputStream "+out+" = _request(\"" + methodIDLName + "\", true);");
+ }
+
+ if (paramTypes.length > 0) {
+ writeMarshalArguments(p, out, paramTypes, paramNames);
+ p.pln();
+ }
+ argStream = out;
+
+ if (returnType.isType(TYPE_VOID)) {
+ p.pln("_invoke(" + argStream + ");" );
+ } else {
+ if (needNewReadStreamClass) {
+ p.plnI(in+" = (" + idExtInputStream + ")_invoke(" + argStream + ");");
+ p.pO();
+ } else {
+ p.pln(in+" = _invoke(" + argStream + ");");
+ }
+ p.p("return ");
+ writeUnmarshalArgument(p, in, returnType, null);
+ p.pln();
+ }
+
+ // Handle ApplicationException...
+
+ p.pOlnI("} catch ("+getName(idApplicationException)+" "+ex+") {");
+ if (needNewReadStreamClass) {
+ p.pln(in + " = (" + idExtInputStream + ") "+ex+".getInputStream();");
+ } else {
+ p.pln(in + " = "+ex+".getInputStream();");
+ }
+
+ boolean idRead = false;
+ boolean idAllocated = false;
+ for(int i = 0; i < exceptions.length; i++) {
+ if (exceptions[i].getIdentifier() != idRemoteException) {
+
+ // Is this our special-case IDLEntity exception?
+
+ if (exceptions[i].isIDLEntityException() && !exceptions[i].isCORBAUserException()) {
+
+ // Yes.
+
+ if (!idAllocated && !idRead) {
+ p.pln("String $_id = "+ex+".getId();");
+ idAllocated = true;
+ }
+
+ String helperName = IDLNames.replace(exceptions[i].getQualifiedIDLName(false),"::",".");
+ helperName += "Helper";
+ p.plnI("if ($_id.equals("+helperName+".id())) {");
+ p.pln("throw "+helperName+".read("+in+");");
+
+ } else {
+
+ // No.
+
+ if (!idAllocated && !idRead) {
+ p.pln("String $_id = "+in+".read_string();");
+ idAllocated = true;
+ idRead = true;
+ } else if (idAllocated && !idRead) {
+ p.pln("$_id = "+in+".read_string();");
+ idRead = true;
+ }
+ p.plnI("if ($_id.equals(\""+getExceptionRepositoryID(exceptions[i])+"\")) {");
+ // Added for Bug 4818753
+ p.pln("throw ("+getExceptionName(exceptions[i])+") "+in+".read_value(" + getExceptionName(exceptions[i]) + ".class);");
+ }
+ p.pOln("}");
+ }
+ }
+ if (!idAllocated && !idRead) {
+ p.pln("String $_id = "+in+".read_string();");
+ idAllocated = true;
+ idRead = true;
+ } else if (idAllocated && !idRead) {
+ p.pln("$_id = "+in+".read_string();");
+ idRead = true;
+ }
+ p.pln("throw new UnexpectedException($_id);");
+
+ // Handle RemarshalException...
+
+ p.pOlnI("} catch ("+getName(idRemarshalException)+" "+ex+") {");
+ if (!returnType.isType(TYPE_VOID)) {
+ p.p("return ");
+ }
+ p.p(methodName + "(");
+ for(int i = 0; i < paramTypes.length; i++) {
+ if (i > 0) {
+ p.p(",");
+ }
+ p.p(paramNames[i]);
+ }
+ p.pln(");");
+
+ // Ensure that we release the reply...
+
+ p.pOlnI("} finally {");
+ p.pln("_releaseReply("+in+");");
+
+ p.pOln("}");
+
+ // Handle SystemException...
+
+ p.pOlnI("} catch (SystemException "+ex+") {");
+ p.pln("throw Util.mapSystemException("+ex+");");
+ p.pOln("}");
+
+ // returnResult(p,returnType);
+ }
+
+ void allocateResult (IndentingWriter p,
+ Type returnType) throws IOException {
+ if (!returnType.isType(TYPE_VOID)) {
+ String objName = testUtil(getName(returnType), returnType);
+ p.p(objName + " result = ");
+ }
+ }
+
+ int getTypeCode(Type type) {
+
+ int typeCode = type.getTypeCode();
+
+ // Handle late-breaking special case for
+ // abstract IDL entities...
+
+ if ((type instanceof CompoundType) &&
+ ((CompoundType)type).isAbstractBase()) {
+ typeCode = TYPE_ABSTRACT;
+ }
+
+ return typeCode;
+ }
+
+
+ /**
+ * Write a snippet of Java code to marshal a value named "name" of
+ * type "type" to the java.io.ObjectOutput stream named "stream".
+ */
+ void writeMarshalArgument(IndentingWriter p,
+ String streamName,
+ Type type, String name) throws IOException {
+
+ int typeCode = getTypeCode(type);
+
+ switch (typeCode) {
+ case TYPE_BOOLEAN:
+ p.p(streamName + ".write_boolean(" + name + ");");
+ break;
+ case TYPE_BYTE:
+ p.p(streamName + ".write_octet(" + name + ");");
+ break;
+ case TYPE_CHAR:
+ p.p(streamName + ".write_wchar(" + name + ");");
+ break;
+ case TYPE_SHORT:
+ p.p(streamName + ".write_short(" + name + ");");
+ break;
+ case TYPE_INT:
+ p.p(streamName + ".write_long(" + name + ");");
+ break;
+ case TYPE_LONG:
+ p.p(streamName + ".write_longlong(" + name + ");");
+ break;
+ case TYPE_FLOAT:
+ p.p(streamName + ".write_float(" + name + ");");
+ break;
+ case TYPE_DOUBLE:
+ p.p(streamName + ".write_double(" + name + ");");
+ break;
+ case TYPE_STRING:
+ p.p(streamName + ".write_value(" + name + "," + getName(type) + ".class);");
+ break;
+ case TYPE_ANY:
+ p.p("Util.writeAny("+ streamName + "," + name + ");");
+ break;
+ case TYPE_CORBA_OBJECT:
+ p.p(streamName + ".write_Object(" + name + ");");
+ break;
+ case TYPE_REMOTE:
+ p.p("Util.writeRemoteObject("+ streamName + "," + name + ");");
+ break;
+ case TYPE_ABSTRACT:
+ p.p("Util.writeAbstractObject("+ streamName + "," + name + ");");
+ break;
+ case TYPE_NC_INTERFACE:
+ p.p(streamName + ".write_value((Serializable)" + name + "," + getName(type) + ".class);");
+ break;
+ case TYPE_VALUE:
+ p.p(streamName + ".write_value(" + name + "," + getName(type) + ".class);");
+ break;
+ case TYPE_IMPLEMENTATION:
+ p.p(streamName + ".write_value((Serializable)" + name + "," + getName(type) + ".class);");
+ break;
+ case TYPE_NC_CLASS:
+ p.p(streamName + ".write_value((Serializable)" + name + "," + getName(type) + ".class);");
+ break;
+ case TYPE_ARRAY:
+ castArray = true;
+ p.p(streamName + ".write_value(cast_array(" + name + ")," + getName(type) + ".class);");
+ break;
+ case TYPE_JAVA_RMI_REMOTE:
+ p.p("Util.writeRemoteObject("+ streamName + "," + name + ");");
+ break;
+ default:
+ throw new Error("unexpected type code: " + typeCode);
+ }
+ }
+
+ /**
+ * Write a snippet of Java code to unmarshal a value of type "type"
+ * from the java.io.ObjectInput stream named "stream" into a variable
+ * named "name" (if "name" is null, the value in unmarshalled and
+ * discarded).
+ */
+ void writeUnmarshalArgument(IndentingWriter p,
+ String streamName,
+ Type type,
+ String name) throws IOException {
+
+ int typeCode = getTypeCode(type);
+
+ if (name != null) {
+ p.p(name + " = ");
+ }
+
+ switch (typeCode) {
+ case TYPE_BOOLEAN:
+ p.p(streamName + ".read_boolean();");
+ break;
+ case TYPE_BYTE:
+ p.p(streamName + ".read_octet();");
+ break;
+ case TYPE_CHAR:
+ p.p(streamName + ".read_wchar();");
+ break;
+ case TYPE_SHORT:
+ p.p(streamName + ".read_short();");
+ break;
+ case TYPE_INT:
+ p.p(streamName + ".read_long();");
+ break;
+ case TYPE_LONG:
+ p.p(streamName + ".read_longlong();");
+ break;
+ case TYPE_FLOAT:
+ p.p(streamName + ".read_float();");
+ break;
+ case TYPE_DOUBLE:
+ p.p(streamName + ".read_double();");
+ break;
+ case TYPE_STRING:
+ p.p("(String) " + streamName + ".read_value(" + getName(type) + ".class);");
+ break;
+ case TYPE_ANY:
+ if (type.getIdentifier() != idJavaLangObject) {
+ p.p("(" + getName(type) + ") ");
+ }
+ p.p("Util.readAny(" + streamName + ");");
+ break;
+ case TYPE_CORBA_OBJECT:
+ if (type.getIdentifier() == idCorbaObject) {
+ p.p("(" + getName(type) + ") " + streamName + ".read_Object();");
+ } else {
+ p.p("(" + getName(type) + ") " + streamName + ".read_Object(" + getStubName(type) + ".class);");
+ }
+ break;
+ case TYPE_REMOTE:
+ String objName = testUtil(getName(type), type);
+ p.p("(" + objName + ") " +
+ "PortableRemoteObject.narrow(" + streamName + ".read_Object(), " + objName + ".class);");
+ break;
+ case TYPE_ABSTRACT:
+ p.p("(" + getName(type) + ") " + streamName + ".read_abstract_interface();");
+ break;
+ case TYPE_NC_INTERFACE:
+ p.p("(" + getName(type) + ") " + streamName + ".read_value(" + getName(type) + ".class);");
+ break;
+ case TYPE_VALUE:
+ p.p("(" + getName(type) + ") " + streamName + ".read_value(" + getName(type) + ".class);");
+ break;
+ case TYPE_IMPLEMENTATION:
+ p.p("(" + getName(type) + ") " + streamName + ".read_value(" + getName(type) + ".class);");
+ break;
+ case TYPE_NC_CLASS:
+ p.p("(" + getName(type) + ") " + streamName + ".read_value(" + getName(type) + ".class);");
+ break;
+ case TYPE_ARRAY:
+ p.p("(" + getName(type) + ") " + streamName + ".read_value(" + getName(type) + ".class);");
+ break;
+ case TYPE_JAVA_RMI_REMOTE:
+ p.p("(" + getName(type) + ") " +
+ "PortableRemoteObject.narrow(" + streamName + ".read_Object(), " + getName(type) + ".class);");
+ // p.p("(" + getName(type) + ") " + streamName + ".read_Object(" + getStubName(type) + ".class);");
+ break;
+ default:
+ throw new Error("unexpected type code: " + typeCode);
+ }
+ }
+
+ /**
+ * Get a list of all the RepositoryIDs for interfaces
+ * implemented directly or indirectly by theType. In the
+ * case of an ImplementationType which implements 2 or
+ * more remote interfaces, this list will begin with the
+ * Identifier for the implementation (see section 5.9 in
+ * the Java -> IDL mapping). Ensures that the most derived
+ * type is first in the list because the IOR is generated
+ * using that entry in the _ids array.
+ */
+ String[] getAllRemoteRepIDs (CompoundType theType) {
+
+ String[] result;
+
+ // Collect up all the (inherited) remote interfaces
+ // (ignores all the 'special' interfaces: Remote,
+ // Serializable, Externalizable)...
+
+ Type[] types = collectAllRemoteInterfaces(theType);
+
+ int length = types.length;
+ boolean haveImpl = theType instanceof ImplementationType;
+ InterfaceType[] interfaces = theType.getInterfaces();
+ int remoteCount = countRemote(interfaces,false);
+ int offset = 0;
+
+ // Do we have an implementation type that implements
+ // more than one remote interface?
+
+ if (haveImpl && remoteCount > 1) {
+
+ // Yes, so we need to insert it at the beginning...
+
+ result = new String[length + 1];
+ result[0] = getRepositoryID(theType);
+ offset = 1;
+
+ } else {
+
+ // No.
+
+ result = new String[length];
+
+ // Here we need to ensure that the most derived
+ // interface ends up being first in the list. If
+ // there is only one, we're done.
+
+ if (length > 1) {
+
+ // First, decide what the most derived type is...
+
+ String mostDerived = null;
+
+ if (haveImpl) {
+
+ // If we get here, we know that there is only one
+ // direct remote interface, so just find it...
+
+ for (int i = 0; i < interfaces.length; i++) {
+ if (interfaces[i].isType(TYPE_REMOTE)) {
+ mostDerived = interfaces[i].getRepositoryID();
+ break;
+ }
+ }
+ } else {
+
+ // If we get here we know that theType is a RemoteType
+ // so just use its id...
+
+ mostDerived = theType.getRepositoryID();
+ }
+
+ // Now search types list and make sure mostDerived is
+ // at index zero...
+
+ for (int i = 0; i < length; i++) {
+ if (types[i].getRepositoryID() == mostDerived) {
+
+ // Found it. Swap it if we need to...
+
+ if (i > 0) {
+ Type temp = types[0];
+ types[0] = types[i];
+ types[i] = temp;
+ }
+
+ break;
+ }
+ }
+ }
+ }
+
+ // Now copy contents of the types array...
+
+ for (int i = 0; i < types.length; i++) {
+ result[offset++] = getRepositoryID(types[i]);
+ }
+
+ // If we're supposed to, reverse the array. This
+ // is only done when the -testReverseIDs flag is
+ // passed, and that should ONLY be done for test
+ // cases. This is an undocumented feature.
+
+ if (reverseIDs) {
+ int start = 0;
+ int end = result.length -1;
+ while (start < end) {
+ String temp = result[start];
+ result[start++] = result[end];
+ result[end--] = temp;
+ }
+ }
+
+ return result;
+ }
+
+ /**
+ * Collect all the inherited remote interfaces.
+ */
+ Type[] collectAllRemoteInterfaces (CompoundType theType) {
+ Vector list = new Vector();
+
+ // Collect up all the Remote interfaces, and get an instance
+ // for java.rmi.Remote...
+
+ addRemoteInterfaces(list,theType);
+
+ // Create and return our results...
+
+ Type[] result = new Type[list.size()];
+ list.copyInto(result);
+
+ return result;
+ }
+
+ /**
+ * Add all the inherited remote interfaces to list.
+ */
+ void addRemoteInterfaces(Vector list, CompoundType theType) {
+
+ if (theType != null) {
+ if (theType.isInterface() && !list.contains(theType)) {
+ list.addElement(theType);
+ }
+
+ InterfaceType[] interfaces = theType.getInterfaces();
+ for (int i = 0; i < interfaces.length; i++) {
+
+ if (interfaces[i].isType(TYPE_REMOTE)) {
+ addRemoteInterfaces(list,interfaces[i]);
+ }
+ }
+
+ addRemoteInterfaces(list,theType.getSuperclass());
+ }
+ }
+
+ /**
+ * Get a list of all the remote interfaces which this stub
+ * should declare.
+ */
+ RemoteType[] getDirectRemoteInterfaces (CompoundType theType) {
+
+ RemoteType[] result;
+ InterfaceType[] interfaces = theType.getInterfaces();
+
+ // First, get a list of all the interfaces...
+
+ InterfaceType[] list;
+
+ // Because we can be passed either an ImplementationType
+ // (which has interfaces) or a RemoteType (which is an
+ // interface and may have interfaces) we must handle each
+ // separately...
+
+ // Do we have an implementation type?
+
+ if (theType instanceof ImplementationType) {
+
+ // Yes, so list is exactly what this type
+ // implements and is correct already.
+
+ list = interfaces;
+
+ } else {
+
+ // No, so list is just theType...
+
+ list = new InterfaceType[1];
+ list[0] = (InterfaceType) theType;
+ }
+
+ // Ok, now count up the remote interfaces, allocate
+ // our result and fill it in...
+
+ int remoteCount = countRemote(list,false);
+
+ if (remoteCount == 0) {
+ throw new CompilerError("iiop.StubGenerator: No remote interfaces!");
+ }
+
+ result = new RemoteType[remoteCount];
+ int offset = 0;
+ for (int i = 0; i < list.length; i++) {
+ if (list[i].isType(TYPE_REMOTE)) {
+ result[offset++] = (RemoteType)list[i];
+ }
+ }
+
+ return result;
+ }
+
+ int countRemote (Type[] list, boolean includeAbstract) {
+ int remoteCount = 0;
+ for (int i = 0; i < list.length; i++) {
+ if (list[i].isType(TYPE_REMOTE) &&
+ (includeAbstract || !list[i].isType(TYPE_ABSTRACT))) {
+ remoteCount++;
+ }
+ }
+
+ return remoteCount;
+ }
+
+ void writeCastArray(IndentingWriter p) throws IOException {
+ if (castArray) {
+ p.pln();
+ p.pln("// This method is required as a work-around for");
+ p.pln("// a bug in the JDK 1.1.6 verifier.");
+ p.pln();
+ p.plnI("private "+getName(idJavaIoSerializable)+" cast_array(Object obj) {");
+ p.pln("return ("+getName(idJavaIoSerializable)+")obj;");
+ p.pOln("}");
+ }
+ }
+ void writeIds(IndentingWriter p, CompoundType theType, boolean isTie
+ ) throws IOException {
+ p.plnI("private static final String[] _type_ids = {");
+
+ String[] ids = getAllRemoteRepIDs(theType);
+
+ if (ids.length >0 ) {
+ for(int i = 0; i < ids.length; i++) {
+ if (i > 0)
+ p.pln(", ");
+ p.p("\"" + ids[i] + "\"");
+ }
+ } else {
+ // Must be an implementation which only implements Remote...
+ p.pln("\"\"");
+ }
+ String qname = theType.getQualifiedName() ;
+ boolean isTransactional = isTie && transactionalObjects.containsKey( qname ) ;
+ // Add TransactionalObject if needed.
+ if (isTransactional) {
+ // Have already written an id.
+ p.pln( ", " ) ;
+ p.pln( "\"IDL:omg.org/CosTransactions/TransactionalObject:1.0\"" ) ;
+ } else if (ids.length > 0) {
+ p.pln();
+ }
+ p.pOln("};");
+ }
+
+
+ /**
+ * Write the Tie for the remote class to a stream.
+ */
+ protected void writeTie(OutputType outputType,
+ IndentingWriter p) throws IOException
+ {
+ CompoundType theType = (CompoundType) outputType.getType();
+ RemoteType[] remoteInterfaces = null;
+
+ // Write comment...
+ p.pln("// Tie class generated by rmic, do not edit.");
+ p.pln("// Contents subject to change without notice.");
+ p.pln();
+
+ // Set our standard classes...
+ setStandardClassesInUse(theType,false);
+
+ // Add classes for this type...
+ addClassesInUse(theType,remoteInterfaces);
+
+ // Write package and import statements...
+ writePackageAndImports(p);
+
+ // Declare the tie class.
+ p.p("public class " + currentClass + " extends " +
+ getName(tieBaseClass) + " implements Tie");
+
+ // Add java.rmi.Remote if this type does not implement it.
+ // This allows stubs for Abstract interfaces to be treated
+ // uniformly...
+ if (!implementsRemote(theType)) {
+ p.pln(",");
+ p.p(getName("java.rmi.Remote"));
+ }
+
+ p.plnI(" {");
+
+ // Write data members...
+ p.pln();
+ p.pln("volatile private " + getName(theType) + " target = null;");
+ p.pln();
+
+ // Write the ids...
+ writeIds( p, theType, true ) ;
+
+ // Write setTarget method...
+ p.pln();
+ p.plnI("public void setTarget(Remote target) {");
+ p.pln("this.target = (" + getName(theType) + ") target;");
+ p.pOln("}");
+
+ // Write getTarget method...
+ p.pln();
+ p.plnI("public Remote getTarget() {");
+ p.pln("return target;");
+ p.pOln("}");
+
+ // Write thisObject method...
+ p.pln();
+ write_tie_thisObject_method(p,idCorbaObject);
+
+ // Write deactivate method...
+ p.pln();
+ write_tie_deactivate_method(p);
+
+ // Write get orb method...
+ p.pln();
+ p.plnI("public ORB orb() {");
+ p.pln("return _orb();");
+ p.pOln("}");
+
+ // Write set orb method...
+ p.pln();
+ write_tie_orb_method(p);
+
+ // Write the _ids() method...
+ p.pln();
+ write_tie__ids_method(p);
+
+ // Get all the methods...
+ CompoundType.Method[] remoteMethods = theType.getMethods();
+
+ // Register all the argument names used, plus our
+ // data member names...
+
+ addNamesInUse(remoteMethods);
+ addNameInUse("target");
+ addNameInUse("_type_ids");
+
+ // Write the _invoke method...
+ p.pln();
+
+ String in = getVariableName("in");
+ String _in = getVariableName("_in");
+ String ex = getVariableName("ex");
+ String method = getVariableName("method");
+ String reply = getVariableName("reply");
+
+ p.plnI("public OutputStream _invoke(String "+method+", InputStream "+_in+", " +
+ "ResponseHandler "+reply+") throws SystemException {");
+
+ if (remoteMethods.length > 0) {
+ p.plnI("try {");
+ p.pln(getName(theType) + " target = this.target;");
+ p.plnI("if (target == null) {");
+ p.pln("throw new java.io.IOException();");
+ p.pOln("}");
+ p.plnI(idExtInputStream + " "+in+" = ");
+ p.pln("(" + idExtInputStream + ") "+_in+";");
+ p.pO();
+
+ // See if we should use a hash table style
+ // comparison...
+
+ StaticStringsHash hash = getStringsHash(remoteMethods);
+
+ if (hash != null) {
+ p.plnI("switch ("+method+"."+hash.method+") {");
+ for (int i = 0; i < hash.buckets.length; i++) {
+ p.plnI("case "+hash.keys[i]+": ");
+ for (int j = 0; j < hash.buckets[i].length; j++) {
+ CompoundType.Method current = remoteMethods[hash.buckets[i][j]];
+ if (j > 0) {
+ p.pO("} else ");
+ }
+ p.plnI("if ("+method+".equals(\""+ current.getIDLName() +"\")) {");
+ writeTieMethod(p, theType,current);
+ }
+ p.pOln("}");
+ p.pO();
+ }
+ } else {
+ for(int i = 0; i < remoteMethods.length; i++) {
+ CompoundType.Method current = remoteMethods[i];
+ if (i > 0) {
+ p.pO("} else ");
+ }
+
+ p.plnI("if ("+method+".equals(\""+ current.getIDLName() +"\")) {");
+ writeTieMethod(p, theType, current);
+ }
+ }
+
+ if (hash != null) {
+ p.pI();
+ // p.plnI("default:");
+ } else {
+ // p.pOlnI("} else {");
+ }
+ // p.pln("throw new "+getName(idBadMethodException)+"();");
+
+ if (hash != null) {
+ p.pO();
+ }
+ p.pOln("}");
+ p.pln("throw new "+getName(idBadMethodException)+"();");
+
+ p.pOlnI("} catch ("+getName(idSystemException)+" "+ex+") {");
+ p.pln("throw "+ex+";");
+
+ p.pOlnI("} catch ("+getName(idJavaLangThrowable)+" "+ex+") {");
+ p.pln("throw new " + getName(idPortableUnknownException) + "("+ex+");");
+ p.pOln("}");
+ } else {
+ // No methods...
+
+ p.pln("throw new " + getName(idBadMethodException) + "();");
+ }
+
+ p.pOln("}"); // end invoke
+
+ // Write the cast array hack...
+
+ writeCastArray(p);
+
+ // End tie class...
+ p.pOln("}");
+ }
+ public void catchWrongPolicy(IndentingWriter p) throws IOException {
+ p.pln("");
+ }
+ public void catchServantNotActive(IndentingWriter p) throws IOException {
+ p.pln("");
+ }
+ public void catchObjectNotActive(IndentingWriter p) throws IOException {
+ p.pln("");
+ }
+
+ public void write_tie_thisObject_method(IndentingWriter p,
+ Identifier idCorbaObject)
+ throws IOException
+ {
+ if(POATie){
+ p.plnI("public " + idCorbaObject + " thisObject() {");
+ /*
+ p.pln("org.omg.CORBA.Object objref = null;");
+ p.pln("try{");
+ p.pln("objref = _poa().servant_to_reference(this);");
+ p.pln("}catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){");
+ catchWrongPolicy(p);
+ p.pln("}catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){");
+ catchServantNotActive(p);
+ p.pln("}");
+ p.pln("return objref;");
+ */
+ p.pln("return _this_object();");
+ p.pOln("}");
+ } else {
+ p.plnI("public " + idCorbaObject + " thisObject() {");
+ p.pln("return this;");
+ p.pOln("}");
+ }
+ }
+
+ public void write_tie_deactivate_method(IndentingWriter p)
+ throws IOException
+ {
+ if(POATie){
+ p.plnI("public void deactivate() {");
+ p.pln("try{");
+ p.pln("_poa().deactivate_object(_poa().servant_to_id(this));");
+ p.pln("}catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){");
+ catchWrongPolicy(p);
+ p.pln("}catch (org.omg.PortableServer.POAPackage.ObjectNotActive exception){");
+ catchObjectNotActive(p);
+ p.pln("}catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){");
+ catchServantNotActive(p);
+ p.pln("}");
+ p.pOln("}");
+ } else {
+ p.plnI("public void deactivate() {");
+ p.pln("_orb().disconnect(this);");
+ p.pln("_set_delegate(null);");
+ p.pln("target = null;");
+ p.pOln("}");
+ }
+ }
+
+ public void write_tie_orb_method(IndentingWriter p)
+ throws IOException
+ {
+ if(POATie){
+ p.plnI("public void orb(ORB orb) {");
+ /*
+ p.pln("try{");
+ p.pln("orb.connect(_poa().servant_to_reference(this));");
+ p.pln("}catch (org.omg.PortableServer.POAPackage.WrongPolicy exception){");
+ catchWrongPolicy(p);
+ p.pln("}catch (org.omg.PortableServer.POAPackage.ServantNotActive exception){");
+ catchServantNotActive(p);
+ p.pln("}");
+ */
+ p.pln("try {");
+ p.pln(" ((org.omg.CORBA_2_3.ORB)orb).set_delegate(this);");
+ p.pln("}");
+ p.pln("catch(ClassCastException e) {");
+ p.pln(" throw new org.omg.CORBA.BAD_PARAM");
+ p.pln(" (\"POA Servant requires an instance of org.omg.CORBA_2_3.ORB\");");
+ p.pln("}");
+ p.pOln("}");
+ } else {
+ p.plnI("public void orb(ORB orb) {");
+ p.pln("orb.connect(this);");
+ p.pOln("}");
+ }
+ }
+
+ public void write_tie__ids_method(IndentingWriter p)
+ throws IOException
+ {
+ if(POATie){
+ p.plnI("public String[] _all_interfaces(org.omg.PortableServer.POA poa, byte[] objectId){");
+ p.pln("return (String[]) _type_ids.clone();");
+ p.pOln("}");
+ } else {
+ p.plnI("public String[] _ids() { ");
+ p.pln("return (String[]) _type_ids.clone();");
+ p.pOln("}");
+ }
+ }
+
+
+ StaticStringsHash getStringsHash (CompoundType.Method[] methods) {
+ if (useHash && methods.length > 1) {
+ String[] methodNames = new String[methods.length];
+ for (int i = 0; i < methodNames.length; i++) {
+ methodNames[i] = methods[i].getIDLName();
+ }
+ return new StaticStringsHash(methodNames);
+ }
+ return null;
+ }
+
+ static boolean needNewReadStreamClass(Type type) {
+ if (type.isType(TYPE_ABSTRACT)) {
+ return true;
+ }
+ // Handle late-breaking special case for
+ // abstract IDL entities...
+ if ((type instanceof CompoundType) &&
+ ((CompoundType)type).isAbstractBase()) {
+ return true;
+ }
+ return needNewWriteStreamClass(type);
+ }
+
+ static boolean needNewWriteStreamClass(Type type) {
+ switch (type.getTypeCode()) {
+ case TYPE_VOID:
+ case TYPE_BOOLEAN:
+ case TYPE_BYTE:
+ case TYPE_CHAR:
+ case TYPE_SHORT:
+ case TYPE_INT:
+ case TYPE_LONG:
+ case TYPE_FLOAT:
+ case TYPE_DOUBLE: return false;
+
+ case TYPE_STRING: return true;
+ case TYPE_ANY: return false;
+ case TYPE_CORBA_OBJECT: return false;
+ case TYPE_REMOTE: return false;
+ case TYPE_ABSTRACT: return false;
+ case TYPE_NC_INTERFACE: return true;
+ case TYPE_VALUE: return true;
+ case TYPE_IMPLEMENTATION: return true;
+ case TYPE_NC_CLASS: return true;
+ case TYPE_ARRAY: return true;
+ case TYPE_JAVA_RMI_REMOTE: return false;
+
+ default: throw new Error("unexpected type code: " + type.getTypeCode());
+ }
+ }
+
+ /*
+ * Decide which arguments need to be copied and write
+ * the copy code. Returns an array of argument names to
+ * use to refer to either the copy or the original.
+ */
+ String[] writeCopyArguments(CompoundType.Method method,
+ IndentingWriter p) throws IOException {
+
+ Type[] args = method.getArguments();
+ String[] origNames = method.getArgumentNames();
+
+ // Copy the current parameter names to a result array...
+
+ String[] result = new String[origNames.length];
+ for (int i = 0; i < result.length; i++) {
+ result[i] = origNames[i];
+ }
+
+ // Decide which arguments must be copied, if any. If
+ // any of the arguments are types for which a 'real' copy
+ // will be done, rather than just an autoConnect, set
+ // realCopy = true. Note that abstract types may only
+ // need autoConnect, but we cannot know that at compile
+ // time...
+
+ boolean realCopy = false;
+ boolean[] copyArg = new boolean[args.length];
+ int copyCount = 0;
+ int firstCopiedArg = 0; // Only used in single copy case. It is only the first arg that
+ // needs copying IF copyCount == 1.
+
+ for (int i = 0; i < args.length; i++) {
+ if (mustCopy(args[i])) {
+ copyArg[i] = true;
+ copyCount++;
+ firstCopiedArg = i;
+ if (args[i].getTypeCode() != TYPE_REMOTE &&
+ args[i].getTypeCode() != TYPE_IMPLEMENTATION) {
+ realCopy = true;
+ }
+ } else {
+ copyArg[i] = false;
+ }
+ }
+
+ // Do we have any types which must be copied?
+ if (copyCount > 0) {
+ // Yes. Are we only doing the copy to ensure
+ // that autoConnect occurs?
+ if (realCopy) {
+ // Nope. We need to go back thru the list and
+ // mark any strings so that they will be copied
+ // to preserve any shared references...
+ for (int i = 0; i < args.length; i++) {
+ if (args[i].getTypeCode() == TYPE_STRING) {
+ copyArg[i] = true;
+ copyCount++;
+ }
+ }
+ }
+
+ // We're ready to generate code. Do we have more than
+ // one to copy?
+ if (copyCount > 1) {
+ // Generate a call to copyObjects...
+ String arrayName = getVariableName("copies");
+ p.p("Object[] " + arrayName + " = Util.copyObjects(new Object[]{");
+ boolean first = true;
+ for (int i = 0; i < args.length; i++) {
+ if (copyArg[i]) {
+ if (!first) {
+ p.p(",");
+ }
+ first = false;
+ p.p(origNames[i]);
+ }
+ }
+ p.pln("},_orb());");
+
+ // For each of the types which was copied, create
+ // a local temporary for it, updating the result
+ // array with the new local parameter name...
+ int copyIndex = 0 ;
+ for (int i = 0; i < args.length; i++) {
+ if (copyArg[i]) {
+ result[i] = getVariableName(result[i]+"Copy");
+ p.pln( getName(args[i]) + " " + result[i] + " = (" + getName(args[i]) + ") " +
+ arrayName + "[" + copyIndex++ +"];");
+ }
+ }
+ } else {
+ // Generate a call to copyObject, updating the result
+ // with the new local parameter name...
+ result[firstCopiedArg] = getVariableName(result[firstCopiedArg]+"Copy");
+ p.pln( getName(args[firstCopiedArg]) + " " + result[firstCopiedArg] + " = (" +
+ getName(args[firstCopiedArg]) + ") Util.copyObject(" +
+ origNames[firstCopiedArg] + ",_orb());");
+ }
+ }
+
+ return result;
+ }
+
+ static final String SINGLE_SLASH = "\\";
+ static final String DOUBLE_SLASH = SINGLE_SLASH + SINGLE_SLASH;
+
+ String getRepositoryID(Type type) {
+ return IDLNames.replace(type.getRepositoryID(), SINGLE_SLASH, DOUBLE_SLASH);
+ }
+
+ String getExceptionRepositoryID(Type type) {
+ ClassType theType = (ClassType) type;
+ return IDLNames.getIDLRepositoryID(theType.getQualifiedIDLExceptionName(false));
+ }
+
+ String getVariableName(String proposed) {
+ while (namesInUse.contains(proposed)) {
+ proposed = "$" + proposed;
+ }
+
+ return proposed;
+ }
+
+ void addNamesInUse(CompoundType.Method[] methods) {
+ for (int i = 0; i < methods.length; i++) {
+ addNamesInUse(methods[i]);
+ }
+ }
+
+ void addNamesInUse(CompoundType.Method method) {
+ String paramNames[] = method.getArgumentNames();
+ for (int i = 0; i < paramNames.length; i++) {
+ addNameInUse(paramNames[i]);
+ }
+ }
+
+ void addNameInUse(String name) {
+ namesInUse.add(name);
+ }
+
+ static boolean mustCopy(Type type) {
+ switch (type.getTypeCode()) {
+ case TYPE_VOID:
+ case TYPE_BOOLEAN:
+ case TYPE_BYTE:
+ case TYPE_CHAR:
+ case TYPE_SHORT:
+ case TYPE_INT:
+ case TYPE_LONG:
+ case TYPE_FLOAT:
+ case TYPE_DOUBLE:
+ case TYPE_STRING: return false;
+
+ case TYPE_ANY: return true;
+
+ case TYPE_CORBA_OBJECT: return false;
+
+ case TYPE_REMOTE:
+ case TYPE_ABSTRACT:
+ case TYPE_NC_INTERFACE:
+ case TYPE_VALUE:
+ case TYPE_IMPLEMENTATION:
+ case TYPE_NC_CLASS:
+ case TYPE_ARRAY:
+ case TYPE_JAVA_RMI_REMOTE: return true;
+
+ default: throw new Error("unexpected type code: " + type.getTypeCode());
+ }
+ }
+
+ ValueType[] getStubExceptions (CompoundType.Method method, boolean sort) {
+
+ ValueType[] list = method.getFilteredStubExceptions(method.getExceptions());
+
+ // Sort the list so that all org.omg.CORBA.UserException
+ // subtypes are at the beginning of the list. This ensures
+ // that the stub will not call read_string() before calling
+ // XXHelper.read().
+
+ if (sort) {
+ Arrays.sort(list,new UserExceptionComparator());
+ }
+
+ return list;
+ }
+
+ ValueType[] getTieExceptions (CompoundType.Method method) {
+ return method.getUniqueCatchList(method.getImplExceptions());
+ }
+
+ void writeTieMethod(IndentingWriter p, CompoundType type,
+ CompoundType.Method method) throws IOException {
+ String methodName = method.getName();
+ Type paramTypes[] = method.getArguments();
+ String paramNames[] = method.getArgumentNames();
+ Type returnType = method.getReturnType();
+ ValueType[] exceptions = getTieExceptions(method);
+ String in = getVariableName("in");
+ String ex = getVariableName("ex");
+ String out = getVariableName("out");
+ String reply = getVariableName("reply");
+
+ for (int i = 0; i < paramTypes.length; i++) {
+ p.p(getName(paramTypes[i])+" "+paramNames[i]+" = ");
+ writeUnmarshalArgument(p, in, paramTypes[i], null);
+ p.pln();
+ }
+
+ boolean handleExceptions = exceptions != null;
+ boolean doReturn = !returnType.isType(TYPE_VOID);
+
+ if (handleExceptions && doReturn) {
+ String objName = testUtil(getName(returnType), returnType);
+ p.pln(objName+" result;");
+ }
+
+ if (handleExceptions)
+ p.plnI("try {");
+
+ if (doReturn) {
+ if (handleExceptions) {
+ p.p("result = ");
+ } else {
+ p.p(getName(returnType)+" result = ");
+ }
+ }
+
+ p.p("target."+methodName+"(");
+ for(int i = 0; i < paramNames.length; i++) {
+ if (i > 0)
+ p.p(", ");
+ p.p(paramNames[i]);
+ }
+ p.pln(");");
+
+ if (handleExceptions) {
+ for(int i = 0; i < exceptions.length; i++) {
+ p.pOlnI("} catch ("+getName(exceptions[i])+" "+ex+") {");
+
+ // Is this our IDLEntity Exception special case?
+
+ if (exceptions[i].isIDLEntityException() && !exceptions[i].isCORBAUserException()) {
+
+ // Yes...
+
+ String helperName = IDLNames.replace(exceptions[i].getQualifiedIDLName(false),"::",".");
+ helperName += "Helper";
+ p.pln(idOutputStream+" "+out +" = "+reply+".createExceptionReply();");
+ p.pln(helperName+".write("+out+","+ex+");");
+
+ } else {
+
+ // No...
+
+ p.pln("String id = \"" + getExceptionRepositoryID(exceptions[i]) + "\";");
+ p.plnI(idExtOutputStream + " "+out+" = ");
+ p.pln("(" + idExtOutputStream + ") "+reply+".createExceptionReply();");
+ p.pOln(out+".write_string(id);");
+ p.pln(out+".write_value("+ex+"," + getName(exceptions[i]) + ".class);");
+ }
+
+ p.pln("return "+out+";");
+ }
+ p.pOln("}");
+ }
+
+ if (needNewWriteStreamClass(returnType)) {
+ p.plnI(idExtOutputStream + " "+out+" = ");
+ p.pln("(" + idExtOutputStream + ") "+reply+".createReply();");
+ p.pO();
+ } else {
+ p.pln("OutputStream "+out+" = "+reply+".createReply();");
+ }
+
+ if (doReturn) {
+ writeMarshalArgument(p, out, returnType, "result");
+ p.pln();
+ }
+
+ p.pln("return "+out+";");
+ }
+
+
+ /**
+ * Write Java statements to marshal a series of values in order as
+ * named in the "names" array, with types as specified in the "types"
+ * array", to the java.io.ObjectOutput stream named "stream".
+ */
+ void writeMarshalArguments(IndentingWriter p,
+ String streamName,
+ Type[] types, String[] names)
+ throws IOException
+ {
+ if (types.length != names.length) {
+ throw new Error("paramter type and name arrays different sizes");
+ }
+
+ for (int i = 0; i < types.length; i++) {
+ writeMarshalArgument(p, streamName, types[i], names[i]);
+ if (i != types.length -1) {
+ p.pln();
+ }
+ }
+ }
+
+ /**
+ * Added for IASRI 4987274. Remote classes named "Util" were
+ * getting confused with javax.rmi.CORBA.Util and the
+ * unqualifiedName "Util".
+ */
+ String testUtil(String objectName, Type ttype) {
+ if (objectName.equals("Util")) {
+ String correctedName = (String)ttype.getPackageName() + "." + objectName;
+ return correctedName;
+ } else {
+ return objectName;
+ }
+ }
+}
+
+class StringComparator implements java.util.Comparator {
+ public int compare(Object o1, Object o2) {
+ String s1 = (String)o1;
+ String s2 = (String)o2;
+ return s1.compareTo(s2);
+ }
+}
+
+
+class UserExceptionComparator implements java.util.Comparator {
+ public int compare(Object o1, Object o2) {
+ ValueType v1 = (ValueType)o1;
+ ValueType v2 = (ValueType)o2;
+ int result = 0;
+ if (isUserException(v1)) {
+ if (!isUserException(v2)) {
+ result = -1;
+ }
+ } else if (isUserException(v2)) {
+ if (!isUserException(v1)) {
+ result = 1;
+ }
+ }
+ return result;
+ }
+
+ final boolean isUserException(ValueType it) {
+ return it.isIDLEntityException() && !it.isCORBAUserException();
+ }
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Type.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Type.java
new file mode 100644
index 0000000..425e938
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Type.java
@@ -0,0 +1,1009 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Vector;
+import java.util.Hashtable;
+import java.util.Enumeration;
+import java.io.IOException;
+import sun.tools.java.ClassDefinition;
+import sun.tools.java.ClassDeclaration;
+import sun.tools.java.Identifier;
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.CompilerError;
+import sun.rmi.rmic.IndentingWriter;
+import java.util.HashSet;
+import com.sun.corba.se.impl.util.RepositoryId;
+import sun.rmi.rmic.Names;
+
+/**
+ * Type is an abstract base class for a family of types which provide
+ * conformance checking and name mapping as defined in the "Java to IDL
+ * Mapping" OMG specification. The family is composed of the following
+ * fixed set of types:
+ * <pre>{@literal
+ *
+ * +- RemoteType <-- AbstractType
+ * |
+ * +- InterfaceType <-+- SpecialInterfaceType
+ * +- PrimitiveType | |
+ * | | +- NCInterfaceType
+ * Type <-+- CompoundType <-|
+ * | | +- ValueType
+ * +- ArrayType | |
+ * +- ClassType <-----+- ImplementationType
+ * |
+ * +- SpecialClassType
+ * |
+ * +- NCClassType
+ *
+ * }</pre>
+ * PrimitiveType represents a primitive or a void type.
+ * <p>
+ * CompoundType is an abstract base representing any non-special class
+ * or interface type.
+ * <p>
+ * InterfaceType is an abstract base representing any non-special
+ * interface type.
+ * <p>
+ * RemoteType represents any non-special interface which inherits
+ * from java.rmi.Remote.
+ * <p>
+ * AbstractType represents any non-special interface which does not
+ * inherit from java.rmi.Remote, for which all methods throw RemoteException.
+ * <p>
+ * SpecialInterfaceType represents any one of the following types:
+ * <pre>
+ * java.rmi.Remote
+ * java.io.Serializable
+ * java.io.Externalizable
+ * </pre>
+ * all of which are treated as special cases.
+ * <p>
+ * NCInterfaceType represents any non-special, non-conforming interface.
+ * <p>
+ * ClassType is an abstract base representing any non-special class
+ * type.
+ * <p>
+ * ValueType represents any non-special class which does inherit from
+ * java.io.Serializable and does not inherit from java.rmi.Remote.
+ * <p>
+ * ImplementationType represents any non-special class which implements
+ * one or more interfaces which inherit from java.rmi.Remote.
+ * <p>
+ * SpecialClassType represents any one of the following types:
+ * <pre>
+ * java.lang.Object
+ * java.lang.String
+ * org.omg.CORBA.Object
+ * </pre>
+ * all of which are treated as special cases. For all but CORBA.Object,
+ * the type must match exactly. For CORBA.Object, the type must either be
+ * CORBA.Object or inherit from it.
+ * <p>
+ * NCClassType represents any non-special, non-conforming class.
+ * <p>
+ * ArrayType is a wrapper for any of the other types. The getElementType()
+ * method can be used to get the array element type. The getArrayDimension()
+ * method can be used to get the array dimension.
+ * <p>
+ * <i><strong>NOTE:</strong> None of these types is multi-thread-safe</i>
+ * @author Bryan Atsatt
+ */
+public abstract class Type implements sun.rmi.rmic.iiop.Constants, ContextElement, Cloneable {
+
+ private int typeCode;
+ private int fullTypeCode;
+ private Identifier id;
+
+ private String name;
+ private String packageName;
+ private String qualifiedName;
+
+ private String idlName;
+ private String[] idlModuleNames;
+ private String qualifiedIDLName;
+
+ private String repositoryID;
+ private Class ourClass;
+
+ private int status = STATUS_PENDING;
+
+ protected BatchEnvironment env; // Easy access for subclasses.
+ protected ContextStack stack; // Easy access for subclasses.
+
+ protected boolean destroyed = false;
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Return the unqualified name for this type (e.g. com.acme.Dynamite would
+ * return "Dynamite").
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Return the package of this type (e.g. com.acme.Dynamite would
+ * return "com.acme"). Will return null if default package or
+ * if this type is a primitive.
+ */
+ public String getPackageName() {
+ return packageName;
+ }
+
+ /**
+ * Return the fully qualified name of this type (e.g. com.acme.Dynamite
+ * would return "com.acme.Dynamite")
+ */
+ public String getQualifiedName() {
+ return qualifiedName;
+ }
+
+ /**
+ * Return signature for this type (e.g. com.acme.Dynamite
+ * would return "com.acme.Dynamite", byte = "B")
+ */
+ public abstract String getSignature();
+
+ /**
+ * IDL_Naming
+ * Return the unqualified IDL name of this type (e.g. com.acme.Dynamite would
+ * return "Dynamite").
+ */
+ public String getIDLName() {
+ return idlName;
+ }
+
+ /**
+ * IDL_Naming
+ * Return the IDL module name for this type (e.g. com.acme.Dynamite would return
+ * a three element array of {"com","acme"). May be a zero length array if
+ * there is no module name.
+ */
+ public String[] getIDLModuleNames() {
+ return idlModuleNames;
+ }
+
+ /**
+ * IDL_Naming
+ * Return the fully qualified IDL name for this type (e.g. com.acme.Dynamite would
+ * return "com::acme::Dynamite").
+ * @param global If true, prepends "::".
+ */
+ public String getQualifiedIDLName(boolean global) {
+ if (global && getIDLModuleNames().length > 0) {
+ return IDL_NAME_SEPARATOR + qualifiedIDLName;
+ } else {
+ return qualifiedIDLName;
+ }
+ }
+
+ /**
+ * Return the identifier for this type. May be qualified.
+ */
+ public Identifier getIdentifier() {
+ return id;
+ }
+
+ /**
+ * Return the repository ID for this type.
+ */
+ public String getRepositoryID() {
+ return repositoryID;
+ }
+
+ /**
+ * Return the repository ID for this "boxed" type.
+ */
+ public String getBoxedRepositoryID() {
+ return RepositoryId.createForJavaType(ourClass);
+ }
+
+ /**
+ * Return the Class for this type.
+ */
+ public Class getClassInstance() {
+ if (ourClass == null) {
+ initClass();
+ }
+ return ourClass;
+ }
+
+ /**
+ * Return the status of this type.
+ */
+ public int getStatus() {
+ return status;
+ }
+
+ /**
+ * Set the status of this type.
+ */
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ /**
+ * Return the compiler environment for this type.
+ */
+ public BatchEnvironment getEnv() {
+ return env;
+ }
+
+ /**
+ * Get type code, without modifiers. Type codes are defined in sun.rmi.rmic.iiop.Constants.
+ */
+ public int getTypeCode() {
+ return typeCode;
+ }
+
+ /**
+ * Get type code, with modifiers. Type codes are defined in sun.rmi.rmic.iiop.Constants.
+ */
+ public int getFullTypeCode() {
+ return fullTypeCode;
+ }
+
+ /**
+ * Get type code modifiers. Type codes are defined in sun.rmi.rmic.iiop.Constants.
+ */
+ public int getTypeCodeModifiers() {
+ return fullTypeCode & TM_MASK;
+ }
+
+ /**
+ * Check for a certain type. Type codes are defined in sun.rmi.rmic.iiop.Constants.
+ * Returns true if all of the bits in typeCodeMask are present in the full type code
+ * of this object.
+ */
+ public boolean isType(int typeCodeMask) {
+ return (fullTypeCode & typeCodeMask) == typeCodeMask;
+ }
+
+ /**
+ * Like isType(), but returns true if <em>any</em> of the bits in typeCodeMask are
+ * present in the full type code of this object.
+ */
+ public boolean typeMatches(int typeCodeMask) {
+ return (fullTypeCode & typeCodeMask) > 0;
+ }
+
+
+ /**
+ * Return the fullTypeCode. If an array, returns the
+ * type code from the element type.
+ */
+ public int getRootTypeCode() {
+ if (isArray()) {
+ return getElementType().getFullTypeCode();
+ } else {
+ return fullTypeCode;
+ }
+ }
+
+ /**
+ * Return true if this type is-a InterfaceType.
+ */
+ public boolean isInterface() {
+ return (fullTypeCode & TM_INTERFACE) == TM_INTERFACE;
+ }
+
+ /**
+ * Return true if this type is-a ClassType.
+ */
+ public boolean isClass() {
+ return (fullTypeCode & TM_CLASS) == TM_CLASS;
+ }
+
+ /**
+ * Return true if this type is-a inner class or interface.
+ */
+ public boolean isInner() {
+ return (fullTypeCode & TM_INNER) == TM_INNER;
+ }
+
+
+ /**
+ * Return true if this type is-a SpecialInterfaceType.
+ */
+ public boolean isSpecialInterface() {
+ return (fullTypeCode & TM_SPECIAL_INTERFACE) == TM_SPECIAL_INTERFACE;
+ }
+
+ /**
+ * Return true if this type is-a SpecialClassType.
+ */
+ public boolean isSpecialClass() {
+ return (fullTypeCode & TM_SPECIAL_CLASS) == TM_SPECIAL_CLASS;
+ }
+
+ /**
+ * Return true if this type is-a CompoundType.
+ */
+ public boolean isCompound() {
+ return (fullTypeCode & TM_COMPOUND) == TM_COMPOUND;
+ }
+
+ /**
+ * Return true if this type is-a PrimitiveType.
+ */
+ public boolean isPrimitive() {
+ return (fullTypeCode & TM_PRIMITIVE) == TM_PRIMITIVE;
+ }
+
+ /**
+ * Return true if this type is-a ArrayType.
+ */
+ public boolean isArray() {
+ return (fullTypeCode & TYPE_ARRAY) == TYPE_ARRAY;
+ }
+
+ /**
+ * Return true if this type is a conforming type.
+ */
+ public boolean isConforming() {
+ return (fullTypeCode & TM_NON_CONFORMING) == TM_NON_CONFORMING;
+ }
+
+ /**
+ * Return a string representation of this type.
+ */
+ public String toString () {
+ return getQualifiedName();
+ }
+
+ /**
+ * Get element type. Returns null if not an array.
+ */
+ public Type getElementType () {
+ return null;
+ }
+
+ /**
+ * Get array dimension. Returns zero if not an array.
+ */
+ public int getArrayDimension () {
+ return 0;
+ }
+
+ /**
+ * Get brackets string. Returns "" if not an array.
+ */
+ public String getArrayBrackets () {
+ return "";
+ }
+
+ /**
+ * Equality check based on the string representation.
+ */
+ public boolean equals(Object obj) {
+
+ String us = toString();
+ String them = ((Type)obj).toString();
+ return us.equals(them);
+ }
+
+ /**
+ * Collect all the matching types referenced directly or indirectly
+ * by this type, including itself.
+ * @param typeCodeFilter The typeCode to use as a filter.
+ */
+ public Type[] collectMatching (int typeCodeFilter) {
+ return collectMatching(typeCodeFilter,new HashSet(env.allTypes.size()));
+ }
+
+ /**
+ * Collect all the matching types referenced directly or indirectly
+ * by this type, including itself.
+ * @param typeCodeFilter The typeCode to use as a filter.
+ * @param alreadyChecked Contains types which have previously been checked
+ * and will be ignored. Updated during collection.
+ */
+ public Type[] collectMatching (int typeCodeFilter, HashSet alreadyChecked) {
+ Vector matching = new Vector();
+
+ // Fill up the list...
+
+ addTypes(typeCodeFilter,alreadyChecked,matching);
+
+ // Copy vector contents to array and return it...
+
+ Type[] result = new Type[matching.size()];
+ matching.copyInto(result);
+
+ return result;
+ }
+
+ /**
+ * Return a string describing this type.
+ */
+ public abstract String getTypeDescription ();
+
+ /**
+ * Return the name of this type. For arrays, will include "[]" if useIDLNames == false.
+ * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ * @param globalIDLNames If true and useIDLNames true, prepends "::".
+ */
+ public String getTypeName ( boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) {
+ if (useIDLNames) {
+ if (useQualifiedNames) {
+ return getQualifiedIDLName(globalIDLNames);
+ } else {
+ return getIDLName();
+ }
+ } else {
+ if (useQualifiedNames) {
+ return getQualifiedName();
+ } else {
+ return getName();
+ }
+ }
+ }
+
+ /**
+ * Print all types referenced directly or indirectly by this type which
+ * match the filter.
+ * @param writer The stream to print to.
+ * @param typeCodeFilter The type codes to print.
+ * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ * @param globalIDLNames If true and useIDLNames true, prepends "::".
+ */
+ public void print ( IndentingWriter writer,
+ int typeCodeFilter,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+ Type[] theTypes = collectMatching(typeCodeFilter);
+ print(writer,theTypes,useQualifiedNames,useIDLNames,globalIDLNames);
+ }
+
+ /**
+ * Print an array of types.
+ * @param writer The stream to print to.
+ * @param theTypes The types to print.
+ * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ * @param globalIDLNames If true and useIDLNames true, prepends "::".
+ */
+ public static void print ( IndentingWriter writer,
+ Type[] theTypes,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+ for (int i = 0; i < theTypes.length; i++) {
+ theTypes[i].println(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ }
+ }
+
+
+ /**
+ * Print this type.
+ * @param writer The stream to print to.
+ * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ * @param globalIDLNames If true and useIDLNames true, prepends "::".
+ */
+ public void print ( IndentingWriter writer,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+ printTypeName(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ }
+
+ /**
+ * Print this type, followed by a newline.
+ * @param writer The stream to print to.
+ * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ * @param globalIDLNames If true and useIDLNames true, prepends "::".
+ */
+ public void println ( IndentingWriter writer,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+ print(writer,useQualifiedNames,useIDLNames,globalIDLNames);
+ writer.pln();
+ }
+
+
+
+ /**
+ * Print the name of this type.
+ * @param writer The stream to print to.
+ * @param useQualifiedNames If true, print qualified names; otherwise, print unqualified names.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ * @param globalIDLNames If true and useIDLNames true, prepends "::".
+ */
+ public void printTypeName ( IndentingWriter writer,
+ boolean useQualifiedNames,
+ boolean useIDLNames,
+ boolean globalIDLNames) throws IOException {
+
+ writer.p(getTypeName(useQualifiedNames,useIDLNames,globalIDLNames));
+ }
+
+ /**
+ * Return context element name.
+ */
+ public String getElementName() {
+ return getQualifiedName();
+ }
+
+ //_____________________________________________________________________
+ // Subclass Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Print the "opening" of the package or module of this type.
+ * @param writer The stream to print to.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ */
+ protected void printPackageOpen ( IndentingWriter writer,
+ boolean useIDLNames) throws IOException {
+
+ if (useIDLNames) {
+ String[] moduleNames = getIDLModuleNames();
+ for (int i = 0; i < moduleNames.length; i++ ) {
+ writer.plnI("module " + moduleNames[i] + " {");
+ }
+ } else {
+ String packageName = getPackageName();
+ if (packageName != null) {
+ writer.pln("package " + packageName + ";");
+ }
+ }
+ }
+
+ /**
+ * Get a type out of the table.
+ */
+ protected static Type getType (sun.tools.java.Type key, ContextStack stack) {
+ return getType(key.toString(),stack);
+ }
+
+ /**
+ * Get a type out of the table.
+ */
+ protected static Type getType (String key, ContextStack stack) {
+ Type result = (Type) stack.getEnv().allTypes.get(key);
+
+ if (result != null) {
+ stack.traceExistingType(result);
+ }
+
+ return result;
+ }
+
+ /**
+ * Remove a type from the table.
+ */
+ protected static void removeType (String key, ContextStack stack) {
+ Type value = (Type) stack.getEnv().allTypes.remove(key);
+ stack.getEnv().invalidTypes.put(value,key);
+ }
+
+ /**
+ * Remove a type from the table.
+ */
+ protected static void removeType (sun.tools.java.Type key, ContextStack stack) {
+ String theKey = key.toString();
+ Type old = (Type) stack.getEnv().allTypes.remove(theKey);
+ putInvalidType(old,theKey,stack);
+ }
+
+ /**
+ * Put a type into the table.
+ */
+ protected static void putType (sun.tools.java.Type key, Type value, ContextStack stack) {
+ stack.getEnv().allTypes.put(key.toString(),value);
+ }
+
+ /**
+ * Put a type into the table.
+ */
+ protected static void putType (String key, Type value, ContextStack stack) {
+ stack.getEnv().allTypes.put(key,value);
+ }
+
+ /**
+ * Put an invalid type into the.
+ */
+ protected static void putInvalidType (Type key, String value, ContextStack stack) {
+ stack.getEnv().invalidTypes.put(key,value);
+ }
+
+
+ /**
+ * Remove all invalid types...
+ */
+ public void removeInvalidTypes () {
+ if (env.invalidTypes.size() > 0) {
+ env.invalidTypes.clear();
+ }
+ }
+
+ /**
+ * Walk all types and tell them to update invalid types...
+ */
+ protected static void updateAllInvalidTypes (ContextStack stack) {
+ BatchEnvironment env = stack.getEnv();
+ if (env.invalidTypes.size() > 0) {
+
+ // Walk all types and swap invalid...
+
+ for (Enumeration e = env.allTypes.elements() ; e.hasMoreElements() ;) {
+ Type it = (Type) e.nextElement();
+ it.swapInvalidTypes();
+ }
+
+ // Delete all invalidTypes...
+
+ env.invalidTypes.clear();
+ }
+ }
+
+ /**
+ * Return count of previously parsed types.
+ */
+ protected int countTypes () {
+ return env.allTypes.size();
+ }
+
+ /**
+ * Reset types removes all previously parsed types.
+ */
+ void resetTypes () {
+ env.reset();
+ }
+
+ /**
+ * Release all resources.
+ */
+ protected void destroy () {
+ if (!destroyed) {
+ id = null;
+ name = null;
+ packageName = null;
+ qualifiedName = null;
+ idlName = null;
+ idlModuleNames = null;
+ qualifiedIDLName = null;
+ repositoryID = null;
+ ourClass = null;
+ env = null;
+ stack = null;
+ destroyed = true;
+ }
+ }
+
+ /**
+ * Convert all invalid types to valid ones.
+ */
+ protected void swapInvalidTypes () {
+ }
+
+ /**
+ * Convert an invalid type to a valid one.
+ */
+ protected Type getValidType (Type invalidType) {
+ if (invalidType.getStatus() == STATUS_VALID) {
+ return invalidType;
+ }
+
+ String key = (String)env.invalidTypes.get(invalidType);
+ Type result = null;
+ if (key != null) {
+ result = (Type) env.allTypes.get(key);
+ }
+
+ if (result == null) {
+ throw new Error("Failed to find valid type to swap for " + invalidType + " mis-identified as " + invalidType.getTypeDescription());
+ }
+ //System.out.println("Swapped " + result + " from " + invalidType.getTypeDescription()
+ // + " to " + result.getTypeDescription());
+ //ContextStack.dumpCallStack();
+ return result;
+ }
+
+ /**
+ * Print the "closing" of the package or module of this type.
+ * @param writer The stream to print to.
+ * @param useIDLNames If true, print IDL names; otherwise, print java names.
+ */
+ protected void printPackageClose ( IndentingWriter writer,
+ boolean useIDLNames) throws IOException {
+ if (useIDLNames) {
+ String[] moduleNames = getIDLModuleNames();
+ for (int i = 0; i < moduleNames.length; i++ ) {
+ writer.pOln("};");
+ }
+ }
+ }
+
+ /**
+ * Create a Type instance for the given type. Requires that
+ * setName(Identifier) be called afterward.
+ */
+ protected Type(ContextStack stack, int fullTypeCode) {
+ this.env = stack.getEnv();
+ this.stack = stack;
+ this.fullTypeCode = fullTypeCode;
+ typeCode = fullTypeCode & TYPE_MASK;
+ }
+
+ /**
+ * Set type codes. May only be called during initialization.
+ */
+ protected void setTypeCode(int fullTypeCode) {
+ this.fullTypeCode = fullTypeCode;
+ typeCode = fullTypeCode & TYPE_MASK;
+ }
+
+ /**
+ * Set name and package. May only be called during initialization.
+ */
+ protected void setNames(Identifier id, String[] idlModuleNames, String idlName) {
+
+ this.id = id;
+ name = Names.mangleClass(id).getName().toString();
+ packageName = null;
+
+ if (id.isQualified()) {
+ packageName = id.getQualifier().toString();
+ qualifiedName = packageName + NAME_SEPARATOR + name;
+ } else {
+ qualifiedName = name;
+ }
+
+ setIDLNames(idlModuleNames,idlName);
+ }
+
+
+ /**
+ * Set IDL name. May only be called during initialization.
+ */
+ protected void setIDLNames(String[] idlModuleNames, String idlName) {
+ this.idlName = idlName;
+
+ if (idlModuleNames != null) {
+ this.idlModuleNames = idlModuleNames;
+ } else {
+ this.idlModuleNames = new String[0];
+ }
+ qualifiedIDLName = IDLNames.getQualifiedName(idlModuleNames,idlName);
+ }
+
+ /**
+ * Report a ClassNotFoundException thru the compiler environment.
+ */
+ protected static void classNotFound(ContextStack stack,
+ ClassNotFound e) {
+ classNotFound(false,stack,e);
+ }
+
+ /**
+ * Report a ClassNotFoundException thru the compiler environment.
+ */
+ protected static void classNotFound(boolean quiet,
+ ContextStack stack,
+ ClassNotFound e) {
+ if (!quiet) stack.getEnv().error(0, "rmic.class.not.found", e.name);
+ stack.traceCallStack();
+ }
+
+ /**
+ * Report a constraint failure thru the compiler environment.
+ * @param constraintNum Used to generate a key of the form
+ "rmic.iiop.constraint.N", which must identify a message
+ in the "rmic.properties" file.
+ * @param quiet True if should not cause failure or message.
+ * @param stack The context stack.
+ * @param arg0 An object to substitute for {0} in the message.
+ * @param arg1 An object to substitute for {1} in the message.
+ * @param arg2 An object to substitute for {2} in the message.
+ * @return false.
+ */
+ protected static boolean failedConstraint(int constraintNum,
+ boolean quiet,
+ ContextStack stack,
+ Object arg0, Object arg1, Object arg2) {
+ String message = "rmic.iiop.constraint." + constraintNum;
+
+ if (!quiet) {
+ stack.getEnv().error(0,message,
+ (arg0 != null ? arg0.toString() : null),
+ (arg1 != null ? arg1.toString() : null),
+ (arg2 != null ? arg2.toString() : null));
+ } else {
+ String error = stack.getEnv().errorString(message,arg0,arg1,arg2);
+ stack.traceln(error);
+ }
+
+ return false;
+ }
+
+ /**
+ * Report a constraint failure thru the compiler environment.
+ * @param constraintNum Used to generate a key of the form
+ "rmic.iiop.constraint.N", which must identify a message
+ in the "rmic.properties" file.
+ * @param quiet True if should not cause failure or message.
+ * @param stack The context stack.
+ * @param arg0 An object to substitute for {0} in the message.
+ * @param arg1 An object to substitute for {1} in the message.
+ * @return false.
+ */
+ protected static boolean failedConstraint(int constraintNum,
+ boolean quiet,
+ ContextStack stack,
+ Object arg0, Object arg1) {
+ return failedConstraint(constraintNum,quiet,stack,arg0,arg1,null);
+ }
+
+
+ /**
+ * Report a constraint failure thru the compiler environment.
+ * @param constraintNum Used to generate a key of the form
+ "rmic.iiop.constraint.N", which must identify a message
+ in the "rmic.properties" file.
+ * @param quiet True if should not cause failure or message.
+ * @param stack The context stack.
+ * @param arg0 An object to substitute for {0} in the message.
+ * @return false.
+ */
+ protected static boolean failedConstraint(int constraintNum,
+ boolean quiet,
+ ContextStack stack,
+ Object arg0) {
+ return failedConstraint(constraintNum,quiet,stack,arg0,null,null);
+ }
+
+ /**
+ * Report a constraint failure thru the compiler environment.
+ * @param quiet True if should not cause failure or message.
+ * @param stack The context stack.
+ * @param constraintNum Used to generate a key of the form
+ "rmic.iiop.constraint.N", which must identify a message
+ in the "rmic.properties" file.
+ * @return false.
+ */
+ protected static boolean failedConstraint(int constraintNum,
+ boolean quiet,
+ ContextStack stack) {
+ return failedConstraint(constraintNum,quiet,stack,null,null,null);
+ }
+
+ /**
+ * Cloning is supported by returning a shallow copy of this object.
+ */
+ protected Object clone() {
+ try {
+ return super.clone();
+ } catch (CloneNotSupportedException e) {
+ throw new Error("clone failed");
+ }
+ }
+
+ /*
+ * Add matching types to list. Return true if this type has not
+ * been previously checked, false otherwise.
+ */
+ protected boolean addTypes (int typeCodeFilter,
+ HashSet checked,
+ Vector matching) {
+
+ boolean result;
+
+ // Have we already checked this type?
+
+ if (checked.contains(this)) {
+
+ // Yes, so return false.
+
+ result = false;
+
+ } else {
+
+ // Nope, so add it...
+
+ checked.add(this);
+
+ // Do we match the filter?
+
+ if (typeMatches(typeCodeFilter)) {
+
+ // Yep. so add it and set result to true...
+
+ matching.addElement(this);
+ }
+
+ // Return true.
+
+ result = true;
+ }
+
+ return result;
+ }
+
+ /*
+ * Load a Class instance. Return null if fail.
+ */
+ protected abstract Class loadClass();
+
+ private boolean initClass() {
+ if (ourClass == null) {
+ ourClass = loadClass();
+ if (ourClass == null) {
+ failedConstraint(27,false,stack,getQualifiedName());
+ return false;
+ }
+ }
+ return true;
+ }
+
+ /*
+ * Set the clz and repositoryID fields. Reports error
+ * and returns false if fails, returns true if succeeds.
+ */
+ protected boolean setRepositoryID() {
+
+ // First, load the class...
+
+ if (!initClass()) {
+ return false;
+ }
+
+ // Now make the repositoryID and return success...
+
+ repositoryID = RepositoryId.createForAnyType(ourClass);
+ return true;
+ }
+
+
+ //_____________________________________________________________________
+ // Internal Interfaces
+ //_____________________________________________________________________
+
+ private Type () {} // Disallowed.
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Util.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Util.java
new file mode 100644
index 0000000..ec15281
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/Util.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) 1999, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.io.File;
+import sun.tools.java.Identifier;
+
+import com.sun.corba.se.impl.util.PackagePrefixChecker;
+
+/**
+ * Util provides static utility methods used by other rmic classes.
+ * @author Bryan Atsatt
+ */
+
+public final class Util implements sun.rmi.rmic.Constants {
+
+
+ public static String packagePrefix(){ return PackagePrefixChecker.packagePrefix();}
+
+
+ /**
+ * Return the directory that should be used for output for a given
+ * class.
+ * @param theClass The fully qualified name of the class.
+ * @param rootDir The directory to use as the root of the
+ * package heirarchy. May be null, in which case the current
+ * working directory is used as the root.
+ */
+ private static File getOutputDirectoryFor(Identifier theClass,
+ File rootDir,
+ BatchEnvironment env,
+ boolean idl ) {
+ File outputDir = null;
+ String className = theClass.getFlatName().toString().replace('.', SIGC_INNERCLASS);
+ String qualifiedClassName = className;
+ String packagePath = null;
+ String packageName = theClass.getQualifier().toString();
+ //Shift package names for stubs generated for interfaces.
+ /*if(type.isInterface())*/
+ packageName = correctPackageName(packageName, idl, env.getStandardPackage());
+ //Done.
+ if (packageName.length() > 0) {
+ qualifiedClassName = packageName + "." + className;
+ packagePath = packageName.replace('.', File.separatorChar);
+ }
+
+ // Do we have a root directory?
+
+ if (rootDir != null) {
+
+ // Yes, do we have a package name?
+
+ if (packagePath != null) {
+
+ // Yes, so use it as the root. Open the directory...
+
+ outputDir = new File(rootDir, packagePath);
+
+ // Make sure the directory exists...
+
+ ensureDirectory(outputDir,env);
+
+ } else {
+
+ // Default package, so use root as output dir...
+
+ outputDir = rootDir;
+ }
+ } else {
+
+ // No root directory. Get the current working directory...
+
+ String workingDirPath = System.getProperty("user.dir");
+ File workingDir = new File(workingDirPath);
+
+ // Do we have a package name?
+
+ if (packagePath == null) {
+
+ // No, so use working directory...
+
+ outputDir = workingDir;
+
+ } else {
+
+ // Yes, so use working directory as the root...
+
+ outputDir = new File(workingDir, packagePath);
+
+ // Make sure the directory exists...
+
+ ensureDirectory(outputDir,env);
+ }
+ }
+
+ // Finally, return the directory...
+
+ return outputDir;
+ }
+
+ public static File getOutputDirectoryForIDL(Identifier theClass,
+ File rootDir,
+ BatchEnvironment env) {
+ return getOutputDirectoryFor(theClass, rootDir, env, true);
+ }
+
+ public static File getOutputDirectoryForStub(Identifier theClass,
+ File rootDir,
+ BatchEnvironment env) {
+ return getOutputDirectoryFor(theClass, rootDir, env, false);
+ }
+
+ private static void ensureDirectory (File dir, BatchEnvironment env) {
+ if (!dir.exists()) {
+ dir.mkdirs();
+ if (!dir.exists()) {
+ env.error(0,"rmic.cannot.create.dir",dir.getAbsolutePath());
+ throw new InternalError();
+ }
+ }
+ }
+
+ public static String correctPackageName(
+ String p, boolean idl, boolean standardPackage){
+ if (idl){
+ return p;
+ } else {
+ if (standardPackage) {
+ return p;
+ } else {
+ return PackagePrefixChecker.correctPackageName(p);
+ }
+ }
+ }
+
+ public static boolean isOffendingPackage(String p){
+ return PackagePrefixChecker.isOffendingPackage(p);
+ }
+
+ public static boolean hasOffendingPrefix(String p){
+ return PackagePrefixChecker.hasOffendingPrefix(p);
+ }
+
+}
diff --git a/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ValueType.java b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ValueType.java
new file mode 100644
index 0000000..2387d84
--- /dev/null
+++ b/src/jdk.rmic/share/classes/sun/rmi/rmic/iiop/ValueType.java
@@ -0,0 +1,488 @@
+/*
+ * Copyright (c) 1998, 2007, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+/*
+ * Licensed Materials - Property of IBM
+ * RMI-IIOP v1.0
+ * Copyright IBM Corp. 1998 1999 All Rights Reserved
+ *
+ */
+
+package sun.rmi.rmic.iiop;
+
+import java.util.Vector;
+import sun.tools.java.ClassNotFound;
+import sun.tools.java.ClassDeclaration;
+import sun.tools.java.ClassDefinition;
+import sun.tools.java.MemberDefinition;
+import java.util.Hashtable;
+import java.io.ObjectStreamClass;
+import java.io.ObjectStreamField;
+
+
+/**
+ * ValueType represents any non-special class which does inherit from
+ * java.io.Serializable and does not inherit from java.rmi.Remote.
+ * <p>
+ * The static forValue(...) method must be used to obtain an instance, and
+ * will return null if the ClassDefinition is non-conforming.
+ *
+ * @author Bryan Atsatt
+ */
+public class ValueType extends ClassType {
+
+ private boolean isCustom;
+
+ //_____________________________________________________________________
+ // Public Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create an ValueType object for the given class.
+ *
+ * If the class is not a properly formed or if some other error occurs, the
+ * return value will be null, and errors will have been reported to the
+ * supplied BatchEnvironment.
+ */
+ public static ValueType forValue(ClassDefinition classDef,
+ ContextStack stack,
+ boolean quiet) {
+
+ if (stack.anyErrors()) return null;
+
+ // Do we already have it?
+
+ sun.tools.java.Type theType = classDef.getType();
+ String typeKey = theType.toString();
+ Type existing = getType(typeKey,stack);
+
+ if (existing != null) {
+
+ if (!(existing instanceof ValueType)) return null; // False hit.
+
+ // Yep, so return it...
+
+ return (ValueType) existing;
+ }
+
+ // Is this java.lang.Class?
+
+ boolean javaLangClass = false;
+
+ if (classDef.getClassDeclaration().getName() == idJavaLangClass) {
+
+ // Yes, so replace classDef with one for
+ // javax.rmi.CORBA.ClassDesc...
+
+ javaLangClass = true;
+ BatchEnvironment env = stack.getEnv();
+ ClassDeclaration decl = env.getClassDeclaration(idClassDesc);
+ ClassDefinition def = null;
+
+ try {
+ def = decl.getClassDefinition(env);
+ } catch (ClassNotFound ex) {
+ classNotFound(stack,ex);
+ return null;
+ }
+
+ classDef = def;
+ }
+
+ // Could this be a value?
+
+ if (couldBeValue(stack,classDef)) {
+
+ // Yes, so check it...
+
+ ValueType it = new ValueType(classDef,stack,javaLangClass);
+ putType(typeKey,it,stack);
+ stack.push(it);
+
+ if (it.initialize(stack,quiet)) {
+ stack.pop(true);
+ return it;
+ } else {
+ removeType(typeKey,stack);
+ stack.pop(false);
+ return null;
+ }
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * Return a string describing this type.
+ */
+ public String getTypeDescription () {
+ String result = addExceptionDescription("Value");
+ if (isCustom) {
+ result = "Custom " + result;
+ }
+ if (isIDLEntity) {
+ result = result + " [IDLEntity]";
+ }
+ return result;
+ }
+
+ /**
+ * Return true if this type is a "custom" type (i.e.
+ * it implements java.io.Externalizable or has a
+ * method with the following signature:
+ *
+ * private void writeObject(java.io.ObjectOutputStream out);
+ *
+ */
+ public boolean isCustom () {
+ return isCustom;
+ }
+
+
+ //_____________________________________________________________________
+ // Subclass/Internal Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Create a ValueType instance for the given class. The resulting
+ * object is not yet completely initialized.
+ */
+ private ValueType(ClassDefinition classDef,
+ ContextStack stack,
+ boolean isMappedJavaLangClass) {
+ super(stack,classDef,TYPE_VALUE | TM_CLASS | TM_COMPOUND);
+ isCustom = false;
+
+ // If this is the mapped version of java.lang.Class,
+ // set the non-IDL names back to java.lang.Class...
+
+ if (isMappedJavaLangClass) {
+ setNames(idJavaLangClass,IDL_CLASS_MODULE,IDL_CLASS);
+ }
+ }
+
+ //_____________________________________________________________________
+ // Internal Interfaces
+ //_____________________________________________________________________
+
+ /**
+ * Initialize this instance.
+ */
+
+ private static boolean couldBeValue(ContextStack stack, ClassDefinition classDef) {
+
+ boolean result = false;
+ ClassDeclaration classDecl = classDef.getClassDeclaration();
+ BatchEnvironment env = stack.getEnv();
+
+ try {
+ // Make sure it's not remote...
+
+ if (env.defRemote.implementedBy(env, classDecl)) {
+ failedConstraint(10,false,stack,classDef.getName());
+ } else {
+
+ // Make sure it's Serializable...
+
+ if (!env.defSerializable.implementedBy(env, classDecl)) {
+ failedConstraint(11,false,stack,classDef.getName());
+ } else {
+ result = true;
+ }
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+
+ return result;
+ }
+
+ /**
+ * Initialize this instance.
+ */
+ private boolean initialize (ContextStack stack, boolean quiet) {
+
+ ClassDefinition ourDef = getClassDefinition();
+ ClassDeclaration ourDecl = getClassDeclaration();
+
+ try {
+
+ // Make sure our parentage is ok...
+
+ if (!initParents(stack)) {
+ failedConstraint(12,quiet,stack,getQualifiedName());
+ return false;
+ }
+
+
+ // We're ok, so make up our collections...
+
+ Vector directInterfaces = new Vector();
+ Vector directMethods = new Vector();
+ Vector directMembers = new Vector();
+
+ // Get interfaces...
+
+ if (addNonRemoteInterfaces(directInterfaces,stack) != null) {
+
+ // Get methods...
+
+ if (addAllMethods(ourDef,directMethods,false,false,stack) != null) {
+
+ // Update parent class methods
+ if (updateParentClassMethods(ourDef,directMethods,false,stack) != null) {
+
+ // Get constants and members...
+
+ if (addAllMembers(directMembers,false,false,stack)) {
+
+ // We're ok, so pass 'em up...
+
+ if (!initialize(directInterfaces,directMethods,directMembers,stack,quiet)) {
+ return false;
+ }
+
+ // Is this class Externalizable?
+
+ boolean externalizable = false;
+ if (!env.defExternalizable.implementedBy(env, ourDecl)) {
+
+ // No, so check to see if we have a serialPersistentField
+ // that will modify the members.
+
+ if (!checkPersistentFields(getClassInstance(),quiet)) {
+ return false;
+ }
+ } else {
+
+ // Yes.
+
+ externalizable = true;
+ }
+
+ // Should this class be considered "custom"? It is if
+ // it is Externalizable OR if it has a method with the
+ // following signature:
+ //
+ // private void writeObject(java.io.ObjectOutputStream out);
+ //
+
+ if (externalizable) {
+ isCustom = true;
+ } else {
+ for (MemberDefinition member = ourDef.getFirstMember();
+ member != null;
+ member = member.getNextMember()) {
+
+ if (member.isMethod() &&
+ !member.isInitializer() &&
+ member.isPrivate() &&
+ member.getName().toString().equals("writeObject")) {
+
+ // Check return type, arguments and exceptions...
+
+ sun.tools.java.Type methodType = member.getType();
+ sun.tools.java.Type rtnType = methodType.getReturnType();
+
+ if (rtnType == sun.tools.java.Type.tVoid) {
+
+ // Return type is correct. How about arguments?
+
+ sun.tools.java.Type[] args = methodType.getArgumentTypes();
+ if (args.length == 1 &&
+ args[0].getTypeSignature().equals("Ljava/io/ObjectOutputStream;")) {
+
+ // Arguments are correct, so it is a custom
+ // value type...
+
+ isCustom = true;
+ }
+ }
+ }
+ }
+ }
+ }
+
+ return true;
+ }
+ }
+ }
+ } catch (ClassNotFound e) {
+ classNotFound(stack,e);
+ }
+
+ return false;
+ }
+
+
+ private boolean checkPersistentFields (Class clz, boolean quiet) {
+
+ // Do we have a writeObject method?
+
+ for (int i = 0; i < methods.length; i++) {
+ if (methods[i].getName().equals("writeObject") &&
+ methods[i].getArguments().length == 1) {
+
+ Type returnType = methods[i].getReturnType();
+ Type arg = methods[i].getArguments()[0];
+ String id = arg.getQualifiedName();
+
+ if (returnType.isType(TYPE_VOID) &&
+ id.equals("java.io.ObjectOutputStream")) {
+
+ // Got one, so there's nothing to do...
+
+ return true;
+ }
+ }
+ }
+
+ // Do we have a valid serialPersistentField array?
+
+ MemberDefinition spfDef = null;
+
+ for (int i = 0; i < members.length; i++) {
+ if (members[i].getName().equals("serialPersistentFields")) {
+
+ Member member = members[i];
+ Type type = member.getType();
+ Type elementType = type.getElementType();
+
+ // We have a member with the correct name. Make sure
+ // we have the correct signature...
+
+ if (elementType != null &&
+ elementType.getQualifiedName().equals(
+ "java.io.ObjectStreamField")
+ ) {
+
+ if (member.isStatic() &&
+ member.isFinal() &&
+ member.isPrivate()) {
+
+ // We have the correct signature
+
+ spfDef = member.getMemberDefinition();
+
+ } else {
+
+ // Bad signature...
+
+ failedConstraint(4,quiet,stack,getQualifiedName());
+ return false;
+ }
+ }
+ }
+ }
+
+ // If we do not have a serialPersistentField,
+ // there's nothing to do, so return with no error...
+
+ if (spfDef == null) {
+ return true;
+ }
+
+ // Ok, now we must examine the contents of the array -
+ // then validate them...
+
+ Hashtable fields = getPersistentFields(clz);
+ boolean result = true;
+
+ for (int i = 0; i < members.length; i++) {
+ String fieldName = members[i].getName();
+ String fieldType = members[i].getType().getSignature();
+
+ // Is this field present in the array?
+
+ String type = (String) fields.get(fieldName);
+
+ if (type == null) {
+
+ // No, so mark it transient...
+
+ members[i].setTransient();
+
+ } else {
+
+ // Yes, does the type match?
+
+ if (type.equals(fieldType)) {
+
+ // Yes, so remove it from the fields table...
+
+ fields.remove(fieldName);
+
+ } else {
+
+ // No, so error...
+
+ result = false;
+ failedConstraint(2,quiet,stack,fieldName,getQualifiedName());
+ }
+ }
+ }
+
+ // Ok, we've checked all of our fields. Are there any left in the "array"?
+ // If so, it's an error...
+
+ if (result && fields.size() > 0) {
+
+ result = false;
+ failedConstraint(9,quiet,stack,getQualifiedName());
+ }
+
+ // Return result...
+
+ return result;
+ }
+
+ /**
+ * Get the names and types of all the persistent fields of a Class.
+ */
+ private Hashtable getPersistentFields (Class clz) {
+ Hashtable result = new Hashtable();
+ ObjectStreamClass osc = ObjectStreamClass.lookup(clz);
+ if (osc != null) {
+ ObjectStreamField[] fields = osc.getFields();
+ for (int i = 0; i < fields.length; i++) {
+ String typeSig;
+ String typePrefix = String.valueOf(fields[i].getTypeCode());
+ if (fields[i].isPrimitive()) {
+ typeSig = typePrefix;
+ } else {
+ if (fields[i].getTypeCode() == '[') {
+ typePrefix = "";
+ }
+ typeSig = typePrefix + fields[i].getType().getName().replace('.','/');
+ if (typeSig.endsWith(";")) {
+ typeSig = typeSig.substring(0,typeSig.length()-1);
+ }
+ }
+ result.put(fields[i].getName(),typeSig);
+ }
+ }
+ return result;
+ }
+}